diff --git a/.eslintrc.js b/.eslintrc.js index 9b55fe3e057f..af531e4f0404 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -184,5 +184,23 @@ module.exports = { '@redwoodjs/process-env-computed': 'off', }, }, + { + files: ['packages/project-config/**'], + excludedFiles: [ + '**/__tests__/**', + '**/*.test.ts?(x)', + '**/*.spec.ts?(x)', + ], + rules: { + 'import/no-extraneous-dependencies': [ + 'error', + { + devDependencies: false, + optionalDependencies: false, + peerDependencies: true, + }, + ], + }, + }, ], } diff --git a/.github/actions/check_create_redwood_app/package.json b/.github/actions/check_create_redwood_app/package.json index f86413cdeb88..03bc407905ca 100644 --- a/.github/actions/check_create_redwood_app/package.json +++ b/.github/actions/check_create_redwood_app/package.json @@ -5,5 +5,5 @@ "@actions/core": "1.10.1", "@actions/exec": "1.1.1" }, - "packageManager": "yarn@3.7.0" + "packageManager": "yarn@4.0.2" } diff --git a/.github/actions/check_create_redwood_app/yarn.lock b/.github/actions/check_create_redwood_app/yarn.lock index e3ef1e202170..67423743c42c 100644 --- a/.github/actions/check_create_redwood_app/yarn.lock +++ b/.github/actions/check_create_redwood_app/yarn.lock @@ -2,16 +2,16 @@ # Manual changes might be lost - proceed with caution! __metadata: - version: 6 - cacheKey: 8c0 + version: 8 + cacheKey: 10c0 "@actions/core@npm:1.10.1": version: 1.10.1 resolution: "@actions/core@npm:1.10.1" dependencies: - "@actions/http-client": ^2.0.1 - uuid: ^8.3.2 - checksum: 7a61446697a23dcad3545cf0634dedbdedf20ae9a0ee6ee977554589a15deb4a93593ee48a41258933d58ce0778f446b0d2c162b60750956fb75e0b9560fb832 + "@actions/http-client": "npm:^2.0.1" + uuid: "npm:^8.3.2" + checksum: 8c0/7a61446697a23dcad3545cf0634dedbdedf20ae9a0ee6ee977554589a15deb4a93593ee48a41258933d58ce0778f446b0d2c162b60750956fb75e0b9560fb832 languageName: node linkType: hard @@ -19,8 +19,8 @@ __metadata: version: 1.1.1 resolution: "@actions/exec@npm:1.1.1" dependencies: - "@actions/io": ^1.0.1 - checksum: 4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a + "@actions/io": "npm:^1.0.1" + checksum: 8c0/4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a languageName: node linkType: hard @@ -28,15 +28,15 @@ __metadata: version: 2.0.1 resolution: "@actions/http-client@npm:2.0.1" dependencies: - tunnel: ^0.0.6 - checksum: b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67 + tunnel: "npm:^0.0.6" + checksum: 8c0/b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67 languageName: node linkType: hard "@actions/io@npm:^1.0.1": version: 1.1.2 resolution: "@actions/io@npm:1.1.2" - checksum: 61c871bbee1cf58f57917d9bb2cf6bb7ea4dc40de3f65c7fb4ec619ceff57fc98f56be9cca2d476b09e7a96e1cba0d88cd125c4f690d384b9483935186f256c1 + checksum: 8c0/61c871bbee1cf58f57917d9bb2cf6bb7ea4dc40de3f65c7fb4ec619ceff57fc98f56be9cca2d476b09e7a96e1cba0d88cd125c4f690d384b9483935186f256c1 languageName: node linkType: hard @@ -44,15 +44,15 @@ __metadata: version: 0.0.0-use.local resolution: "check_test_project_fixture@workspace:." dependencies: - "@actions/core": 1.10.1 - "@actions/exec": 1.1.1 + "@actions/core": "npm:1.10.1" + "@actions/exec": "npm:1.1.1" languageName: unknown linkType: soft "tunnel@npm:^0.0.6": version: 0.0.6 resolution: "tunnel@npm:0.0.6" - checksum: e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75 + checksum: 8c0/e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75 languageName: node linkType: hard @@ -61,6 +61,6 @@ __metadata: resolution: "uuid@npm:8.3.2" bin: uuid: dist/bin/uuid - checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54 + checksum: 8c0/bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54 languageName: node linkType: hard diff --git a/.github/actions/check_test_project_fixture/package.json b/.github/actions/check_test_project_fixture/package.json index f86413cdeb88..03bc407905ca 100644 --- a/.github/actions/check_test_project_fixture/package.json +++ b/.github/actions/check_test_project_fixture/package.json @@ -5,5 +5,5 @@ "@actions/core": "1.10.1", "@actions/exec": "1.1.1" }, - "packageManager": "yarn@3.7.0" + "packageManager": "yarn@4.0.2" } diff --git a/.github/actions/check_test_project_fixture/yarn.lock b/.github/actions/check_test_project_fixture/yarn.lock index e3ef1e202170..67423743c42c 100644 --- a/.github/actions/check_test_project_fixture/yarn.lock +++ b/.github/actions/check_test_project_fixture/yarn.lock @@ -2,16 +2,16 @@ # Manual changes might be lost - proceed with caution! __metadata: - version: 6 - cacheKey: 8c0 + version: 8 + cacheKey: 10c0 "@actions/core@npm:1.10.1": version: 1.10.1 resolution: "@actions/core@npm:1.10.1" dependencies: - "@actions/http-client": ^2.0.1 - uuid: ^8.3.2 - checksum: 7a61446697a23dcad3545cf0634dedbdedf20ae9a0ee6ee977554589a15deb4a93593ee48a41258933d58ce0778f446b0d2c162b60750956fb75e0b9560fb832 + "@actions/http-client": "npm:^2.0.1" + uuid: "npm:^8.3.2" + checksum: 8c0/7a61446697a23dcad3545cf0634dedbdedf20ae9a0ee6ee977554589a15deb4a93593ee48a41258933d58ce0778f446b0d2c162b60750956fb75e0b9560fb832 languageName: node linkType: hard @@ -19,8 +19,8 @@ __metadata: version: 1.1.1 resolution: "@actions/exec@npm:1.1.1" dependencies: - "@actions/io": ^1.0.1 - checksum: 4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a + "@actions/io": "npm:^1.0.1" + checksum: 8c0/4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a languageName: node linkType: hard @@ -28,15 +28,15 @@ __metadata: version: 2.0.1 resolution: "@actions/http-client@npm:2.0.1" dependencies: - tunnel: ^0.0.6 - checksum: b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67 + tunnel: "npm:^0.0.6" + checksum: 8c0/b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67 languageName: node linkType: hard "@actions/io@npm:^1.0.1": version: 1.1.2 resolution: "@actions/io@npm:1.1.2" - checksum: 61c871bbee1cf58f57917d9bb2cf6bb7ea4dc40de3f65c7fb4ec619ceff57fc98f56be9cca2d476b09e7a96e1cba0d88cd125c4f690d384b9483935186f256c1 + checksum: 8c0/61c871bbee1cf58f57917d9bb2cf6bb7ea4dc40de3f65c7fb4ec619ceff57fc98f56be9cca2d476b09e7a96e1cba0d88cd125c4f690d384b9483935186f256c1 languageName: node linkType: hard @@ -44,15 +44,15 @@ __metadata: version: 0.0.0-use.local resolution: "check_test_project_fixture@workspace:." dependencies: - "@actions/core": 1.10.1 - "@actions/exec": 1.1.1 + "@actions/core": "npm:1.10.1" + "@actions/exec": "npm:1.1.1" languageName: unknown linkType: soft "tunnel@npm:^0.0.6": version: 0.0.6 resolution: "tunnel@npm:0.0.6" - checksum: e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75 + checksum: 8c0/e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75 languageName: node linkType: hard @@ -61,6 +61,6 @@ __metadata: resolution: "uuid@npm:8.3.2" bin: uuid: dist/bin/uuid - checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54 + checksum: 8c0/bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54 languageName: node linkType: hard diff --git a/.github/actions/detect-changes/cases/code_changes.mjs b/.github/actions/detect-changes/cases/code_changes.mjs new file mode 100644 index 000000000000..fd0306ebc1fb --- /dev/null +++ b/.github/actions/detect-changes/cases/code_changes.mjs @@ -0,0 +1,40 @@ +/** + * Detects if the given file path points to a code file (as apposed to a docs + * file) + */ +function isCodeFile(filePath) { + if (filePath.startsWith('docs')) { + return false + } + + if ( + [ + 'CHANGELOG.md', + 'CODE_OF_CONDUCT.md', + 'CONTRIBUTING.md', + 'CONTRIBUTORS.md', + 'LICENSE', + 'README.md', + 'SECURITY.md', + ].includes(filePath) + ) { + return false + } + + return true +} + +/** + * Checks if the given array of file paths contains any files with potential + * code changes + */ +export function hasCodeChanges(changedFiles) { + return changedFiles.some((file) => { + if (isCodeFile(file)) { + console.log(`Found code file: ${file}`) + return true + } + + return false + }) +} diff --git a/.github/actions/detect-changes/cases/onlydocs.mjs b/.github/actions/detect-changes/cases/onlydocs.mjs deleted file mode 100644 index 39e66ac7d381..000000000000 --- a/.github/actions/detect-changes/cases/onlydocs.mjs +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Detects if there are only changes to the documentation - * - * @param {string[]} changedFiles The list of files which git has listed as changed - * @returns {boolean} True if there are changes, false if not - */ -export function onlyDocsChanged(changedFiles){ - for (const changedFile of changedFiles) { - if (changedFile.startsWith('docs')) { - continue - } - - for (const fileToIgnore of [ - 'CHANGELOG.md', - 'CODE_OF_CONDUCT.md', - 'CONTRIBUTING.md', - 'CONTRIBUTORS.md', - 'LICENSE', - 'README.md', - 'SECURITY.md', - ]) { - if (changedFile === fileToIgnore) { - continue - } - } - - console.log('Non-docs change detected:', changedFile) - return false - } - - console.log('Only docs changes') - return true -} diff --git a/.github/actions/detect-changes/cases/rsc.mjs b/.github/actions/detect-changes/cases/rsc.mjs index eefd7294b184..e2e31da48e8a 100644 --- a/.github/actions/detect-changes/cases/rsc.mjs +++ b/.github/actions/detect-changes/cases/rsc.mjs @@ -20,7 +20,9 @@ export function rscChanged(changedFiles){ changedFile.startsWith('packages/internal/') || changedFile.startsWith('packages/project-config/') || changedFile.startsWith('packages/web/') || - changedFile.startsWith('packages/vite/') + changedFile.startsWith('packages/vite/') || + changedFile.startsWith('__fixtures__/test-project-rsa') || + changedFile.startsWith('__fixtures__/test-project-rsc-external-packages') ) { console.log('RSC change detected:', changedFile) return true diff --git a/.github/actions/detect-changes/cases/ssr.mjs b/.github/actions/detect-changes/cases/ssr.mjs index 7f83bc9b9a02..c3d05e7296cb 100644 --- a/.github/actions/detect-changes/cases/ssr.mjs +++ b/.github/actions/detect-changes/cases/ssr.mjs @@ -8,7 +8,8 @@ export function ssrChanged(changedFiles){ for (const changedFile of changedFiles) { if ( changedFile.startsWith('tasks/smoke-tests/streaming-ssr') || - changedFile.startsWith('tasks/smoke-tests/basePlaywright.config.ts') || + changedFile === 'tasks/smoke-tests/basePlaywright.config.ts' || + changedFile === 'tasks/test-project/codemods/delayedPage.js' || changedFile.startsWith('packages/internal/') || changedFile.startsWith('packages/project-config/') || changedFile.startsWith('packages/web/') || diff --git a/.github/actions/detect-changes/detectChanges.mjs b/.github/actions/detect-changes/detectChanges.mjs index 64eff77b6cad..a7119100199d 100644 --- a/.github/actions/detect-changes/detectChanges.mjs +++ b/.github/actions/detect-changes/detectChanges.mjs @@ -1,9 +1,98 @@ +import fs from 'node:fs' + import core from '@actions/core' -import { exec, getExecOutput } from '@actions/exec' -import { onlyDocsChanged } from './cases/onlydocs.mjs' +import { hasCodeChanges } from './cases/code_changes.mjs' import { rscChanged } from './cases/rsc.mjs' import { ssrChanged } from './cases/ssr.mjs' +const getPrNumber = () => { + // Example GITHUB_REF refs/pull/9544/merge + const result = /refs\/pull\/(\d+)\/merge/g.exec(process.env.GITHUB_REF) + + let prNumber = result?.[1] + + if (!prNumber) { + try { + // Example GITHUB_EVENT_PATH + // /home/runner/work/_temp/_github_workflow/event.json + const ev = JSON.parse( + fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8') + ) + prNumber = ev.pull_request?.number + } catch { + // fall through + } + } + + if (!prNumber) { + throw new Error('Could not find the PR number') + } + + return prNumber +} + +async function getChangedFiles(page = 1, retries = 0) { + const prNumber = getPrNumber() + + if (retries) { + console.log( + `Retry ${retries}: Getting changed files for PR ${prNumber} (page ${page})` + ) + } else { + console.log(`Getting changed files for PR ${prNumber} (page ${page})`) + } + + let changedFiles = [] + + // Query the GitHub API to get the changed files in the PR + const githubToken = process.env.GITHUB_TOKEN + const url = `https://api.github.com/repos/redwoodjs/redwood/pulls/${prNumber}/files?per_page=100&page=${page}` + let resp + let files = [] + + try { + resp = await fetch(url, { + headers: { + Authorization: githubToken ? `Bearer ${githubToken}` : undefined, + ['X-GitHub-Api-Version']: '2022-11-28', + Accept: 'application/vnd.github+json', + }, + }) + + if (!resp.ok) { + console.log() + console.error('Response not ok') + console.log('resp', resp) + } + + const json = await resp.json() + files = json.map((file) => file.filename) || [] + } catch (e) { + if (retries >= 3) { + console.error(e) + + console.log() + console.log('Too many retries, giving up.') + + return [] + } else { + await new Promise((resolve) => setTimeout(resolve, 3000 * retries)) + files = await getChangedFiles(page, ++retries) + } + } + + changedFiles = changedFiles.concat(files) + + // Look at the headers to see if the result is paginated + const linkHeader = resp.headers.get('link') + if (linkHeader && linkHeader.includes('rel="next"')) { + const files = await getChangedFiles(page + 1) + changedFiles = changedFiles.concat(files) + } + + return changedFiles +} + async function main() { const branch = process.env.GITHUB_BASE_REF @@ -15,14 +104,22 @@ async function main() { return } - await exec(`git fetch origin ${branch}`) - - const { stdout } = await getExecOutput(`git diff origin/${branch} --name-only`) - const changedFiles = stdout.toString().trim().split('\n').filter(Boolean) + const changedFiles = await getChangedFiles() console.log(`${changedFiles.length} changed files`) - const onlyDocs = onlyDocsChanged(changedFiles) - if(onlyDocs){ + if (changedFiles.length === 0) { + console.log( + 'No changed files found. Something must have gone wrong. Falling back ' + + 'to running all tests.' + ) + core.setOutput('onlydocs', false) + core.setOutput('rsc', true) + core.setOutput('ssr', true) + return + } + + if (!hasCodeChanges(changedFiles)) { + console.log('No code changes detected, only docs') core.setOutput('onlydocs', true) core.setOutput('rsc', false) core.setOutput('ssr', false) diff --git a/.github/actions/detect-changes/package.json b/.github/actions/detect-changes/package.json index 6790460c30d1..e3eddcdb1965 100644 --- a/.github/actions/detect-changes/package.json +++ b/.github/actions/detect-changes/package.json @@ -5,5 +5,5 @@ "@actions/core": "1.10.1", "@actions/exec": "1.1.1" }, - "packageManager": "yarn@3.7.0" + "packageManager": "yarn@4.0.2" } diff --git a/.github/actions/detect-changes/yarn.lock b/.github/actions/detect-changes/yarn.lock index fb228a60ac7c..d92f30d6019d 100644 --- a/.github/actions/detect-changes/yarn.lock +++ b/.github/actions/detect-changes/yarn.lock @@ -2,15 +2,15 @@ # Manual changes might be lost - proceed with caution! __metadata: - version: 6 - cacheKey: 8c0 + version: 8 + cacheKey: 10c0 "@actions/core@npm:1.10.1": version: 1.10.1 resolution: "@actions/core@npm:1.10.1" dependencies: - "@actions/http-client": ^2.0.1 - uuid: ^8.3.2 + "@actions/http-client": "npm:^2.0.1" + uuid: "npm:^8.3.2" checksum: 7a61446697a23dcad3545cf0634dedbdedf20ae9a0ee6ee977554589a15deb4a93593ee48a41258933d58ce0778f446b0d2c162b60750956fb75e0b9560fb832 languageName: node linkType: hard @@ -19,7 +19,7 @@ __metadata: version: 1.1.1 resolution: "@actions/exec@npm:1.1.1" dependencies: - "@actions/io": ^1.0.1 + "@actions/io": "npm:^1.0.1" checksum: 4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a languageName: node linkType: hard @@ -28,7 +28,7 @@ __metadata: version: 2.0.1 resolution: "@actions/http-client@npm:2.0.1" dependencies: - tunnel: ^0.0.6 + tunnel: "npm:^0.0.6" checksum: b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67 languageName: node linkType: hard @@ -44,8 +44,8 @@ __metadata: version: 0.0.0-use.local resolution: "detect-changes@workspace:." dependencies: - "@actions/core": 1.10.1 - "@actions/exec": 1.1.1 + "@actions/core": "npm:1.10.1" + "@actions/exec": "npm:1.1.1" languageName: unknown linkType: soft diff --git a/.github/renovate.json b/.github/renovate.json index bab2785c3eb2..3aa6fbfd133d 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -39,7 +39,9 @@ "pretty-ms", "stdout-update", "tempy", - "terminal-link" + "terminal-link", + "title-case", + "untildify" ], "matchPackagePatterns": [ "^@redwoodjs/" diff --git a/.github/workflows/check-create-redwood-app.yml b/.github/workflows/check-create-redwood-app.yml index cd1f964a9714..1f22ece18aa8 100644 --- a/.github/workflows/check-create-redwood-app.yml +++ b/.github/workflows/check-create-redwood-app.yml @@ -16,9 +16,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - name: Enable Corepack + run: corepack enable + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 + - run: yarn install working-directory: ./.github/actions/check_create_redwood_app diff --git a/.github/workflows/check-test-project-fixture.yml b/.github/workflows/check-test-project-fixture.yml index 6a60ad3ce0c1..2a681dfb36a3 100644 --- a/.github/workflows/check-test-project-fixture.yml +++ b/.github/workflows/check-test-project-fixture.yml @@ -16,9 +16,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - name: Enable Corepack + run: corepack enable + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 + - run: yarn install working-directory: ./.github/actions/check_test_project_fixture diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cf317ac7172..61c51cbebd7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,10 +28,13 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: 🐈 Yarn install working-directory: ./.github/actions/detect-changes @@ -53,10 +56,13 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: 🐈 Yarn install working-directory: ./tasks/check @@ -94,10 +100,16 @@ jobs: - uses: actions/checkout@v4 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 + + - name: Enable Corepack + run: corepack enable - name: 🐈 Set up yarn cache uses: ./.github/actions/set-up-yarn-cache @@ -151,10 +163,13 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: 🐈 Set up yarn cache uses: ./.github/actions/set-up-yarn-cache @@ -244,10 +259,16 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 + + - name: Enable Corepack + run: corepack enable - name: 🐈 Set up yarn cache uses: ./.github/actions/set-up-yarn-cache @@ -447,10 +468,16 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 + + - name: Enable Corepack + run: corepack enable - name: 🐈 Set up yarn cache uses: ./.github/actions/set-up-yarn-cache @@ -503,10 +530,16 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 + + - name: Enable Corepack + run: corepack enable - name: 🐈 Set up yarn cache uses: ./.github/actions/set-up-yarn-cache @@ -597,10 +630,13 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: 🐈 Set up yarn cache uses: ./.github/actions/set-up-yarn-cache @@ -665,3 +701,75 @@ jobs: steps: - run: echo "Skipped" + + crwa: + needs: check + + name: 🌲 Create Redwood App + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: ⬢ Enable Corepack + run: corepack enable + + - name: ⬢ Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: 🐈 Set up yarn cache + uses: ./.github/actions/set-up-yarn-cache + + - name: 🐈 Yarn install + run: yarn install --inline-builds + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: 🏗️ Build + run: yarn build + + - name: Set up test project + run: | + yarn build:pack + PROJECT_PATH=$(yarn set-up-test-project) + echo "PROJECT_PATH=$PROJECT_PATH" >> $GITHUB_ENV + working-directory: ./packages/create-redwood-app + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: false + + - name: Set up git + run: | + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + + - name: e2e test + run: yarn test e2e + working-directory: ./packages/create-redwood-app + env: + PROJECT_PATH: ${{ env.PROJECT_PATH }} + + - name: Prompt tests + run: | + sudo apt-get update + sudo apt-get install expect + + ./tests/e2e_prompts.sh + ./tests/e2e_prompts_git.sh + ./tests/e2e_prompts_m.sh + ./tests/e2e_prompts_ts.sh + ./tests/e2e_prompts_overwrite.sh + working-directory: ./packages/create-redwood-app + env: + PROJECT_PATH: ${{ env.PROJECT_PATH }} + + crwa-skip: + needs: detect-changes + if: needs.detect-changes.outputs.onlydocs == 'true' + + name: 🌲 Create Redwood App + runs-on: ubuntu-latest + + steps: + - run: echo "Skipped" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1c3a1e263bbc..2af57bf1c982 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -45,7 +45,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} config-file: ./.github/codeql/codeql-config.yml @@ -57,7 +57,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -71,4 +71,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index fffb55c15a43..862707ef9d61 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -28,10 +28,13 @@ jobs: with: fetch-depth: 0 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: 🐈 Set up yarn cache uses: ./.github/actions/set-up-yarn-cache diff --git a/.github/workflows/publish-release-candidate.yml b/.github/workflows/publish-release-candidate.yml index 4269d9f838d6..a6fb174f204f 100644 --- a/.github/workflows/publish-release-candidate.yml +++ b/.github/workflows/publish-release-candidate.yml @@ -25,10 +25,13 @@ jobs: with: fetch-depth: 0 - - name: Setup node + - name: Enable Corepack + run: corepack enable + + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: 🏷 Check git tags run: | @@ -62,10 +65,13 @@ jobs: # This is required because lerna uses tags to determine the version. fetch-depth: 0 + - name: Enable Corepack + run: corepack enable + - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: 🐈 Set up yarn cache uses: ./.github/actions/set-up-yarn-cache diff --git a/.github/workflows/require-milestone.yml b/.github/workflows/require-milestone.yml index c77c0d35eb19..052a0f029d48 100644 --- a/.github/workflows/require-milestone.yml +++ b/.github/workflows/require-milestone.yml @@ -21,7 +21,7 @@ jobs: - name: ⬢ Set up Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: ✅ Check milestone uses: ./.github/actions/require-milestone diff --git a/.github/workflows/require-release-label.yml b/.github/workflows/require-release-label.yml index 84593106555d..63a2cc0a99e2 100644 --- a/.github/workflows/require-release-label.yml +++ b/.github/workflows/require-release-label.yml @@ -19,4 +19,4 @@ jobs: with: mode: exactly count: 1 - labels: "release:docs, release:chore, release:experiment, release:fix, release:feature, release:feature-breaking" + labels: "release:docs, release:chore, release:experiment, release:fix, release:feature, release:breaking" diff --git a/.github/workflows/update-all-contributors.yml b/.github/workflows/update-all-contributors.yml index b6b86d99faf6..63317934a946 100644 --- a/.github/workflows/update-all-contributors.yml +++ b/.github/workflows/update-all-contributors.yml @@ -22,9 +22,12 @@ jobs: with: token: ${{ secrets.JTOAR_TOKEN }} + - name: Enable Corepack + run: corepack enable + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - run: yarn install diff --git a/.gitignore b/.gitignore index b7c70b01b192..c974501ed9c1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ yarn-error.log **/*.tsbuildinfo tasks/.verdaccio tasks/e2e/cypress/fixtures/example.json -tasks/release/*.md tmp/ blog-test-project/* .yarn/* @@ -22,7 +21,11 @@ blog-test-project/* .pnp.* *.code-workspace .nova +packages/**/redwoodjs-*.tgz +packages/create-redwood-app/create-redwood-app.tgz # For esbuild. **/meta.json **/meta.*.json + +.nx/cache diff --git a/.gitpod.yml b/.gitpod.yml index d2f0627d52a9..7efea74f68a5 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -21,6 +21,7 @@ tasks: export REDWOOD_DISABLE_TELEMETRY=1 init: | cd /workspace/redwood + corepack enable yarn install yarn run build:test-project ../rw-test-app --typescript --link --verbose cd /workspace/rw-test-app && sed -i "s/\(open *= *\).*/\1false/" redwood.toml diff --git a/.prettierignore b/.prettierignore index b33452924a44..2b1ef87f61bf 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,3 +2,5 @@ # Do not format Markdown files to allow easier documentation contribution *.md + +/.nx/cache diff --git a/.vscode/settings.json b/.vscode/settings.json index 9a5deb77495c..fe09e853a9bc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,7 @@ "files.trimTrailingWhitespace": true, "editor.formatOnSave": false, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "workbench.colorCustomizations": { "statusBar.background": "#b85833", @@ -16,6 +16,9 @@ "**/__fixtures__": true, ".yarn-packages-cache": true }, + "[markdown][html][mjml]": { + "files.trimTrailingWhitespace": false + }, "typescript.tsdk": "node_modules/typescript/lib", "peacock.color": "#b85833" } diff --git a/.yarn/plugins/@yarnpkg/plugin-constraints.cjs b/.yarn/plugins/@yarnpkg/plugin-constraints.cjs deleted file mode 100644 index 7a2139dcfaa4..000000000000 --- a/.yarn/plugins/@yarnpkg/plugin-constraints.cjs +++ /dev/null @@ -1,52 +0,0 @@ -/* eslint-disable */ -//prettier-ignore -module.exports = { -name: "@yarnpkg/plugin-constraints", -factory: function (require) { -var plugin=(()=>{var Li=Object.create,Je=Object.defineProperty;var Hi=Object.getOwnPropertyDescriptor;var Gi=Object.getOwnPropertyNames;var Yi=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty;var Zi=r=>Je(r,"__esModule",{value:!0});var I=(r,u)=>()=>(u||r((u={exports:{}}).exports,u),u.exports),Qi=(r,u)=>{for(var p in u)Je(r,p,{get:u[p],enumerable:!0})},Ji=(r,u,p)=>{if(u&&typeof u=="object"||typeof u=="function")for(let c of Gi(u))!Ui.call(r,c)&&c!=="default"&&Je(r,c,{get:()=>u[c],enumerable:!(p=Hi(u,c))||p.enumerable});return r},G=r=>Ji(Zi(Je(r!=null?Li(Yi(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var Xr=I((Nu,_r)=>{var Ki;(function(r){var u=function(){return{"append/2":[new r.type.Rule(new r.type.Term("append",[new r.type.Var("X"),new r.type.Var("L")]),new r.type.Term("foldl",[new r.type.Term("append",[]),new r.type.Var("X"),new r.type.Term("[]",[]),new r.type.Var("L")]))],"append/3":[new r.type.Rule(new r.type.Term("append",[new r.type.Term("[]",[]),new r.type.Var("X"),new r.type.Var("X")]),null),new r.type.Rule(new r.type.Term("append",[new r.type.Term(".",[new r.type.Var("H"),new r.type.Var("T")]),new r.type.Var("X"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Var("S")])]),new r.type.Term("append",[new r.type.Var("T"),new r.type.Var("X"),new r.type.Var("S")]))],"member/2":[new r.type.Rule(new r.type.Term("member",[new r.type.Var("X"),new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("_")])]),null),new r.type.Rule(new r.type.Term("member",[new r.type.Var("X"),new r.type.Term(".",[new r.type.Var("_"),new r.type.Var("Xs")])]),new r.type.Term("member",[new r.type.Var("X"),new r.type.Var("Xs")]))],"permutation/2":[new r.type.Rule(new r.type.Term("permutation",[new r.type.Term("[]",[]),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("permutation",[new r.type.Term(".",[new r.type.Var("H"),new r.type.Var("T")]),new r.type.Var("S")]),new r.type.Term(",",[new r.type.Term("permutation",[new r.type.Var("T"),new r.type.Var("P")]),new r.type.Term(",",[new r.type.Term("append",[new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("P")]),new r.type.Term("append",[new r.type.Var("X"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Var("Y")]),new r.type.Var("S")])])]))],"maplist/2":[new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("_"),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Xs")])]),new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("P"),new r.type.Var("X")]),new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Var("Xs")])]))],"maplist/3":[new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("_"),new r.type.Term("[]",[]),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("A"),new r.type.Var("As")]),new r.type.Term(".",[new r.type.Var("B"),new r.type.Var("Bs")])]),new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("P"),new r.type.Var("A"),new r.type.Var("B")]),new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Var("As"),new r.type.Var("Bs")])]))],"maplist/4":[new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("_"),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("A"),new r.type.Var("As")]),new r.type.Term(".",[new r.type.Var("B"),new r.type.Var("Bs")]),new r.type.Term(".",[new r.type.Var("C"),new r.type.Var("Cs")])]),new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("P"),new r.type.Var("A"),new r.type.Var("B"),new r.type.Var("C")]),new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Var("As"),new r.type.Var("Bs"),new r.type.Var("Cs")])]))],"maplist/5":[new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("_"),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("A"),new r.type.Var("As")]),new r.type.Term(".",[new r.type.Var("B"),new r.type.Var("Bs")]),new r.type.Term(".",[new r.type.Var("C"),new r.type.Var("Cs")]),new r.type.Term(".",[new r.type.Var("D"),new r.type.Var("Ds")])]),new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("P"),new r.type.Var("A"),new r.type.Var("B"),new r.type.Var("C"),new r.type.Var("D")]),new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Var("As"),new r.type.Var("Bs"),new r.type.Var("Cs"),new r.type.Var("Ds")])]))],"maplist/6":[new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("_"),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("A"),new r.type.Var("As")]),new r.type.Term(".",[new r.type.Var("B"),new r.type.Var("Bs")]),new r.type.Term(".",[new r.type.Var("C"),new r.type.Var("Cs")]),new r.type.Term(".",[new r.type.Var("D"),new r.type.Var("Ds")]),new r.type.Term(".",[new r.type.Var("E"),new r.type.Var("Es")])]),new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("P"),new r.type.Var("A"),new r.type.Var("B"),new r.type.Var("C"),new r.type.Var("D"),new r.type.Var("E")]),new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Var("As"),new r.type.Var("Bs"),new r.type.Var("Cs"),new r.type.Var("Ds"),new r.type.Var("Es")])]))],"maplist/7":[new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("_"),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("A"),new r.type.Var("As")]),new r.type.Term(".",[new r.type.Var("B"),new r.type.Var("Bs")]),new r.type.Term(".",[new r.type.Var("C"),new r.type.Var("Cs")]),new r.type.Term(".",[new r.type.Var("D"),new r.type.Var("Ds")]),new r.type.Term(".",[new r.type.Var("E"),new r.type.Var("Es")]),new r.type.Term(".",[new r.type.Var("F"),new r.type.Var("Fs")])]),new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("P"),new r.type.Var("A"),new r.type.Var("B"),new r.type.Var("C"),new r.type.Var("D"),new r.type.Var("E"),new r.type.Var("F")]),new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Var("As"),new r.type.Var("Bs"),new r.type.Var("Cs"),new r.type.Var("Ds"),new r.type.Var("Es"),new r.type.Var("Fs")])]))],"maplist/8":[new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("_"),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[]),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("A"),new r.type.Var("As")]),new r.type.Term(".",[new r.type.Var("B"),new r.type.Var("Bs")]),new r.type.Term(".",[new r.type.Var("C"),new r.type.Var("Cs")]),new r.type.Term(".",[new r.type.Var("D"),new r.type.Var("Ds")]),new r.type.Term(".",[new r.type.Var("E"),new r.type.Var("Es")]),new r.type.Term(".",[new r.type.Var("F"),new r.type.Var("Fs")]),new r.type.Term(".",[new r.type.Var("G"),new r.type.Var("Gs")])]),new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("P"),new r.type.Var("A"),new r.type.Var("B"),new r.type.Var("C"),new r.type.Var("D"),new r.type.Var("E"),new r.type.Var("F"),new r.type.Var("G")]),new r.type.Term("maplist",[new r.type.Var("P"),new r.type.Var("As"),new r.type.Var("Bs"),new r.type.Var("Cs"),new r.type.Var("Ds"),new r.type.Var("Es"),new r.type.Var("Fs"),new r.type.Var("Gs")])]))],"include/3":[new r.type.Rule(new r.type.Term("include",[new r.type.Var("_"),new r.type.Term("[]",[]),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("include",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Var("T")]),new r.type.Var("L")]),new r.type.Term(",",[new r.type.Term("=..",[new r.type.Var("P"),new r.type.Var("A")]),new r.type.Term(",",[new r.type.Term("append",[new r.type.Var("A"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Term("[]",[])]),new r.type.Var("B")]),new r.type.Term(",",[new r.type.Term("=..",[new r.type.Var("F"),new r.type.Var("B")]),new r.type.Term(",",[new r.type.Term(";",[new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("F")]),new r.type.Term(",",[new r.type.Term("=",[new r.type.Var("L"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Var("S")])]),new r.type.Term("!",[])])]),new r.type.Term("=",[new r.type.Var("L"),new r.type.Var("S")])]),new r.type.Term("include",[new r.type.Var("P"),new r.type.Var("T"),new r.type.Var("S")])])])])]))],"exclude/3":[new r.type.Rule(new r.type.Term("exclude",[new r.type.Var("_"),new r.type.Term("[]",[]),new r.type.Term("[]",[])]),null),new r.type.Rule(new r.type.Term("exclude",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Var("T")]),new r.type.Var("S")]),new r.type.Term(",",[new r.type.Term("exclude",[new r.type.Var("P"),new r.type.Var("T"),new r.type.Var("E")]),new r.type.Term(",",[new r.type.Term("=..",[new r.type.Var("P"),new r.type.Var("L")]),new r.type.Term(",",[new r.type.Term("append",[new r.type.Var("L"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Term("[]",[])]),new r.type.Var("Q")]),new r.type.Term(",",[new r.type.Term("=..",[new r.type.Var("R"),new r.type.Var("Q")]),new r.type.Term(";",[new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("R")]),new r.type.Term(",",[new r.type.Term("!",[]),new r.type.Term("=",[new r.type.Var("S"),new r.type.Var("E")])])]),new r.type.Term("=",[new r.type.Var("S"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Var("E")])])])])])])]))],"foldl/4":[new r.type.Rule(new r.type.Term("foldl",[new r.type.Var("_"),new r.type.Term("[]",[]),new r.type.Var("I"),new r.type.Var("I")]),null),new r.type.Rule(new r.type.Term("foldl",[new r.type.Var("P"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Var("T")]),new r.type.Var("I"),new r.type.Var("R")]),new r.type.Term(",",[new r.type.Term("=..",[new r.type.Var("P"),new r.type.Var("L")]),new r.type.Term(",",[new r.type.Term("append",[new r.type.Var("L"),new r.type.Term(".",[new r.type.Var("I"),new r.type.Term(".",[new r.type.Var("H"),new r.type.Term(".",[new r.type.Var("X"),new r.type.Term("[]",[])])])]),new r.type.Var("L2")]),new r.type.Term(",",[new r.type.Term("=..",[new r.type.Var("P2"),new r.type.Var("L2")]),new r.type.Term(",",[new r.type.Term("call",[new r.type.Var("P2")]),new r.type.Term("foldl",[new r.type.Var("P"),new r.type.Var("T"),new r.type.Var("X"),new r.type.Var("R")])])])])]))],"select/3":[new r.type.Rule(new r.type.Term("select",[new r.type.Var("E"),new r.type.Term(".",[new r.type.Var("E"),new r.type.Var("Xs")]),new r.type.Var("Xs")]),null),new r.type.Rule(new r.type.Term("select",[new r.type.Var("E"),new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Xs")]),new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Ys")])]),new r.type.Term("select",[new r.type.Var("E"),new r.type.Var("Xs"),new r.type.Var("Ys")]))],"sum_list/2":[new r.type.Rule(new r.type.Term("sum_list",[new r.type.Term("[]",[]),new r.type.Num(0,!1)]),null),new r.type.Rule(new r.type.Term("sum_list",[new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Xs")]),new r.type.Var("S")]),new r.type.Term(",",[new r.type.Term("sum_list",[new r.type.Var("Xs"),new r.type.Var("Y")]),new r.type.Term("is",[new r.type.Var("S"),new r.type.Term("+",[new r.type.Var("X"),new r.type.Var("Y")])])]))],"max_list/2":[new r.type.Rule(new r.type.Term("max_list",[new r.type.Term(".",[new r.type.Var("X"),new r.type.Term("[]",[])]),new r.type.Var("X")]),null),new r.type.Rule(new r.type.Term("max_list",[new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Xs")]),new r.type.Var("S")]),new r.type.Term(",",[new r.type.Term("max_list",[new r.type.Var("Xs"),new r.type.Var("Y")]),new r.type.Term(";",[new r.type.Term(",",[new r.type.Term(">=",[new r.type.Var("X"),new r.type.Var("Y")]),new r.type.Term(",",[new r.type.Term("=",[new r.type.Var("S"),new r.type.Var("X")]),new r.type.Term("!",[])])]),new r.type.Term("=",[new r.type.Var("S"),new r.type.Var("Y")])])]))],"min_list/2":[new r.type.Rule(new r.type.Term("min_list",[new r.type.Term(".",[new r.type.Var("X"),new r.type.Term("[]",[])]),new r.type.Var("X")]),null),new r.type.Rule(new r.type.Term("min_list",[new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Xs")]),new r.type.Var("S")]),new r.type.Term(",",[new r.type.Term("min_list",[new r.type.Var("Xs"),new r.type.Var("Y")]),new r.type.Term(";",[new r.type.Term(",",[new r.type.Term("=<",[new r.type.Var("X"),new r.type.Var("Y")]),new r.type.Term(",",[new r.type.Term("=",[new r.type.Var("S"),new r.type.Var("X")]),new r.type.Term("!",[])])]),new r.type.Term("=",[new r.type.Var("S"),new r.type.Var("Y")])])]))],"prod_list/2":[new r.type.Rule(new r.type.Term("prod_list",[new r.type.Term("[]",[]),new r.type.Num(1,!1)]),null),new r.type.Rule(new r.type.Term("prod_list",[new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Xs")]),new r.type.Var("S")]),new r.type.Term(",",[new r.type.Term("prod_list",[new r.type.Var("Xs"),new r.type.Var("Y")]),new r.type.Term("is",[new r.type.Var("S"),new r.type.Term("*",[new r.type.Var("X"),new r.type.Var("Y")])])]))],"last/2":[new r.type.Rule(new r.type.Term("last",[new r.type.Term(".",[new r.type.Var("X"),new r.type.Term("[]",[])]),new r.type.Var("X")]),null),new r.type.Rule(new r.type.Term("last",[new r.type.Term(".",[new r.type.Var("_"),new r.type.Var("Xs")]),new r.type.Var("X")]),new r.type.Term("last",[new r.type.Var("Xs"),new r.type.Var("X")]))],"prefix/2":[new r.type.Rule(new r.type.Term("prefix",[new r.type.Var("Part"),new r.type.Var("Whole")]),new r.type.Term("append",[new r.type.Var("Part"),new r.type.Var("_"),new r.type.Var("Whole")]))],"nth0/3":[new r.type.Rule(new r.type.Term("nth0",[new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z")]),new r.type.Term(";",[new r.type.Term("->",[new r.type.Term("var",[new r.type.Var("X")]),new r.type.Term("nth",[new r.type.Num(0,!1),new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("_")])]),new r.type.Term(",",[new r.type.Term(">=",[new r.type.Var("X"),new r.type.Num(0,!1)]),new r.type.Term(",",[new r.type.Term("nth",[new r.type.Num(0,!1),new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("_")]),new r.type.Term("!",[])])])]))],"nth1/3":[new r.type.Rule(new r.type.Term("nth1",[new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z")]),new r.type.Term(";",[new r.type.Term("->",[new r.type.Term("var",[new r.type.Var("X")]),new r.type.Term("nth",[new r.type.Num(1,!1),new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("_")])]),new r.type.Term(",",[new r.type.Term(">",[new r.type.Var("X"),new r.type.Num(0,!1)]),new r.type.Term(",",[new r.type.Term("nth",[new r.type.Num(1,!1),new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("_")]),new r.type.Term("!",[])])])]))],"nth0/4":[new r.type.Rule(new r.type.Term("nth0",[new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("W")]),new r.type.Term(";",[new r.type.Term("->",[new r.type.Term("var",[new r.type.Var("X")]),new r.type.Term("nth",[new r.type.Num(0,!1),new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("W")])]),new r.type.Term(",",[new r.type.Term(">=",[new r.type.Var("X"),new r.type.Num(0,!1)]),new r.type.Term(",",[new r.type.Term("nth",[new r.type.Num(0,!1),new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("W")]),new r.type.Term("!",[])])])]))],"nth1/4":[new r.type.Rule(new r.type.Term("nth1",[new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("W")]),new r.type.Term(";",[new r.type.Term("->",[new r.type.Term("var",[new r.type.Var("X")]),new r.type.Term("nth",[new r.type.Num(1,!1),new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("W")])]),new r.type.Term(",",[new r.type.Term(">",[new r.type.Var("X"),new r.type.Num(0,!1)]),new r.type.Term(",",[new r.type.Term("nth",[new r.type.Num(1,!1),new r.type.Var("X"),new r.type.Var("Y"),new r.type.Var("Z"),new r.type.Var("W")]),new r.type.Term("!",[])])])]))],"nth/5":[new r.type.Rule(new r.type.Term("nth",[new r.type.Var("N"),new r.type.Var("N"),new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Xs")]),new r.type.Var("X"),new r.type.Var("Xs")]),null),new r.type.Rule(new r.type.Term("nth",[new r.type.Var("N"),new r.type.Var("O"),new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Xs")]),new r.type.Var("Y"),new r.type.Term(".",[new r.type.Var("X"),new r.type.Var("Ys")])]),new r.type.Term(",",[new r.type.Term("is",[new r.type.Var("M"),new r.type.Term("+",[new r.type.Var("N"),new r.type.Num(1,!1)])]),new r.type.Term("nth",[new r.type.Var("M"),new r.type.Var("O"),new r.type.Var("Xs"),new r.type.Var("Y"),new r.type.Var("Ys")])]))],"length/2":function(c,w,_){var v=_.args[0],g=_.args[1];if(!r.type.is_variable(g)&&!r.type.is_integer(g))c.throw_error(r.error.type("integer",g,_.indicator));else if(r.type.is_integer(g)&&g.value<0)c.throw_error(r.error.domain("not_less_than_zero",g,_.indicator));else{var h=new r.type.Term("length",[v,new r.type.Num(0,!1),g]);r.type.is_integer(g)&&(h=new r.type.Term(",",[h,new r.type.Term("!",[])])),c.prepend([new r.type.State(w.goal.replace(h),w.substitution,w)])}},"length/3":[new r.type.Rule(new r.type.Term("length",[new r.type.Term("[]",[]),new r.type.Var("N"),new r.type.Var("N")]),null),new r.type.Rule(new r.type.Term("length",[new r.type.Term(".",[new r.type.Var("_"),new r.type.Var("X")]),new r.type.Var("A"),new r.type.Var("N")]),new r.type.Term(",",[new r.type.Term("succ",[new r.type.Var("A"),new r.type.Var("B")]),new r.type.Term("length",[new r.type.Var("X"),new r.type.Var("B"),new r.type.Var("N")])]))],"replicate/3":function(c,w,_){var v=_.args[0],g=_.args[1],h=_.args[2];if(r.type.is_variable(g))c.throw_error(r.error.instantiation(_.indicator));else if(!r.type.is_integer(g))c.throw_error(r.error.type("integer",g,_.indicator));else if(g.value<0)c.throw_error(r.error.domain("not_less_than_zero",g,_.indicator));else if(!r.type.is_variable(h)&&!r.type.is_list(h))c.throw_error(r.error.type("list",h,_.indicator));else{for(var x=new r.type.Term("[]"),T=0;T0;b--)T[b].equals(T[b-1])&&T.splice(b,1);for(var C=new r.type.Term("[]"),b=T.length-1;b>=0;b--)C=new r.type.Term(".",[T[b],C]);c.prepend([new r.type.State(w.goal.replace(new r.type.Term("=",[C,g])),w.substitution,w)])}}},"msort/2":function(c,w,_){var v=_.args[0],g=_.args[1];if(r.type.is_variable(v))c.throw_error(r.error.instantiation(_.indicator));else if(!r.type.is_variable(g)&&!r.type.is_fully_list(g))c.throw_error(r.error.type("list",g,_.indicator));else{for(var h=[],x=v;x.indicator==="./2";)h.push(x.args[0]),x=x.args[1];if(r.type.is_variable(x))c.throw_error(r.error.instantiation(_.indicator));else if(!r.type.is_empty_list(x))c.throw_error(r.error.type("list",v,_.indicator));else{for(var T=h.sort(r.compare),b=new r.type.Term("[]"),C=T.length-1;C>=0;C--)b=new r.type.Term(".",[T[C],b]);c.prepend([new r.type.State(w.goal.replace(new r.type.Term("=",[b,g])),w.substitution,w)])}}},"keysort/2":function(c,w,_){var v=_.args[0],g=_.args[1];if(r.type.is_variable(v))c.throw_error(r.error.instantiation(_.indicator));else if(!r.type.is_variable(g)&&!r.type.is_fully_list(g))c.throw_error(r.error.type("list",g,_.indicator));else{for(var h=[],x,T=v;T.indicator==="./2";){if(x=T.args[0],r.type.is_variable(x)){c.throw_error(r.error.instantiation(_.indicator));return}else if(!r.type.is_term(x)||x.indicator!=="-/2"){c.throw_error(r.error.type("pair",x,_.indicator));return}x.args[0].pair=x.args[1],h.push(x.args[0]),T=T.args[1]}if(r.type.is_variable(T))c.throw_error(r.error.instantiation(_.indicator));else if(!r.type.is_empty_list(T))c.throw_error(r.error.type("list",v,_.indicator));else{for(var b=h.sort(r.compare),C=new r.type.Term("[]"),N=b.length-1;N>=0;N--)C=new r.type.Term(".",[new r.type.Term("-",[b[N],b[N].pair]),C]),delete b[N].pair;c.prepend([new r.type.State(w.goal.replace(new r.type.Term("=",[C,g])),w.substitution,w)])}}},"take/3":function(c,w,_){var v=_.args[0],g=_.args[1],h=_.args[2];if(r.type.is_variable(g)||r.type.is_variable(v))c.throw_error(r.error.instantiation(_.indicator));else if(!r.type.is_list(g))c.throw_error(r.error.type("list",g,_.indicator));else if(!r.type.is_integer(v))c.throw_error(r.error.type("integer",v,_.indicator));else if(!r.type.is_variable(h)&&!r.type.is_list(h))c.throw_error(r.error.type("list",h,_.indicator));else{for(var x=v.value,T=[],b=g;x>0&&b.indicator==="./2";)T.push(b.args[0]),b=b.args[1],x--;if(x===0){for(var C=new r.type.Term("[]"),x=T.length-1;x>=0;x--)C=new r.type.Term(".",[T[x],C]);c.prepend([new r.type.State(w.goal.replace(new r.type.Term("=",[C,h])),w.substitution,w)])}}},"drop/3":function(c,w,_){var v=_.args[0],g=_.args[1],h=_.args[2];if(r.type.is_variable(g)||r.type.is_variable(v))c.throw_error(r.error.instantiation(_.indicator));else if(!r.type.is_list(g))c.throw_error(r.error.type("list",g,_.indicator));else if(!r.type.is_integer(v))c.throw_error(r.error.type("integer",v,_.indicator));else if(!r.type.is_variable(h)&&!r.type.is_list(h))c.throw_error(r.error.type("list",h,_.indicator));else{for(var x=v.value,T=[],b=g;x>0&&b.indicator==="./2";)T.push(b.args[0]),b=b.args[1],x--;x===0&&c.prepend([new r.type.State(w.goal.replace(new r.type.Term("=",[b,h])),w.substitution,w)])}},"reverse/2":function(c,w,_){var v=_.args[0],g=_.args[1],h=r.type.is_instantiated_list(v),x=r.type.is_instantiated_list(g);if(r.type.is_variable(v)&&r.type.is_variable(g))c.throw_error(r.error.instantiation(_.indicator));else if(!r.type.is_variable(v)&&!r.type.is_fully_list(v))c.throw_error(r.error.type("list",v,_.indicator));else if(!r.type.is_variable(g)&&!r.type.is_fully_list(g))c.throw_error(r.error.type("list",g,_.indicator));else if(!h&&!x)c.throw_error(r.error.instantiation(_.indicator));else{for(var T=h?v:g,b=new r.type.Term("[]",[]);T.indicator==="./2";)b=new r.type.Term(".",[T.args[0],b]),T=T.args[1];c.prepend([new r.type.State(w.goal.replace(new r.type.Term("=",[b,h?g:v])),w.substitution,w)])}},"list_to_set/2":function(c,w,_){var v=_.args[0],g=_.args[1];if(r.type.is_variable(v))c.throw_error(r.error.instantiation(_.indicator));else{for(var h=v,x=[];h.indicator==="./2";)x.push(h.args[0]),h=h.args[1];if(r.type.is_variable(h))c.throw_error(r.error.instantiation(_.indicator));else if(!r.type.is_term(h)||h.indicator!=="[]/0")c.throw_error(r.error.type("list",v,_.indicator));else{for(var T=[],b=new r.type.Term("[]",[]),C,N=0;N=0;N--)b=new r.type.Term(".",[T[N],b]);c.prepend([new r.type.State(w.goal.replace(new r.type.Term("=",[g,b])),w.substitution,w)])}}}}},p=["append/2","append/3","member/2","permutation/2","maplist/2","maplist/3","maplist/4","maplist/5","maplist/6","maplist/7","maplist/8","include/3","exclude/3","foldl/4","sum_list/2","max_list/2","min_list/2","prod_list/2","last/2","prefix/2","nth0/3","nth1/3","nth0/4","nth1/4","length/2","replicate/3","select/3","sort/2","msort/2","keysort/2","take/3","drop/3","reverse/2","list_to_set/2"];typeof _r!="undefined"?_r.exports=function(c){r=c,new r.type.Module("lists",u(),p)}:new r.type.Module("lists",u(),p)})(Ki)});var et=I(M=>{"use strict";var Ve=process.platform==="win32",wr="aes-256-cbc",ji="sha256",Br="The current environment doesn't support interactive reading from TTY.",z=require("fs"),Fr=process.binding("tty_wrap").TTY,gr=require("child_process"),ye=require("path"),dr={prompt:"> ",hideEchoBack:!1,mask:"*",limit:[],limitMessage:"Input another, please.$<( [)limit(])>",defaultInput:"",trueValue:[],falseValue:[],caseSensitive:!1,keepWhitespace:!1,encoding:"utf8",bufferSize:1024,print:void 0,history:!0,cd:!1,phContent:void 0,preCheck:void 0},ce="none",oe,Ce,zr=!1,_e,Ke,vr,es=0,hr="",Se=[],je,Wr=!1,mr=!1,qe=!1;function Lr(r){function u(p){return p.replace(/[^\w\u0080-\uFFFF]/g,function(c){return"#"+c.charCodeAt(0)+";"})}return Ke.concat(function(p){var c=[];return Object.keys(p).forEach(function(w){p[w]==="boolean"?r[w]&&c.push("--"+w):p[w]==="string"&&r[w]&&c.push("--"+w,u(r[w]))}),c}({display:"string",displayOnly:"boolean",keyIn:"boolean",hideEchoBack:"boolean",mask:"string",limit:"string",caseSensitive:"boolean"}))}function rs(r,u){function p(K){var U,Ue="",Ze;for(vr=vr||require("os").tmpdir();;){U=ye.join(vr,K+Ue);try{Ze=z.openSync(U,"wx")}catch(Qe){if(Qe.code==="EEXIST"){Ue++;continue}else throw Qe}z.closeSync(Ze);break}return U}var c,w,_,v={},g,h,x=p("readline-sync.stdout"),T=p("readline-sync.stderr"),b=p("readline-sync.exit"),C=p("readline-sync.done"),N=require("crypto"),W,ee,te;W=N.createHash(ji),W.update(""+process.pid+es+++Math.random()),te=W.digest("hex"),ee=N.createDecipher(wr,te),c=Lr(r),Ve?(w=process.env.ComSpec||"cmd.exe",process.env.Q='"',_=["/V:ON","/S","/C","(%Q%"+w+"%Q% /V:ON /S /C %Q%%Q%"+_e+"%Q%"+c.map(function(K){return" %Q%"+K+"%Q%"}).join("")+" & (echo !ERRORLEVEL!)>%Q%"+b+"%Q%%Q%) 2>%Q%"+T+"%Q% |%Q%"+process.execPath+"%Q% %Q%"+__dirname+"\\encrypt.js%Q% %Q%"+wr+"%Q% %Q%"+te+"%Q% >%Q%"+x+"%Q% & (echo 1)>%Q%"+C+"%Q%"]):(w="/bin/sh",_=["-c",'("'+_e+'"'+c.map(function(K){return" '"+K.replace(/'/g,"'\\''")+"'"}).join("")+'; echo $?>"'+b+'") 2>"'+T+'" |"'+process.execPath+'" "'+__dirname+'/encrypt.js" "'+wr+'" "'+te+'" >"'+x+'"; echo 1 >"'+C+'"']),qe&&qe("_execFileSync",c);try{gr.spawn(w,_,u)}catch(K){v.error=new Error(K.message),v.error.method="_execFileSync - spawn",v.error.program=w,v.error.args=_}for(;z.readFileSync(C,{encoding:r.encoding}).trim()!=="1";);return(g=z.readFileSync(b,{encoding:r.encoding}).trim())==="0"?v.input=ee.update(z.readFileSync(x,{encoding:"binary"}),"hex",r.encoding)+ee.final(r.encoding):(h=z.readFileSync(T,{encoding:r.encoding}).trim(),v.error=new Error(Br+(h?` -`+h:"")),v.error.method="_execFileSync",v.error.program=w,v.error.args=_,v.error.extMessage=h,v.error.exitCode=+g),z.unlinkSync(x),z.unlinkSync(T),z.unlinkSync(b),z.unlinkSync(C),v}function ts(r){var u,p={},c,w={env:process.env,encoding:r.encoding};if(_e||(Ve?process.env.PSModulePath?(_e="powershell.exe",Ke=["-ExecutionPolicy","Bypass","-File",__dirname+"\\read.ps1"]):(_e="cscript.exe",Ke=["//nologo",__dirname+"\\read.cs.js"]):(_e="/bin/sh",Ke=[__dirname+"/read.sh"])),Ve&&!process.env.PSModulePath&&(w.stdio=[process.stdin]),gr.execFileSync){u=Lr(r),qe&&qe("execFileSync",u);try{p.input=gr.execFileSync(_e,u,w)}catch(_){c=_.stderr?(_.stderr+"").trim():"",p.error=new Error(Br+(c?` -`+c:"")),p.error.method="execFileSync",p.error.program=_e,p.error.args=u,p.error.extMessage=c,p.error.exitCode=_.status,p.error.code=_.code,p.error.signal=_.signal}}else p=rs(r,w);return p.error||(p.input=p.input.replace(/^\s*'|'\s*$/g,""),r.display=""),p}function br(r){var u="",p=r.display,c=!r.display&&r.keyIn&&r.hideEchoBack&&!r.mask;function w(){var _=ts(r);if(_.error)throw _.error;return _.input}return mr&&mr(r),function(){var _,v,g;function h(){return _||(_=process.binding("fs"),v=process.binding("constants")),_}if(typeof ce=="string")if(ce=null,Ve){if(g=function(x){var T=x.replace(/^\D+/,"").split("."),b=0;return(T[0]=+T[0])&&(b+=T[0]*1e4),(T[1]=+T[1])&&(b+=T[1]*100),(T[2]=+T[2])&&(b+=T[2]),b}(process.version),!(g>=20302&&g<40204||g>=5e4&&g<50100||g>=50600&&g<60200)&&process.stdin.isTTY)process.stdin.pause(),ce=process.stdin.fd,Ce=process.stdin._handle;else try{ce=h().open("CONIN$",v.O_RDWR,parseInt("0666",8)),Ce=new Fr(ce,!0)}catch(x){}if(process.stdout.isTTY)oe=process.stdout.fd;else{try{oe=z.openSync("\\\\.\\CON","w")}catch(x){}if(typeof oe!="number")try{oe=h().open("CONOUT$",v.O_RDWR,parseInt("0666",8))}catch(x){}}}else{if(process.stdin.isTTY){process.stdin.pause();try{ce=z.openSync("/dev/tty","r"),Ce=process.stdin._handle}catch(x){}}else try{ce=z.openSync("/dev/tty","r"),Ce=new Fr(ce,!1)}catch(x){}if(process.stdout.isTTY)oe=process.stdout.fd;else try{oe=z.openSync("/dev/tty","w")}catch(x){}}}(),function(){var _,v,g=!r.hideEchoBack&&!r.keyIn,h,x,T,b,C;je="";function N(W){return W===zr?!0:Ce.setRawMode(W)!==0?!1:(zr=W,!0)}if(Wr||!Ce||typeof oe!="number"&&(r.display||!g)){u=w();return}if(r.display&&(z.writeSync(oe,r.display),r.display=""),!r.displayOnly){if(!N(!g)){u=w();return}for(x=r.keyIn?1:r.bufferSize,h=Buffer.allocUnsafe&&Buffer.alloc?Buffer.alloc(x):new Buffer(x),r.keyIn&&r.limit&&(v=new RegExp("[^"+r.limit+"]","g"+(r.caseSensitive?"":"i")));;){T=0;try{T=z.readSync(ce,h,0,x)}catch(W){if(W.code!=="EOF"){N(!1),u+=w();return}}if(T>0?(b=h.toString(r.encoding,0,T),je+=b):(b=` -`,je+=String.fromCharCode(0)),b&&typeof(C=(b.match(/^(.*?)[\r\n]/)||[])[1])=="string"&&(b=C,_=!0),b&&(b=b.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"")),b&&v&&(b=b.replace(v,"")),b&&(g||(r.hideEchoBack?r.mask&&z.writeSync(oe,new Array(b.length+1).join(r.mask)):z.writeSync(oe,b)),u+=b),!r.keyIn&&_||r.keyIn&&u.length>=x)break}!g&&!c&&z.writeSync(oe,` -`),N(!1)}}(),r.print&&!c&&r.print(p+(r.displayOnly?"":(r.hideEchoBack?new Array(u.length+1).join(r.mask):u)+` -`),r.encoding),r.displayOnly?"":hr=r.keepWhitespace||r.keyIn?u:u.trim()}function ns(r,u){var p=[];function c(w){w!=null&&(Array.isArray(w)?w.forEach(c):(!u||u(w))&&p.push(w))}return c(r),p}function Tr(r){return r.replace(/[\x00-\x7f]/g,function(u){return"\\x"+("00"+u.charCodeAt().toString(16)).substr(-2)})}function Z(){var r=Array.prototype.slice.call(arguments),u,p;return r.length&&typeof r[0]=="boolean"&&(p=r.shift(),p&&(u=Object.keys(dr),r.unshift(dr))),r.reduce(function(c,w){return w==null||(w.hasOwnProperty("noEchoBack")&&!w.hasOwnProperty("hideEchoBack")&&(w.hideEchoBack=w.noEchoBack,delete w.noEchoBack),w.hasOwnProperty("noTrim")&&!w.hasOwnProperty("keepWhitespace")&&(w.keepWhitespace=w.noTrim,delete w.noTrim),p||(u=Object.keys(w)),u.forEach(function(_){var v;if(!!w.hasOwnProperty(_))switch(v=w[_],_){case"mask":case"limitMessage":case"defaultInput":case"encoding":v=v!=null?v+"":"",v&&_!=="limitMessage"&&(v=v.replace(/[\r\n]/g,"")),c[_]=v;break;case"bufferSize":!isNaN(v=parseInt(v,10))&&typeof v=="number"&&(c[_]=v);break;case"displayOnly":case"keyIn":case"hideEchoBack":case"caseSensitive":case"keepWhitespace":case"history":case"cd":c[_]=!!v;break;case"limit":case"trueValue":case"falseValue":c[_]=ns(v,function(g){var h=typeof g;return h==="string"||h==="number"||h==="function"||g instanceof RegExp}).map(function(g){return typeof g=="string"?g.replace(/[\r\n]/g,""):g});break;case"print":case"phContent":case"preCheck":c[_]=typeof v=="function"?v:void 0;break;case"prompt":case"display":c[_]=v!=null?v:"";break}})),c},{})}function xr(r,u,p){return u.some(function(c){var w=typeof c;return w==="string"?p?r===c:r.toLowerCase()===c.toLowerCase():w==="number"?parseFloat(r)===c:w==="function"?c(r):c instanceof RegExp?c.test(r):!1})}function Vr(r,u){var p=ye.normalize(Ve?(process.env.HOMEDRIVE||"")+(process.env.HOMEPATH||""):process.env.HOME||"").replace(/[\/\\]+$/,"");return r=ye.normalize(r),u?r.replace(/^~(?=\/|\\|$)/,p):r.replace(new RegExp("^"+Tr(p)+"(?=\\/|\\\\|$)",Ve?"i":""),"~")}function Oe(r,u){var p="(?:\\(([\\s\\S]*?)\\))?(\\w+|.-.)(?:\\(([\\s\\S]*?)\\))?",c=new RegExp("(\\$)?(\\$<"+p+">)","g"),w=new RegExp("(\\$)?(\\$\\{"+p+"\\})","g");function _(v,g,h,x,T,b){var C;return g||typeof(C=u(T))!="string"?h:C?(x||"")+C+(b||""):""}return r.replace(c,_).replace(w,_)}function Hr(r,u,p){var c,w=[],_=-1,v=0,g="",h;function x(T,b){return b.length>3?(T.push(b[0]+"..."+b[b.length-1]),h=!0):b.length&&(T=T.concat(b)),T}return c=r.reduce(function(T,b){return T.concat((b+"").split(""))},[]).reduce(function(T,b){var C,N;return u||(b=b.toLowerCase()),C=/^\d$/.test(b)?1:/^[A-Z]$/.test(b)?2:/^[a-z]$/.test(b)?3:0,p&&C===0?g+=b:(N=b.charCodeAt(0),C&&C===_&&N===v+1?w.push(b):(T=x(T,w),w=[b],_=C),v=N),T},[]),c=x(c,w),g&&(c.push(g),h=!0),{values:c,suppressed:h}}function Gr(r,u){return r.join(r.length>2?", ":u?" / ":"/")}function Yr(r,u){var p,c,w={},_;if(u.phContent&&(p=u.phContent(r,u)),typeof p!="string")switch(r){case"hideEchoBack":case"mask":case"defaultInput":case"caseSensitive":case"keepWhitespace":case"encoding":case"bufferSize":case"history":case"cd":p=u.hasOwnProperty(r)?typeof u[r]=="boolean"?u[r]?"on":"off":u[r]+"":"";break;case"limit":case"trueValue":case"falseValue":c=u[u.hasOwnProperty(r+"Src")?r+"Src":r],u.keyIn?(w=Hr(c,u.caseSensitive),c=w.values):c=c.filter(function(v){var g=typeof v;return g==="string"||g==="number"}),p=Gr(c,w.suppressed);break;case"limitCount":case"limitCountNotZero":p=u[u.hasOwnProperty("limitSrc")?"limitSrc":"limit"].length,p=p||r!=="limitCountNotZero"?p+"":"";break;case"lastInput":p=hr;break;case"cwd":case"CWD":case"cwdHome":p=process.cwd(),r==="CWD"?p=ye.basename(p):r==="cwdHome"&&(p=Vr(p));break;case"date":case"time":case"localeDate":case"localeTime":p=new Date()["to"+r.replace(/^./,function(v){return v.toUpperCase()})+"String"]();break;default:typeof(_=(r.match(/^history_m(\d+)$/)||[])[1])=="string"&&(p=Se[Se.length-_]||"")}return p}function Ur(r){var u=/^(.)-(.)$/.exec(r),p="",c,w,_,v;if(!u)return null;for(c=u[1].charCodeAt(0),w=u[2].charCodeAt(0),v=c -And the length must be: $`,trueValue:null,falseValue:null,caseSensitive:!0},u,{history:!1,cd:!1,phContent:function(N){return N==="charlist"?p.text:N==="length"?c+"..."+w:null}}),v,g,h,x,T,b,C;for(u=u||{},v=Oe(u.charlist?u.charlist+"":"$",Ur),(isNaN(c=parseInt(u.min,10))||typeof c!="number")&&(c=12),(isNaN(w=parseInt(u.max,10))||typeof w!="number")&&(w=24),x=new RegExp("^["+Tr(v)+"]{"+c+","+w+"}$"),p=Hr([v],_.caseSensitive,!0),p.text=Gr(p.values,p.suppressed),g=u.confirmMessage!=null?u.confirmMessage:"Reinput a same one to confirm it: ",h=u.unmatchMessage!=null?u.unmatchMessage:"It differs from first one. Hit only the Enter key if you want to retry from first one.",r==null&&(r="Input new password: "),T=_.limitMessage;!C;)_.limit=x,_.limitMessage=T,b=M.question(r,_),_.limit=[b,""],_.limitMessage=h,C=M.question(g,_);return b};function Jr(r,u,p){var c;function w(_){return c=p(_),!isNaN(c)&&typeof c=="number"}return M.question(r,Z({limitMessage:"Input valid number, please."},u,{limit:w,cd:!1})),c}M.questionInt=function(r,u){return Jr(r,u,function(p){return parseInt(p,10)})};M.questionFloat=function(r,u){return Jr(r,u,parseFloat)};M.questionPath=function(r,u){var p,c="",w=Z({hideEchoBack:!1,limitMessage:`$Input valid path, please.$<( Min:)min>$<( Max:)max>`,history:!0,cd:!0},u,{keepWhitespace:!1,limit:function(_){var v,g,h;_=Vr(_,!0),c="";function x(T){T.split(/\/|\\/).reduce(function(b,C){var N=ye.resolve(b+=C+ye.sep);if(!z.existsSync(N))z.mkdirSync(N);else if(!z.statSync(N).isDirectory())throw new Error("Non directory already exists: "+N);return b},"")}try{if(v=z.existsSync(_),p=v?z.realpathSync(_):ye.resolve(_),!u.hasOwnProperty("exists")&&!v||typeof u.exists=="boolean"&&u.exists!==v)return c=(v?"Already exists":"No such file or directory")+": "+p,!1;if(!v&&u.create&&(u.isDirectory?x(p):(x(ye.dirname(p)),z.closeSync(z.openSync(p,"w"))),p=z.realpathSync(p)),v&&(u.min||u.max||u.isFile||u.isDirectory)){if(g=z.statSync(p),u.isFile&&!g.isFile())return c="Not file: "+p,!1;if(u.isDirectory&&!g.isDirectory())return c="Not directory: "+p,!1;if(u.min&&g.size<+u.min||u.max&&g.size>+u.max)return c="Size "+g.size+" is out of range: "+p,!1}if(typeof u.validate=="function"&&(h=u.validate(p))!==!0)return typeof h=="string"&&(c=h),!1}catch(T){return c=T+"",!1}return!0},phContent:function(_){return _==="error"?c:_!=="min"&&_!=="max"?null:u.hasOwnProperty(_)?u[_]+"":""}});return u=u||{},r==null&&(r='Input path (you can "cd" and "pwd"): '),M.question(r,w),p};function Kr(r,u){var p={},c={};return typeof r=="object"?(Object.keys(r).forEach(function(w){typeof r[w]=="function"&&(c[u.caseSensitive?w:w.toLowerCase()]=r[w])}),p.preCheck=function(w){var _;return p.args=Sr(w),_=p.args[0]||"",u.caseSensitive||(_=_.toLowerCase()),p.hRes=_!=="_"&&c.hasOwnProperty(_)?c[_].apply(w,p.args.slice(1)):c.hasOwnProperty("_")?c._.apply(w,p.args):null,{res:w,forceNext:!1}},c.hasOwnProperty("_")||(p.limit=function(){var w=p.args[0]||"";return u.caseSensitive||(w=w.toLowerCase()),c.hasOwnProperty(w)})):p.preCheck=function(w){return p.args=Sr(w),p.hRes=typeof r=="function"?r.apply(w,p.args):!0,{res:w,forceNext:!1}},p}M.promptCL=function(r,u){var p=Z({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},u),c=Kr(r,p);return p.limit=c.limit,p.preCheck=c.preCheck,M.prompt(p),c.args};M.promptLoop=function(r,u){for(var p=Z({hideEchoBack:!1,trueValue:null,falseValue:null,caseSensitive:!1,history:!0},u);!r(M.prompt(p)););};M.promptCLLoop=function(r,u){var p=Z({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},u),c=Kr(r,p);for(p.limit=c.limit,p.preCheck=c.preCheck;M.prompt(p),!c.hRes;);};M.promptSimShell=function(r){return M.prompt(Z({hideEchoBack:!1,history:!0},r,{prompt:function(){return Ve?"$>":(process.env.USER||"")+(process.env.HOSTNAME?"@"+process.env.HOSTNAME.replace(/\..*$/,""):"")+":$$ "}()}))};function jr(r,u,p){var c;return r==null&&(r="Are you sure? "),(!u||u.guide!==!1)&&(r+="")&&(r=r.replace(/\s*:?\s*$/,"")+" [y/n]: "),c=M.keyIn(r,Z(u,{hideEchoBack:!1,limit:p,trueValue:"y",falseValue:"n",caseSensitive:!1})),typeof c=="boolean"?c:""}M.keyInYN=function(r,u){return jr(r,u)};M.keyInYNStrict=function(r,u){return jr(r,u,"yn")};M.keyInPause=function(r,u){r==null&&(r="Continue..."),(!u||u.guide!==!1)&&(r+="")&&(r=r.replace(/\s+$/,"")+" (Hit any key)"),M.keyIn(r,Z({limit:null},u,{hideEchoBack:!0,mask:""}))};M.keyInSelect=function(r,u,p){var c=Z({hideEchoBack:!1},p,{trueValue:null,falseValue:null,caseSensitive:!1,phContent:function(h){return h==="itemsCount"?r.length+"":h==="firstItem"?(r[0]+"").trim():h==="lastItem"?(r[r.length-1]+"").trim():null}}),w="",_={},v=49,g=` -`;if(!Array.isArray(r)||!r.length||r.length>35)throw"`items` must be Array (max length: 35).";return r.forEach(function(h,x){var T=String.fromCharCode(v);w+=T,_[T]=x,g+="["+T+"] "+(h+"").trim()+` -`,v=v===57?97:v+1}),(!p||p.cancel!==!1)&&(w+="0",_["0"]=-1,g+="[0] "+(p&&p.cancel!=null&&typeof p.cancel!="boolean"?(p.cancel+"").trim():"CANCEL")+` -`),c.limit=w,g+=` -`,u==null&&(u="Choose one from list: "),(u+="")&&((!p||p.guide!==!1)&&(u=u.replace(/\s*:?\s*$/,"")+" [$]: "),g+=u),_[M.keyIn(g,c).toLowerCase()]};M.getRawInput=function(){return je};function $e(r,u){var p;return u.length&&(p={},p[r]=u[0]),M.setDefaultOptions(p)[r]}M.setPrint=function(){return $e("print",arguments)};M.setPrompt=function(){return $e("prompt",arguments)};M.setEncoding=function(){return $e("encoding",arguments)};M.setMask=function(){return $e("mask",arguments)};M.setBufferSize=function(){return $e("bufferSize",arguments)}});var kr=I((Mu,ie)=>{(function(){var r={major:0,minor:2,patch:66,status:"beta"};tau_file_system={files:{},open:function(e,n,t){var s=tau_file_system.files[e];if(!s){if(t==="read")return null;s={path:e,text:"",type:n,get:function(a,l){return l===this.text.length||l>this.text.length?"end_of_file":this.text.substring(l,l+a)},put:function(a,l){return l==="end_of_file"?(this.text+=a,!0):l==="past_end_of_file"?null:(this.text=this.text.substring(0,l)+a+this.text.substring(l+a.length),!0)},get_byte:function(a){if(a==="end_of_stream")return-1;var l=Math.floor(a/2);if(this.text.length<=l)return-1;var f=_(this.text[Math.floor(a/2)],0);return a%2==0?f&255:f/256>>>0},put_byte:function(a,l){var f=l==="end_of_stream"?this.text.length:Math.floor(l/2);if(this.text.length>>0,y=(y&255)<<8|a&255):(y=y&255,y=(a&255)<<8|y&255),this.text.length===f?this.text+=v(y):this.text=this.text.substring(0,f)+v(y)+this.text.substring(f+1),!0},flush:function(){return!0},close:function(){var a=tau_file_system.files[this.path];return a?!0:null}},tau_file_system.files[e]=s}return t==="write"&&(s.text=""),s}},tau_user_input={buffer:"",get:function(e,n){for(var t;tau_user_input.buffer.length\?\@\^\~\\]+|'(?:[^']*?(?:\\(?:x?\d+)?\\)*(?:'')*(?:\\')*)*')/,number:/^(?:0o[0-7]+|0x[0-9a-fA-F]+|0b[01]+|0'(?:''|\\[abfnrtv\\'"`]|\\x?\d+\\|[^\\])|\d+(?:\.\d+(?:[eE][+-]?\d+)?)?)/,string:/^(?:"([^"]|""|\\")*"|`([^`]|``|\\`)*`)/,l_brace:/^(?:\[)/,r_brace:/^(?:\])/,l_bracket:/^(?:\{)/,r_bracket:/^(?:\})/,bar:/^(?:\|)/,l_paren:/^(?:\()/,r_paren:/^(?:\))/};function te(e,n){return e.get_flag("char_conversion").id==="on"?n.replace(/./g,function(t){return e.get_char_conversion(t)}):n}function K(e){this.thread=e,this.text="",this.tokens=[]}K.prototype.set_last_tokens=function(e){return this.tokens=e},K.prototype.new_text=function(e){this.text=e,this.tokens=[]},K.prototype.get_tokens=function(e){var n,t=0,s=0,a=0,l=[],f=!1;if(e){var y=this.tokens[e-1];t=y.len,n=te(this.thread,this.text.substr(y.len)),s=y.line,a=y.start}else n=this.text;if(/^\s*$/.test(n))return null;for(;n!=="";){var d=[],m=!1;if(/^\n/.exec(n)!==null){s++,a=0,t++,n=n.replace(/\n/,""),f=!0;continue}for(var S in ee)if(ee.hasOwnProperty(S)){var P=ee[S].exec(n);P&&d.push({value:P[0],name:S,matches:P})}if(!d.length)return this.set_last_tokens([{value:n,matches:[],name:"lexical",line:s,start:a}]);var y=p(d,function(B,q){return B.value.length>=q.value.length?B:q});switch(y.start=a,y.line=s,n=n.replace(y.value,""),a+=y.value.length,t+=y.value.length,y.name){case"atom":y.raw=y.value,y.value.charAt(0)==="'"&&(y.value=C(y.value.substr(1,y.value.length-2),"'"),y.value===null&&(y.name="lexical",y.value="unknown escape sequence"));break;case"number":y.float=y.value.substring(0,2)!=="0x"&&y.value.match(/[.eE]/)!==null&&y.value!=="0'.",y.value=W(y.value),y.blank=m;break;case"string":var A=y.value.charAt(0);y.value=C(y.value.substr(1,y.value.length-2),A),y.value===null&&(y.name="lexical",y.value="unknown escape sequence");break;case"whitespace":var R=l[l.length-1];R&&(R.space=!0),m=!0;continue;case"r_bracket":l.length>0&&l[l.length-1].name==="l_bracket"&&(y=l.pop(),y.name="atom",y.value="{}",y.raw="{}",y.space=!1);break;case"r_brace":l.length>0&&l[l.length-1].name==="l_brace"&&(y=l.pop(),y.name="atom",y.value="[]",y.raw="[]",y.space=!1);break}y.len=t,l.push(y),m=!1}var k=this.set_last_tokens(l);return k.length===0?null:k};function U(e,n,t,s,a){if(!n[t])return{type:g,value:i.error.syntax(n[t-1],"expression expected",!0)};var l;if(s==="0"){var f=n[t];switch(f.name){case"number":return{type:h,len:t+1,value:new i.type.Num(f.value,f.float)};case"variable":return{type:h,len:t+1,value:new i.type.Var(f.value)};case"string":var y;switch(e.get_flag("double_quotes").id){case"atom":y=new o(f.value,[]);break;case"codes":y=new o("[]",[]);for(var d=f.value.length-1;d>=0;d--)y=new o(".",[new i.type.Num(_(f.value,d),!1),y]);break;case"chars":y=new o("[]",[]);for(var d=f.value.length-1;d>=0;d--)y=new o(".",[new i.type.Term(f.value.charAt(d),[]),y]);break}return{type:h,len:t+1,value:y};case"l_paren":var k=U(e,n,t+1,e.__get_max_priority(),!0);return k.type!==h?k:n[k.len]&&n[k.len].name==="r_paren"?(k.len++,k):{type:g,derived:!0,value:i.error.syntax(n[k.len]?n[k.len]:n[k.len-1],") or operator expected",!n[k.len])};case"l_bracket":var k=U(e,n,t+1,e.__get_max_priority(),!0);return k.type!==h?k:n[k.len]&&n[k.len].name==="r_bracket"?(k.len++,k.value=new o("{}",[k.value]),k):{type:g,derived:!0,value:i.error.syntax(n[k.len]?n[k.len]:n[k.len-1],"} or operator expected",!n[k.len])}}var m=Ue(e,n,t,a);return m.type===h||m.derived||(m=Ze(e,n,t),m.type===h||m.derived)?m:{type:g,derived:!1,value:i.error.syntax(n[t],"unexpected token")}}var S=e.__get_max_priority(),P=e.__get_next_priority(s),A=t;if(n[t].name==="atom"&&n[t+1]&&(n[t].space||n[t+1].name!=="l_paren")){var f=n[t++],R=e.__lookup_operator_classes(s,f.value);if(R&&R.indexOf("fy")>-1){var k=U(e,n,t,s,a);if(k.type!==g)return f.value==="-"&&!f.space&&i.type.is_number(k.value)?{value:new i.type.Num(-k.value.value,k.value.is_float),len:k.len,type:h}:{value:new i.type.Term(f.value,[k.value]),len:k.len,type:h};l=k}else if(R&&R.indexOf("fx")>-1){var k=U(e,n,t,P,a);if(k.type!==g)return{value:new i.type.Term(f.value,[k.value]),len:k.len,type:h};l=k}}t=A;var k=U(e,n,t,P,a);if(k.type===h){t=k.len;var f=n[t];if(n[t]&&(n[t].name==="atom"&&e.__lookup_operator_classes(s,f.value)||n[t].name==="bar"&&e.__lookup_operator_classes(s,"|"))){var L=P,B=s,R=e.__lookup_operator_classes(s,f.value);if(R.indexOf("xf")>-1)return{value:new i.type.Term(f.value,[k.value]),len:++k.len,type:h};if(R.indexOf("xfx")>-1){var q=U(e,n,t+1,L,a);return q.type===h?{value:new i.type.Term(f.value,[k.value,q.value]),len:q.len,type:h}:(q.derived=!0,q)}else if(R.indexOf("xfy")>-1){var q=U(e,n,t+1,B,a);return q.type===h?{value:new i.type.Term(f.value,[k.value,q.value]),len:q.len,type:h}:(q.derived=!0,q)}else if(k.type!==g)for(;;){t=k.len;var f=n[t];if(f&&f.name==="atom"&&e.__lookup_operator_classes(s,f.value)){var R=e.__lookup_operator_classes(s,f.value);if(R.indexOf("yf")>-1)k={value:new i.type.Term(f.value,[k.value]),len:++t,type:h};else if(R.indexOf("yfx")>-1){var q=U(e,n,++t,L,a);if(q.type===g)return q.derived=!0,q;t=q.len,k={value:new i.type.Term(f.value,[k.value,q.value]),len:t,type:h}}else break}else break}}else l={type:g,value:i.error.syntax(n[k.len-1],"operator expected")};return k}return k}function Ue(e,n,t,s){if(!n[t]||n[t].name==="atom"&&n[t].raw==="."&&!s&&(n[t].space||!n[t+1]||n[t+1].name!=="l_paren"))return{type:g,derived:!1,value:i.error.syntax(n[t-1],"unfounded token")};var a=n[t],l=[];if(n[t].name==="atom"&&n[t].raw!==","){if(t++,n[t-1].space)return{type:h,len:t,value:new i.type.Term(a.value,l)};if(n[t]&&n[t].name==="l_paren"){if(n[t+1]&&n[t+1].name==="r_paren")return{type:g,derived:!0,value:i.error.syntax(n[t+1],"argument expected")};var f=U(e,n,++t,"999",!0);if(f.type===g)return f.derived?f:{type:g,derived:!0,value:i.error.syntax(n[t]?n[t]:n[t-1],"argument expected",!n[t])};for(l.push(f.value),t=f.len;n[t]&&n[t].name==="atom"&&n[t].value===",";){if(f=U(e,n,t+1,"999",!0),f.type===g)return f.derived?f:{type:g,derived:!0,value:i.error.syntax(n[t+1]?n[t+1]:n[t],"argument expected",!n[t+1])};l.push(f.value),t=f.len}if(n[t]&&n[t].name==="r_paren")t++;else return{type:g,derived:!0,value:i.error.syntax(n[t]?n[t]:n[t-1],", or ) expected",!n[t])}}return{type:h,len:t,value:new i.type.Term(a.value,l)}}return{type:g,derived:!1,value:i.error.syntax(n[t],"term expected")}}function Ze(e,n,t){if(!n[t])return{type:g,derived:!1,value:i.error.syntax(n[t-1],"[ expected")};if(n[t]&&n[t].name==="l_brace"){var s=U(e,n,++t,"999",!0),a=[s.value],l=void 0;if(s.type===g)return n[t]&&n[t].name==="r_brace"?{type:h,len:t+1,value:new i.type.Term("[]",[])}:{type:g,derived:!0,value:i.error.syntax(n[t],"] expected")};for(t=s.len;n[t]&&n[t].name==="atom"&&n[t].value===",";){if(s=U(e,n,t+1,"999",!0),s.type===g)return s.derived?s:{type:g,derived:!0,value:i.error.syntax(n[t+1]?n[t+1]:n[t],"argument expected",!n[t+1])};a.push(s.value),t=s.len}var f=!1;if(n[t]&&n[t].name==="bar"){if(f=!0,s=U(e,n,t+1,"999",!0),s.type===g)return s.derived?s:{type:g,derived:!0,value:i.error.syntax(n[t+1]?n[t+1]:n[t],"argument expected",!n[t+1])};l=s.value,t=s.len}return n[t]&&n[t].name==="r_brace"?{type:h,len:t+1,value:he(a,l)}:{type:g,derived:!0,value:i.error.syntax(n[t]?n[t]:n[t-1],f?"] expected":", or | or ] expected",!n[t])}}return{type:g,derived:!1,value:i.error.syntax(n[t],"list expected")}}function Qe(e,n,t){var s=n[t].line,a=U(e,n,t,e.__get_max_priority(),!1),l=null,f;if(a.type!==g)if(t=a.len,n[t]&&n[t].name==="atom"&&n[t].raw===".")if(t++,i.type.is_term(a.value)){if(a.value.indicator===":-/2"?(l=new i.type.Rule(a.value.args[0],ve(a.value.args[1])),f={value:l,len:t,type:h}):a.value.indicator==="-->/2"?(l=Bi(new i.type.Rule(a.value.args[0],a.value.args[1]),e),l.body=ve(l.body),f={value:l,len:t,type:i.type.is_rule(l)?h:g}):(l=new i.type.Rule(a.value,null),f={value:l,len:t,type:h}),l){var y=l.singleton_variables();y.length>0&&e.throw_warning(i.warning.singleton(y,l.head.indicator,s))}return f}else return{type:g,value:i.error.syntax(n[t],"callable expected")};else return{type:g,value:i.error.syntax(n[t]?n[t]:n[t-1],". or operator expected")};return a}function Di(e,n,t){t=t||{},t.from=t.from?t.from:"$tau-js",t.reconsult=t.reconsult!==void 0?t.reconsult:!0;var s=new K(e),a={},l;s.new_text(n);var f=0,y=s.get_tokens(f);do{if(y===null||!y[f])break;var d=Qe(e,y,f);if(d.type===g)return new o("throw",[d.value]);if(d.value.body===null&&d.value.head.indicator==="?-/1"){var m=new X(e.session);m.add_goal(d.value.head.args[0]),m.answer(function(P){i.type.is_error(P)?e.throw_warning(P.args[0]):(P===!1||P===null)&&e.throw_warning(i.warning.failed_goal(d.value.head.args[0],d.len))}),f=d.len;var S=!0}else if(d.value.body===null&&d.value.head.indicator===":-/1"){var S=e.run_directive(d.value.head.args[0]);f=d.len,d.value.head.args[0].indicator==="char_conversion/2"&&(y=s.get_tokens(f),f=0)}else{l=d.value.head.indicator,t.reconsult!==!1&&a[l]!==!0&&!e.is_multifile_predicate(l)&&(e.session.rules[l]=w(e.session.rules[l]||[],function(A){return A.dynamic}),a[l]=!0);var S=e.add_rule(d.value,t);f=d.len}if(!S)return S}while(!0);return!0}function Xi(e,n){var t=new K(e);t.new_text(n);var s=0;do{var a=t.get_tokens(s);if(a===null)break;var l=U(e,a,0,e.__get_max_priority(),!1);if(l.type!==g){var f=l.len,y=f;if(a[f]&&a[f].name==="atom"&&a[f].raw===".")e.add_goal(ve(l.value));else{var d=a[f];return new o("throw",[i.error.syntax(d||a[f-1],". or operator expected",!d)])}s=l.len+1}else return new o("throw",[l.value])}while(!0);return!0}function Bi(e,n){e=e.rename(n);var t=n.next_free_variable(),s=pr(e.body,t,n);return s.error?s.value:(e.body=s.value,e.head.args=e.head.args.concat([t,s.variable]),e.head=new o(e.head.id,e.head.args),e)}function pr(e,n,t){var s;if(i.type.is_term(e)&&e.indicator==="!/0")return{value:e,variable:n,error:!1};if(i.type.is_term(e)&&e.indicator===",/2"){var a=pr(e.args[0],n,t);if(a.error)return a;var l=pr(e.args[1],a.variable,t);return l.error?l:{value:new o(",",[a.value,l.value]),variable:l.variable,error:!1}}else{if(i.type.is_term(e)&&e.indicator==="{}/1")return{value:e.args[0],variable:n,error:!1};if(i.type.is_empty_list(e))return{value:new o("true",[]),variable:n,error:!1};if(i.type.is_list(e)){s=t.next_free_variable();for(var f=e,y;f.indicator==="./2";)y=f,f=f.args[1];return i.type.is_variable(f)?{value:i.error.instantiation("DCG"),variable:n,error:!0}:i.type.is_empty_list(f)?(y.args[1]=s,{value:new o("=",[n,e]),variable:s,error:!1}):{value:i.error.type("list",e,"DCG"),variable:n,error:!0}}else return i.type.is_callable(e)?(s=t.next_free_variable(),e.args=e.args.concat([n,s]),e=new o(e.id,e.args),{value:e,variable:s,error:!1}):{value:i.error.type("callable",e,"DCG"),variable:n,error:!0}}}function ve(e){return i.type.is_variable(e)?new o("call",[e]):i.type.is_term(e)&&[",/2",";/2","->/2"].indexOf(e.indicator)!==-1?new o(e.id,[ve(e.args[0]),ve(e.args[1])]):e}function he(e,n){for(var t=n||new i.type.Term("[]",[]),s=e.length-1;s>=0;s--)t=new i.type.Term(".",[e[s],t]);return t}function Fi(e,n){for(var t=e.length-1;t>=0;t--)e[t]===n&&e.splice(t,1)}function yr(e){for(var n={},t=[],s=0;s=0;n--)if(e.charAt(n)==="/")return new o("/",[new o(e.substring(0,n)),new E(parseInt(e.substring(n+1)),!1)])}function O(e){this.id=e}function E(e,n){this.is_float=n!==void 0?n:parseInt(e)!==e,this.value=this.is_float?e:parseInt(e)}var $r=0;function o(e,n,t){this.ref=t||++$r,this.id=e,this.args=n||[],this.indicator=e+"/"+this.args.length}var Wi=0;function ne(e,n,t,s,a,l){this.id=Wi++,this.stream=e,this.mode=n,this.alias=t,this.type=s!==void 0?s:"text",this.reposition=a!==void 0?a:!0,this.eof_action=l!==void 0?l:"eof_code",this.position=this.mode==="append"?"end_of_stream":0,this.output=this.mode==="write"||this.mode==="append",this.input=this.mode==="read"}function Y(e){e=e||{},this.links=e}function V(e,n,t){n=n||new Y,t=t||null,this.goal=e,this.substitution=n,this.parent=t}function Q(e,n,t){this.head=e,this.body=n,this.dynamic=t||!1}function D(e){e=e===void 0||e<=0?1e3:e,this.rules={},this.src_predicates={},this.rename=0,this.modules=[],this.thread=new X(this),this.total_threads=1,this.renamed_variables={},this.public_predicates={},this.multifile_predicates={},this.limit=e,this.streams={user_input:new ne(typeof ie!="undefined"&&ie.exports?nodejs_user_input:tau_user_input,"read","user_input","text",!1,"reset"),user_output:new ne(typeof ie!="undefined"&&ie.exports?nodejs_user_output:tau_user_output,"write","user_output","text",!1,"eof_code")},this.file_system=typeof ie!="undefined"&&ie.exports?nodejs_file_system:tau_file_system,this.standard_input=this.streams.user_input,this.standard_output=this.streams.user_output,this.current_input=this.streams.user_input,this.current_output=this.streams.user_output,this.format_success=function(n){return n.substitution},this.format_error=function(n){return n.goal},this.flag={bounded:i.flag.bounded.value,max_integer:i.flag.max_integer.value,min_integer:i.flag.min_integer.value,integer_rounding_function:i.flag.integer_rounding_function.value,char_conversion:i.flag.char_conversion.value,debug:i.flag.debug.value,max_arity:i.flag.max_arity.value,unknown:i.flag.unknown.value,double_quotes:i.flag.double_quotes.value,occurs_check:i.flag.occurs_check.value,dialect:i.flag.dialect.value,version_data:i.flag.version_data.value,nodejs:i.flag.nodejs.value},this.__loaded_modules=[],this.__char_conversion={},this.__operators={1200:{":-":["fx","xfx"],"-->":["xfx"],"?-":["fx"]},1100:{";":["xfy"]},1050:{"->":["xfy"]},1e3:{",":["xfy"]},900:{"\\+":["fy"]},700:{"=":["xfx"],"\\=":["xfx"],"==":["xfx"],"\\==":["xfx"],"@<":["xfx"],"@=<":["xfx"],"@>":["xfx"],"@>=":["xfx"],"=..":["xfx"],is:["xfx"],"=:=":["xfx"],"=\\=":["xfx"],"<":["xfx"],"=<":["xfx"],">":["xfx"],">=":["xfx"]},600:{":":["xfy"]},500:{"+":["yfx"],"-":["yfx"],"/\\":["yfx"],"\\/":["yfx"]},400:{"*":["yfx"],"/":["yfx"],"//":["yfx"],rem:["yfx"],mod:["yfx"],"<<":["yfx"],">>":["yfx"]},200:{"**":["xfx"],"^":["xfy"],"-":["fy"],"+":["fy"],"\\":["fy"]}}}function X(e){this.epoch=Date.now(),this.session=e,this.session.total_threads++,this.total_steps=0,this.cpu_time=0,this.cpu_time_last=0,this.points=[],this.debugger=!1,this.debugger_states=[],this.level="top_level/0",this.__calls=[],this.current_limit=this.session.limit,this.warnings=[]}function Dr(e,n,t){this.id=e,this.rules=n,this.exports=t,i.module[e]=this}Dr.prototype.exports_predicate=function(e){return this.exports.indexOf(e)!==-1},O.prototype.unify=function(e,n){if(n&&u(e.variables(),this.id)!==-1&&!i.type.is_variable(e))return null;var t={};return t[this.id]=e,new Y(t)},E.prototype.unify=function(e,n){return i.type.is_number(e)&&this.value===e.value&&this.is_float===e.is_float?new Y:null},o.prototype.unify=function(e,n){if(i.type.is_term(e)&&this.indicator===e.indicator){for(var t=new Y,s=0;s=0){var s=this.args[0].value,a=Math.floor(s/26),l=s%26;return"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[l]+(a!==0?a:"")}switch(this.indicator){case"[]/0":case"{}/0":case"!/0":return this.id;case"{}/1":return"{"+this.args[0].toString(e)+"}";case"./2":for(var f="["+this.args[0].toString(e),y=this.args[1];y.indicator==="./2";)f+=", "+y.args[0].toString(e),y=y.args[1];return y.indicator!=="[]/0"&&(f+="|"+y.toString(e)),f+="]",f;case",/2":return"("+this.args[0].toString(e)+", "+this.args[1].toString(e)+")";default:var d=this.id,m=e.session?e.session.lookup_operator(this.id,this.args.length):null;if(e.session===void 0||e.ignore_ops||m===null)return e.quoted&&!/^(!|,|;|[a-z][0-9a-zA-Z_]*)$/.test(d)&&d!=="{}"&&d!=="[]"&&(d="'"+N(d)+"'"),d+(this.args.length?"("+c(this.args,function(R){return R.toString(e)}).join(", ")+")":"");var S=m.priority>n.priority||m.priority===n.priority&&(m.class==="xfy"&&this.indicator!==n.indicator||m.class==="yfx"&&this.indicator!==n.indicator||this.indicator===n.indicator&&m.class==="yfx"&&t==="right"||this.indicator===n.indicator&&m.class==="xfy"&&t==="left");m.indicator=this.indicator;var P=S?"(":"",A=S?")":"";return this.args.length===0?"("+this.id+")":["fy","fx"].indexOf(m.class)!==-1?P+d+" "+this.args[0].toString(e,m)+A:["yf","xf"].indexOf(m.class)!==-1?P+this.args[0].toString(e,m)+" "+d+A:P+this.args[0].toString(e,m,"left")+" "+this.id+" "+this.args[1].toString(e,m,"right")+A}},ne.prototype.toString=function(e){return"("+this.id+")"},Y.prototype.toString=function(e){var n="{";for(var t in this.links)!this.links.hasOwnProperty(t)||(n!=="{"&&(n+=", "),n+=t+"/"+this.links[t].toString(e));return n+="}",n},V.prototype.toString=function(e){return this.goal===null?"<"+this.substitution.toString(e)+">":"<"+this.goal.toString(e)+", "+this.substitution.toString(e)+">"},Q.prototype.toString=function(e){return this.body?this.head.toString(e)+" :- "+this.body.toString(e)+".":this.head.toString(e)+"."},D.prototype.toString=function(e){for(var n="",t=0;t=0;a--)s=new o(".",[n[a],s]);return s}return new o(this.id,c(this.args,function(l){return l.apply(e)}),this.ref)},ne.prototype.apply=function(e){return this},Q.prototype.apply=function(e){return new Q(this.head.apply(e),this.body!==null?this.body.apply(e):null)},Y.prototype.apply=function(e){var n,t={};for(n in this.links)!this.links.hasOwnProperty(n)||(t[n]=this.links[n].apply(e));return new Y(t)},o.prototype.select=function(){for(var e=this;e.indicator===",/2";)e=e.args[0];return e},o.prototype.replace=function(e){return this.indicator===",/2"?this.args[0].indicator===",/2"?new o(",",[this.args[0].replace(e),this.args[1]]):e===null?this.args[1]:new o(",",[e,this.args[1]]):e},o.prototype.search=function(e){if(i.type.is_term(e)&&e.ref!==void 0&&this.ref===e.ref)return!0;for(var n=0;nn&&s0&&(n=this.head_point().substitution.domain());u(n,i.format_variable(this.session.rename))!==-1;)this.session.rename++;if(e.id==="_")return new O(i.format_variable(this.session.rename));this.session.renamed_variables[e.id]=i.format_variable(this.session.rename)}return new O(this.session.renamed_variables[e.id])},D.prototype.next_free_variable=function(){return this.thread.next_free_variable()},X.prototype.next_free_variable=function(){this.session.rename++;var e=[];for(this.points.length>0&&(e=this.head_point().substitution.domain());u(e,i.format_variable(this.session.rename))!==-1;)this.session.rename++;return new O(i.format_variable(this.session.rename))},D.prototype.is_public_predicate=function(e){return!this.public_predicates.hasOwnProperty(e)||this.public_predicates[e]===!0},X.prototype.is_public_predicate=function(e){return this.session.is_public_predicate(e)},D.prototype.is_multifile_predicate=function(e){return this.multifile_predicates.hasOwnProperty(e)&&this.multifile_predicates[e]===!0},X.prototype.is_multifile_predicate=function(e){return this.session.is_multifile_predicate(e)},D.prototype.prepend=function(e){return this.thread.prepend(e)},X.prototype.prepend=function(e){for(var n=e.length-1;n>=0;n--)this.points.push(e[n])},D.prototype.success=function(e,n){return this.thread.success(e,n)},X.prototype.success=function(e,n){var n=typeof n=="undefined"?e:n;this.prepend([new V(e.goal.replace(null),e.substitution,n)])},D.prototype.throw_error=function(e){return this.thread.throw_error(e)},X.prototype.throw_error=function(e){this.prepend([new V(new o("throw",[e]),new Y,null,null)])},D.prototype.step_rule=function(e,n){return this.thread.step_rule(e,n)},X.prototype.step_rule=function(e,n){var t=n.indicator;if(e==="user"&&(e=null),e===null&&this.session.rules.hasOwnProperty(t))return this.session.rules[t];for(var s=e===null?this.session.modules:u(this.session.modules,e)===-1?[]:[e],a=0;a1)&&this.again()},D.prototype.answers=function(e,n,t){return this.thread.answers(e,n,t)},X.prototype.answers=function(e,n,t){var s=n||1e3,a=this;if(n<=0){t&&t();return}this.answer(function(l){e(l),l!==!1?setTimeout(function(){a.answers(e,n-1,t)},1):t&&t()})},D.prototype.again=function(e){return this.thread.again(e)},X.prototype.again=function(e){for(var n,t=Date.now();this.__calls.length>0;){for(this.warnings=[],e!==!1&&(this.current_limit=this.session.limit);this.current_limit>0&&this.points.length>0&&this.head_point().goal!==null&&!i.type.is_error(this.head_point().goal);)if(this.current_limit--,this.step()===!0)return;var s=Date.now();this.cpu_time_last=s-t,this.cpu_time+=this.cpu_time_last;var a=this.__calls.shift();this.current_limit<=0?a(null):this.points.length===0?a(!1):i.type.is_error(this.head_point().goal)?(n=this.session.format_error(this.points.pop()),this.points=[],a(n)):(this.debugger&&this.debugger_states.push(this.head_point()),n=this.session.format_success(this.points.pop()),a(n))}},D.prototype.unfold=function(e){if(e.body===null)return!1;var n=e.head,t=e.body,s=t.select(),a=new X(this),l=[];a.add_goal(s),a.step();for(var f=a.points.length-1;f>=0;f--){var y=a.points[f],d=n.apply(y.substitution),m=t.replace(y.goal);m!==null&&(m=m.apply(y.substitution)),l.push(new Q(d,m))}var S=this.rules[n.indicator],P=u(S,e);return l.length>0&&P!==-1?(S.splice.apply(S,[P,1].concat(l)),!0):!1},X.prototype.unfold=function(e){return this.session.unfold(e)},O.prototype.interpret=function(e){return i.error.instantiation(e.level)},E.prototype.interpret=function(e){return this},o.prototype.interpret=function(e){return i.type.is_unitary_list(this)?this.args[0].interpret(e):i.operate(e,this)},O.prototype.compare=function(e){return this.ide.id?1:0},E.prototype.compare=function(e){if(this.value===e.value&&this.is_float===e.is_float)return 0;if(this.valuee.value)return 1},o.prototype.compare=function(e){if(this.args.lengthe.args.length||this.args.length===e.args.length&&this.id>e.id)return 1;for(var n=0;ns)return 1;if(e.constructor===E){if(e.is_float&&n.is_float)return 0;if(e.is_float)return-1;if(n.is_float)return 1}return 0},is_substitution:function(e){return e instanceof Y},is_state:function(e){return e instanceof V},is_rule:function(e){return e instanceof Q},is_variable:function(e){return e instanceof O},is_stream:function(e){return e instanceof ne},is_anonymous_var:function(e){return e instanceof O&&e.id==="_"},is_callable:function(e){return e instanceof o},is_number:function(e){return e instanceof E},is_integer:function(e){return e instanceof E&&!e.is_float},is_float:function(e){return e instanceof E&&e.is_float},is_term:function(e){return e instanceof o},is_atom:function(e){return e instanceof o&&e.args.length===0},is_ground:function(e){if(e instanceof O)return!1;if(e instanceof o){for(var n=0;n0},is_list:function(e){return e instanceof o&&(e.indicator==="[]/0"||e.indicator==="./2")},is_empty_list:function(e){return e instanceof o&&e.indicator==="[]/0"},is_non_empty_list:function(e){return e instanceof o&&e.indicator==="./2"},is_fully_list:function(e){for(;e instanceof o&&e.indicator==="./2";)e=e.args[1];return e instanceof O||e instanceof o&&e.indicator==="[]/0"},is_instantiated_list:function(e){for(;e instanceof o&&e.indicator==="./2";)e=e.args[1];return e instanceof o&&e.indicator==="[]/0"},is_unitary_list:function(e){return e instanceof o&&e.indicator==="./2"&&e.args[1]instanceof o&&e.args[1].indicator==="[]/0"},is_character:function(e){return e instanceof o&&(e.id.length===1||e.id.length>0&&e.id.length<=2&&_(e.id,0)>=65536)},is_character_code:function(e){return e instanceof E&&!e.is_float&&e.value>=0&&e.value<=1114111},is_byte:function(e){return e instanceof E&&!e.is_float&&e.value>=0&&e.value<=255},is_operator:function(e){return e instanceof o&&i.arithmetic.evaluation[e.indicator]},is_directive:function(e){return e instanceof o&&i.directive[e.indicator]!==void 0},is_builtin:function(e){return e instanceof o&&i.predicate[e.indicator]!==void 0},is_error:function(e){return e instanceof o&&e.indicator==="throw/1"},is_predicate_indicator:function(e){return e instanceof o&&e.indicator==="//2"&&e.args[0]instanceof o&&e.args[0].args.length===0&&e.args[1]instanceof E&&e.args[1].is_float===!1},is_flag:function(e){return e instanceof o&&e.args.length===0&&i.flag[e.id]!==void 0},is_value_flag:function(e,n){if(!i.type.is_flag(e))return!1;for(var t in i.flag[e.id].allowed)if(!!i.flag[e.id].allowed.hasOwnProperty(t)&&i.flag[e.id].allowed[t].equals(n))return!0;return!1},is_io_mode:function(e){return i.type.is_atom(e)&&["read","write","append"].indexOf(e.id)!==-1},is_stream_option:function(e){return i.type.is_term(e)&&(e.indicator==="alias/1"&&i.type.is_atom(e.args[0])||e.indicator==="reposition/1"&&i.type.is_atom(e.args[0])&&(e.args[0].id==="true"||e.args[0].id==="false")||e.indicator==="type/1"&&i.type.is_atom(e.args[0])&&(e.args[0].id==="text"||e.args[0].id==="binary")||e.indicator==="eof_action/1"&&i.type.is_atom(e.args[0])&&(e.args[0].id==="error"||e.args[0].id==="eof_code"||e.args[0].id==="reset"))},is_stream_position:function(e){return i.type.is_integer(e)&&e.value>=0||i.type.is_atom(e)&&(e.id==="end_of_stream"||e.id==="past_end_of_stream")},is_stream_property:function(e){return i.type.is_term(e)&&(e.indicator==="input/0"||e.indicator==="output/0"||e.indicator==="alias/1"&&(i.type.is_variable(e.args[0])||i.type.is_atom(e.args[0]))||e.indicator==="file_name/1"&&(i.type.is_variable(e.args[0])||i.type.is_atom(e.args[0]))||e.indicator==="position/1"&&(i.type.is_variable(e.args[0])||i.type.is_stream_position(e.args[0]))||e.indicator==="reposition/1"&&(i.type.is_variable(e.args[0])||i.type.is_atom(e.args[0])&&(e.args[0].id==="true"||e.args[0].id==="false"))||e.indicator==="type/1"&&(i.type.is_variable(e.args[0])||i.type.is_atom(e.args[0])&&(e.args[0].id==="text"||e.args[0].id==="binary"))||e.indicator==="mode/1"&&(i.type.is_variable(e.args[0])||i.type.is_atom(e.args[0])&&(e.args[0].id==="read"||e.args[0].id==="write"||e.args[0].id==="append"))||e.indicator==="eof_action/1"&&(i.type.is_variable(e.args[0])||i.type.is_atom(e.args[0])&&(e.args[0].id==="error"||e.args[0].id==="eof_code"||e.args[0].id==="reset"))||e.indicator==="end_of_stream/1"&&(i.type.is_variable(e.args[0])||i.type.is_atom(e.args[0])&&(e.args[0].id==="at"||e.args[0].id==="past"||e.args[0].id==="not")))},is_streamable:function(e){return e.__proto__.stream!==void 0},is_read_option:function(e){return i.type.is_term(e)&&["variables/1","variable_names/1","singletons/1"].indexOf(e.indicator)!==-1},is_write_option:function(e){return i.type.is_term(e)&&(e.indicator==="quoted/1"&&i.type.is_atom(e.args[0])&&(e.args[0].id==="true"||e.args[0].id==="false")||e.indicator==="ignore_ops/1"&&i.type.is_atom(e.args[0])&&(e.args[0].id==="true"||e.args[0].id==="false")||e.indicator==="numbervars/1"&&i.type.is_atom(e.args[0])&&(e.args[0].id==="true"||e.args[0].id==="false"))},is_close_option:function(e){return i.type.is_term(e)&&e.indicator==="force/1"&&i.type.is_atom(e.args[0])&&(e.args[0].id==="true"||e.args[0].id==="false")},is_modifiable_flag:function(e){return i.type.is_flag(e)&&i.flag[e.id].changeable},is_module:function(e){return e instanceof o&&e.indicator==="library/1"&&e.args[0]instanceof o&&e.args[0].args.length===0&&i.module[e.args[0].id]!==void 0}},arithmetic:{evaluation:{"e/0":{type_args:null,type_result:!0,fn:function(e){return Math.E}},"pi/0":{type_args:null,type_result:!0,fn:function(e){return Math.PI}},"tau/0":{type_args:null,type_result:!0,fn:function(e){return 2*Math.PI}},"epsilon/0":{type_args:null,type_result:!0,fn:function(e){return Number.EPSILON}},"+/1":{type_args:null,type_result:null,fn:function(e,n){return e}},"-/1":{type_args:null,type_result:null,fn:function(e,n){return-e}},"\\/1":{type_args:!1,type_result:!1,fn:function(e,n){return~e}},"abs/1":{type_args:null,type_result:null,fn:function(e,n){return Math.abs(e)}},"sign/1":{type_args:null,type_result:null,fn:function(e,n){return Math.sign(e)}},"float_integer_part/1":{type_args:!0,type_result:!1,fn:function(e,n){return parseInt(e)}},"float_fractional_part/1":{type_args:!0,type_result:!0,fn:function(e,n){return e-parseInt(e)}},"float/1":{type_args:null,type_result:!0,fn:function(e,n){return parseFloat(e)}},"floor/1":{type_args:!0,type_result:!1,fn:function(e,n){return Math.floor(e)}},"truncate/1":{type_args:!0,type_result:!1,fn:function(e,n){return parseInt(e)}},"round/1":{type_args:!0,type_result:!1,fn:function(e,n){return Math.round(e)}},"ceiling/1":{type_args:!0,type_result:!1,fn:function(e,n){return Math.ceil(e)}},"sin/1":{type_args:null,type_result:!0,fn:function(e,n){return Math.sin(e)}},"cos/1":{type_args:null,type_result:!0,fn:function(e,n){return Math.cos(e)}},"tan/1":{type_args:null,type_result:!0,fn:function(e,n){return Math.tan(e)}},"asin/1":{type_args:null,type_result:!0,fn:function(e,n){return Math.asin(e)}},"acos/1":{type_args:null,type_result:!0,fn:function(e,n){return Math.acos(e)}},"atan/1":{type_args:null,type_result:!0,fn:function(e,n){return Math.atan(e)}},"atan2/2":{type_args:null,type_result:!0,fn:function(e,n,t){return Math.atan2(e,n)}},"exp/1":{type_args:null,type_result:!0,fn:function(e,n){return Math.exp(e)}},"sqrt/1":{type_args:null,type_result:!0,fn:function(e,n){return Math.sqrt(e)}},"log/1":{type_args:null,type_result:!0,fn:function(e,n){return e>0?Math.log(e):i.error.evaluation("undefined",n.__call_indicator)}},"+/2":{type_args:null,type_result:null,fn:function(e,n,t){return e+n}},"-/2":{type_args:null,type_result:null,fn:function(e,n,t){return e-n}},"*/2":{type_args:null,type_result:null,fn:function(e,n,t){return e*n}},"//2":{type_args:null,type_result:!0,fn:function(e,n,t){return n?e/n:i.error.evaluation("zero_division",t.__call_indicator)}},"///2":{type_args:!1,type_result:!1,fn:function(e,n,t){return n?parseInt(e/n):i.error.evaluation("zero_division",t.__call_indicator)}},"**/2":{type_args:null,type_result:!0,fn:function(e,n,t){return Math.pow(e,n)}},"^/2":{type_args:null,type_result:null,fn:function(e,n,t){return Math.pow(e,n)}},"<>/2":{type_args:!1,type_result:!1,fn:function(e,n,t){return e>>n}},"/\\/2":{type_args:!1,type_result:!1,fn:function(e,n,t){return e&n}},"\\//2":{type_args:!1,type_result:!1,fn:function(e,n,t){return e|n}},"xor/2":{type_args:!1,type_result:!1,fn:function(e,n,t){return e^n}},"rem/2":{type_args:!1,type_result:!1,fn:function(e,n,t){return n?e%n:i.error.evaluation("zero_division",t.__call_indicator)}},"mod/2":{type_args:!1,type_result:!1,fn:function(e,n,t){return n?e-parseInt(e/n)*n:i.error.evaluation("zero_division",t.__call_indicator)}},"max/2":{type_args:null,type_result:null,fn:function(e,n,t){return Math.max(e,n)}},"min/2":{type_args:null,type_result:null,fn:function(e,n,t){return Math.min(e,n)}}}},directive:{"dynamic/1":function(e,n){var t=n.args[0];if(i.type.is_variable(t))e.throw_error(i.error.instantiation(n.indicator));else if(!i.type.is_compound(t)||t.indicator!=="//2")e.throw_error(i.error.type("predicate_indicator",t,n.indicator));else if(i.type.is_variable(t.args[0])||i.type.is_variable(t.args[1]))e.throw_error(i.error.instantiation(n.indicator));else if(!i.type.is_atom(t.args[0]))e.throw_error(i.error.type("atom",t.args[0],n.indicator));else if(!i.type.is_integer(t.args[1]))e.throw_error(i.error.type("integer",t.args[1],n.indicator));else{var s=n.args[0].args[0].id+"/"+n.args[0].args[1].value;e.session.public_predicates[s]=!0,e.session.rules[s]||(e.session.rules[s]=[])}},"multifile/1":function(e,n){var t=n.args[0];i.type.is_variable(t)?e.throw_error(i.error.instantiation(n.indicator)):!i.type.is_compound(t)||t.indicator!=="//2"?e.throw_error(i.error.type("predicate_indicator",t,n.indicator)):i.type.is_variable(t.args[0])||i.type.is_variable(t.args[1])?e.throw_error(i.error.instantiation(n.indicator)):i.type.is_atom(t.args[0])?i.type.is_integer(t.args[1])?e.session.multifile_predicates[n.args[0].args[0].id+"/"+n.args[0].args[1].value]=!0:e.throw_error(i.error.type("integer",t.args[1],n.indicator)):e.throw_error(i.error.type("atom",t.args[0],n.indicator))},"set_prolog_flag/2":function(e,n){var t=n.args[0],s=n.args[1];i.type.is_variable(t)||i.type.is_variable(s)?e.throw_error(i.error.instantiation(n.indicator)):i.type.is_atom(t)?i.type.is_flag(t)?i.type.is_value_flag(t,s)?i.type.is_modifiable_flag(t)?e.session.flag[t.id]=s:e.throw_error(i.error.permission("modify","flag",t)):e.throw_error(i.error.domain("flag_value",new o("+",[t,s]),n.indicator)):e.throw_error(i.error.domain("prolog_flag",t,n.indicator)):e.throw_error(i.error.type("atom",t,n.indicator))},"use_module/1":function(e,n){var t=n.args[0];if(i.type.is_variable(t))e.throw_error(i.error.instantiation(n.indicator));else if(!i.type.is_term(t))e.throw_error(i.error.type("term",t,n.indicator));else if(i.type.is_module(t)){var s=t.args[0].id;u(e.session.modules,s)===-1&&e.session.modules.push(s)}},"char_conversion/2":function(e,n){var t=n.args[0],s=n.args[1];i.type.is_variable(t)||i.type.is_variable(s)?e.throw_error(i.error.instantiation(n.indicator)):i.type.is_character(t)?i.type.is_character(s)?t.id===s.id?delete e.session.__char_conversion[t.id]:e.session.__char_conversion[t.id]=s.id:e.throw_error(i.error.type("character",s,n.indicator)):e.throw_error(i.error.type("character",t,n.indicator))},"op/3":function(e,n){var t=n.args[0],s=n.args[1],a=n.args[2];if(i.type.is_variable(t)||i.type.is_variable(s)||i.type.is_variable(a))e.throw_error(i.error.instantiation(n.indicator));else if(!i.type.is_integer(t))e.throw_error(i.error.type("integer",t,n.indicator));else if(!i.type.is_atom(s))e.throw_error(i.error.type("atom",s,n.indicator));else if(!i.type.is_atom(a))e.throw_error(i.error.type("atom",a,n.indicator));else if(t.value<0||t.value>1200)e.throw_error(i.error.domain("operator_priority",t,n.indicator));else if(a.id===",")e.throw_error(i.error.permission("modify","operator",a,n.indicator));else if(a.id==="|"&&(t.value<1001||s.id.length!==3))e.throw_error(i.error.permission("modify","operator",a,n.indicator));else if(["fy","fx","yf","xf","xfx","yfx","xfy"].indexOf(s.id)===-1)e.throw_error(i.error.domain("operator_specifier",s,n.indicator));else{var l={prefix:null,infix:null,postfix:null};for(var f in e.session.__operators)if(!!e.session.__operators.hasOwnProperty(f)){var y=e.session.__operators[f][a.id];y&&(u(y,"fx")!==-1&&(l.prefix={priority:f,type:"fx"}),u(y,"fy")!==-1&&(l.prefix={priority:f,type:"fy"}),u(y,"xf")!==-1&&(l.postfix={priority:f,type:"xf"}),u(y,"yf")!==-1&&(l.postfix={priority:f,type:"yf"}),u(y,"xfx")!==-1&&(l.infix={priority:f,type:"xfx"}),u(y,"xfy")!==-1&&(l.infix={priority:f,type:"xfy"}),u(y,"yfx")!==-1&&(l.infix={priority:f,type:"yfx"}))}var d;switch(s.id){case"fy":case"fx":d="prefix";break;case"yf":case"xf":d="postfix";break;default:d="infix";break}if(((l.prefix&&d==="prefix"||l.postfix&&d==="postfix"||l.infix&&d==="infix")&&l[d].type!==s.id||l.infix&&d==="postfix"||l.postfix&&d==="infix")&&t.value!==0)e.throw_error(i.error.permission("create","operator",a,n.indicator));else return l[d]&&(Fi(e.session.__operators[l[d].priority][a.id],s.id),e.session.__operators[l[d].priority][a.id].length===0&&delete e.session.__operators[l[d].priority][a.id]),t.value>0&&(e.session.__operators[t.value]||(e.session.__operators[t.value.toString()]={}),e.session.__operators[t.value][a.id]||(e.session.__operators[t.value][a.id]=[]),e.session.__operators[t.value][a.id].push(s.id)),!0}}},predicate:{"op/3":function(e,n,t){i.directive["op/3"](e,t)&&e.success(n)},"current_op/3":function(e,n,t){var s=t.args[0],a=t.args[1],l=t.args[2],f=[];for(var y in e.session.__operators)for(var d in e.session.__operators[y])for(var m=0;m/2"){var s=e.points,a=e.session.format_success,l=e.session.format_error;e.session.format_success=function(m){return m.substitution},e.session.format_error=function(m){return m.goal},e.points=[new V(t.args[0].args[0],n.substitution,n)];var f=function(m){e.points=s,e.session.format_success=a,e.session.format_error=l,m===!1?e.prepend([new V(n.goal.replace(t.args[1]),n.substitution,n)]):i.type.is_error(m)?e.throw_error(m.args[0]):m===null?(e.prepend([n]),e.__calls.shift()(null)):e.prepend([new V(n.goal.replace(t.args[0].args[1]).apply(m),n.substitution.apply(m),n)])};e.__calls.unshift(f)}else{var y=new V(n.goal.replace(t.args[0]),n.substitution,n),d=new V(n.goal.replace(t.args[1]),n.substitution,n);e.prepend([y,d])}},"!/0":function(e,n,t){var s,a,l=[];for(s=n,a=null;s.parent!==null&&s.parent.goal.search(t);)if(a=s,s=s.parent,s.goal!==null){var f=s.goal.select();if(f&&f.id==="call"&&f.search(t)){s=a;break}}for(var y=e.points.length-1;y>=0;y--){for(var d=e.points[y],m=d.parent;m!==null&&m!==s.parent;)m=m.parent;m===null&&m!==s.parent&&l.push(d)}e.points=l.reverse(),e.success(n)},"\\+/1":function(e,n,t){var s=t.args[0];i.type.is_variable(s)?e.throw_error(i.error.instantiation(e.level)):i.type.is_callable(s)?e.prepend([new V(n.goal.replace(new o(",",[new o(",",[new o("call",[s]),new o("!",[])]),new o("fail",[])])),n.substitution,n),new V(n.goal.replace(null),n.substitution,n)]):e.throw_error(i.error.type("callable",s,e.level))},"->/2":function(e,n,t){var s=n.goal.replace(new o(",",[t.args[0],new o(",",[new o("!"),t.args[1]])]));e.prepend([new V(s,n.substitution,n)])},"fail/0":function(e,n,t){},"false/0":function(e,n,t){},"true/0":function(e,n,t){e.success(n)},"call/1":pe(1),"call/2":pe(2),"call/3":pe(3),"call/4":pe(4),"call/5":pe(5),"call/6":pe(6),"call/7":pe(7),"call/8":pe(8),"once/1":function(e,n,t){var s=t.args[0];e.prepend([new V(n.goal.replace(new o(",",[new o("call",[s]),new o("!",[])])),n.substitution,n)])},"forall/2":function(e,n,t){var s=t.args[0],a=t.args[1];e.prepend([new V(n.goal.replace(new o("\\+",[new o(",",[new o("call",[s]),new o("\\+",[new o("call",[a])])])])),n.substitution,n)])},"repeat/0":function(e,n,t){e.prepend([new V(n.goal.replace(null),n.substitution,n),n])},"throw/1":function(e,n,t){i.type.is_variable(t.args[0])?e.throw_error(i.error.instantiation(e.level)):e.throw_error(t.args[0])},"catch/3":function(e,n,t){var s=e.points;e.points=[],e.prepend([new V(t.args[0],n.substitution,n)]);var a=e.session.format_success,l=e.session.format_error;e.session.format_success=function(y){return y.substitution},e.session.format_error=function(y){return y.goal};var f=function(y){var d=e.points;if(e.points=s,e.session.format_success=a,e.session.format_error=l,i.type.is_error(y)){for(var m=[],S=e.points.length-1;S>=0;S--){for(var R=e.points[S],P=R.parent;P!==null&&P!==n.parent;)P=P.parent;P===null&&P!==n.parent&&m.push(R)}e.points=m;var A=e.get_flag("occurs_check").indicator==="true/0",R=new V,k=i.unify(y.args[0],t.args[1],A);k!==null?(R.substitution=n.substitution.apply(k),R.goal=n.goal.replace(t.args[2]).apply(k),R.parent=n,e.prepend([R])):e.throw_error(y.args[0])}else if(y!==!1){for(var L=y===null?[]:[new V(n.goal.apply(y).replace(null),n.substitution.apply(y),n)],B=[],S=d.length-1;S>=0;S--){B.push(d[S]);var q=d[S].goal!==null?d[S].goal.select():null;if(i.type.is_term(q)&&q.indicator==="!/0")break}var F=c(B,function(H){return H.goal===null&&(H.goal=new o("true",[])),H=new V(n.goal.replace(new o("catch",[H.goal,t.args[1],t.args[2]])),n.substitution.apply(H.substitution),H.parent),H.exclude=t.args[0].variables(),H}).reverse();e.prepend(F),e.prepend(L),y===null&&(this.current_limit=0,e.__calls.shift()(null))}};e.__calls.unshift(f)},"=/2":function(e,n,t){var s=e.get_flag("occurs_check").indicator==="true/0",a=new V,l=i.unify(t.args[0],t.args[1],s);l!==null&&(a.goal=n.goal.apply(l).replace(null),a.substitution=n.substitution.apply(l),a.parent=n,e.prepend([a]))},"unify_with_occurs_check/2":function(e,n,t){var s=new V,a=i.unify(t.args[0],t.args[1],!0);a!==null&&(s.goal=n.goal.apply(a).replace(null),s.substitution=n.substitution.apply(a),s.parent=n,e.prepend([s]))},"\\=/2":function(e,n,t){var s=e.get_flag("occurs_check").indicator==="true/0",a=i.unify(t.args[0],t.args[1],s);a===null&&e.success(n)},"subsumes_term/2":function(e,n,t){var s=e.get_flag("occurs_check").indicator==="true/0",a=i.unify(t.args[1],t.args[0],s);a!==null&&t.args[1].apply(a).equals(t.args[1])&&e.success(n)},"findall/3":function(e,n,t){var s=t.args[0],a=t.args[1],l=t.args[2];if(i.type.is_variable(a))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_callable(a))e.throw_error(i.error.type("callable",a,t.indicator));else if(!i.type.is_variable(l)&&!i.type.is_list(l))e.throw_error(i.error.type("list",l,t.indicator));else{var f=e.next_free_variable(),y=new o(",",[a,new o("=",[f,s])]),d=e.points,m=e.session.limit,S=e.session.format_success;e.session.format_success=function(R){return R.substitution},e.add_goal(y,!0,n);var P=[],A=function(R){if(R!==!1&&R!==null&&!i.type.is_error(R))e.__calls.unshift(A),P.push(R.links[f.id]),e.session.limit=e.current_limit;else if(e.points=d,e.session.limit=m,e.session.format_success=S,i.type.is_error(R))e.throw_error(R.args[0]);else if(e.current_limit>0){for(var k=new o("[]"),L=P.length-1;L>=0;L--)k=new o(".",[P[L],k]);e.prepend([new V(n.goal.replace(new o("=",[l,k])),n.substitution,n)])}};e.__calls.unshift(A)}},"bagof/3":function(e,n,t){var s,a=t.args[0],l=t.args[1],f=t.args[2];if(i.type.is_variable(l))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_callable(l))e.throw_error(i.error.type("callable",l,t.indicator));else if(!i.type.is_variable(f)&&!i.type.is_list(f))e.throw_error(i.error.type("list",f,t.indicator));else{var y=e.next_free_variable(),d;l.indicator==="^/2"?(d=l.args[0].variables(),l=l.args[1]):d=[],d=d.concat(a.variables());for(var m=l.variables().filter(function(F){return u(d,F)===-1}),S=new o("[]"),P=m.length-1;P>=0;P--)S=new o(".",[new O(m[P]),S]);var A=new o(",",[l,new o("=",[y,new o(",",[S,a])])]),R=e.points,k=e.session.limit,L=e.session.format_success;e.session.format_success=function(F){return F.substitution},e.add_goal(A,!0,n);var B=[],q=function(F){if(F!==!1&&F!==null&&!i.type.is_error(F)){e.__calls.unshift(q);var H=!1,J=F.links[y.id].args[0],me=F.links[y.id].args[1];for(var be in B)if(!!B.hasOwnProperty(be)){var Re=B[be];if(Re.variables.equals(J)){Re.answers.push(me),H=!0;break}}H||B.push({variables:J,answers:[me]}),e.session.limit=e.current_limit}else if(e.points=R,e.session.limit=k,e.session.format_success=L,i.type.is_error(F))e.throw_error(F.args[0]);else if(e.current_limit>0){for(var Me=[],le=0;le=0;xe--)Te=new o(".",[F[xe],Te]);Me.push(new V(n.goal.replace(new o(",",[new o("=",[S,B[le].variables]),new o("=",[f,Te])])),n.substitution,n))}e.prepend(Me)}};e.__calls.unshift(q)}},"setof/3":function(e,n,t){var s,a=t.args[0],l=t.args[1],f=t.args[2];if(i.type.is_variable(l))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_callable(l))e.throw_error(i.error.type("callable",l,t.indicator));else if(!i.type.is_variable(f)&&!i.type.is_list(f))e.throw_error(i.error.type("list",f,t.indicator));else{var y=e.next_free_variable(),d;l.indicator==="^/2"?(d=l.args[0].variables(),l=l.args[1]):d=[],d=d.concat(a.variables());for(var m=l.variables().filter(function(F){return u(d,F)===-1}),S=new o("[]"),P=m.length-1;P>=0;P--)S=new o(".",[new O(m[P]),S]);var A=new o(",",[l,new o("=",[y,new o(",",[S,a])])]),R=e.points,k=e.session.limit,L=e.session.format_success;e.session.format_success=function(F){return F.substitution},e.add_goal(A,!0,n);var B=[],q=function(F){if(F!==!1&&F!==null&&!i.type.is_error(F)){e.__calls.unshift(q);var H=!1,J=F.links[y.id].args[0],me=F.links[y.id].args[1];for(var be in B)if(!!B.hasOwnProperty(be)){var Re=B[be];if(Re.variables.equals(J)){Re.answers.push(me),H=!0;break}}H||B.push({variables:J,answers:[me]}),e.session.limit=e.current_limit}else if(e.points=R,e.session.limit=k,e.session.format_success=L,i.type.is_error(F))e.throw_error(F.args[0]);else if(e.current_limit>0){for(var Me=[],le=0;le=0;xe--)Te=new o(".",[F[xe],Te]);Me.push(new V(n.goal.replace(new o(",",[new o("=",[S,B[le].variables]),new o("=",[f,Te])])),n.substitution,n))}e.prepend(Me)}};e.__calls.unshift(q)}},"functor/3":function(e,n,t){var s,a=t.args[0],l=t.args[1],f=t.args[2];if(i.type.is_variable(a)&&(i.type.is_variable(l)||i.type.is_variable(f)))e.throw_error(i.error.instantiation("functor/3"));else if(!i.type.is_variable(f)&&!i.type.is_integer(f))e.throw_error(i.error.type("integer",t.args[2],"functor/3"));else if(!i.type.is_variable(l)&&!i.type.is_atomic(l))e.throw_error(i.error.type("atomic",t.args[1],"functor/3"));else if(i.type.is_integer(l)&&i.type.is_integer(f)&&f.value!==0)e.throw_error(i.error.type("atom",t.args[1],"functor/3"));else if(i.type.is_variable(a)){if(t.args[2].value>=0){for(var y=[],d=0;d0&&s<=t.args[1].args.length){var a=new o("=",[t.args[1].args[s-1],t.args[2]]);e.prepend([new V(n.goal.replace(a),n.substitution,n)])}}},"=../2":function(e,n,t){var s;if(i.type.is_variable(t.args[0])&&(i.type.is_variable(t.args[1])||i.type.is_non_empty_list(t.args[1])&&i.type.is_variable(t.args[1].args[0])))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_fully_list(t.args[1]))e.throw_error(i.error.type("list",t.args[1],t.indicator));else if(i.type.is_variable(t.args[0])){if(!i.type.is_variable(t.args[1])){var l=[];for(s=t.args[1].args[1];s.indicator==="./2";)l.push(s.args[0]),s=s.args[1];i.type.is_variable(t.args[0])&&i.type.is_variable(s)?e.throw_error(i.error.instantiation(t.indicator)):l.length===0&&i.type.is_compound(t.args[1].args[0])?e.throw_error(i.error.type("atomic",t.args[1].args[0],t.indicator)):l.length>0&&(i.type.is_compound(t.args[1].args[0])||i.type.is_number(t.args[1].args[0]))?e.throw_error(i.error.type("atom",t.args[1].args[0],t.indicator)):l.length===0?e.prepend([new V(n.goal.replace(new o("=",[t.args[1].args[0],t.args[0]],n)),n.substitution,n)]):e.prepend([new V(n.goal.replace(new o("=",[new o(t.args[1].args[0].id,l),t.args[0]])),n.substitution,n)])}}else{if(i.type.is_atomic(t.args[0]))s=new o(".",[t.args[0],new o("[]")]);else{s=new o("[]");for(var a=t.args[0].args.length-1;a>=0;a--)s=new o(".",[t.args[0].args[a],s]);s=new o(".",[new o(t.args[0].id),s])}e.prepend([new V(n.goal.replace(new o("=",[s,t.args[1]])),n.substitution,n)])}},"copy_term/2":function(e,n,t){var s=t.args[0].rename(e);e.prepend([new V(n.goal.replace(new o("=",[s,t.args[1]])),n.substitution,n.parent)])},"term_variables/2":function(e,n,t){var s=t.args[0],a=t.args[1];if(!i.type.is_fully_list(a))e.throw_error(i.error.type("list",a,t.indicator));else{var l=he(c(yr(s.variables()),function(f){return new O(f)}));e.prepend([new V(n.goal.replace(new o("=",[a,l])),n.substitution,n)])}},"clause/2":function(e,n,t){if(i.type.is_variable(t.args[0]))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_callable(t.args[0]))e.throw_error(i.error.type("callable",t.args[0],t.indicator));else if(!i.type.is_variable(t.args[1])&&!i.type.is_callable(t.args[1]))e.throw_error(i.error.type("callable",t.args[1],t.indicator));else if(e.session.rules[t.args[0].indicator]!==void 0)if(e.is_public_predicate(t.args[0].indicator)){var s=[];for(var a in e.session.rules[t.args[0].indicator])if(!!e.session.rules[t.args[0].indicator].hasOwnProperty(a)){var l=e.session.rules[t.args[0].indicator][a];e.session.renamed_variables={},l=l.rename(e),l.body===null&&(l.body=new o("true"));var f=new o(",",[new o("=",[l.head,t.args[0]]),new o("=",[l.body,t.args[1]])]);s.push(new V(n.goal.replace(f),n.substitution,n))}e.prepend(s)}else e.throw_error(i.error.permission("access","private_procedure",t.args[0].indicator,t.indicator))},"current_predicate/1":function(e,n,t){var s=t.args[0];if(!i.type.is_variable(s)&&(!i.type.is_compound(s)||s.indicator!=="//2"))e.throw_error(i.error.type("predicate_indicator",s,t.indicator));else if(!i.type.is_variable(s)&&!i.type.is_variable(s.args[0])&&!i.type.is_atom(s.args[0]))e.throw_error(i.error.type("atom",s.args[0],t.indicator));else if(!i.type.is_variable(s)&&!i.type.is_variable(s.args[1])&&!i.type.is_integer(s.args[1]))e.throw_error(i.error.type("integer",s.args[1],t.indicator));else{var a=[];for(var l in e.session.rules)if(!!e.session.rules.hasOwnProperty(l)){var f=l.lastIndexOf("/"),y=l.substr(0,f),d=parseInt(l.substr(f+1,l.length-(f+1))),m=new o("/",[new o(y),new E(d,!1)]),S=new o("=",[m,s]);a.push(new V(n.goal.replace(S),n.substitution,n))}e.prepend(a)}},"asserta/1":function(e,n,t){if(i.type.is_variable(t.args[0]))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_callable(t.args[0]))e.throw_error(i.error.type("callable",t.args[0],t.indicator));else{var s,a;t.args[0].indicator===":-/2"?(s=t.args[0].args[0],a=ve(t.args[0].args[1])):(s=t.args[0],a=null),i.type.is_callable(s)?a!==null&&!i.type.is_callable(a)?e.throw_error(i.error.type("callable",a,t.indicator)):e.is_public_predicate(s.indicator)?(e.session.rules[s.indicator]===void 0&&(e.session.rules[s.indicator]=[]),e.session.public_predicates[s.indicator]=!0,e.session.rules[s.indicator]=[new Q(s,a,!0)].concat(e.session.rules[s.indicator]),e.success(n)):e.throw_error(i.error.permission("modify","static_procedure",s.indicator,t.indicator)):e.throw_error(i.error.type("callable",s,t.indicator))}},"assertz/1":function(e,n,t){if(i.type.is_variable(t.args[0]))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_callable(t.args[0]))e.throw_error(i.error.type("callable",t.args[0],t.indicator));else{var s,a;t.args[0].indicator===":-/2"?(s=t.args[0].args[0],a=ve(t.args[0].args[1])):(s=t.args[0],a=null),i.type.is_callable(s)?a!==null&&!i.type.is_callable(a)?e.throw_error(i.error.type("callable",a,t.indicator)):e.is_public_predicate(s.indicator)?(e.session.rules[s.indicator]===void 0&&(e.session.rules[s.indicator]=[]),e.session.public_predicates[s.indicator]=!0,e.session.rules[s.indicator].push(new Q(s,a,!0)),e.success(n)):e.throw_error(i.error.permission("modify","static_procedure",s.indicator,t.indicator)):e.throw_error(i.error.type("callable",s,t.indicator))}},"retract/1":function(e,n,t){if(i.type.is_variable(t.args[0]))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_callable(t.args[0]))e.throw_error(i.error.type("callable",t.args[0],t.indicator));else{var s,a;if(t.args[0].indicator===":-/2"?(s=t.args[0].args[0],a=t.args[0].args[1]):(s=t.args[0],a=new o("true")),typeof n.retract=="undefined")if(e.is_public_predicate(s.indicator)){if(e.session.rules[s.indicator]!==void 0){for(var l=[],f=0;fe.get_flag("max_arity").value)e.throw_error(i.error.representation("max_arity",t.indicator));else{var s=t.args[0].args[0].id+"/"+t.args[0].args[1].value;e.is_public_predicate(s)?(delete e.session.rules[s],e.success(n)):e.throw_error(i.error.permission("modify","static_procedure",s,t.indicator))}},"atom_length/2":function(e,n,t){if(i.type.is_variable(t.args[0]))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_atom(t.args[0]))e.throw_error(i.error.type("atom",t.args[0],t.indicator));else if(!i.type.is_variable(t.args[1])&&!i.type.is_integer(t.args[1]))e.throw_error(i.error.type("integer",t.args[1],t.indicator));else if(i.type.is_integer(t.args[1])&&t.args[1].value<0)e.throw_error(i.error.domain("not_less_than_zero",t.args[1],t.indicator));else{var s=new E(t.args[0].id.length,!1);e.prepend([new V(n.goal.replace(new o("=",[s,t.args[1]])),n.substitution,n)])}},"atom_concat/3":function(e,n,t){var s,a,l=t.args[0],f=t.args[1],y=t.args[2];if(i.type.is_variable(y)&&(i.type.is_variable(l)||i.type.is_variable(f)))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_variable(l)&&!i.type.is_atom(l))e.throw_error(i.error.type("atom",l,t.indicator));else if(!i.type.is_variable(f)&&!i.type.is_atom(f))e.throw_error(i.error.type("atom",f,t.indicator));else if(!i.type.is_variable(y)&&!i.type.is_atom(y))e.throw_error(i.error.type("atom",y,t.indicator));else{var d=i.type.is_variable(l),m=i.type.is_variable(f);if(!d&&!m)a=new o("=",[y,new o(l.id+f.id)]),e.prepend([new V(n.goal.replace(a),n.substitution,n)]);else if(d&&!m)s=y.id.substr(0,y.id.length-f.id.length),s+f.id===y.id&&(a=new o("=",[l,new o(s)]),e.prepend([new V(n.goal.replace(a),n.substitution,n)]));else if(m&&!d)s=y.id.substr(l.id.length),l.id+s===y.id&&(a=new o("=",[f,new o(s)]),e.prepend([new V(n.goal.replace(a),n.substitution,n)]));else{for(var S=[],P=0;P<=y.id.length;P++){var A=new o(y.id.substr(0,P)),R=new o(y.id.substr(P));a=new o(",",[new o("=",[A,l]),new o("=",[R,f])]),S.push(new V(n.goal.replace(a),n.substitution,n))}e.prepend(S)}}},"sub_atom/5":function(e,n,t){var s,a=t.args[0],l=t.args[1],f=t.args[2],y=t.args[3],d=t.args[4];if(i.type.is_variable(a))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_variable(l)&&!i.type.is_integer(l))e.throw_error(i.error.type("integer",l,t.indicator));else if(!i.type.is_variable(f)&&!i.type.is_integer(f))e.throw_error(i.error.type("integer",f,t.indicator));else if(!i.type.is_variable(y)&&!i.type.is_integer(y))e.throw_error(i.error.type("integer",y,t.indicator));else if(i.type.is_integer(l)&&l.value<0)e.throw_error(i.error.domain("not_less_than_zero",l,t.indicator));else if(i.type.is_integer(f)&&f.value<0)e.throw_error(i.error.domain("not_less_than_zero",f,t.indicator));else if(i.type.is_integer(y)&&y.value<0)e.throw_error(i.error.domain("not_less_than_zero",y,t.indicator));else{var m=[],S=[],P=[];if(i.type.is_variable(l))for(s=0;s<=a.id.length;s++)m.push(s);else m.push(l.value);if(i.type.is_variable(f))for(s=0;s<=a.id.length;s++)S.push(s);else S.push(f.value);if(i.type.is_variable(y))for(s=0;s<=a.id.length;s++)P.push(s);else P.push(y.value);var A=[];for(var R in m)if(!!m.hasOwnProperty(R)){s=m[R];for(var k in S)if(!!S.hasOwnProperty(k)){var L=S[k],B=a.id.length-s-L;if(u(P,B)!==-1&&s+L+B===a.id.length){var q=a.id.substr(s,L);if(a.id===a.id.substr(0,s)+q+a.id.substr(s+L,B)){var F=new o("=",[new o(q),d]),H=new o("=",[l,new E(s)]),J=new o("=",[f,new E(L)]),me=new o("=",[y,new E(B)]),be=new o(",",[new o(",",[new o(",",[H,J]),me]),F]);A.push(new V(n.goal.replace(be),n.substitution,n))}}}}e.prepend(A)}},"atom_chars/2":function(e,n,t){var s=t.args[0],a=t.args[1];if(i.type.is_variable(s)&&i.type.is_variable(a))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_variable(s)&&!i.type.is_atom(s))e.throw_error(i.error.type("atom",s,t.indicator));else if(i.type.is_variable(s)){for(var y=a,d=i.type.is_variable(s),m="";y.indicator==="./2";){if(i.type.is_character(y.args[0]))m+=y.args[0].id;else if(i.type.is_variable(y.args[0])&&d){e.throw_error(i.error.instantiation(t.indicator));return}else if(!i.type.is_variable(y.args[0])){e.throw_error(i.error.type("character",y.args[0],t.indicator));return}y=y.args[1]}i.type.is_variable(y)&&d?e.throw_error(i.error.instantiation(t.indicator)):!i.type.is_empty_list(y)&&!i.type.is_variable(y)?e.throw_error(i.error.type("list",a,t.indicator)):e.prepend([new V(n.goal.replace(new o("=",[new o(m),s])),n.substitution,n)])}else{for(var l=new o("[]"),f=s.id.length-1;f>=0;f--)l=new o(".",[new o(s.id.charAt(f)),l]);e.prepend([new V(n.goal.replace(new o("=",[a,l])),n.substitution,n)])}},"atom_codes/2":function(e,n,t){var s=t.args[0],a=t.args[1];if(i.type.is_variable(s)&&i.type.is_variable(a))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_variable(s)&&!i.type.is_atom(s))e.throw_error(i.error.type("atom",s,t.indicator));else if(i.type.is_variable(s)){for(var y=a,d=i.type.is_variable(s),m="";y.indicator==="./2";){if(i.type.is_character_code(y.args[0]))m+=v(y.args[0].value);else if(i.type.is_variable(y.args[0])&&d){e.throw_error(i.error.instantiation(t.indicator));return}else if(!i.type.is_variable(y.args[0])){e.throw_error(i.error.representation("character_code",t.indicator));return}y=y.args[1]}i.type.is_variable(y)&&d?e.throw_error(i.error.instantiation(t.indicator)):!i.type.is_empty_list(y)&&!i.type.is_variable(y)?e.throw_error(i.error.type("list",a,t.indicator)):e.prepend([new V(n.goal.replace(new o("=",[new o(m),s])),n.substitution,n)])}else{for(var l=new o("[]"),f=s.id.length-1;f>=0;f--)l=new o(".",[new E(_(s.id,f),!1),l]);e.prepend([new V(n.goal.replace(new o("=",[a,l])),n.substitution,n)])}},"char_code/2":function(e,n,t){var s=t.args[0],a=t.args[1];if(i.type.is_variable(s)&&i.type.is_variable(a))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_variable(s)&&!i.type.is_character(s))e.throw_error(i.error.type("character",s,t.indicator));else if(!i.type.is_variable(a)&&!i.type.is_integer(a))e.throw_error(i.error.type("integer",a,t.indicator));else if(!i.type.is_variable(a)&&!i.type.is_character_code(a))e.throw_error(i.error.representation("character_code",t.indicator));else if(i.type.is_variable(a)){var l=new E(_(s.id,0),!1);e.prepend([new V(n.goal.replace(new o("=",[l,a])),n.substitution,n)])}else{var f=new o(v(a.value));e.prepend([new V(n.goal.replace(new o("=",[f,s])),n.substitution,n)])}},"number_chars/2":function(e,n,t){var s,a=t.args[0],l=t.args[1];if(i.type.is_variable(a)&&i.type.is_variable(l))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_variable(a)&&!i.type.is_number(a))e.throw_error(i.error.type("number",a,t.indicator));else if(!i.type.is_variable(l)&&!i.type.is_list(l))e.throw_error(i.error.type("list",l,t.indicator));else{var f=i.type.is_variable(a);if(!i.type.is_variable(l)){var y=l,d=!0;for(s="";y.indicator==="./2";){if(i.type.is_character(y.args[0]))s+=y.args[0].id;else if(i.type.is_variable(y.args[0]))d=!1;else if(!i.type.is_variable(y.args[0])){e.throw_error(i.error.type("character",y.args[0],t.indicator));return}y=y.args[1]}if(d=d&&i.type.is_empty_list(y),!i.type.is_empty_list(y)&&!i.type.is_variable(y)){e.throw_error(i.error.type("list",l,t.indicator));return}if(!d&&f){e.throw_error(i.error.instantiation(t.indicator));return}else if(d)if(i.type.is_variable(y)&&f){e.throw_error(i.error.instantiation(t.indicator));return}else{var m=e.parse(s),S=m.value;!i.type.is_number(S)||m.tokens[m.tokens.length-1].space?e.throw_error(i.error.syntax_by_predicate("parseable_number",t.indicator)):e.prepend([new V(n.goal.replace(new o("=",[a,S])),n.substitution,n)]);return}}if(!f){s=a.toString();for(var P=new o("[]"),A=s.length-1;A>=0;A--)P=new o(".",[new o(s.charAt(A)),P]);e.prepend([new V(n.goal.replace(new o("=",[l,P])),n.substitution,n)])}}},"number_codes/2":function(e,n,t){var s,a=t.args[0],l=t.args[1];if(i.type.is_variable(a)&&i.type.is_variable(l))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_variable(a)&&!i.type.is_number(a))e.throw_error(i.error.type("number",a,t.indicator));else if(!i.type.is_variable(l)&&!i.type.is_list(l))e.throw_error(i.error.type("list",l,t.indicator));else{var f=i.type.is_variable(a);if(!i.type.is_variable(l)){var y=l,d=!0;for(s="";y.indicator==="./2";){if(i.type.is_character_code(y.args[0]))s+=v(y.args[0].value);else if(i.type.is_variable(y.args[0]))d=!1;else if(!i.type.is_variable(y.args[0])){e.throw_error(i.error.type("character_code",y.args[0],t.indicator));return}y=y.args[1]}if(d=d&&i.type.is_empty_list(y),!i.type.is_empty_list(y)&&!i.type.is_variable(y)){e.throw_error(i.error.type("list",l,t.indicator));return}if(!d&&f){e.throw_error(i.error.instantiation(t.indicator));return}else if(d)if(i.type.is_variable(y)&&f){e.throw_error(i.error.instantiation(t.indicator));return}else{var m=e.parse(s),S=m.value;!i.type.is_number(S)||m.tokens[m.tokens.length-1].space?e.throw_error(i.error.syntax_by_predicate("parseable_number",t.indicator)):e.prepend([new V(n.goal.replace(new o("=",[a,S])),n.substitution,n)]);return}}if(!f){s=a.toString();for(var P=new o("[]"),A=s.length-1;A>=0;A--)P=new o(".",[new E(_(s,A),!1),P]);e.prepend([new V(n.goal.replace(new o("=",[l,P])),n.substitution,n)])}}},"upcase_atom/2":function(e,n,t){var s=t.args[0],a=t.args[1];i.type.is_variable(s)?e.throw_error(i.error.instantiation(t.indicator)):i.type.is_atom(s)?!i.type.is_variable(a)&&!i.type.is_atom(a)?e.throw_error(i.error.type("atom",a,t.indicator)):e.prepend([new V(n.goal.replace(new o("=",[a,new o(s.id.toUpperCase(),[])])),n.substitution,n)]):e.throw_error(i.error.type("atom",s,t.indicator))},"downcase_atom/2":function(e,n,t){var s=t.args[0],a=t.args[1];i.type.is_variable(s)?e.throw_error(i.error.instantiation(t.indicator)):i.type.is_atom(s)?!i.type.is_variable(a)&&!i.type.is_atom(a)?e.throw_error(i.error.type("atom",a,t.indicator)):e.prepend([new V(n.goal.replace(new o("=",[a,new o(s.id.toLowerCase(),[])])),n.substitution,n)]):e.throw_error(i.error.type("atom",s,t.indicator))},"atomic_list_concat/2":function(e,n,t){var s=t.args[0],a=t.args[1];e.prepend([new V(n.goal.replace(new o("atomic_list_concat",[s,new o("",[]),a])),n.substitution,n)])},"atomic_list_concat/3":function(e,n,t){var s=t.args[0],a=t.args[1],l=t.args[2];if(i.type.is_variable(a)||i.type.is_variable(s)&&i.type.is_variable(l))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_variable(s)&&!i.type.is_list(s))e.throw_error(i.error.type("list",s,t.indicator));else if(!i.type.is_variable(l)&&!i.type.is_atom(l))e.throw_error(i.error.type("atom",l,t.indicator));else if(i.type.is_variable(l)){for(var y="",d=s;i.type.is_term(d)&&d.indicator==="./2";){if(!i.type.is_atom(d.args[0])&&!i.type.is_number(d.args[0])){e.throw_error(i.error.type("atomic",d.args[0],t.indicator));return}y!==""&&(y+=a.id),i.type.is_atom(d.args[0])?y+=d.args[0].id:y+=""+d.args[0].value,d=d.args[1]}y=new o(y,[]),i.type.is_variable(d)?e.throw_error(i.error.instantiation(t.indicator)):!i.type.is_term(d)||d.indicator!=="[]/0"?e.throw_error(i.error.type("list",s,t.indicator)):e.prepend([new V(n.goal.replace(new o("=",[y,l])),n.substitution,n)])}else{var f=he(c(l.id.split(a.id),function(m){return new o(m,[])}));e.prepend([new V(n.goal.replace(new o("=",[f,s])),n.substitution,n)])}},"@=/2":function(e,n,t){i.compare(t.args[0],t.args[1])>0&&e.success(n)},"@>=/2":function(e,n,t){i.compare(t.args[0],t.args[1])>=0&&e.success(n)},"compare/3":function(e,n,t){var s=t.args[0],a=t.args[1],l=t.args[2];if(!i.type.is_variable(s)&&!i.type.is_atom(s))e.throw_error(i.error.type("atom",s,t.indicator));else if(i.type.is_atom(s)&&["<",">","="].indexOf(s.id)===-1)e.throw_error(i.type.domain("order",s,t.indicator));else{var f=i.compare(a,l);f=f===0?"=":f===-1?"<":">",e.prepend([new V(n.goal.replace(new o("=",[s,new o(f,[])])),n.substitution,n)])}},"is/2":function(e,n,t){var s=t.args[1].interpret(e);i.type.is_number(s)?e.prepend([new V(n.goal.replace(new o("=",[t.args[0],s],e.level)),n.substitution,n)]):e.throw_error(s)},"between/3":function(e,n,t){var s=t.args[0],a=t.args[1],l=t.args[2];if(i.type.is_variable(s)||i.type.is_variable(a))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_integer(s))e.throw_error(i.error.type("integer",s,t.indicator));else if(!i.type.is_integer(a))e.throw_error(i.error.type("integer",a,t.indicator));else if(!i.type.is_variable(l)&&!i.type.is_integer(l))e.throw_error(i.error.type("integer",l,t.indicator));else if(i.type.is_variable(l)){var f=[new V(n.goal.replace(new o("=",[l,s])),n.substitution,n)];s.value=l.value&&e.success(n)},"succ/2":function(e,n,t){var s=t.args[0],a=t.args[1];i.type.is_variable(s)&&i.type.is_variable(a)?e.throw_error(i.error.instantiation(t.indicator)):!i.type.is_variable(s)&&!i.type.is_integer(s)?e.throw_error(i.error.type("integer",s,t.indicator)):!i.type.is_variable(a)&&!i.type.is_integer(a)?e.throw_error(i.error.type("integer",a,t.indicator)):!i.type.is_variable(s)&&s.value<0?e.throw_error(i.error.domain("not_less_than_zero",s,t.indicator)):!i.type.is_variable(a)&&a.value<0?e.throw_error(i.error.domain("not_less_than_zero",a,t.indicator)):(i.type.is_variable(a)||a.value>0)&&(i.type.is_variable(s)?e.prepend([new V(n.goal.replace(new o("=",[s,new E(a.value-1,!1)])),n.substitution,n)]):e.prepend([new V(n.goal.replace(new o("=",[a,new E(s.value+1,!1)])),n.substitution,n)]))},"=:=/2":function(e,n,t){var s=i.arithmetic_compare(e,t.args[0],t.args[1]);i.type.is_term(s)?e.throw_error(s):s===0&&e.success(n)},"=\\=/2":function(e,n,t){var s=i.arithmetic_compare(e,t.args[0],t.args[1]);i.type.is_term(s)?e.throw_error(s):s!==0&&e.success(n)},"/2":function(e,n,t){var s=i.arithmetic_compare(e,t.args[0],t.args[1]);i.type.is_term(s)?e.throw_error(s):s>0&&e.success(n)},">=/2":function(e,n,t){var s=i.arithmetic_compare(e,t.args[0],t.args[1]);i.type.is_term(s)?e.throw_error(s):s>=0&&e.success(n)},"var/1":function(e,n,t){i.type.is_variable(t.args[0])&&e.success(n)},"atom/1":function(e,n,t){i.type.is_atom(t.args[0])&&e.success(n)},"atomic/1":function(e,n,t){i.type.is_atomic(t.args[0])&&e.success(n)},"compound/1":function(e,n,t){i.type.is_compound(t.args[0])&&e.success(n)},"integer/1":function(e,n,t){i.type.is_integer(t.args[0])&&e.success(n)},"float/1":function(e,n,t){i.type.is_float(t.args[0])&&e.success(n)},"number/1":function(e,n,t){i.type.is_number(t.args[0])&&e.success(n)},"nonvar/1":function(e,n,t){i.type.is_variable(t.args[0])||e.success(n)},"ground/1":function(e,n,t){t.variables().length===0&&e.success(n)},"acyclic_term/1":function(e,n,t){for(var s=n.substitution.apply(n.substitution),a=t.args[0].variables(),l=0;l0?k[k.length-1]:null,k!==null&&(A=U(e,k,0,e.__get_max_priority(),!1))}if(A.type===h&&A.len===k.length-1&&L.value==="."){A=A.value.rename(e);var B=new o("=",[a,A]);if(y.variables){var q=he(c(yr(A.variables()),function(F){return new O(F)}));B=new o(",",[B,new o("=",[y.variables,q])])}if(y.variable_names){var q=he(c(yr(A.variables()),function(H){var J;for(J in e.session.renamed_variables)if(e.session.renamed_variables.hasOwnProperty(J)&&e.session.renamed_variables[J]===H)break;return new o("=",[new o(J,[]),new O(H)])}));B=new o(",",[B,new o("=",[y.variable_names,q])])}if(y.singletons){var q=he(c(new Q(A,null).singleton_variables(),function(H){var J;for(J in e.session.renamed_variables)if(e.session.renamed_variables.hasOwnProperty(J)&&e.session.renamed_variables[J]===H)break;return new o("=",[new o(J,[]),new O(H)])}));B=new o(",",[B,new o("=",[y.singletons,q])])}e.prepend([new V(n.goal.replace(B),n.substitution,n)])}else A.type===h?e.throw_error(i.error.syntax(k[A.len],"unexpected token",!1)):e.throw_error(A.value)}}},"write/1":function(e,n,t){var s=t.args[0];e.prepend([new V(n.goal.replace(new o(",",[new o("current_output",[new O("S")]),new o("write",[new O("S"),s])])),n.substitution,n)])},"write/2":function(e,n,t){var s=t.args[0],a=t.args[1];e.prepend([new V(n.goal.replace(new o("write_term",[s,a,new o(".",[new o("quoted",[new o("false",[])]),new o(".",[new o("ignore_ops",[new o("false")]),new o(".",[new o("numbervars",[new o("true")]),new o("[]",[])])])])])),n.substitution,n)])},"writeq/1":function(e,n,t){var s=t.args[0];e.prepend([new V(n.goal.replace(new o(",",[new o("current_output",[new O("S")]),new o("writeq",[new O("S"),s])])),n.substitution,n)])},"writeq/2":function(e,n,t){var s=t.args[0],a=t.args[1];e.prepend([new V(n.goal.replace(new o("write_term",[s,a,new o(".",[new o("quoted",[new o("true",[])]),new o(".",[new o("ignore_ops",[new o("false")]),new o(".",[new o("numbervars",[new o("true")]),new o("[]",[])])])])])),n.substitution,n)])},"write_canonical/1":function(e,n,t){var s=t.args[0];e.prepend([new V(n.goal.replace(new o(",",[new o("current_output",[new O("S")]),new o("write_canonical",[new O("S"),s])])),n.substitution,n)])},"write_canonical/2":function(e,n,t){var s=t.args[0],a=t.args[1];e.prepend([new V(n.goal.replace(new o("write_term",[s,a,new o(".",[new o("quoted",[new o("true",[])]),new o(".",[new o("ignore_ops",[new o("true")]),new o(".",[new o("numbervars",[new o("false")]),new o("[]",[])])])])])),n.substitution,n)])},"write_term/2":function(e,n,t){var s=t.args[0],a=t.args[1];e.prepend([new V(n.goal.replace(new o(",",[new o("current_output",[new O("S")]),new o("write_term",[new O("S"),s,a])])),n.substitution,n)])},"write_term/3":function(e,n,t){var s=t.args[0],a=t.args[1],l=t.args[2],f=i.type.is_stream(s)?s:e.get_stream_by_alias(s.id);if(i.type.is_variable(s)||i.type.is_variable(l))e.throw_error(i.error.instantiation(t.indicator));else if(!i.type.is_list(l))e.throw_error(i.error.type("list",l,t.indicator));else if(!i.type.is_stream(s)&&!i.type.is_atom(s))e.throw_error(i.error.domain("stream_or_alias",s,t.indicator));else if(!i.type.is_stream(f)||f.stream===null)e.throw_error(i.error.existence("stream",s,t.indicator));else if(f.input)e.throw_error(i.error.permission("output","stream",s,t.indicator));else if(f.type==="binary")e.throw_error(i.error.permission("output","binary_stream",s,t.indicator));else if(f.position==="past_end_of_stream"&&f.eof_action==="error")e.throw_error(i.error.permission("output","past_end_of_stream",s,t.indicator));else{for(var y={},d=l,m;i.type.is_term(d)&&d.indicator==="./2";){if(m=d.args[0],i.type.is_variable(m)){e.throw_error(i.error.instantiation(t.indicator));return}else if(!i.type.is_write_option(m)){e.throw_error(i.error.domain("write_option",m,t.indicator));return}y[m.id]=m.args[0].id==="true",d=d.args[1]}if(d.indicator!=="[]/0"){i.type.is_variable(d)?e.throw_error(i.error.instantiation(t.indicator)):e.throw_error(i.error.type("list",l,t.indicator));return}else{y.session=e.session;var S=a.toString(y);f.stream.put(S,f.position),typeof f.position=="number"&&(f.position+=S.length),e.success(n)}}},"halt/0":function(e,n,t){e.points=[]},"halt/1":function(e,n,t){var s=t.args[0];i.type.is_variable(s)?e.throw_error(i.error.instantiation(t.indicator)):i.type.is_integer(s)?e.points=[]:e.throw_error(i.error.type("integer",s,t.indicator))},"current_prolog_flag/2":function(e,n,t){var s=t.args[0],a=t.args[1];if(!i.type.is_variable(s)&&!i.type.is_atom(s))e.throw_error(i.error.type("atom",s,t.indicator));else if(!i.type.is_variable(s)&&!i.type.is_flag(s))e.throw_error(i.error.domain("prolog_flag",s,t.indicator));else{var l=[];for(var f in i.flag)if(!!i.flag.hasOwnProperty(f)){var y=new o(",",[new o("=",[new o(f),s]),new o("=",[e.get_flag(f),a])]);l.push(new V(n.goal.replace(y),n.substitution,n))}e.prepend(l)}},"set_prolog_flag/2":function(e,n,t){var s=t.args[0],a=t.args[1];i.type.is_variable(s)||i.type.is_variable(a)?e.throw_error(i.error.instantiation(t.indicator)):i.type.is_atom(s)?i.type.is_flag(s)?i.type.is_value_flag(s,a)?i.type.is_modifiable_flag(s)?(e.session.flag[s.id]=a,e.success(n)):e.throw_error(i.error.permission("modify","flag",s)):e.throw_error(i.error.domain("flag_value",new o("+",[s,a]),t.indicator)):e.throw_error(i.error.domain("prolog_flag",s,t.indicator)):e.throw_error(i.error.type("atom",s,t.indicator))}},flag:{bounded:{allowed:[new o("true"),new o("false")],value:new o("true"),changeable:!1},max_integer:{allowed:[new E(Number.MAX_SAFE_INTEGER)],value:new E(Number.MAX_SAFE_INTEGER),changeable:!1},min_integer:{allowed:[new E(Number.MIN_SAFE_INTEGER)],value:new E(Number.MIN_SAFE_INTEGER),changeable:!1},integer_rounding_function:{allowed:[new o("down"),new o("toward_zero")],value:new o("toward_zero"),changeable:!1},char_conversion:{allowed:[new o("on"),new o("off")],value:new o("on"),changeable:!0},debug:{allowed:[new o("on"),new o("off")],value:new o("off"),changeable:!0},max_arity:{allowed:[new o("unbounded")],value:new o("unbounded"),changeable:!1},unknown:{allowed:[new o("error"),new o("fail"),new o("warning")],value:new o("error"),changeable:!0},double_quotes:{allowed:[new o("chars"),new o("codes"),new o("atom")],value:new o("codes"),changeable:!0},occurs_check:{allowed:[new o("false"),new o("true")],value:new o("false"),changeable:!0},dialect:{allowed:[new o("tau")],value:new o("tau"),changeable:!1},version_data:{allowed:[new o("tau",[new E(r.major,!1),new E(r.minor,!1),new E(r.patch,!1),new o(r.status)])],value:new o("tau",[new E(r.major,!1),new E(r.minor,!1),new E(r.patch,!1),new o(r.status)]),changeable:!1},nodejs:{allowed:[new o("yes"),new o("no")],value:new o(typeof ie!="undefined"&&ie.exports?"yes":"no"),changeable:!1}},unify:function(e,n,t){t=t===void 0?!1:t;for(var s=[{left:e,right:n}],a={};s.length!==0;){var l=s.pop();if(e=l.left,n=l.right,i.type.is_term(e)&&i.type.is_term(n)){if(e.indicator!==n.indicator)return null;for(var f=0;fa.value?1:0:a}else return s},operate:function(e,n){if(i.type.is_operator(n)){for(var t=i.type.is_operator(n),s=[],a,l=!1,f=0;fe.get_flag("max_integer").value||a0?e.start+e.matches[0].length:e.start,a=t?new o("token_not_found"):new o("found",[new o(e.value.toString())]),l=new o(".",[new o("line",[new E(e.line+1)]),new o(".",[new o("column",[new E(s+1)]),new o(".",[a,new o("[]",[])])])]);return new o("error",[new o("syntax_error",[new o(n)]),l])},syntax_by_predicate:function(e,n){return new o("error",[new o("syntax_error",[new o(e)]),ae(n)])}},warning:{singleton:function(e,n,t){for(var s=new o("[]"),a=e.length-1;a>=0;a--)s=new o(".",[new O(e[a]),s]);return new o("warning",[new o("singleton_variables",[s,ae(n)]),new o(".",[new o("line",[new E(t,!1)]),new o("[]")])])},failed_goal:function(e,n){return new o("warning",[new o("failed_goal",[e]),new o(".",[new o("line",[new E(n,!1)]),new o("[]")])])}},format_variable:function(e){return"_"+e},format_answer:function(e,n,t){n instanceof D&&(n=n.thread);var t=t||{};if(t.session=n?n.session:void 0,i.type.is_error(e))return"uncaught exception: "+e.args[0].toString();if(e===!1)return"false.";if(e===null)return"limit exceeded ;";var s=0,a="";if(i.type.is_substitution(e)){var l=e.domain(!0);e=e.filter(function(d,m){return!i.type.is_variable(m)||l.indexOf(m.id)!==-1&&d!==m.id})}for(var f in e.links)!e.links.hasOwnProperty(f)||(s++,a!==""&&(a+=", "),a+=f.toString(t)+" = "+e.links[f].toString(t));var y=typeof n=="undefined"||n.points.length>0?" ;":".";return s===0?"true"+y:a+y},flatten_error:function(e){if(!i.type.is_error(e))return null;e=e.args[0];var n={};return n.type=e.args[0].id,n.thrown=n.type==="syntax_error"?null:e.args[1].id,n.expected=null,n.found=null,n.representation=null,n.existence=null,n.existence_type=null,n.line=null,n.column=null,n.permission_operation=null,n.permission_type=null,n.evaluation_type=null,n.type==="type_error"||n.type==="domain_error"?(n.expected=e.args[0].args[0].id,n.found=e.args[0].args[1].toString()):n.type==="syntax_error"?e.args[1].indicator==="./2"?(n.expected=e.args[0].args[0].id,n.found=e.args[1].args[1].args[1].args[0],n.found=n.found.id==="token_not_found"?n.found.id:n.found.args[0].id,n.line=e.args[1].args[0].args[0].value,n.column=e.args[1].args[1].args[0].args[0].value):n.thrown=e.args[1].id:n.type==="permission_error"?(n.found=e.args[0].args[2].toString(),n.permission_operation=e.args[0].args[0].id,n.permission_type=e.args[0].args[1].id):n.type==="evaluation_error"?n.evaluation_type=e.args[0].args[0].id:n.type==="representation_error"?n.representation=e.args[0].args[0].id:n.type==="existence_error"&&(n.existence=e.args[0].args[1].toString(),n.existence_type=e.args[0].args[0].id),n},create:function(e){return new i.type.Session(e)}};typeof ie!="undefined"?ie.exports=i:window.pl=i})()});var er=I((qu,rt)=>{var is=Array.isArray;rt.exports=is});var nt=I(($u,tt)=>{var ss=typeof global=="object"&&global&&global.Object===Object&&global;tt.exports=ss});var rr=I((Du,it)=>{var as=nt(),os=typeof self=="object"&&self&&self.Object===Object&&self,us=as||os||Function("return this")();it.exports=us});var tr=I((Xu,st)=>{var ls=rr(),cs=ls.Symbol;st.exports=cs});var lt=I((Bu,at)=>{var ot=tr(),ut=Object.prototype,fs=ut.hasOwnProperty,ps=ut.toString,De=ot?ot.toStringTag:void 0;function ys(r){var u=fs.call(r,De),p=r[De];try{r[De]=void 0;var c=!0}catch(_){}var w=ps.call(r);return c&&(u?r[De]=p:delete r[De]),w}at.exports=ys});var ft=I((Fu,ct)=>{var _s=Object.prototype,ws=_s.toString;function gs(r){return ws.call(r)}ct.exports=gs});var Pr=I((zu,pt)=>{var yt=tr(),ds=lt(),vs=ft(),hs="[object Null]",ms="[object Undefined]",_t=yt?yt.toStringTag:void 0;function bs(r){return r==null?r===void 0?ms:hs:_t&&_t in Object(r)?ds(r):vs(r)}pt.exports=bs});var gt=I((Wu,wt)=>{function Ts(r){return r!=null&&typeof r=="object"}wt.exports=Ts});var nr=I((Lu,dt)=>{var xs=Pr(),Vs=gt(),Ss="[object Symbol]";function ks(r){return typeof r=="symbol"||Vs(r)&&xs(r)==Ss}dt.exports=ks});var ht=I((Hu,vt)=>{var Ps=er(),Cs=nr(),Os=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Is=/^\w*$/;function Es(r,u){if(Ps(r))return!1;var p=typeof r;return p=="number"||p=="symbol"||p=="boolean"||r==null||Cs(r)?!0:Is.test(r)||!Os.test(r)||u!=null&&r in Object(u)}vt.exports=Es});var ir=I((Gu,mt)=>{function As(r){var u=typeof r;return r!=null&&(u=="object"||u=="function")}mt.exports=As});var Tt=I((Yu,bt)=>{var Ns=Pr(),Rs=ir(),Ms="[object AsyncFunction]",qs="[object Function]",$s="[object GeneratorFunction]",Ds="[object Proxy]";function Xs(r){if(!Rs(r))return!1;var u=Ns(r);return u==qs||u==$s||u==Ms||u==Ds}bt.exports=Xs});var Vt=I((Uu,xt)=>{var Bs=rr(),Fs=Bs["__core-js_shared__"];xt.exports=Fs});var Pt=I((Zu,St)=>{var Cr=Vt(),kt=function(){var r=/[^.]+$/.exec(Cr&&Cr.keys&&Cr.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function zs(r){return!!kt&&kt in r}St.exports=zs});var Ot=I((Qu,Ct)=>{var Ws=Function.prototype,Ls=Ws.toString;function Hs(r){if(r!=null){try{return Ls.call(r)}catch(u){}try{return r+""}catch(u){}}return""}Ct.exports=Hs});var Et=I((Ju,It)=>{var Gs=Tt(),Ys=Pt(),Us=ir(),Zs=Ot(),Qs=/[\\^$.*+?()[\]{}|]/g,Js=/^\[object .+?Constructor\]$/,Ks=Function.prototype,js=Object.prototype,ea=Ks.toString,ra=js.hasOwnProperty,ta=RegExp("^"+ea.call(ra).replace(Qs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function na(r){if(!Us(r)||Ys(r))return!1;var u=Gs(r)?ta:Js;return u.test(Zs(r))}It.exports=na});var Nt=I((Ku,At)=>{function ia(r,u){return r==null?void 0:r[u]}At.exports=ia});var sr=I((ju,Rt)=>{var sa=Et(),aa=Nt();function oa(r,u){var p=aa(r,u);return sa(p)?p:void 0}Rt.exports=oa});var Xe=I((el,Mt)=>{var ua=sr(),la=ua(Object,"create");Mt.exports=la});var Dt=I((rl,qt)=>{var $t=Xe();function ca(){this.__data__=$t?$t(null):{},this.size=0}qt.exports=ca});var Bt=I((tl,Xt)=>{function fa(r){var u=this.has(r)&&delete this.__data__[r];return this.size-=u?1:0,u}Xt.exports=fa});var zt=I((nl,Ft)=>{var pa=Xe(),ya="__lodash_hash_undefined__",_a=Object.prototype,wa=_a.hasOwnProperty;function ga(r){var u=this.__data__;if(pa){var p=u[r];return p===ya?void 0:p}return wa.call(u,r)?u[r]:void 0}Ft.exports=ga});var Lt=I((il,Wt)=>{var da=Xe(),va=Object.prototype,ha=va.hasOwnProperty;function ma(r){var u=this.__data__;return da?u[r]!==void 0:ha.call(u,r)}Wt.exports=ma});var Gt=I((sl,Ht)=>{var ba=Xe(),Ta="__lodash_hash_undefined__";function xa(r,u){var p=this.__data__;return this.size+=this.has(r)?0:1,p[r]=ba&&u===void 0?Ta:u,this}Ht.exports=xa});var Ut=I((al,Yt)=>{var Va=Dt(),Sa=Bt(),ka=zt(),Pa=Lt(),Ca=Gt();function Ie(r){var u=-1,p=r==null?0:r.length;for(this.clear();++u{function Oa(){this.__data__=[],this.size=0}Zt.exports=Oa});var Or=I((ul,Jt)=>{function Ia(r,u){return r===u||r!==r&&u!==u}Jt.exports=Ia});var Be=I((ll,Kt)=>{var Ea=Or();function Aa(r,u){for(var p=r.length;p--;)if(Ea(r[p][0],u))return p;return-1}Kt.exports=Aa});var en=I((cl,jt)=>{var Na=Be(),Ra=Array.prototype,Ma=Ra.splice;function qa(r){var u=this.__data__,p=Na(u,r);if(p<0)return!1;var c=u.length-1;return p==c?u.pop():Ma.call(u,p,1),--this.size,!0}jt.exports=qa});var tn=I((fl,rn)=>{var $a=Be();function Da(r){var u=this.__data__,p=$a(u,r);return p<0?void 0:u[p][1]}rn.exports=Da});var sn=I((pl,nn)=>{var Xa=Be();function Ba(r){return Xa(this.__data__,r)>-1}nn.exports=Ba});var on=I((yl,an)=>{var Fa=Be();function za(r,u){var p=this.__data__,c=Fa(p,r);return c<0?(++this.size,p.push([r,u])):p[c][1]=u,this}an.exports=za});var ln=I((_l,un)=>{var Wa=Qt(),La=en(),Ha=tn(),Ga=sn(),Ya=on();function Ee(r){var u=-1,p=r==null?0:r.length;for(this.clear();++u{var Ua=sr(),Za=rr(),Qa=Ua(Za,"Map");cn.exports=Qa});var _n=I((gl,pn)=>{var yn=Ut(),Ja=ln(),Ka=fn();function ja(){this.size=0,this.__data__={hash:new yn,map:new(Ka||Ja),string:new yn}}pn.exports=ja});var gn=I((dl,wn)=>{function eo(r){var u=typeof r;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?r!=="__proto__":r===null}wn.exports=eo});var Fe=I((vl,dn)=>{var ro=gn();function to(r,u){var p=r.__data__;return ro(u)?p[typeof u=="string"?"string":"hash"]:p.map}dn.exports=to});var hn=I((hl,vn)=>{var no=Fe();function io(r){var u=no(this,r).delete(r);return this.size-=u?1:0,u}vn.exports=io});var bn=I((ml,mn)=>{var so=Fe();function ao(r){return so(this,r).get(r)}mn.exports=ao});var xn=I((bl,Tn)=>{var oo=Fe();function uo(r){return oo(this,r).has(r)}Tn.exports=uo});var Sn=I((Tl,Vn)=>{var lo=Fe();function co(r,u){var p=lo(this,r),c=p.size;return p.set(r,u),this.size+=p.size==c?0:1,this}Vn.exports=co});var Pn=I((xl,kn)=>{var fo=_n(),po=hn(),yo=bn(),_o=xn(),wo=Sn();function Ae(r){var u=-1,p=r==null?0:r.length;for(this.clear();++u{var On=Pn(),go="Expected a function";function Ir(r,u){if(typeof r!="function"||u!=null&&typeof u!="function")throw new TypeError(go);var p=function(){var c=arguments,w=u?u.apply(this,c):c[0],_=p.cache;if(_.has(w))return _.get(w);var v=r.apply(this,c);return p.cache=_.set(w,v)||_,v};return p.cache=new(Ir.Cache||On),p}Ir.Cache=On;Cn.exports=Ir});var An=I((Sl,En)=>{var vo=In(),ho=500;function mo(r){var u=vo(r,function(c){return p.size===ho&&p.clear(),c}),p=u.cache;return u}En.exports=mo});var Rn=I((kl,Nn)=>{var bo=An(),To=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xo=/\\(\\)?/g,Vo=bo(function(r){var u=[];return r.charCodeAt(0)===46&&u.push(""),r.replace(To,function(p,c,w,_){u.push(w?_.replace(xo,"$1"):c||p)}),u});Nn.exports=Vo});var qn=I((Pl,Mn)=>{function So(r,u){for(var p=-1,c=r==null?0:r.length,w=Array(c);++p{var Dn=tr(),ko=qn(),Po=er(),Co=nr(),Oo=1/0,Xn=Dn?Dn.prototype:void 0,Bn=Xn?Xn.toString:void 0;function Fn(r){if(typeof r=="string")return r;if(Po(r))return ko(r,Fn)+"";if(Co(r))return Bn?Bn.call(r):"";var u=r+"";return u=="0"&&1/r==-Oo?"-0":u}$n.exports=Fn});var Ln=I((Ol,Wn)=>{var Io=zn();function Eo(r){return r==null?"":Io(r)}Wn.exports=Eo});var ar=I((Il,Hn)=>{var Ao=er(),No=ht(),Ro=Rn(),Mo=Ln();function qo(r,u){return Ao(r)?r:No(r,u)?[r]:Ro(Mo(r))}Hn.exports=qo});var or=I((El,Gn)=>{var $o=nr(),Do=1/0;function Xo(r){if(typeof r=="string"||$o(r))return r;var u=r+"";return u=="0"&&1/r==-Do?"-0":u}Gn.exports=Xo});var Er=I((Al,Yn)=>{var Bo=ar(),Fo=or();function zo(r,u){u=Bo(u,r);for(var p=0,c=u.length;r!=null&&p{var Wo=Er();function Lo(r,u,p){var c=r==null?void 0:Wo(r,u);return c===void 0?p:c}Un.exports=Lo});var li=I((Ul,ui)=>{var Jo=sr(),Ko=function(){try{var r=Jo(Object,"defineProperty");return r({},"",{}),r}catch(u){}}();ui.exports=Ko});var pi=I((Zl,ci)=>{var fi=li();function jo(r,u,p){u=="__proto__"&&fi?fi(r,u,{configurable:!0,enumerable:!0,value:p,writable:!0}):r[u]=p}ci.exports=jo});var _i=I((Ql,yi)=>{var eu=pi(),ru=Or(),tu=Object.prototype,nu=tu.hasOwnProperty;function iu(r,u,p){var c=r[u];(!(nu.call(r,u)&&ru(c,p))||p===void 0&&!(u in r))&&eu(r,u,p)}yi.exports=iu});var gi=I((Jl,wi)=>{var su=9007199254740991,au=/^(?:0|[1-9]\d*)$/;function ou(r,u){var p=typeof r;return u=u==null?su:u,!!u&&(p=="number"||p!="symbol"&&au.test(r))&&r>-1&&r%1==0&&r{var uu=_i(),lu=ar(),cu=gi(),vi=ir(),fu=or();function pu(r,u,p,c){if(!vi(r))return r;u=lu(u,r);for(var w=-1,_=u.length,v=_-1,g=r;g!=null&&++w<_;){var h=fu(u[w]),x=p;if(h==="__proto__"||h==="constructor"||h==="prototype")return r;if(w!=v){var T=g[h];x=c?c(T,h,g):void 0,x===void 0&&(x=vi(T)?T:cu(u[w+1])?[]:{})}uu(g,h,x),g=g[h]}return r}di.exports=pu});var bi=I((jl,mi)=>{var yu=hi();function _u(r,u,p){return r==null?r:yu(r,u,p)}mi.exports=_u});var xi=I((ec,Ti)=>{function wu(r){var u=r==null?0:r.length;return u?r[u-1]:void 0}Ti.exports=wu});var Si=I((rc,Vi)=>{function gu(r,u,p){var c=-1,w=r.length;u<0&&(u=-u>w?0:w+u),p=p>w?w:p,p<0&&(p+=w),w=u>p?0:p-u>>>0,u>>>=0;for(var _=Array(w);++c{var du=Er(),vu=Si();function hu(r,u){return u.length<2?r:du(r,vu(u,0,-1))}ki.exports=hu});var Oi=I((nc,Ci)=>{var mu=ar(),bu=xi(),Tu=Pi(),xu=or();function Vu(r,u){return u=mu(u,r),r=Tu(r,u),r==null||delete r[xu(bu(u))]}Ci.exports=Vu});var Ei=I((ic,Ii)=>{var Su=Oi();function ku(r,u){return r==null?!0:Su(r,u)}Ii.exports=ku});var Ou={};Qi(Ou,{default:()=>Eu});var $i=G(require("@yarnpkg/core"));var ni=G(require("@yarnpkg/cli")),ur=G(require("@yarnpkg/core")),ii=G(require("@yarnpkg/core")),Le=G(require("clipanion"));var ge=G(require("@yarnpkg/core")),ue=G(require("@yarnpkg/core")),Ne=G(require("@yarnpkg/fslib")),jn=G(Xr()),ze=G(kr());var Nr=G(require("@yarnpkg/core")),Rr=G(Ar()),re=G(kr()),Zn=G(require("vm")),{is_atom:we,is_variable:Ho,is_instantiated_list:Go}=re.default.type;function Qn(r,u,p){r.prepend(p.map(c=>new re.default.type.State(u.goal.replace(c),u.substitution,u)))}var Jn=new WeakMap;function Mr(r){let u=Jn.get(r.session);if(u==null)throw new Error("Assertion failed: A project should have been registered for the active session");return u}var Yo=new re.default.type.Module("constraints",{["project_workspaces_by_descriptor/3"]:(r,u,p)=>{let[c,w,_]=p.args;if(!we(c)||!we(w)){r.throwError(re.default.error.instantiation(p.indicator));return}let v=Nr.structUtils.parseIdent(c.id),g=Nr.structUtils.makeDescriptor(v,w.id),x=Mr(r).tryWorkspaceByDescriptor(g);Ho(_)&&x!==null&&Qn(r,u,[new re.default.type.Term("=",[_,new re.default.type.Term(String(x.relativeCwd))])]),we(_)&&x!==null&&x.relativeCwd===_.id&&r.success(u)},["workspace_field/3"]:(r,u,p)=>{let[c,w,_]=p.args;if(!we(c)||!we(w)){r.throwError(re.default.error.instantiation(p.indicator));return}let g=Mr(r).tryWorkspaceByCwd(c.id);if(g==null)return;let h=(0,Rr.default)(g.manifest.raw,w.id);typeof h!="undefined"&&Qn(r,u,[new re.default.type.Term("=",[_,new re.default.type.Term(String(h))])])},["workspace_field_test/3"]:(r,u,p)=>{let[c,w,_]=p.args;r.prepend([new re.default.type.State(u.goal.replace(new re.default.type.Term("workspace_field_test",[c,w,_,new re.default.type.Term("[]",[])])),u.substitution,u)])},["workspace_field_test/4"]:(r,u,p)=>{let[c,w,_,v]=p.args;if(!we(c)||!we(w)||!we(_)||!Go(v)){r.throwError(re.default.error.instantiation(p.indicator));return}let h=Mr(r).tryWorkspaceByCwd(c.id);if(h==null)return;let x=(0,Rr.default)(h.manifest.raw,w.id);if(typeof x=="undefined")return;let T={$$:x};for(let[C,N]of v.toJavaScript().entries())T[`$${C}`]=N;Zn.default.runInNewContext(_.id,T)&&r.success(u)}},["project_workspaces_by_descriptor/3","workspace_field/3","workspace_field_test/3","workspace_field_test/4"]);function Kn(r,u){Jn.set(r,u),r.consult(`:- use_module(library(${Yo.id})).`)}(0,jn.default)(ze.default);var We;(function(c){c.Dependencies="dependencies",c.DevDependencies="devDependencies",c.PeerDependencies="peerDependencies"})(We||(We={}));var ei=[We.Dependencies,We.DevDependencies,We.PeerDependencies];function j(r){if(r instanceof ze.default.type.Num)return r.value;if(r instanceof ze.default.type.Term){if(r.args.length===0)return r.id;switch(r.indicator){case"throw/1":return j(r.args[0]);case"error/1":return j(r.args[0]);case"error/2":return Object.assign(j(r.args[0]),...j(r.args[1]));case"syntax_error/1":return new ge.ReportError(ge.MessageName.PROLOG_SYNTAX_ERROR,`Syntax error: ${j(r.args[0])}`);case"existence_error/2":return new ge.ReportError(ge.MessageName.PROLOG_EXISTENCE_ERROR,`Existence error: ${j(r.args[0])} ${j(r.args[1])} not found`);case"line/1":return{line:j(r.args[0])};case"column/1":return{column:j(r.args[0])};case"found/1":return{found:j(r.args[0])};case"./2":return[j(r.args[0])].concat(j(r.args[1]));case"//2":return`${j(r.args[0])}/${j(r.args[1])}`}}throw`couldn't pretty print because of unsupported node ${r}`}function ri(r){let u;try{u=j(r)}catch(p){throw typeof p=="string"?new ge.ReportError(ge.MessageName.PROLOG_UNKNOWN_ERROR,`Unknown error: ${r} (note: ${p})`):p}return typeof u.line!="undefined"&&typeof u.column!="undefined"&&(u.message+=` at line ${u.line}, column ${u.column}`),u}var ti=class{constructor(u,p){this.session=ze.default.create(),Kn(this.session,u),this.session.consult(":- use_module(library(lists))."),this.session.consult(p)}fetchNextAnswer(){return new Promise(u=>{this.session.answer(p=>{u(p)})})}async*makeQuery(u){let p=this.session.query(u);if(p!==!0)throw ri(p);for(;;){let c=await this.fetchNextAnswer();if(!c)break;if(c.id==="throw")throw ri(c);yield c}}};function ke(r){return r.id==="null"?null:`${r.toJavaScript()}`}function Uo(r){if(r.id==="null")return null;{let u=r.toJavaScript();if(typeof u!="string")return JSON.stringify(u);try{return JSON.stringify(JSON.parse(u))}catch{return JSON.stringify(u)}}}var fe=class{constructor(u){this.source="";this.project=u;let p=u.configuration.get("constraintsPath");Ne.xfs.existsSync(p)&&(this.source=Ne.xfs.readFileSync(p,"utf8"))}static async find(u){return new fe(u)}getProjectDatabase(){let u="";for(let p of ei)u+=`dependency_type(${p}). -`;for(let p of this.project.workspacesByCwd.values()){let c=p.relativeCwd;u+=`workspace(${de(c)}). -`,u+=`workspace_ident(${de(c)}, ${de(ue.structUtils.stringifyIdent(p.locator))}). -`,u+=`workspace_version(${de(c)}, ${de(p.manifest.version)}). -`;for(let w of ei)for(let _ of p.manifest[w].values())u+=`workspace_has_dependency(${de(c)}, ${de(ue.structUtils.stringifyIdent(_))}, ${de(_.range)}, ${w}). -`}return u+=`workspace(_) :- false. -`,u+=`workspace_ident(_, _) :- false. -`,u+=`workspace_version(_, _) :- false. -`,u+=`workspace_has_dependency(_, _, _, _) :- false. -`,u}getDeclarations(){let u="";return u+=`gen_enforced_dependency(_, _, _, _) :- false. -`,u+=`gen_enforced_field(_, _, _) :- false. -`,u}get fullSource(){return`${this.getProjectDatabase()} -${this.source} -${this.getDeclarations()}`}createSession(){return new ti(this.project,this.fullSource)}async process(){let u=this.createSession();return{enforcedDependencies:await this.genEnforcedDependencies(u),enforcedFields:await this.genEnforcedFields(u)}}async genEnforcedDependencies(u){let p=[];for await(let c of u.makeQuery("workspace(WorkspaceCwd), dependency_type(DependencyType), gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType).")){let w=Ne.ppath.resolve(this.project.cwd,ke(c.links.WorkspaceCwd)),_=ke(c.links.DependencyIdent),v=ke(c.links.DependencyRange),g=ke(c.links.DependencyType);if(w===null||_===null)throw new Error("Invalid rule");let h=this.project.getWorkspaceByCwd(w),x=ue.structUtils.parseIdent(_);p.push({workspace:h,dependencyIdent:x,dependencyRange:v,dependencyType:g})}return ue.miscUtils.sortMap(p,[({dependencyRange:c})=>c!==null?"0":"1",({workspace:c})=>ue.structUtils.stringifyIdent(c.locator),({dependencyIdent:c})=>ue.structUtils.stringifyIdent(c)])}async genEnforcedFields(u){let p=[];for await(let c of u.makeQuery("workspace(WorkspaceCwd), gen_enforced_field(WorkspaceCwd, FieldPath, FieldValue).")){let w=Ne.ppath.resolve(this.project.cwd,ke(c.links.WorkspaceCwd)),_=ke(c.links.FieldPath),v=Uo(c.links.FieldValue);if(w===null||_===null)throw new Error("Invalid rule");let g=this.project.getWorkspaceByCwd(w);p.push({workspace:g,fieldPath:_,fieldValue:v})}return ue.miscUtils.sortMap(p,[({workspace:c})=>ue.structUtils.stringifyIdent(c.locator),({fieldPath:c})=>c])}async*query(u){let p=this.createSession();for await(let c of p.makeQuery(u)){let w={};for(let[_,v]of Object.entries(c.links))_!=="_"&&(w[_]=ke(v));yield w}}};function de(r){return typeof r=="string"?`'${r}'`:"[]"}var He=class extends ni.BaseCommand{constructor(){super(...arguments);this.json=Le.Option.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.query=Le.Option.String()}async execute(){let u=await ur.Configuration.find(this.context.cwd,this.context.plugins),{project:p}=await ur.Project.find(u,this.context.cwd),c=await fe.find(p),w=this.query;return w.endsWith(".")||(w=`${w}.`),(await ii.StreamReport.start({configuration:u,json:this.json,stdout:this.context.stdout},async v=>{for await(let g of c.query(w)){let h=Array.from(Object.entries(g)),x=h.length,T=h.reduce((b,[C])=>Math.max(b,C.length),0);for(let b=0;b{let v=new Set,g=[];for(let h=0,x=this.fix?10:1;h{await h.persistManifest()}));for(let[h,x]of g)_.reportError(h,x)});return w.hasErrors()?w.exitCode():0}};Ye.paths=[["constraints"]],Ye.usage=fr.Command.Usage({category:"Constraints-related commands",description:"check that the project constraints are met",details:` - This command will run constraints on your project and emit errors for each one that is found but isn't met. If any error is emitted the process will exit with a non-zero exit code. - - If the \`--fix\` flag is used, Yarn will attempt to automatically fix the issues the best it can, following a multi-pass process (with a maximum of 10 iterations). Some ambiguous patterns cannot be autofixed, in which case you'll have to manually specify the right resolution. - - For more information as to how to write constraints, please consult our dedicated page on our website: https://yarnpkg.com/features/constraints. - `,examples:[["Check that all constraints are satisfied","yarn constraints"],["Autofix all unmet constraints","yarn constraints --fix"]]});var qi=Ye;async function Pu(r,u,p,{configuration:c,fix:w}){let _=new Map,v=new Map;for(let{workspace:g,dependencyIdent:h,dependencyRange:x,dependencyType:T}of p){let b=v.get(g);typeof b=="undefined"&&v.set(g,b=new Map);let C=b.get(h.identHash);typeof C=="undefined"&&b.set(h.identHash,C=new Map);let N=C.get(T);typeof N=="undefined"&&C.set(T,N=new Set),_.set(h.identHash,h),N.add(x)}for(let[g,h]of v)for(let[x,T]of h){let b=_.get(x);if(typeof b=="undefined")throw new Error("Assertion failed: The ident should have been registered");for(let[C,N]of T){let W=N.has(null)?[null]:[...N];if(W.length>2)u.push([se.MessageName.CONSTRAINTS_AMBIGUITY,`${$.structUtils.prettyWorkspace(c,g)} must depend on ${$.structUtils.prettyIdent(c,b)} via conflicting ranges ${W.slice(0,-1).map(ee=>$.structUtils.prettyRange(c,String(ee))).join(", ")}, and ${$.structUtils.prettyRange(c,String(W[W.length-1]))} (in ${C})`]);else if(W.length>1)u.push([se.MessageName.CONSTRAINTS_AMBIGUITY,`${$.structUtils.prettyWorkspace(c,g)} must depend on ${$.structUtils.prettyIdent(c,b)} via conflicting ranges ${$.structUtils.prettyRange(c,String(W[0]))} and ${$.structUtils.prettyRange(c,String(W[1]))} (in ${C})`]);else{let ee=g.manifest[C].get(b.identHash),[te]=W;te!==null?ee?ee.range!==te&&(w?(g.manifest[C].set(b.identHash,$.structUtils.makeDescriptor(b,te)),r.add(g)):u.push([se.MessageName.CONSTRAINTS_INCOMPATIBLE_DEPENDENCY,`${$.structUtils.prettyWorkspace(c,g)} must depend on ${$.structUtils.prettyIdent(c,b)} via ${$.structUtils.prettyRange(c,te)}, but uses ${$.structUtils.prettyRange(c,ee.range)} instead (in ${C})`])):w?(g.manifest[C].set(b.identHash,$.structUtils.makeDescriptor(b,te)),r.add(g)):u.push([se.MessageName.CONSTRAINTS_MISSING_DEPENDENCY,`${$.structUtils.prettyWorkspace(c,g)} must depend on ${$.structUtils.prettyIdent(c,b)} (via ${$.structUtils.prettyRange(c,te)}), but doesn't (in ${C})`]):ee&&(w?(g.manifest[C].delete(b.identHash),r.add(g)):u.push([se.MessageName.CONSTRAINTS_EXTRANEOUS_DEPENDENCY,`${$.structUtils.prettyWorkspace(c,g)} has an extraneous dependency on ${$.structUtils.prettyIdent(c,b)} (in ${C})`]))}}}}async function Cu(r,u,p,{configuration:c,fix:w}){let _=new Map;for(let{workspace:v,fieldPath:g,fieldValue:h}of p){let x=Pe.miscUtils.getMapWithDefault(_,v);Pe.miscUtils.getSetWithDefault(x,g).add(h)}for(let[v,g]of _)for(let[h,x]of g){let T=[...x];if(T.length>2)u.push([se.MessageName.CONSTRAINTS_AMBIGUITY,`${$.structUtils.prettyWorkspace(c,v)} must have a field ${$.formatUtils.pretty(c,h,"cyan")} set to conflicting values ${T.slice(0,-1).map(b=>$.formatUtils.pretty(c,String(b),"magenta")).join(", ")}, or ${$.formatUtils.pretty(c,String(T[T.length-1]),"magenta")}`]);else if(T.length>1)u.push([se.MessageName.CONSTRAINTS_AMBIGUITY,`${$.structUtils.prettyWorkspace(c,v)} must have a field ${$.formatUtils.pretty(c,h,"cyan")} set to conflicting values ${$.formatUtils.pretty(c,String(T[0]),"magenta")} or ${$.formatUtils.pretty(c,String(T[1]),"magenta")}`]);else{let b=(0,Ni.default)(v.manifest.raw,h),[C]=T;C!==null?b===void 0?w?(await qr(v,h,C),r.add(v)):u.push([se.MessageName.CONSTRAINTS_MISSING_FIELD,`${$.structUtils.prettyWorkspace(c,v)} must have a field ${$.formatUtils.pretty(c,h,"cyan")} set to ${$.formatUtils.pretty(c,String(C),"magenta")}, but doesn't`]):JSON.stringify(b)!==C&&(w?(await qr(v,h,C),r.add(v)):u.push([se.MessageName.CONSTRAINTS_INCOMPATIBLE_FIELD,`${$.structUtils.prettyWorkspace(c,v)} must have a field ${$.formatUtils.pretty(c,h,"cyan")} set to ${$.formatUtils.pretty(c,String(C),"magenta")}, but is set to ${$.formatUtils.pretty(c,JSON.stringify(b),"magenta")} instead`])):b!=null&&(w?(await qr(v,h,null),r.add(v)):u.push([se.MessageName.CONSTRAINTS_EXTRANEOUS_FIELD,`${$.structUtils.prettyWorkspace(c,v)} has an extraneous field ${$.formatUtils.pretty(c,h,"cyan")} set to ${$.formatUtils.pretty(c,JSON.stringify(b),"magenta")}`]))}}}async function qr(r,u,p){p===null?(0,Mi.default)(r.manifest.raw,u):(0,Ri.default)(r.manifest.raw,u,JSON.parse(p))}var Iu={configuration:{constraintsPath:{description:"The path of the constraints file.",type:$i.SettingsType.ABSOLUTE_PATH,default:"./constraints.pro"}},commands:[si,oi,qi]},Eu=Iu;return Ou;})(); -return plugin; -} -}; diff --git a/.yarn/plugins/@yarnpkg/plugin-typescript.cjs b/.yarn/plugins/@yarnpkg/plugin-typescript.cjs deleted file mode 100644 index 5c1859e0b90d..000000000000 --- a/.yarn/plugins/@yarnpkg/plugin-typescript.cjs +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable */ -//prettier-ignore -module.exports = { -name: "@yarnpkg/plugin-typescript", -factory: function (require) { -var plugin=(()=>{var Ft=Object.create,H=Object.defineProperty,Bt=Object.defineProperties,Kt=Object.getOwnPropertyDescriptor,zt=Object.getOwnPropertyDescriptors,Gt=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,$t=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable;var Re=(e,t,r)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u=(e,t)=>{for(var r in t||(t={}))ne.call(t,r)&&Re(e,r,t[r]);if(Q)for(var r of Q(t))De.call(t,r)&&Re(e,r,t[r]);return e},g=(e,t)=>Bt(e,zt(t)),Lt=e=>H(e,"__esModule",{value:!0});var R=(e,t)=>{var r={};for(var s in e)ne.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&Q)for(var s of Q(e))t.indexOf(s)<0&&De.call(e,s)&&(r[s]=e[s]);return r};var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vt=(e,t)=>{for(var r in t)H(e,r,{get:t[r],enumerable:!0})},Qt=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Gt(t))!ne.call(e,s)&&s!=="default"&&H(e,s,{get:()=>t[s],enumerable:!(r=Kt(t,s))||r.enumerable});return e},C=e=>Qt(Lt(H(e!=null?Ft($t(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var xe=I(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});function _(e){let t=[...e.caches],r=t.shift();return r===void 0?ve():{get(s,n,a={miss:()=>Promise.resolve()}){return r.get(s,n,a).catch(()=>_({caches:t}).get(s,n,a))},set(s,n){return r.set(s,n).catch(()=>_({caches:t}).set(s,n))},delete(s){return r.delete(s).catch(()=>_({caches:t}).delete(s))},clear(){return r.clear().catch(()=>_({caches:t}).clear())}}}function ve(){return{get(e,t,r={miss:()=>Promise.resolve()}){return t().then(n=>Promise.all([n,r.miss(n)])).then(([n])=>n)},set(e,t){return Promise.resolve(t)},delete(e){return Promise.resolve()},clear(){return Promise.resolve()}}}J.createFallbackableCache=_;J.createNullCache=ve});var Ee=I(($s,qe)=>{qe.exports=xe()});var Te=I(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});function Jt(e={serializable:!0}){let t={};return{get(r,s,n={miss:()=>Promise.resolve()}){let a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);let o=s(),d=n&&n.miss||(()=>Promise.resolve());return o.then(y=>d(y)).then(()=>o)},set(r,s){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)},delete(r){return delete t[JSON.stringify(r)],Promise.resolve()},clear(){return t={},Promise.resolve()}}}ae.createInMemoryCache=Jt});var we=I((Vs,Me)=>{Me.exports=Te()});var Ce=I(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});function Xt(e,t,r){let s={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers(){return e===oe.WithinHeaders?s:{}},queryParameters(){return e===oe.WithinQueryParameters?s:{}}}}function Yt(e){let t=0,r=()=>(t++,new Promise(s=>{setTimeout(()=>{s(e(r))},Math.min(100*t,1e3))}));return e(r)}function ke(e,t=(r,s)=>Promise.resolve()){return Object.assign(e,{wait(r){return ke(e.then(s=>Promise.all([t(s,r),s])).then(s=>s[1]))}})}function Zt(e){let t=e.length-1;for(t;t>0;t--){let r=Math.floor(Math.random()*(t+1)),s=e[t];e[t]=e[r],e[r]=s}return e}function er(e,t){return Object.keys(t!==void 0?t:{}).forEach(r=>{e[r]=t[r](e)}),e}function tr(e,...t){let r=0;return e.replace(/%s/g,()=>encodeURIComponent(t[r++]))}var rr="4.2.0",sr=e=>()=>e.transporter.requester.destroy(),oe={WithinQueryParameters:0,WithinHeaders:1};M.AuthMode=oe;M.addMethods=er;M.createAuth=Xt;M.createRetryablePromise=Yt;M.createWaitablePromise=ke;M.destroy=sr;M.encode=tr;M.shuffle=Zt;M.version=rr});var F=I((Js,Ue)=>{Ue.exports=Ce()});var Ne=I(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});var nr={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"};ie.MethodEnum=nr});var B=I((Ys,We)=>{We.exports=Ne()});var Ze=I(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});var He=B();function ce(e,t){let r=e||{},s=r.data||{};return Object.keys(r).forEach(n=>{["timeout","headers","queryParameters","data","cacheable"].indexOf(n)===-1&&(s[n]=r[n])}),{data:Object.entries(s).length>0?s:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var X={Read:1,Write:2,Any:3},U={Up:1,Down:2,Timeouted:3},_e=2*60*1e3;function ue(e,t=U.Up){return g(u({},e),{status:t,lastUpdate:Date.now()})}function Fe(e){return e.status===U.Up||Date.now()-e.lastUpdate>_e}function Be(e){return e.status===U.Timeouted&&Date.now()-e.lastUpdate<=_e}function le(e){return{protocol:e.protocol||"https",url:e.url,accept:e.accept||X.Any}}function ar(e,t){return Promise.all(t.map(r=>e.get(r,()=>Promise.resolve(ue(r))))).then(r=>{let s=r.filter(d=>Fe(d)),n=r.filter(d=>Be(d)),a=[...s,...n],o=a.length>0?a.map(d=>le(d)):t;return{getTimeout(d,y){return(n.length===0&&d===0?1:n.length+3+d)*y},statelessHosts:o}})}var or=({isTimedOut:e,status:t})=>!e&&~~t==0,ir=e=>{let t=e.status;return e.isTimedOut||or(e)||~~(t/100)!=2&&~~(t/100)!=4},cr=({status:e})=>~~(e/100)==2,ur=(e,t)=>ir(e)?t.onRetry(e):cr(e)?t.onSucess(e):t.onFail(e);function Qe(e,t,r,s){let n=[],a=$e(r,s),o=Le(e,s),d=r.method,y=r.method!==He.MethodEnum.Get?{}:u(u({},r.data),s.data),b=u(u(u({"x-algolia-agent":e.userAgent.value},e.queryParameters),y),s.queryParameters),f=0,p=(h,S)=>{let O=h.pop();if(O===void 0)throw Ve(de(n));let P={data:a,headers:o,method:d,url:Ge(O,r.path,b),connectTimeout:S(f,e.timeouts.connect),responseTimeout:S(f,s.timeout)},x=j=>{let T={request:P,response:j,host:O,triesLeft:h.length};return n.push(T),T},v={onSucess:j=>Ke(j),onRetry(j){let T=x(j);return j.isTimedOut&&f++,Promise.all([e.logger.info("Retryable failure",pe(T)),e.hostsCache.set(O,ue(O,j.isTimedOut?U.Timeouted:U.Down))]).then(()=>p(h,S))},onFail(j){throw x(j),ze(j,de(n))}};return e.requester.send(P).then(j=>ur(j,v))};return ar(e.hostsCache,t).then(h=>p([...h.statelessHosts].reverse(),h.getTimeout))}function lr(e){let{hostsCache:t,logger:r,requester:s,requestsCache:n,responsesCache:a,timeouts:o,userAgent:d,hosts:y,queryParameters:b,headers:f}=e,p={hostsCache:t,logger:r,requester:s,requestsCache:n,responsesCache:a,timeouts:o,userAgent:d,headers:f,queryParameters:b,hosts:y.map(h=>le(h)),read(h,S){let O=ce(S,p.timeouts.read),P=()=>Qe(p,p.hosts.filter(j=>(j.accept&X.Read)!=0),h,O);if((O.cacheable!==void 0?O.cacheable:h.cacheable)!==!0)return P();let v={request:h,mappedRequestOptions:O,transporter:{queryParameters:p.queryParameters,headers:p.headers}};return p.responsesCache.get(v,()=>p.requestsCache.get(v,()=>p.requestsCache.set(v,P()).then(j=>Promise.all([p.requestsCache.delete(v),j]),j=>Promise.all([p.requestsCache.delete(v),Promise.reject(j)])).then(([j,T])=>T)),{miss:j=>p.responsesCache.set(v,j)})},write(h,S){return Qe(p,p.hosts.filter(O=>(O.accept&X.Write)!=0),h,ce(S,p.timeouts.write))}};return p}function dr(e){let t={value:`Algolia for JavaScript (${e})`,add(r){let s=`; ${r.segment}${r.version!==void 0?` (${r.version})`:""}`;return t.value.indexOf(s)===-1&&(t.value=`${t.value}${s}`),t}};return t}function Ke(e){try{return JSON.parse(e.content)}catch(t){throw Je(t.message,e)}}function ze({content:e,status:t},r){let s=e;try{s=JSON.parse(e).message}catch(n){}return Xe(s,t,r)}function pr(e,...t){let r=0;return e.replace(/%s/g,()=>encodeURIComponent(t[r++]))}function Ge(e,t,r){let s=Ye(r),n=`${e.protocol}://${e.url}/${t.charAt(0)==="/"?t.substr(1):t}`;return s.length&&(n+=`?${s}`),n}function Ye(e){let t=r=>Object.prototype.toString.call(r)==="[object Object]"||Object.prototype.toString.call(r)==="[object Array]";return Object.keys(e).map(r=>pr("%s=%s",r,t(e[r])?JSON.stringify(e[r]):e[r])).join("&")}function $e(e,t){if(e.method===He.MethodEnum.Get||e.data===void 0&&t.data===void 0)return;let r=Array.isArray(e.data)?e.data:u(u({},e.data),t.data);return JSON.stringify(r)}function Le(e,t){let r=u(u({},e.headers),t.headers),s={};return Object.keys(r).forEach(n=>{let a=r[n];s[n.toLowerCase()]=a}),s}function de(e){return e.map(t=>pe(t))}function pe(e){let t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return g(u({},e),{request:g(u({},e.request),{headers:u(u({},e.request.headers),t)})})}function Xe(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}function Je(e,t){return{name:"DeserializationError",message:e,response:t}}function Ve(e){return{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:e}}A.CallEnum=X;A.HostStatusEnum=U;A.createApiError=Xe;A.createDeserializationError=Je;A.createMappedRequestOptions=ce;A.createRetryError=Ve;A.createStatefulHost=ue;A.createStatelessHost=le;A.createTransporter=lr;A.createUserAgent=dr;A.deserializeFailure=ze;A.deserializeSuccess=Ke;A.isStatefulHostTimeouted=Be;A.isStatefulHostUp=Fe;A.serializeData=$e;A.serializeHeaders=Le;A.serializeQueryParameters=Ye;A.serializeUrl=Ge;A.stackFrameWithoutCredentials=pe;A.stackTraceWithoutCredentials=de});var K=I((en,et)=>{et.exports=Ze()});var tt=I(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});var N=F(),mr=K(),z=B(),hr=e=>{let t=e.region||"us",r=N.createAuth(N.AuthMode.WithinHeaders,e.appId,e.apiKey),s=mr.createTransporter(g(u({hosts:[{url:`analytics.${t}.algolia.com`}]},e),{headers:u(g(u({},r.headers()),{"content-type":"application/json"}),e.headers),queryParameters:u(u({},r.queryParameters()),e.queryParameters)})),n=e.appId;return N.addMethods({appId:n,transporter:s},e.methods)},yr=e=>(t,r)=>e.transporter.write({method:z.MethodEnum.Post,path:"2/abtests",data:t},r),gr=e=>(t,r)=>e.transporter.write({method:z.MethodEnum.Delete,path:N.encode("2/abtests/%s",t)},r),fr=e=>(t,r)=>e.transporter.read({method:z.MethodEnum.Get,path:N.encode("2/abtests/%s",t)},r),br=e=>t=>e.transporter.read({method:z.MethodEnum.Get,path:"2/abtests"},t),Pr=e=>(t,r)=>e.transporter.write({method:z.MethodEnum.Post,path:N.encode("2/abtests/%s/stop",t)},r);w.addABTest=yr;w.createAnalyticsClient=hr;w.deleteABTest=gr;w.getABTest=fr;w.getABTests=br;w.stopABTest=Pr});var st=I((rn,rt)=>{rt.exports=tt()});var at=I(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});var me=F(),jr=K(),nt=B(),Or=e=>{let t=e.region||"us",r=me.createAuth(me.AuthMode.WithinHeaders,e.appId,e.apiKey),s=jr.createTransporter(g(u({hosts:[{url:`recommendation.${t}.algolia.com`}]},e),{headers:u(g(u({},r.headers()),{"content-type":"application/json"}),e.headers),queryParameters:u(u({},r.queryParameters()),e.queryParameters)}));return me.addMethods({appId:e.appId,transporter:s},e.methods)},Ir=e=>t=>e.transporter.read({method:nt.MethodEnum.Get,path:"1/strategies/personalization"},t),Ar=e=>(t,r)=>e.transporter.write({method:nt.MethodEnum.Post,path:"1/strategies/personalization",data:t},r);G.createRecommendationClient=Or;G.getPersonalizationStrategy=Ir;G.setPersonalizationStrategy=Ar});var it=I((nn,ot)=>{ot.exports=at()});var jt=I(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var l=F(),q=K(),m=B(),Sr=require("crypto");function Y(e){let t=r=>e.request(r).then(s=>{if(e.batch!==void 0&&e.batch(s.hits),!e.shouldStop(s))return s.cursor?t({cursor:s.cursor}):t({page:(r.page||0)+1})});return t({})}var Dr=e=>{let t=e.appId,r=l.createAuth(e.authMode!==void 0?e.authMode:l.AuthMode.WithinHeaders,t,e.apiKey),s=q.createTransporter(g(u({hosts:[{url:`${t}-dsn.algolia.net`,accept:q.CallEnum.Read},{url:`${t}.algolia.net`,accept:q.CallEnum.Write}].concat(l.shuffle([{url:`${t}-1.algolianet.com`},{url:`${t}-2.algolianet.com`},{url:`${t}-3.algolianet.com`}]))},e),{headers:u(g(u({},r.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:u(u({},r.queryParameters()),e.queryParameters)})),n={transporter:s,appId:t,addAlgoliaAgent(a,o){s.userAgent.add({segment:a,version:o})},clearCache(){return Promise.all([s.requestsCache.clear(),s.responsesCache.clear()]).then(()=>{})}};return l.addMethods(n,e.methods)};function ct(){return{name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}}function ut(){return{name:"ObjectNotFoundError",message:"Object not found."}}function lt(){return{name:"ValidUntilNotFoundError",message:"ValidUntil not found in given secured api key."}}var Rr=e=>(t,r)=>{let d=r||{},{queryParameters:s}=d,n=R(d,["queryParameters"]),a=u({acl:t},s!==void 0?{queryParameters:s}:{}),o=(y,b)=>l.createRetryablePromise(f=>$(e)(y.key,b).catch(p=>{if(p.status!==404)throw p;return f()}));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:"1/keys",data:a},n),o)},vr=e=>(t,r,s)=>{let n=q.createMappedRequestOptions(s);return n.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:m.MethodEnum.Post,path:"1/clusters/mapping",data:{cluster:r}},n)},xr=e=>(t,r,s)=>e.transporter.write({method:m.MethodEnum.Post,path:"1/clusters/mapping/batch",data:{users:t,cluster:r}},s),Z=e=>(t,r,s)=>{let n=(a,o)=>L(e)(t,{methods:{waitTask:D}}).waitTask(a.taskID,o);return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/operation",t),data:{operation:"copy",destination:r}},s),n)},qr=e=>(t,r,s)=>Z(e)(t,r,g(u({},s),{scope:[ee.Rules]})),Er=e=>(t,r,s)=>Z(e)(t,r,g(u({},s),{scope:[ee.Settings]})),Tr=e=>(t,r,s)=>Z(e)(t,r,g(u({},s),{scope:[ee.Synonyms]})),Mr=e=>(t,r)=>{let s=(n,a)=>l.createRetryablePromise(o=>$(e)(t,a).then(o).catch(d=>{if(d.status!==404)throw d}));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Delete,path:l.encode("1/keys/%s",t)},r),s)},wr=()=>(e,t)=>{let r=q.serializeQueryParameters(t),s=Sr.createHmac("sha256",e).update(r).digest("hex");return Buffer.from(s+r).toString("base64")},$=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/keys/%s",t)},r),kr=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/logs"},t),Cr=()=>e=>{let t=Buffer.from(e,"base64").toString("ascii"),r=/validUntil=(\d+)/,s=t.match(r);if(s===null)throw lt();return parseInt(s[1],10)-Math.round(new Date().getTime()/1e3)},Ur=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/clusters/mapping/top"},t),Nr=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/clusters/mapping/%s",t)},r),Wr=e=>t=>{let n=t||{},{retrieveMappings:r}=n,s=R(n,["retrieveMappings"]);return r===!0&&(s.getClusters=!0),e.transporter.read({method:m.MethodEnum.Get,path:"1/clusters/mapping/pending"},s)},L=e=>(t,r={})=>{let s={transporter:e.transporter,appId:e.appId,indexName:t};return l.addMethods(s,r.methods)},Hr=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/keys"},t),_r=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/clusters"},t),Fr=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/indexes"},t),Br=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/clusters/mapping"},t),Kr=e=>(t,r,s)=>{let n=(a,o)=>L(e)(t,{methods:{waitTask:D}}).waitTask(a.taskID,o);return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/operation",t),data:{operation:"move",destination:r}},s),n)},zr=e=>(t,r)=>{let s=(n,a)=>Promise.all(Object.keys(n.taskID).map(o=>L(e)(o,{methods:{waitTask:D}}).waitTask(n.taskID[o],a)));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:"1/indexes/*/batch",data:{requests:t}},r),s)},Gr=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:t}},r),$r=e=>(t,r)=>{let s=t.map(n=>g(u({},n),{params:q.serializeQueryParameters(n.params||{})}));return e.transporter.read({method:m.MethodEnum.Post,path:"1/indexes/*/queries",data:{requests:s},cacheable:!0},r)},Lr=e=>(t,r)=>Promise.all(t.map(s=>{let d=s.params,{facetName:n,facetQuery:a}=d,o=R(d,["facetName","facetQuery"]);return L(e)(s.indexName,{methods:{searchForFacetValues:dt}}).searchForFacetValues(n,a,u(u({},r),o))})),Vr=e=>(t,r)=>{let s=q.createMappedRequestOptions(r);return s.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:m.MethodEnum.Delete,path:"1/clusters/mapping"},s)},Qr=e=>(t,r)=>{let s=(n,a)=>l.createRetryablePromise(o=>$(e)(t,a).catch(d=>{if(d.status!==404)throw d;return o()}));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/keys/%s/restore",t)},r),s)},Jr=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:"1/clusters/mapping/search",data:{query:t}},r),Xr=e=>(t,r)=>{let s=Object.assign({},r),f=r||{},{queryParameters:n}=f,a=R(f,["queryParameters"]),o=n?{queryParameters:n}:{},d=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"],y=p=>Object.keys(s).filter(h=>d.indexOf(h)!==-1).every(h=>p[h]===s[h]),b=(p,h)=>l.createRetryablePromise(S=>$(e)(t,h).then(O=>y(O)?Promise.resolve():S()));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Put,path:l.encode("1/keys/%s",t),data:o},a),b)},pt=e=>(t,r)=>{let s=(n,a)=>D(e)(n.taskID,a);return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/batch",e.indexName),data:{requests:t}},r),s)},Yr=e=>t=>Y(g(u({},t),{shouldStop:r=>r.cursor===void 0,request:r=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/browse",e.indexName),data:r},t)})),Zr=e=>t=>{let r=u({hitsPerPage:1e3},t);return Y(g(u({},r),{shouldStop:s=>s.hits.lengthg(u({},n),{hits:n.hits.map(a=>(delete a._highlightResult,a))}))}}))},es=e=>t=>{let r=u({hitsPerPage:1e3},t);return Y(g(u({},r),{shouldStop:s=>s.hits.lengthg(u({},n),{hits:n.hits.map(a=>(delete a._highlightResult,a))}))}}))},te=e=>(t,r,s)=>{let y=s||{},{batchSize:n}=y,a=R(y,["batchSize"]),o={taskIDs:[],objectIDs:[]},d=(b=0)=>{let f=[],p;for(p=b;p({action:r,body:h})),a).then(h=>(o.objectIDs=o.objectIDs.concat(h.objectIDs),o.taskIDs.push(h.taskID),p++,d(p)))};return l.createWaitablePromise(d(),(b,f)=>Promise.all(b.taskIDs.map(p=>D(e)(p,f))))},ts=e=>t=>l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/clear",e.indexName)},t),(r,s)=>D(e)(r.taskID,s)),rs=e=>t=>{let a=t||{},{forwardToReplicas:r}=a,s=R(a,["forwardToReplicas"]),n=q.createMappedRequestOptions(s);return r&&(n.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/rules/clear",e.indexName)},n),(o,d)=>D(e)(o.taskID,d))},ss=e=>t=>{let a=t||{},{forwardToReplicas:r}=a,s=R(a,["forwardToReplicas"]),n=q.createMappedRequestOptions(s);return r&&(n.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/synonyms/clear",e.indexName)},n),(o,d)=>D(e)(o.taskID,d))},ns=e=>(t,r)=>l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/deleteByQuery",e.indexName),data:t},r),(s,n)=>D(e)(s.taskID,n)),as=e=>t=>l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Delete,path:l.encode("1/indexes/%s",e.indexName)},t),(r,s)=>D(e)(r.taskID,s)),os=e=>(t,r)=>l.createWaitablePromise(yt(e)([t],r).then(s=>({taskID:s.taskIDs[0]})),(s,n)=>D(e)(s.taskID,n)),yt=e=>(t,r)=>{let s=t.map(n=>({objectID:n}));return te(e)(s,k.DeleteObject,r)},is=e=>(t,r)=>{let o=r||{},{forwardToReplicas:s}=o,n=R(o,["forwardToReplicas"]),a=q.createMappedRequestOptions(n);return s&&(a.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Delete,path:l.encode("1/indexes/%s/rules/%s",e.indexName,t)},a),(d,y)=>D(e)(d.taskID,y))},cs=e=>(t,r)=>{let o=r||{},{forwardToReplicas:s}=o,n=R(o,["forwardToReplicas"]),a=q.createMappedRequestOptions(n);return s&&(a.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Delete,path:l.encode("1/indexes/%s/synonyms/%s",e.indexName,t)},a),(d,y)=>D(e)(d.taskID,y))},us=e=>t=>gt(e)(t).then(()=>!0).catch(r=>{if(r.status!==404)throw r;return!1}),ls=e=>(t,r)=>{let y=r||{},{query:s,paginate:n}=y,a=R(y,["query","paginate"]),o=0,d=()=>ft(e)(s||"",g(u({},a),{page:o})).then(b=>{for(let[f,p]of Object.entries(b.hits))if(t(p))return{object:p,position:parseInt(f,10),page:o};if(o++,n===!1||o>=b.nbPages)throw ut();return d()});return d()},ds=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/%s",e.indexName,t)},r),ps=()=>(e,t)=>{for(let[r,s]of Object.entries(e.hits))if(s.objectID===t)return parseInt(r,10);return-1},ms=e=>(t,r)=>{let o=r||{},{attributesToRetrieve:s}=o,n=R(o,["attributesToRetrieve"]),a=t.map(d=>u({indexName:e.indexName,objectID:d},s?{attributesToRetrieve:s}:{}));return e.transporter.read({method:m.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:a}},n)},hs=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/rules/%s",e.indexName,t)},r),gt=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/settings",e.indexName),data:{getVersion:2}},t),ys=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/synonyms/%s",e.indexName,t)},r),bt=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/task/%s",e.indexName,t.toString())},r),gs=e=>(t,r)=>l.createWaitablePromise(Pt(e)([t],r).then(s=>({objectID:s.objectIDs[0],taskID:s.taskIDs[0]})),(s,n)=>D(e)(s.taskID,n)),Pt=e=>(t,r)=>{let o=r||{},{createIfNotExists:s}=o,n=R(o,["createIfNotExists"]),a=s?k.PartialUpdateObject:k.PartialUpdateObjectNoCreate;return te(e)(t,a,n)},fs=e=>(t,r)=>{let O=r||{},{safe:s,autoGenerateObjectIDIfNotExist:n,batchSize:a}=O,o=R(O,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),d=(P,x,v,j)=>l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/operation",P),data:{operation:v,destination:x}},j),(T,V)=>D(e)(T.taskID,V)),y=Math.random().toString(36).substring(7),b=`${e.indexName}_tmp_${y}`,f=he({appId:e.appId,transporter:e.transporter,indexName:b}),p=[],h=d(e.indexName,b,"copy",g(u({},o),{scope:["settings","synonyms","rules"]}));p.push(h);let S=(s?h.wait(o):h).then(()=>{let P=f(t,g(u({},o),{autoGenerateObjectIDIfNotExist:n,batchSize:a}));return p.push(P),s?P.wait(o):P}).then(()=>{let P=d(b,e.indexName,"move",o);return p.push(P),s?P.wait(o):P}).then(()=>Promise.all(p)).then(([P,x,v])=>({objectIDs:x.objectIDs,taskIDs:[P.taskID,...x.taskIDs,v.taskID]}));return l.createWaitablePromise(S,(P,x)=>Promise.all(p.map(v=>v.wait(x))))},bs=e=>(t,r)=>ye(e)(t,g(u({},r),{clearExistingRules:!0})),Ps=e=>(t,r)=>ge(e)(t,g(u({},r),{replaceExistingSynonyms:!0})),js=e=>(t,r)=>l.createWaitablePromise(he(e)([t],r).then(s=>({objectID:s.objectIDs[0],taskID:s.taskIDs[0]})),(s,n)=>D(e)(s.taskID,n)),he=e=>(t,r)=>{let o=r||{},{autoGenerateObjectIDIfNotExist:s}=o,n=R(o,["autoGenerateObjectIDIfNotExist"]),a=s?k.AddObject:k.UpdateObject;if(a===k.UpdateObject){for(let d of t)if(d.objectID===void 0)return l.createWaitablePromise(Promise.reject(ct()))}return te(e)(t,a,n)},Os=e=>(t,r)=>ye(e)([t],r),ye=e=>(t,r)=>{let d=r||{},{forwardToReplicas:s,clearExistingRules:n}=d,a=R(d,["forwardToReplicas","clearExistingRules"]),o=q.createMappedRequestOptions(a);return s&&(o.queryParameters.forwardToReplicas=1),n&&(o.queryParameters.clearExistingRules=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/rules/batch",e.indexName),data:t},o),(y,b)=>D(e)(y.taskID,b))},Is=e=>(t,r)=>ge(e)([t],r),ge=e=>(t,r)=>{let d=r||{},{forwardToReplicas:s,replaceExistingSynonyms:n}=d,a=R(d,["forwardToReplicas","replaceExistingSynonyms"]),o=q.createMappedRequestOptions(a);return s&&(o.queryParameters.forwardToReplicas=1),n&&(o.queryParameters.replaceExistingSynonyms=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/synonyms/batch",e.indexName),data:t},o),(y,b)=>D(e)(y.taskID,b))},ft=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r),dt=e=>(t,r,s)=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},s),mt=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/rules/search",e.indexName),data:{query:t}},r),ht=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/synonyms/search",e.indexName),data:{query:t}},r),As=e=>(t,r)=>{let o=r||{},{forwardToReplicas:s}=o,n=R(o,["forwardToReplicas"]),a=q.createMappedRequestOptions(n);return s&&(a.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Put,path:l.encode("1/indexes/%s/settings",e.indexName),data:t},a),(d,y)=>D(e)(d.taskID,y))},D=e=>(t,r)=>l.createRetryablePromise(s=>bt(e)(t,r).then(n=>n.status!=="published"?s():void 0)),Ss={AddObject:"addObject",Analytics:"analytics",Browser:"browse",DeleteIndex:"deleteIndex",DeleteObject:"deleteObject",EditSettings:"editSettings",ListIndexes:"listIndexes",Logs:"logs",Recommendation:"recommendation",Search:"search",SeeUnretrievableAttributes:"seeUnretrievableAttributes",Settings:"settings",Usage:"usage"},k={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject"},ee={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},Ds={None:"none",StopIfEnoughMatches:"stopIfEnoughMatches"},Rs={Synonym:"synonym",OneWaySynonym:"oneWaySynonym",AltCorrection1:"altCorrection1",AltCorrection2:"altCorrection2",Placeholder:"placeholder"};i.ApiKeyACLEnum=Ss;i.BatchActionEnum=k;i.ScopeEnum=ee;i.StrategyEnum=Ds;i.SynonymEnum=Rs;i.addApiKey=Rr;i.assignUserID=vr;i.assignUserIDs=xr;i.batch=pt;i.browseObjects=Yr;i.browseRules=Zr;i.browseSynonyms=es;i.chunkedBatch=te;i.clearObjects=ts;i.clearRules=rs;i.clearSynonyms=ss;i.copyIndex=Z;i.copyRules=qr;i.copySettings=Er;i.copySynonyms=Tr;i.createBrowsablePromise=Y;i.createMissingObjectIDError=ct;i.createObjectNotFoundError=ut;i.createSearchClient=Dr;i.createValidUntilNotFoundError=lt;i.deleteApiKey=Mr;i.deleteBy=ns;i.deleteIndex=as;i.deleteObject=os;i.deleteObjects=yt;i.deleteRule=is;i.deleteSynonym=cs;i.exists=us;i.findObject=ls;i.generateSecuredApiKey=wr;i.getApiKey=$;i.getLogs=kr;i.getObject=ds;i.getObjectPosition=ps;i.getObjects=ms;i.getRule=hs;i.getSecuredApiKeyRemainingValidity=Cr;i.getSettings=gt;i.getSynonym=ys;i.getTask=bt;i.getTopUserIDs=Ur;i.getUserID=Nr;i.hasPendingMappings=Wr;i.initIndex=L;i.listApiKeys=Hr;i.listClusters=_r;i.listIndices=Fr;i.listUserIDs=Br;i.moveIndex=Kr;i.multipleBatch=zr;i.multipleGetObjects=Gr;i.multipleQueries=$r;i.multipleSearchForFacetValues=Lr;i.partialUpdateObject=gs;i.partialUpdateObjects=Pt;i.removeUserID=Vr;i.replaceAllObjects=fs;i.replaceAllRules=bs;i.replaceAllSynonyms=Ps;i.restoreApiKey=Qr;i.saveObject=js;i.saveObjects=he;i.saveRule=Os;i.saveRules=ye;i.saveSynonym=Is;i.saveSynonyms=ge;i.search=ft;i.searchForFacetValues=dt;i.searchRules=mt;i.searchSynonyms=ht;i.searchUserIDs=Jr;i.setSettings=As;i.updateApiKey=Xr;i.waitTask=D});var It=I((on,Ot)=>{Ot.exports=jt()});var At=I(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});function vs(){return{debug(e,t){return Promise.resolve()},info(e,t){return Promise.resolve()},error(e,t){return Promise.resolve()}}}var xs={Debug:1,Info:2,Error:3};re.LogLevelEnum=xs;re.createNullLogger=vs});var Dt=I((un,St)=>{St.exports=At()});var xt=I(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});var Rt=require("http"),vt=require("https"),qs=require("url");function Es(){let e={keepAlive:!0},t=new Rt.Agent(e),r=new vt.Agent(e);return{send(s){return new Promise(n=>{let a=qs.parse(s.url),o=a.query===null?a.pathname:`${a.pathname}?${a.query}`,d=u({agent:a.protocol==="https:"?r:t,hostname:a.hostname,path:o,method:s.method,headers:s.headers},a.port!==void 0?{port:a.port||""}:{}),y=(a.protocol==="https:"?vt:Rt).request(d,h=>{let S="";h.on("data",O=>S+=O),h.on("end",()=>{clearTimeout(f),clearTimeout(p),n({status:h.statusCode||0,content:S,isTimedOut:!1})})}),b=(h,S)=>setTimeout(()=>{y.abort(),n({status:0,content:S,isTimedOut:!0})},h*1e3),f=b(s.connectTimeout,"Connection timeout"),p;y.on("error",h=>{clearTimeout(f),clearTimeout(p),n({status:0,content:h.message,isTimedOut:!1})}),y.once("response",()=>{clearTimeout(f),p=b(s.responseTimeout,"Socket timeout")}),s.data!==void 0&&y.write(s.data),y.end()})},destroy(){return t.destroy(),r.destroy(),Promise.resolve()}}}fe.createNodeHttpRequester=Es});var Et=I((dn,qt)=>{qt.exports=xt()});var kt=I((pn,Tt)=>{"use strict";var Mt=Ee(),Ts=we(),W=st(),be=F(),Pe=it(),c=It(),Ms=Dt(),ws=Et(),ks=K();function wt(e,t,r){let s={appId:e,apiKey:t,timeouts:{connect:2,read:5,write:30},requester:ws.createNodeHttpRequester(),logger:Ms.createNullLogger(),responsesCache:Mt.createNullCache(),requestsCache:Mt.createNullCache(),hostsCache:Ts.createInMemoryCache(),userAgent:ks.createUserAgent(be.version).add({segment:"Node.js",version:process.versions.node})};return c.createSearchClient(g(u(u({},s),r),{methods:{search:c.multipleQueries,searchForFacetValues:c.multipleSearchForFacetValues,multipleBatch:c.multipleBatch,multipleGetObjects:c.multipleGetObjects,multipleQueries:c.multipleQueries,copyIndex:c.copyIndex,copySettings:c.copySettings,copyRules:c.copyRules,copySynonyms:c.copySynonyms,moveIndex:c.moveIndex,listIndices:c.listIndices,getLogs:c.getLogs,listClusters:c.listClusters,multipleSearchForFacetValues:c.multipleSearchForFacetValues,getApiKey:c.getApiKey,addApiKey:c.addApiKey,listApiKeys:c.listApiKeys,updateApiKey:c.updateApiKey,deleteApiKey:c.deleteApiKey,restoreApiKey:c.restoreApiKey,assignUserID:c.assignUserID,assignUserIDs:c.assignUserIDs,getUserID:c.getUserID,searchUserIDs:c.searchUserIDs,listUserIDs:c.listUserIDs,getTopUserIDs:c.getTopUserIDs,removeUserID:c.removeUserID,hasPendingMappings:c.hasPendingMappings,generateSecuredApiKey:c.generateSecuredApiKey,getSecuredApiKeyRemainingValidity:c.getSecuredApiKeyRemainingValidity,destroy:be.destroy,initIndex:n=>a=>c.initIndex(n)(a,{methods:{batch:c.batch,delete:c.deleteIndex,getObject:c.getObject,getObjects:c.getObjects,saveObject:c.saveObject,saveObjects:c.saveObjects,search:c.search,searchForFacetValues:c.searchForFacetValues,waitTask:c.waitTask,setSettings:c.setSettings,getSettings:c.getSettings,partialUpdateObject:c.partialUpdateObject,partialUpdateObjects:c.partialUpdateObjects,deleteObject:c.deleteObject,deleteObjects:c.deleteObjects,deleteBy:c.deleteBy,clearObjects:c.clearObjects,browseObjects:c.browseObjects,getObjectPosition:c.getObjectPosition,findObject:c.findObject,exists:c.exists,saveSynonym:c.saveSynonym,saveSynonyms:c.saveSynonyms,getSynonym:c.getSynonym,searchSynonyms:c.searchSynonyms,browseSynonyms:c.browseSynonyms,deleteSynonym:c.deleteSynonym,clearSynonyms:c.clearSynonyms,replaceAllObjects:c.replaceAllObjects,replaceAllSynonyms:c.replaceAllSynonyms,searchRules:c.searchRules,getRule:c.getRule,deleteRule:c.deleteRule,saveRule:c.saveRule,saveRules:c.saveRules,replaceAllRules:c.replaceAllRules,browseRules:c.browseRules,clearRules:c.clearRules}}),initAnalytics:()=>n=>W.createAnalyticsClient(g(u(u({},s),n),{methods:{addABTest:W.addABTest,getABTest:W.getABTest,getABTests:W.getABTests,stopABTest:W.stopABTest,deleteABTest:W.deleteABTest}})),initRecommendation:()=>n=>Pe.createRecommendationClient(g(u(u({},s),n),{methods:{getPersonalizationStrategy:Pe.getPersonalizationStrategy,setPersonalizationStrategy:Pe.setPersonalizationStrategy}}))}}))}wt.version=be.version;Tt.exports=wt});var Ut=I((mn,je)=>{var Ct=kt();je.exports=Ct;je.exports.default=Ct});var Ws={};Vt(Ws,{default:()=>Ks});var Oe=C(require("@yarnpkg/core")),E=C(require("@yarnpkg/core")),Ie=C(require("@yarnpkg/plugin-essentials")),Ht=C(require("semver"));var se=C(require("@yarnpkg/core")),Nt=C(Ut()),Cs="e8e1bd300d860104bb8c58453ffa1eb4",Us="OFCNCOG2CU",Wt=async(e,t)=>{var a;let r=se.structUtils.stringifyIdent(e),n=Ns(t).initIndex("npm-search");try{return((a=(await n.getObject(r,{attributesToRetrieve:["types"]})).types)==null?void 0:a.ts)==="definitely-typed"}catch(o){return!1}},Ns=e=>(0,Nt.default)(Us,Cs,{requester:{async send(r){try{let s=await se.httpUtils.request(r.url,r.data||null,{configuration:e,headers:r.headers});return{content:s.body,isTimedOut:!1,status:s.statusCode}}catch(s){return{content:s.response.body,isTimedOut:!1,status:s.response.statusCode}}}}});var _t=e=>e.scope?`${e.scope}__${e.name}`:`${e.name}`,Hs=async(e,t,r,s)=>{if(r.scope==="types")return;let{project:n}=e,{configuration:a}=n,o=a.makeResolver(),d={project:n,resolver:o,report:new E.ThrowReport};if(!await Wt(r,a))return;let b=_t(r),f=E.structUtils.parseRange(r.range).selector;if(!E.semverUtils.validRange(f)){let P=await o.getCandidates(r,new Map,d);f=E.structUtils.parseRange(P[0].reference).selector}let p=Ht.default.coerce(f);if(p===null)return;let h=`${Ie.suggestUtils.Modifier.CARET}${p.major}`,S=E.structUtils.makeDescriptor(E.structUtils.makeIdent("types",b),h),O=E.miscUtils.mapAndFind(n.workspaces,P=>{var T,V;let x=(T=P.manifest.dependencies.get(r.identHash))==null?void 0:T.descriptorHash,v=(V=P.manifest.devDependencies.get(r.identHash))==null?void 0:V.descriptorHash;if(x!==r.descriptorHash&&v!==r.descriptorHash)return E.miscUtils.mapAndFind.skip;let j=[];for(let Ae of Oe.Manifest.allDependencies){let Se=P.manifest[Ae].get(S.identHash);typeof Se!="undefined"&&j.push([Ae,Se])}return j.length===0?E.miscUtils.mapAndFind.skip:j});if(typeof O!="undefined")for(let[P,x]of O)e.manifest[P].set(x.identHash,x);else{try{if((await o.getCandidates(S,new Map,d)).length===0)return}catch{return}e.manifest[Ie.suggestUtils.Target.DEVELOPMENT].set(S.identHash,S)}},_s=async(e,t,r)=>{if(r.scope==="types")return;let s=_t(r),n=E.structUtils.makeIdent("types",s);for(let a of Oe.Manifest.allDependencies)typeof e.manifest[a].get(n.identHash)!="undefined"&&e.manifest[a].delete(n.identHash)},Fs=(e,t)=>{t.publishConfig&&t.publishConfig.typings&&(t.typings=t.publishConfig.typings),t.publishConfig&&t.publishConfig.types&&(t.types=t.publishConfig.types)},Bs={hooks:{afterWorkspaceDependencyAddition:Hs,afterWorkspaceDependencyRemoval:_s,beforeWorkspacePacking:Fs}},Ks=Bs;return Ws;})(); -return plugin; -} -}; diff --git a/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs b/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs deleted file mode 100644 index 799c5be98b78..000000000000 --- a/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint-disable */ -//prettier-ignore -module.exports = { -name: "@yarnpkg/plugin-workspace-tools", -factory: function (require) { -var plugin=(()=>{var Cr=Object.create,ge=Object.defineProperty,wr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptor,vr=Object.getOwnPropertyDescriptors,Hr=Object.getOwnPropertyNames,Je=Object.getOwnPropertySymbols,$r=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty,Tr=Object.prototype.propertyIsEnumerable;var tt=(e,t,r)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,N=(e,t)=>{for(var r in t||(t={}))et.call(t,r)&&tt(e,r,t[r]);if(Je)for(var r of Je(t))Tr.call(t,r)&&tt(e,r,t[r]);return e},Q=(e,t)=>wr(e,vr(t)),kr=e=>ge(e,"__esModule",{value:!0});var q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Lr=(e,t)=>{for(var r in t)ge(e,r,{get:t[r],enumerable:!0})},Or=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Hr(t))!et.call(e,n)&&n!=="default"&&ge(e,n,{get:()=>t[n],enumerable:!(r=Sr(t,n))||r.enumerable});return e},Y=e=>Or(kr(ge(e!=null?Cr($r(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var He=q(J=>{"use strict";J.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;J.find=(e,t)=>e.nodes.find(r=>r.type===t);J.exceedsLimit=(e,t,r=1,n)=>n===!1||!J.isInteger(e)||!J.isInteger(t)?!1:(Number(t)-Number(e))/Number(r)>=n;J.escapeNode=(e,t=0,r)=>{let n=e.nodes[t];!n||(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};J.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0==0?(e.invalid=!0,!0):!1;J.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0==0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;J.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;J.reduce=e=>e.reduce((t,r)=>(r.type==="text"&&t.push(r.value),r.type==="range"&&(r.type="text"),t),[]);J.flatten=(...e)=>{let t=[],r=n=>{for(let s=0;s{"use strict";var at=He();st.exports=(e,t={})=>{let r=(n,s={})=>{let a=t.escapeInvalid&&at.isInvalidBrace(s),i=n.invalid===!0&&t.escapeInvalid===!0,o="";if(n.value)return(a||i)&&at.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let h of n.nodes)o+=r(h);return o};return r(e)}});var ot=q((is,it)=>{"use strict";it.exports=function(e){return typeof e=="number"?e-e==0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var At=q((os,ut)=>{"use strict";var ct=ot(),pe=(e,t,r)=>{if(ct(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(t===void 0||e===t)return String(e);if(ct(t)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n=N({relaxZeros:!0},r);typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let s=String(n.relaxZeros),a=String(n.shorthand),i=String(n.capture),o=String(n.wrap),h=e+":"+t+"="+s+a+i+o;if(pe.cache.hasOwnProperty(h))return pe.cache[h].result;let A=Math.min(e,t),f=Math.max(e,t);if(Math.abs(A-f)===1){let R=e+"|"+t;return n.capture?`(${R})`:n.wrap===!1?R:`(?:${R})`}let m=pt(e)||pt(t),p={min:e,max:t,a:A,b:f},H=[],_=[];if(m&&(p.isPadded=m,p.maxLen=String(p.max).length),A<0){let R=f<0?Math.abs(f):1;_=lt(R,Math.abs(A),p,n),A=p.a=0}return f>=0&&(H=lt(A,f,p,n)),p.negatives=_,p.positives=H,p.result=Nr(_,H,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&H.length+_.length>1&&(p.result=`(?:${p.result})`),pe.cache[h]=p,p.result};function Nr(e,t,r){let n=Pe(e,t,"-",!1,r)||[],s=Pe(t,e,"",!1,r)||[],a=Pe(e,t,"-?",!0,r)||[];return n.concat(a).concat(s).join("|")}function Br(e,t){let r=1,n=1,s=ft(e,r),a=new Set([t]);for(;e<=s&&s<=t;)a.add(s),r+=1,s=ft(e,r);for(s=ht(t+1,n)-1;e1&&o.count.pop(),o.count.push(f.count[0]),o.string=o.pattern+dt(o.count),i=A+1;continue}r.isPadded&&(m=Gr(A,r,n)),f.string=m+f.pattern+dt(f.count),a.push(f),i=A+1,o=f}return a}function Pe(e,t,r,n,s){let a=[];for(let i of e){let{string:o}=i;!n&&!gt(t,"string",o)&&a.push(r+o),n&>(t,"string",o)&&a.push(r+o)}return a}function Mr(e,t){let r=[];for(let n=0;nt?1:t>e?-1:0}function gt(e,t,r){return e.some(n=>n[t]===r)}function ft(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function ht(e,t){return e-e%Math.pow(10,t)}function dt(e){let[t=0,r=""]=e;return r||t>1?`{${t+(r?","+r:"")}}`:""}function Pr(e,t,r){return`[${e}${t-e==1?"":"-"}${t}]`}function pt(e){return/^-?(0+)\d/.test(e)}function Gr(e,t,r){if(!t.isPadded)return e;let n=Math.abs(t.maxLen-String(e).length),s=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${n}}`:`0{${n}}`}}pe.cache={};pe.clearCache=()=>pe.cache={};ut.exports=pe});var Ue=q((us,mt)=>{"use strict";var Ur=require("util"),Rt=At(),yt=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),qr=e=>t=>e===!0?Number(t):String(t),De=e=>typeof e=="number"||typeof e=="string"&&e!=="",me=e=>Number.isInteger(+e),Ge=e=>{let t=`${e}`,r=-1;if(t[0]==="-"&&(t=t.slice(1)),t==="0")return!1;for(;t[++r]==="0";);return r>0},Kr=(e,t,r)=>typeof e=="string"||typeof t=="string"?!0:r.stringify===!0,Wr=(e,t,r)=>{if(t>0){let n=e[0]==="-"?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return r===!1?String(e):e},_t=(e,t)=>{let r=e[0]==="-"?"-":"";for(r&&(e=e.slice(1),t--);e.length{e.negatives.sort((i,o)=>io?1:0),e.positives.sort((i,o)=>io?1:0);let r=t.capture?"":"?:",n="",s="",a;return e.positives.length&&(n=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n&&s?a=`${n}|${s}`:a=n||s,t.wrap?`(${r}${a})`:a},Et=(e,t,r,n)=>{if(r)return Rt(e,t,N({wrap:!1},n));let s=String.fromCharCode(e);if(e===t)return s;let a=String.fromCharCode(t);return`[${s}-${a}]`},xt=(e,t,r)=>{if(Array.isArray(e)){let n=r.wrap===!0,s=r.capture?"":"?:";return n?`(${s}${e.join("|")})`:e.join("|")}return Rt(e,t,r)},bt=(...e)=>new RangeError("Invalid range arguments: "+Ur.inspect(...e)),Ct=(e,t,r)=>{if(r.strictRanges===!0)throw bt([e,t]);return[]},Fr=(e,t)=>{if(t.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},Qr=(e,t,r=1,n={})=>{let s=Number(e),a=Number(t);if(!Number.isInteger(s)||!Number.isInteger(a)){if(n.strictRanges===!0)throw bt([e,t]);return[]}s===0&&(s=0),a===0&&(a=0);let i=s>a,o=String(e),h=String(t),A=String(r);r=Math.max(Math.abs(r),1);let f=Ge(o)||Ge(h)||Ge(A),m=f?Math.max(o.length,h.length,A.length):0,p=f===!1&&Kr(e,t,n)===!1,H=n.transform||qr(p);if(n.toRegex&&r===1)return Et(_t(e,m),_t(t,m),!0,n);let _={negatives:[],positives:[]},R=T=>_[T<0?"negatives":"positives"].push(Math.abs(T)),b=[],C=0;for(;i?s>=a:s<=a;)n.toRegex===!0&&r>1?R(s):b.push(Wr(H(s,C),m,p)),s=i?s-r:s+r,C++;return n.toRegex===!0?r>1?jr(_,n):xt(b,null,N({wrap:!1},n)):b},Xr=(e,t,r=1,n={})=>{if(!me(e)&&e.length>1||!me(t)&&t.length>1)return Ct(e,t,n);let s=n.transform||(p=>String.fromCharCode(p)),a=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),o=a>i,h=Math.min(a,i),A=Math.max(a,i);if(n.toRegex&&r===1)return Et(h,A,!1,n);let f=[],m=0;for(;o?a>=i:a<=i;)f.push(s(a,m)),a=o?a-r:a+r,m++;return n.toRegex===!0?xt(f,null,{wrap:!1,options:n}):f},Te=(e,t,r,n={})=>{if(t==null&&De(e))return[e];if(!De(e)||!De(t))return Ct(e,t,n);if(typeof r=="function")return Te(e,t,1,{transform:r});if(yt(r))return Te(e,t,0,r);let s=N({},n);return s.capture===!0&&(s.wrap=!0),r=r||s.step||1,me(r)?me(e)&&me(t)?Qr(e,t,r,s):Xr(e,t,Math.max(Math.abs(r),1),s):r!=null&&!yt(r)?Fr(r,s):Te(e,t,1,r)};mt.exports=Te});var vt=q((cs,wt)=>{"use strict";var Zr=Ue(),St=He(),Yr=(e,t={})=>{let r=(n,s={})=>{let a=St.isInvalidBrace(s),i=n.invalid===!0&&t.escapeInvalid===!0,o=a===!0||i===!0,h=t.escapeInvalid===!0?"\\":"",A="";if(n.isOpen===!0||n.isClose===!0)return h+n.value;if(n.type==="open")return o?h+n.value:"(";if(n.type==="close")return o?h+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":o?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let f=St.reduce(n.nodes),m=Zr(...f,Q(N({},t),{wrap:!1,toRegex:!0}));if(m.length!==0)return f.length>1&&m.length>1?`(${m})`:m}if(n.nodes)for(let f of n.nodes)A+=r(f,n);return A};return r(e)};wt.exports=Yr});var Tt=q((ls,Ht)=>{"use strict";var zr=Ue(),$t=$e(),he=He(),fe=(e="",t="",r=!1)=>{let n=[];if(e=[].concat(e),t=[].concat(t),!t.length)return e;if(!e.length)return r?he.flatten(t).map(s=>`{${s}}`):t;for(let s of e)if(Array.isArray(s))for(let a of s)n.push(fe(a,t,r));else for(let a of t)r===!0&&typeof a=="string"&&(a=`{${a}}`),n.push(Array.isArray(a)?fe(s,a,r):s+a);return he.flatten(n)},Vr=(e,t={})=>{let r=t.rangeLimit===void 0?1e3:t.rangeLimit,n=(s,a={})=>{s.queue=[];let i=a,o=a.queue;for(;i.type!=="brace"&&i.type!=="root"&&i.parent;)i=i.parent,o=i.queue;if(s.invalid||s.dollar){o.push(fe(o.pop(),$t(s,t)));return}if(s.type==="brace"&&s.invalid!==!0&&s.nodes.length===2){o.push(fe(o.pop(),["{}"]));return}if(s.nodes&&s.ranges>0){let m=he.reduce(s.nodes);if(he.exceedsLimit(...m,t.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=zr(...m,t);p.length===0&&(p=$t(s,t)),o.push(fe(o.pop(),p)),s.nodes=[];return}let h=he.encloseBrace(s),A=s.queue,f=s;for(;f.type!=="brace"&&f.type!=="root"&&f.parent;)f=f.parent,A=f.queue;for(let m=0;m{"use strict";kt.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:` -`,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 Mt=q((fs,Ot)=>{"use strict";var Jr=$e(),{MAX_LENGTH:Nt,CHAR_BACKSLASH:qe,CHAR_BACKTICK:en,CHAR_COMMA:tn,CHAR_DOT:rn,CHAR_LEFT_PARENTHESES:nn,CHAR_RIGHT_PARENTHESES:sn,CHAR_LEFT_CURLY_BRACE:an,CHAR_RIGHT_CURLY_BRACE:on,CHAR_LEFT_SQUARE_BRACKET:It,CHAR_RIGHT_SQUARE_BRACKET:Bt,CHAR_DOUBLE_QUOTE:un,CHAR_SINGLE_QUOTE:cn,CHAR_NO_BREAK_SPACE:ln,CHAR_ZERO_WIDTH_NOBREAK_SPACE:pn}=Lt(),fn=(e,t={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let r=t||{},n=typeof r.maxLength=="number"?Math.min(Nt,r.maxLength):Nt;if(e.length>n)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${n})`);let s={type:"root",input:e,nodes:[]},a=[s],i=s,o=s,h=0,A=e.length,f=0,m=0,p,H={},_=()=>e[f++],R=b=>{if(b.type==="text"&&o.type==="dot"&&(o.type="text"),o&&o.type==="text"&&b.type==="text"){o.value+=b.value;return}return i.nodes.push(b),b.parent=i,b.prev=o,o=b,b};for(R({type:"bos"});f0){if(i.ranges>0){i.ranges=0;let b=i.nodes.shift();i.nodes=[b,{type:"text",value:Jr(i)}]}R({type:"comma",value:p}),i.commas++;continue}if(p===rn&&m>0&&i.commas===0){let b=i.nodes;if(m===0||b.length===0){R({type:"text",value:p});continue}if(o.type==="dot"){if(i.range=[],o.value+=p,o.type="range",i.nodes.length!==3&&i.nodes.length!==5){i.invalid=!0,i.ranges=0,o.type="text";continue}i.ranges++,i.args=[];continue}if(o.type==="range"){b.pop();let C=b[b.length-1];C.value+=o.value+p,o=C,i.ranges--;continue}R({type:"dot",value:p});continue}R({type:"text",value:p})}do if(i=a.pop(),i.type!=="root"){i.nodes.forEach(T=>{T.nodes||(T.type==="open"&&(T.isOpen=!0),T.type==="close"&&(T.isClose=!0),T.nodes||(T.type="text"),T.invalid=!0)});let b=a[a.length-1],C=b.nodes.indexOf(i);b.nodes.splice(C,1,...i.nodes)}while(a.length>0);return R({type:"eos"}),s};Ot.exports=fn});var Gt=q((hs,Pt)=>{"use strict";var Dt=$e(),hn=vt(),dn=Tt(),gn=Mt(),z=(e,t={})=>{let r=[];if(Array.isArray(e))for(let n of e){let s=z.create(n,t);Array.isArray(s)?r.push(...s):r.push(s)}else r=[].concat(z.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(r=[...new Set(r)]),r};z.parse=(e,t={})=>gn(e,t);z.stringify=(e,t={})=>typeof e=="string"?Dt(z.parse(e,t),t):Dt(e,t);z.compile=(e,t={})=>(typeof e=="string"&&(e=z.parse(e,t)),hn(e,t));z.expand=(e,t={})=>{typeof e=="string"&&(e=z.parse(e,t));let r=dn(e,t);return t.noempty===!0&&(r=r.filter(Boolean)),t.nodupes===!0&&(r=[...new Set(r)]),r};z.create=(e,t={})=>e===""||e.length<3?[e]:t.expand!==!0?z.compile(e,t):z.expand(e,t);Pt.exports=z});var Re=q((ds,Ut)=>{"use strict";var An=require("path"),se="\\\\/",qt=`[^${se}]`,oe="\\.",mn="\\+",Rn="\\?",ke="\\/",yn="(?=.)",Kt="[^/]",Ke=`(?:${ke}|$)`,Wt=`(?:^|${ke})`,We=`${oe}{1,2}${Ke}`,_n=`(?!${oe})`,En=`(?!${Wt}${We})`,xn=`(?!${oe}{0,1}${Ke})`,bn=`(?!${We})`,Cn=`[^.${ke}]`,wn=`${Kt}*?`,jt={DOT_LITERAL:oe,PLUS_LITERAL:mn,QMARK_LITERAL:Rn,SLASH_LITERAL:ke,ONE_CHAR:yn,QMARK:Kt,END_ANCHOR:Ke,DOTS_SLASH:We,NO_DOT:_n,NO_DOTS:En,NO_DOT_SLASH:xn,NO_DOTS_SLASH:bn,QMARK_NO_DOT:Cn,STAR:wn,START_ANCHOR:Wt},Sn=Q(N({},jt),{SLASH_LITERAL:`[${se}]`,QMARK:qt,STAR:`${qt}*?`,DOTS_SLASH:`${oe}{1,2}(?:[${se}]|$)`,NO_DOT:`(?!${oe})`,NO_DOTS:`(?!(?:^|[${se}])${oe}{1,2}(?:[${se}]|$))`,NO_DOT_SLASH:`(?!${oe}{0,1}(?:[${se}]|$))`,NO_DOTS_SLASH:`(?!${oe}{1,2}(?:[${se}]|$))`,QMARK_NO_DOT:`[^.${se}]`,START_ANCHOR:`(?:^|[${se}])`,END_ANCHOR:`(?:[${se}]|$)`}),vn={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:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Ut.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:vn,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:An.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?Sn:jt}}});var ye=q(X=>{"use strict";var Hn=require("path"),$n=process.platform==="win32",{REGEX_BACKSLASH:Tn,REGEX_REMOVE_BACKSLASH:kn,REGEX_SPECIAL_CHARS:Ln,REGEX_SPECIAL_CHARS_GLOBAL:On}=Re();X.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);X.hasRegexChars=e=>Ln.test(e);X.isRegexChar=e=>e.length===1&&X.hasRegexChars(e);X.escapeRegex=e=>e.replace(On,"\\$1");X.toPosixSlashes=e=>e.replace(Tn,"/");X.removeBackslashes=e=>e.replace(kn,t=>t==="\\"?"":t);X.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};X.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:$n===!0||Hn.sep==="\\";X.escapeLast=(e,t,r)=>{let n=e.lastIndexOf(t,r);return n===-1?e:e[n-1]==="\\"?X.escapeLast(e,t,n-1):`${e.slice(0,n)}\\${e.slice(n)}`};X.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r};X.wrapOutput=(e,t={},r={})=>{let n=r.contains?"":"^",s=r.contains?"":"$",a=`${n}(?:${e})${s}`;return t.negated===!0&&(a=`(?:^(?!${a}).*$)`),a}});var er=q((As,Ft)=>{"use strict";var Qt=ye(),{CHAR_ASTERISK:je,CHAR_AT:Nn,CHAR_BACKWARD_SLASH:_e,CHAR_COMMA:In,CHAR_DOT:Fe,CHAR_EXCLAMATION_MARK:Xt,CHAR_FORWARD_SLASH:Zt,CHAR_LEFT_CURLY_BRACE:Qe,CHAR_LEFT_PARENTHESES:Xe,CHAR_LEFT_SQUARE_BRACKET:Bn,CHAR_PLUS:Mn,CHAR_QUESTION_MARK:Yt,CHAR_RIGHT_CURLY_BRACE:Pn,CHAR_RIGHT_PARENTHESES:zt,CHAR_RIGHT_SQUARE_BRACKET:Dn}=Re(),Vt=e=>e===Zt||e===_e,Jt=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?Infinity:1)},Gn=(e,t)=>{let r=t||{},n=e.length-1,s=r.parts===!0||r.scanToEnd===!0,a=[],i=[],o=[],h=e,A=-1,f=0,m=0,p=!1,H=!1,_=!1,R=!1,b=!1,C=!1,T=!1,k=!1,E=!1,ee=0,j,y,x={value:"",depth:0,isGlob:!1},M=()=>A>=n,$=()=>h.charCodeAt(A+1),u=()=>(j=y,h.charCodeAt(++A));for(;A0&&(W=h.slice(0,f),h=h.slice(f),m-=f),w&&_===!0&&m>0?(w=h.slice(0,m),P=h.slice(m)):_===!0?(w="",P=h):w=h,w&&w!==""&&w!=="/"&&w!==h&&Vt(w.charCodeAt(w.length-1))&&(w=w.slice(0,-1)),r.unescape===!0&&(P&&(P=Qt.removeBackslashes(P)),w&&T===!0&&(w=Qt.removeBackslashes(w)));let l={prefix:W,input:e,start:f,base:w,glob:P,isBrace:p,isBracket:H,isGlob:_,isExtglob:R,isGlobstar:b,negated:k};if(r.tokens===!0&&(l.maxDepth=0,Vt(y)||i.push(x),l.tokens=i),r.parts===!0||r.tokens===!0){let c;for(let D=0;D{"use strict";var Le=Re(),V=ye(),{MAX_LENGTH:Oe,POSIX_REGEX_SOURCE:Un,REGEX_NON_SPECIAL_CHARS:qn,REGEX_SPECIAL_CHARS_BACKREF:Kn,REPLACEMENTS:rr}=Le,Wn=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();let r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map(s=>V.escapeRegex(s)).join("..")}return r},de=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,nr=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=rr[e]||e;let r=N({},t),n=typeof r.maxLength=="number"?Math.min(Oe,r.maxLength):Oe,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let a={type:"bos",value:"",output:r.prepend||""},i=[a],o=r.capture?"":"?:",h=V.isWindows(t),A=Le.globChars(h),f=Le.extglobChars(A),{DOT_LITERAL:m,PLUS_LITERAL:p,SLASH_LITERAL:H,ONE_CHAR:_,DOTS_SLASH:R,NO_DOT:b,NO_DOT_SLASH:C,NO_DOTS_SLASH:T,QMARK:k,QMARK_NO_DOT:E,STAR:ee,START_ANCHOR:j}=A,y=g=>`(${o}(?:(?!${j}${g.dot?R:m}).)*?)`,x=r.dot?"":b,M=r.dot?k:E,$=r.bash===!0?y(r):ee;r.capture&&($=`(${$})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let u={input:e,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};e=V.removePrefix(e,u),s=e.length;let w=[],W=[],P=[],l=a,c,D=()=>u.index===s-1,G=u.peek=(g=1)=>e[u.index+g],te=u.advance=()=>e[++u.index],re=()=>e.slice(u.index+1),ie=(g="",L=0)=>{u.consumed+=g,u.index+=L},be=g=>{u.output+=g.output!=null?g.output:g.value,ie(g.value)},xr=()=>{let g=1;for(;G()==="!"&&(G(2)!=="("||G(3)==="?");)te(),u.start++,g++;return g%2==0?!1:(u.negated=!0,u.start++,!0)},Ce=g=>{u[g]++,P.push(g)},ce=g=>{u[g]--,P.pop()},S=g=>{if(l.type==="globstar"){let L=u.braces>0&&(g.type==="comma"||g.type==="brace"),d=g.extglob===!0||w.length&&(g.type==="pipe"||g.type==="paren");g.type!=="slash"&&g.type!=="paren"&&!L&&!d&&(u.output=u.output.slice(0,-l.output.length),l.type="star",l.value="*",l.output=$,u.output+=l.output)}if(w.length&&g.type!=="paren"&&!f[g.value]&&(w[w.length-1].inner+=g.value),(g.value||g.output)&&be(g),l&&l.type==="text"&&g.type==="text"){l.value+=g.value,l.output=(l.output||"")+g.value;return}g.prev=l,i.push(g),l=g},we=(g,L)=>{let d=Q(N({},f[L]),{conditions:1,inner:""});d.prev=l,d.parens=u.parens,d.output=u.output;let v=(r.capture?"(":"")+d.open;Ce("parens"),S({type:g,value:L,output:u.output?"":_}),S({type:"paren",extglob:!0,value:te(),output:v}),w.push(d)},br=g=>{let L=g.close+(r.capture?")":"");if(g.type==="negate"){let d=$;g.inner&&g.inner.length>1&&g.inner.includes("/")&&(d=y(r)),(d!==$||D()||/^\)+$/.test(re()))&&(L=g.close=`)$))${d}`),g.prev.type==="bos"&&(u.negatedExtglob=!0)}S({type:"paren",extglob:!0,value:c,output:L}),ce("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let g=!1,L=e.replace(Kn,(d,v,I,F,U,Me)=>F==="\\"?(g=!0,d):F==="?"?v?v+F+(U?k.repeat(U.length):""):Me===0?M+(U?k.repeat(U.length):""):k.repeat(I.length):F==="."?m.repeat(I.length):F==="*"?v?v+F+(U?$:""):$:v?d:`\\${d}`);return g===!0&&(r.unescape===!0?L=L.replace(/\\/g,""):L=L.replace(/\\+/g,d=>d.length%2==0?"\\\\":d?"\\":"")),L===e&&r.contains===!0?(u.output=e,u):(u.output=V.wrapOutput(L,u,t),u)}for(;!D();){if(c=te(),c==="\0")continue;if(c==="\\"){let d=G();if(d==="/"&&r.bash!==!0||d==="."||d===";")continue;if(!d){c+="\\",S({type:"text",value:c});continue}let v=/^\\+/.exec(re()),I=0;if(v&&v[0].length>2&&(I=v[0].length,u.index+=I,I%2!=0&&(c+="\\")),r.unescape===!0?c=te()||"":c+=te()||"",u.brackets===0){S({type:"text",value:c});continue}}if(u.brackets>0&&(c!=="]"||l.value==="["||l.value==="[^")){if(r.posix!==!1&&c===":"){let d=l.value.slice(1);if(d.includes("[")&&(l.posix=!0,d.includes(":"))){let v=l.value.lastIndexOf("["),I=l.value.slice(0,v),F=l.value.slice(v+2),U=Un[F];if(U){l.value=I+U,u.backtrack=!0,te(),!a.output&&i.indexOf(l)===1&&(a.output=_);continue}}}(c==="["&&G()!==":"||c==="-"&&G()==="]")&&(c=`\\${c}`),c==="]"&&(l.value==="["||l.value==="[^")&&(c=`\\${c}`),r.posix===!0&&c==="!"&&l.value==="["&&(c="^"),l.value+=c,be({value:c});continue}if(u.quotes===1&&c!=='"'){c=V.escapeRegex(c),l.value+=c,be({value:c});continue}if(c==='"'){u.quotes=u.quotes===1?0:1,r.keepQuotes===!0&&S({type:"text",value:c});continue}if(c==="("){Ce("parens"),S({type:"paren",value:c});continue}if(c===")"){if(u.parens===0&&r.strictBrackets===!0)throw new SyntaxError(de("opening","("));let d=w[w.length-1];if(d&&u.parens===d.parens+1){br(w.pop());continue}S({type:"paren",value:c,output:u.parens?")":"\\)"}),ce("parens");continue}if(c==="["){if(r.nobracket===!0||!re().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(de("closing","]"));c=`\\${c}`}else Ce("brackets");S({type:"bracket",value:c});continue}if(c==="]"){if(r.nobracket===!0||l&&l.type==="bracket"&&l.value.length===1){S({type:"text",value:c,output:`\\${c}`});continue}if(u.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(de("opening","["));S({type:"text",value:c,output:`\\${c}`});continue}ce("brackets");let d=l.value.slice(1);if(l.posix!==!0&&d[0]==="^"&&!d.includes("/")&&(c=`/${c}`),l.value+=c,be({value:c}),r.literalBrackets===!1||V.hasRegexChars(d))continue;let v=V.escapeRegex(l.value);if(u.output=u.output.slice(0,-l.value.length),r.literalBrackets===!0){u.output+=v,l.value=v;continue}l.value=`(${o}${v}|${l.value})`,u.output+=l.value;continue}if(c==="{"&&r.nobrace!==!0){Ce("braces");let d={type:"brace",value:c,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};W.push(d),S(d);continue}if(c==="}"){let d=W[W.length-1];if(r.nobrace===!0||!d){S({type:"text",value:c,output:c});continue}let v=")";if(d.dots===!0){let I=i.slice(),F=[];for(let U=I.length-1;U>=0&&(i.pop(),I[U].type!=="brace");U--)I[U].type!=="dots"&&F.unshift(I[U].value);v=Wn(F,r),u.backtrack=!0}if(d.comma!==!0&&d.dots!==!0){let I=u.output.slice(0,d.outputIndex),F=u.tokens.slice(d.tokensIndex);d.value=d.output="\\{",c=v="\\}",u.output=I;for(let U of F)u.output+=U.output||U.value}S({type:"brace",value:c,output:v}),ce("braces"),W.pop();continue}if(c==="|"){w.length>0&&w[w.length-1].conditions++,S({type:"text",value:c});continue}if(c===","){let d=c,v=W[W.length-1];v&&P[P.length-1]==="braces"&&(v.comma=!0,d="|"),S({type:"comma",value:c,output:d});continue}if(c==="/"){if(l.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),l=a;continue}S({type:"slash",value:c,output:H});continue}if(c==="."){if(u.braces>0&&l.type==="dot"){l.value==="."&&(l.output=m);let d=W[W.length-1];l.type="dots",l.output+=c,l.value+=c,d.dots=!0;continue}if(u.braces+u.parens===0&&l.type!=="bos"&&l.type!=="slash"){S({type:"text",value:c,output:m});continue}S({type:"dot",value:c,output:m});continue}if(c==="?"){if(!(l&&l.value==="(")&&r.noextglob!==!0&&G()==="("&&G(2)!=="?"){we("qmark",c);continue}if(l&&l.type==="paren"){let v=G(),I=c;if(v==="<"&&!V.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(l.value==="("&&!/[!=<:]/.test(v)||v==="<"&&!/<([!=]|\w+>)/.test(re()))&&(I=`\\${c}`),S({type:"text",value:c,output:I});continue}if(r.dot!==!0&&(l.type==="slash"||l.type==="bos")){S({type:"qmark",value:c,output:E});continue}S({type:"qmark",value:c,output:k});continue}if(c==="!"){if(r.noextglob!==!0&&G()==="("&&(G(2)!=="?"||!/[!=<:]/.test(G(3)))){we("negate",c);continue}if(r.nonegate!==!0&&u.index===0){xr();continue}}if(c==="+"){if(r.noextglob!==!0&&G()==="("&&G(2)!=="?"){we("plus",c);continue}if(l&&l.value==="("||r.regex===!1){S({type:"plus",value:c,output:p});continue}if(l&&(l.type==="bracket"||l.type==="paren"||l.type==="brace")||u.parens>0){S({type:"plus",value:c});continue}S({type:"plus",value:p});continue}if(c==="@"){if(r.noextglob!==!0&&G()==="("&&G(2)!=="?"){S({type:"at",extglob:!0,value:c,output:""});continue}S({type:"text",value:c});continue}if(c!=="*"){(c==="$"||c==="^")&&(c=`\\${c}`);let d=qn.exec(re());d&&(c+=d[0],u.index+=d[0].length),S({type:"text",value:c});continue}if(l&&(l.type==="globstar"||l.star===!0)){l.type="star",l.star=!0,l.value+=c,l.output=$,u.backtrack=!0,u.globstar=!0,ie(c);continue}let g=re();if(r.noextglob!==!0&&/^\([^?]/.test(g)){we("star",c);continue}if(l.type==="star"){if(r.noglobstar===!0){ie(c);continue}let d=l.prev,v=d.prev,I=d.type==="slash"||d.type==="bos",F=v&&(v.type==="star"||v.type==="globstar");if(r.bash===!0&&(!I||g[0]&&g[0]!=="/")){S({type:"star",value:c,output:""});continue}let U=u.braces>0&&(d.type==="comma"||d.type==="brace"),Me=w.length&&(d.type==="pipe"||d.type==="paren");if(!I&&d.type!=="paren"&&!U&&!Me){S({type:"star",value:c,output:""});continue}for(;g.slice(0,3)==="/**";){let Se=e[u.index+4];if(Se&&Se!=="/")break;g=g.slice(3),ie("/**",3)}if(d.type==="bos"&&D()){l.type="globstar",l.value+=c,l.output=y(r),u.output=l.output,u.globstar=!0,ie(c);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&!F&&D()){u.output=u.output.slice(0,-(d.output+l.output).length),d.output=`(?:${d.output}`,l.type="globstar",l.output=y(r)+(r.strictSlashes?")":"|$)"),l.value+=c,u.globstar=!0,u.output+=d.output+l.output,ie(c);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&g[0]==="/"){let Se=g[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(d.output+l.output).length),d.output=`(?:${d.output}`,l.type="globstar",l.output=`${y(r)}${H}|${H}${Se})`,l.value+=c,u.output+=d.output+l.output,u.globstar=!0,ie(c+te()),S({type:"slash",value:"/",output:""});continue}if(d.type==="bos"&&g[0]==="/"){l.type="globstar",l.value+=c,l.output=`(?:^|${H}|${y(r)}${H})`,u.output=l.output,u.globstar=!0,ie(c+te()),S({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-l.output.length),l.type="globstar",l.output=y(r),l.value+=c,u.output+=l.output,u.globstar=!0,ie(c);continue}let L={type:"star",value:c,output:$};if(r.bash===!0){L.output=".*?",(l.type==="bos"||l.type==="slash")&&(L.output=x+L.output),S(L);continue}if(l&&(l.type==="bracket"||l.type==="paren")&&r.regex===!0){L.output=c,S(L);continue}(u.index===u.start||l.type==="slash"||l.type==="dot")&&(l.type==="dot"?(u.output+=C,l.output+=C):r.dot===!0?(u.output+=T,l.output+=T):(u.output+=x,l.output+=x),G()!=="*"&&(u.output+=_,l.output+=_)),S(L)}for(;u.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(de("closing","]"));u.output=V.escapeLast(u.output,"["),ce("brackets")}for(;u.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(de("closing",")"));u.output=V.escapeLast(u.output,"("),ce("parens")}for(;u.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(de("closing","}"));u.output=V.escapeLast(u.output,"{"),ce("braces")}if(r.strictSlashes!==!0&&(l.type==="star"||l.type==="bracket")&&S({type:"maybe_slash",value:"",output:`${H}?`}),u.backtrack===!0){u.output="";for(let g of u.tokens)u.output+=g.output!=null?g.output:g.value,g.suffix&&(u.output+=g.suffix)}return u};nr.fastpaths=(e,t)=>{let r=N({},t),n=typeof r.maxLength=="number"?Math.min(Oe,r.maxLength):Oe,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);e=rr[e]||e;let a=V.isWindows(t),{DOT_LITERAL:i,SLASH_LITERAL:o,ONE_CHAR:h,DOTS_SLASH:A,NO_DOT:f,NO_DOTS:m,NO_DOTS_SLASH:p,STAR:H,START_ANCHOR:_}=Le.globChars(a),R=r.dot?m:f,b=r.dot?p:f,C=r.capture?"":"?:",T={negated:!1,prefix:""},k=r.bash===!0?".*?":H;r.capture&&(k=`(${k})`);let E=x=>x.noglobstar===!0?k:`(${C}(?:(?!${_}${x.dot?A:i}).)*?)`,ee=x=>{switch(x){case"*":return`${R}${h}${k}`;case".*":return`${i}${h}${k}`;case"*.*":return`${R}${k}${i}${h}${k}`;case"*/*":return`${R}${k}${o}${h}${b}${k}`;case"**":return R+E(r);case"**/*":return`(?:${R}${E(r)}${o})?${b}${h}${k}`;case"**/*.*":return`(?:${R}${E(r)}${o})?${b}${k}${i}${h}${k}`;case"**/.*":return`(?:${R}${E(r)}${o})?${i}${h}${k}`;default:{let M=/^(.*?)\.(\w+)$/.exec(x);if(!M)return;let $=ee(M[1]);return $?$+i+M[2]:void 0}}},j=V.removePrefix(e,T),y=ee(j);return y&&r.strictSlashes!==!0&&(y+=`${o}?`),y};tr.exports=nr});var ir=q((Rs,ar)=>{"use strict";var jn=require("path"),Fn=er(),Ze=sr(),Ye=ye(),Qn=Re(),Xn=e=>e&&typeof e=="object"&&!Array.isArray(e),B=(e,t,r=!1)=>{if(Array.isArray(e)){let f=e.map(p=>B(p,t,r));return p=>{for(let H of f){let _=H(p);if(_)return _}return!1}}let n=Xn(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=t||{},a=Ye.isWindows(t),i=n?B.compileRe(e,t):B.makeRe(e,t,!1,!0),o=i.state;delete i.state;let h=()=>!1;if(s.ignore){let f=Q(N({},t),{ignore:null,onMatch:null,onResult:null});h=B(s.ignore,f,r)}let A=(f,m=!1)=>{let{isMatch:p,match:H,output:_}=B.test(f,i,t,{glob:e,posix:a}),R={glob:e,state:o,regex:i,posix:a,input:f,output:_,match:H,isMatch:p};return typeof s.onResult=="function"&&s.onResult(R),p===!1?(R.isMatch=!1,m?R:!1):h(f)?(typeof s.onIgnore=="function"&&s.onIgnore(R),R.isMatch=!1,m?R:!1):(typeof s.onMatch=="function"&&s.onMatch(R),m?R:!0)};return r&&(A.state=o),A};B.test=(e,t,r,{glob:n,posix:s}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let a=r||{},i=a.format||(s?Ye.toPosixSlashes:null),o=e===n,h=o&&i?i(e):e;return o===!1&&(h=i?i(e):e,o=h===n),(o===!1||a.capture===!0)&&(a.matchBase===!0||a.basename===!0?o=B.matchBase(e,t,r,s):o=t.exec(h)),{isMatch:Boolean(o),match:o,output:h}};B.matchBase=(e,t,r,n=Ye.isWindows(r))=>(t instanceof RegExp?t:B.makeRe(t,r)).test(jn.basename(e));B.isMatch=(e,t,r)=>B(t,r)(e);B.parse=(e,t)=>Array.isArray(e)?e.map(r=>B.parse(r,t)):Ze(e,Q(N({},t),{fastpaths:!1}));B.scan=(e,t)=>Fn(e,t);B.compileRe=(e,t,r=!1,n=!1)=>{if(r===!0)return e.output;let s=t||{},a=s.contains?"":"^",i=s.contains?"":"$",o=`${a}(?:${e.output})${i}`;e&&e.negated===!0&&(o=`^(?!${o}).*$`);let h=B.toRegex(o,t);return n===!0&&(h.state=e),h};B.makeRe=(e,t,r=!1,n=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let s=t||{},a={negated:!1,fastpaths:!0},i="",o;return e.startsWith("./")&&(e=e.slice(2),i=a.prefix="./"),s.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(o=Ze.fastpaths(e,t)),o===void 0?(a=Ze(e,t),a.prefix=i+(a.prefix||"")):a.output=o,B.compileRe(a,t,r,n)};B.toRegex=(e,t)=>{try{let r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(r){if(t&&t.debug===!0)throw r;return/$^/}};B.constants=Qn;ar.exports=B});var ur=q((ys,or)=>{"use strict";or.exports=ir()});var hr=q((_s,cr)=>{"use strict";var lr=require("util"),pr=Gt(),ae=ur(),ze=ye(),fr=e=>typeof e=="string"&&(e===""||e==="./"),O=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let n=new Set,s=new Set,a=new Set,i=0,o=f=>{a.add(f.output),r&&r.onResult&&r.onResult(f)};for(let f=0;f!n.has(f));if(r&&A.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${t.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?t.map(f=>f.replace(/\\/g,"")):t}return A};O.match=O;O.matcher=(e,t)=>ae(e,t);O.isMatch=(e,t,r)=>ae(t,r)(e);O.any=O.isMatch;O.not=(e,t,r={})=>{t=[].concat(t).map(String);let n=new Set,s=[],a=o=>{r.onResult&&r.onResult(o),s.push(o.output)},i=O(e,t,Q(N({},r),{onResult:a}));for(let o of s)i.includes(o)||n.add(o);return[...n]};O.contains=(e,t,r)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${lr.inspect(e)}"`);if(Array.isArray(t))return t.some(n=>O.contains(e,n,r));if(typeof t=="string"){if(fr(e)||fr(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return O.isMatch(e,t,Q(N({},r),{contains:!0}))};O.matchKeys=(e,t,r)=>{if(!ze.isObject(e))throw new TypeError("Expected the first argument to be an object");let n=O(Object.keys(e),t,r),s={};for(let a of n)s[a]=e[a];return s};O.some=(e,t,r)=>{let n=[].concat(e);for(let s of[].concat(t)){let a=ae(String(s),r);if(n.some(i=>a(i)))return!0}return!1};O.every=(e,t,r)=>{let n=[].concat(e);for(let s of[].concat(t)){let a=ae(String(s),r);if(!n.every(i=>a(i)))return!1}return!0};O.all=(e,t,r)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${lr.inspect(e)}"`);return[].concat(t).every(n=>ae(n,r)(e))};O.capture=(e,t,r)=>{let n=ze.isWindows(r),a=ae.makeRe(String(e),Q(N({},r),{capture:!0})).exec(n?ze.toPosixSlashes(t):t);if(a)return a.slice(1).map(i=>i===void 0?"":i)};O.makeRe=(...e)=>ae.makeRe(...e);O.scan=(...e)=>ae.scan(...e);O.parse=(e,t)=>{let r=[];for(let n of[].concat(e||[]))for(let s of pr(String(n),t))r.push(ae.parse(s,t));return r};O.braces=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return t&&t.nobrace===!0||!/\{.*\}/.test(e)?[e]:pr(e,t)};O.braceExpand=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return O.braces(e,Q(N({},t),{expand:!0}))};cr.exports=O});var gr=q((Es,dr)=>{"use strict";dr.exports=(e,...t)=>new Promise(r=>{r(e(...t))})});var mr=q((xs,Ve)=>{"use strict";var Zn=gr(),Ar=e=>{if(e<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let t=[],r=0,n=()=>{r--,t.length>0&&t.shift()()},s=(o,h,...A)=>{r++;let f=Zn(o,...A);h(f),f.then(n,n)},a=(o,h,...A)=>{rnew Promise(A=>a(o,A,...h));return Object.defineProperties(i,{activeCount:{get:()=>r},pendingCount:{get:()=>t.length}}),i};Ve.exports=Ar;Ve.exports.default=Ar});var zn={};Lr(zn,{default:()=>Jn});var ve=Y(require("@yarnpkg/cli")),ne=Y(require("@yarnpkg/core")),rt=Y(require("@yarnpkg/core")),le=Y(require("clipanion")),Ae=class extends ve.BaseCommand{constructor(){super(...arguments);this.json=le.Option.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.production=le.Option.Boolean("--production",!1,{description:"Only install regular dependencies by omitting dev dependencies"});this.all=le.Option.Boolean("-A,--all",!1,{description:"Install the entire project"});this.workspaces=le.Option.Rest()}async execute(){let t=await ne.Configuration.find(this.context.cwd,this.context.plugins),{project:r,workspace:n}=await ne.Project.find(t,this.context.cwd),s=await ne.Cache.find(t);await r.restoreInstallState({restoreResolutions:!1});let a;if(this.all)a=new Set(r.workspaces);else if(this.workspaces.length===0){if(!n)throw new ve.WorkspaceRequiredError(r.cwd,this.context.cwd);a=new Set([n])}else a=new Set(this.workspaces.map(o=>r.getWorkspaceByIdent(rt.structUtils.parseIdent(o))));for(let o of a)for(let h of this.production?["dependencies"]:ne.Manifest.hardDependencies)for(let A of o.manifest.getForScope(h).values()){let f=r.tryWorkspaceByDescriptor(A);f!==null&&a.add(f)}for(let o of r.workspaces)a.has(o)?this.production&&o.manifest.devDependencies.clear():(o.manifest.dependencies.clear(),o.manifest.devDependencies.clear(),o.manifest.peerDependencies.clear(),o.manifest.scripts.clear());return(await ne.StreamReport.start({configuration:t,json:this.json,stdout:this.context.stdout,includeLogs:!0},async o=>{await r.install({cache:s,report:o,persistProject:!1})})).exitCode()}};Ae.paths=[["workspaces","focus"]],Ae.usage=le.Command.Usage({category:"Workspace-related commands",description:"install a single workspace and its dependencies",details:"\n This command will run an install as if the specified workspaces (and all other workspaces they depend on) were the only ones in the project. If no workspaces are explicitly listed, the active one will be assumed.\n\n Note that this command is only very moderately useful when using zero-installs, since the cache will contain all the packages anyway - meaning that the only difference between a full install and a focused install would just be a few extra lines in the `.pnp.cjs` file, at the cost of introducing an extra complexity.\n\n If the `-A,--all` flag is set, the entire project will be installed. Combine with `--production` to replicate the old `yarn install --production`.\n "});var nt=Ae;var Ne=Y(require("@yarnpkg/cli")),Ie=Y(require("@yarnpkg/core")),Ee=Y(require("@yarnpkg/core")),Z=Y(require("@yarnpkg/core")),K=Y(require("clipanion")),Be=Y(hr()),Rr=Y(require("os")),yr=Y(mr()),ue=Y(require("typanion")),xe=class extends Ne.BaseCommand{constructor(){super(...arguments);this.recursive=K.Option.Boolean("-R,--recursive",!1,{description:"Find packages via dependencies/devDependencies instead of using the workspaces field"});this.from=K.Option.Array("--from",[],{description:"An array of glob pattern idents from which to base any recursion"});this.all=K.Option.Boolean("-A,--all",!1,{description:"Run the command on all workspaces of a project"});this.verbose=K.Option.Boolean("-v,--verbose",!1,{description:"Prefix each output line with the name of the originating workspace"});this.parallel=K.Option.Boolean("-p,--parallel",!1,{description:"Run the commands in parallel"});this.interlaced=K.Option.Boolean("-i,--interlaced",!1,{description:"Print the output of commands in real-time instead of buffering it"});this.jobs=K.Option.String("-j,--jobs",{description:"The maximum number of parallel tasks that the execution will be limited to",validator:ue.applyCascade(ue.isNumber(),[ue.isInteger(),ue.isAtLeast(2)])});this.topological=K.Option.Boolean("-t,--topological",!1,{description:"Run the command after all workspaces it depends on (regular) have finished"});this.topologicalDev=K.Option.Boolean("--topological-dev",!1,{description:"Run the command after all workspaces it depends on (regular + dev) have finished"});this.include=K.Option.Array("--include",[],{description:"An array of glob pattern idents; only matching workspaces will be traversed"});this.exclude=K.Option.Array("--exclude",[],{description:"An array of glob pattern idents; matching workspaces won't be traversed"});this.publicOnly=K.Option.Boolean("--no-private",{description:"Avoid running the command on private workspaces"});this.commandName=K.Option.String();this.args=K.Option.Proxy()}async execute(){let t=await Ie.Configuration.find(this.context.cwd,this.context.plugins),{project:r,workspace:n}=await Ie.Project.find(t,this.context.cwd);if(!this.all&&!n)throw new Ne.WorkspaceRequiredError(r.cwd,this.context.cwd);let s=this.cli.process([this.commandName,...this.args]),a=s.path.length===1&&s.path[0]==="run"&&typeof s.scriptName!="undefined"?s.scriptName:null;if(s.path.length===0)throw new K.UsageError("Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script");let i=this.all?r.topLevelWorkspace:n,o=E=>Be.default.isMatch(Z.structUtils.stringifyIdent(E.locator),this.from),h=this.from.length>0?[i,...i.getRecursiveWorkspaceChildren()].filter(o):[i],A=this.recursive?[...h,...h.map(E=>[...E.getRecursiveWorkspaceDependencies()]).flat()]:[...h,...h.map(E=>[...E.getRecursiveWorkspaceChildren()]).flat()],f=[];for(let E of A)a&&!E.manifest.scripts.has(a)&&!a.includes(":")||a===process.env.npm_lifecycle_event&&E.cwd===n.cwd||this.include.length>0&&!Be.default.isMatch(Z.structUtils.stringifyIdent(E.locator),this.include)||this.exclude.length>0&&Be.default.isMatch(Z.structUtils.stringifyIdent(E.locator),this.exclude)||this.publicOnly&&E.manifest.private===!0||f.push(E);let m=this.interlaced;this.parallel||(m=!0);let p=new Map,H=new Set,_=this.parallel?Math.max(1,(0,Rr.cpus)().length/2):1,R=(0,yr.default)(this.jobs||_),b=0,C=null,T=!1,k=await Ee.StreamReport.start({configuration:t,stdout:this.context.stdout},async E=>{let ee=async(j,{commandIndex:y})=>{if(T)return-1;!this.parallel&&this.verbose&&y>1&&E.reportSeparator();let x=Yn(j,{configuration:t,verbose:this.verbose,commandIndex:y}),[M,$]=_r(E,{prefix:x,interlaced:m}),[u,w]=_r(E,{prefix:x,interlaced:m});try{this.verbose&&E.reportInfo(null,`${x} Process started`);let W=Date.now(),P=await this.cli.run([this.commandName,...this.args],{cwd:j.cwd,stdout:M,stderr:u})||0;M.end(),u.end(),await $,await w;let l=Date.now();if(this.verbose){let c=t.get("enableTimers")?`, completed in ${Z.formatUtils.pretty(t,l-W,Z.formatUtils.Type.DURATION)}`:"";E.reportInfo(null,`${x} Process exited (exit code ${P})${c}`)}return P===130&&(T=!0,C=P),P}catch(W){throw M.end(),u.end(),await $,await w,W}};for(let j of f)p.set(j.anchoredLocator.locatorHash,j);for(;p.size>0&&!E.hasErrors();){let j=[];for(let[M,$]of p){if(H.has($.anchoredDescriptor.descriptorHash))continue;let u=!0;if(this.topological||this.topologicalDev){let w=this.topologicalDev?new Map([...$.manifest.dependencies,...$.manifest.devDependencies]):$.manifest.dependencies;for(let W of w.values()){let P=r.tryWorkspaceByDescriptor(W);if(u=P===null||!p.has(P.anchoredLocator.locatorHash),!u)break}}if(!!u&&(H.add($.anchoredDescriptor.descriptorHash),j.push(R(async()=>{let w=await ee($,{commandIndex:++b});return p.delete(M),H.delete($.anchoredDescriptor.descriptorHash),w})),!this.parallel))break}if(j.length===0){let M=Array.from(p.values()).map($=>Z.structUtils.prettyLocator(t,$.anchoredLocator)).join(", ");E.reportError(Ee.MessageName.CYCLIC_DEPENDENCIES,`Dependency cycle detected (${M})`);return}let x=(await Promise.all(j)).find(M=>M!==0);C===null&&(C=typeof x!="undefined"?1:C),(this.topological||this.topologicalDev)&&typeof x!="undefined"&&E.reportError(Ee.MessageName.UNNAMED,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return C!==null?C:k.exitCode()}};xe.paths=[["workspaces","foreach"]],xe.usage=K.Command.Usage({category:"Workspace-related commands",description:"run a command on all workspaces",details:"\n This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:\n\n - If `-p,--parallel` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via `-j,--jobs`.\n\n - If `-p,--parallel` and `-i,--interlaced` are both set, Yarn will print the lines from the output as it receives them. If `-i,--interlaced` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.\n\n - If `-t,--topological` is set, Yarn will only run the command after all workspaces that it depends on through the `dependencies` field have successfully finished executing. If `--topological-dev` is set, both the `dependencies` and `devDependencies` fields will be considered when figuring out the wait points.\n\n - If `-A,--all` is set, Yarn will run the command on all the workspaces of a project. By default yarn runs the command only on current and all its descendant workspaces.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `--from` is set, Yarn will use the packages matching the 'from' glob as the starting point for any recursive search.\n\n - The command may apply to only some workspaces through the use of `--include` which acts as a whitelist. The `--exclude` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (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.\n\n Adding the `-v,--verbose` flag will cause Yarn to print more information; in particular the name of the workspace that generated the output will be printed at the front of each line.\n\n If the command is `run` and the script being run does not exist the child workspace will be skipped without error.\n ",examples:[["Publish current and all descendant packages","yarn workspaces foreach npm publish --tolerate-republish"],["Run build script on current and all descendant packages","yarn workspaces foreach run build"],["Run build script on current and all descendant packages in parallel, building package dependencies first","yarn workspaces foreach -pt run build"],["Run build script on several packages and all their dependencies, building dependencies first","yarn workspaces foreach -ptR --from '{workspace-a,workspace-b}' run build"]]});var Er=xe;function _r(e,{prefix:t,interlaced:r}){let n=e.createStreamReporter(t),s=new Z.miscUtils.DefaultStream;s.pipe(n,{end:!1}),s.on("finish",()=>{n.end()});let a=new Promise(o=>{n.on("finish",()=>{o(s.active)})});if(r)return[s,a];let i=new Z.miscUtils.BufferStream;return i.pipe(s,{end:!1}),i.on("finish",()=>{s.end()}),[i,a]}function Yn(e,{configuration:t,commandIndex:r,verbose:n}){if(!n)return null;let s=Z.structUtils.convertToIdent(e.locator),i=`[${Z.structUtils.stringifyIdent(s)}]:`,o=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],h=o[r%o.length];return Z.formatUtils.pretty(t,i,h)}var Vn={commands:[nt,Er]},Jn=Vn;return zn;})(); -/*! - * fill-range - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Licensed under the MIT License. - */ -/*! - * is-number - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Released under the MIT License. - */ -/*! - * to-regex-range - * - * Copyright (c) 2015-present, Jon Schlinkert. - * Released under the MIT License. - */ -return plugin; -} -}; diff --git a/.yarn/releases/yarn-3.7.0.cjs b/.yarn/releases/yarn-3.7.0.cjs deleted file mode 100755 index d5174e5ac00d..000000000000 --- a/.yarn/releases/yarn-3.7.0.cjs +++ /dev/null @@ -1,875 +0,0 @@ -#!/usr/bin/env node -/* eslint-disable */ -//prettier-ignore -(()=>{var Tge=Object.create;var cS=Object.defineProperty;var Lge=Object.getOwnPropertyDescriptor;var Oge=Object.getOwnPropertyNames;var Mge=Object.getPrototypeOf,Kge=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 Uge=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ct=(r,e)=>{for(var t in e)cS(r,t,{get:e[t],enumerable:!0})},Hge=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Oge(e))!Kge.call(r,n)&&n!==t&&cS(r,n,{get:()=>e[n],enumerable:!(i=Lge(e,n))||i.enumerable});return r};var ve=(r,e,t)=>(t=r!=null?Tge(Mge(r)):{},Hge(e||!r||!r.__esModule?cS(t,"default",{value:r,enumerable:!0}):t,r));var DK=I((rZe,kK)=>{kK.exports=PK;PK.sync=Afe;var vK=J("fs");function afe(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{TK.exports=FK;FK.sync=lfe;var RK=J("fs");function FK(r,e,t){RK.stat(r,function(i,n){t(i,i?!1:NK(n,e))})}function lfe(r,e){return NK(RK.statSync(r),e)}function NK(r,e){return r.isFile()&&cfe(r,e)}function cfe(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 MK=I((sZe,OK)=>{var nZe=J("fs"),cI;process.platform==="win32"||global.TESTING_WINDOWS?cI=DK():cI=LK();OK.exports=vS;vS.sync=ufe;function vS(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){vS(r,e||{},function(s,o){s?n(s):i(o)})})}cI(r,e||{},function(i,n){i&&(i.code==="EACCES"||e&&e.ignoreErrors)&&(i=null,n=!1),t(i,n)})}function ufe(r,e){try{return cI.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var qK=I((oZe,jK)=>{var Dg=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",KK=J("path"),gfe=Dg?";":":",UK=MK(),HK=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),GK=(r,e)=>{let t=e.colon||gfe,i=r.match(/\//)||Dg&&r.match(/\\/)?[""]:[...Dg?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],n=Dg?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Dg?n.split(t):[""];return Dg&&r.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},YK=(r,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:i,pathExt:n,pathExtExe:s}=GK(r,e),o=[],a=c=>new Promise((u,g)=>{if(c===i.length)return e.all&&o.length?u(o):g(HK(r));let h=i[c],p=/^".*"$/.test(h)?h.slice(1,-1):h,d=KK.join(p,r),m=!p&&/^\.[\\\/]/.test(r)?r.slice(0,2)+d:d;u(l(m,c,0))}),l=(c,u,g)=>new Promise((h,p)=>{if(g===n.length)return h(a(u+1));let d=n[g];UK(c+d,{pathExt:s},(m,y)=>{if(!m&&y)if(e.all)o.push(c+d);else return h(c+d);return h(l(c,u,g+1))})});return t?a(0).then(c=>t(null,c),t):a(0)},ffe=(r,e)=>{e=e||{};let{pathEnv:t,pathExt:i,pathExtExe:n}=GK(r,e),s=[];for(let o=0;o{"use strict";var JK=(r={})=>{let e=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};xS.exports=JK;xS.exports.default=JK});var ZK=I((AZe,XK)=>{"use strict";var zK=J("path"),hfe=qK(),pfe=WK();function VK(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=hfe.sync(r.command,{path:t[pfe({env:t})],pathExt:e?zK.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return o&&(o=zK.resolve(n?r.options.cwd:"",o)),o}function dfe(r){return VK(r)||VK(r,!0)}XK.exports=dfe});var _K=I((lZe,kS)=>{"use strict";var PS=/([()\][%!^"`<>&|;, *?])/g;function Cfe(r){return r=r.replace(PS,"^$1"),r}function mfe(r,e){return r=`${r}`,r=r.replace(/(\\*)"/g,'$1$1\\"'),r=r.replace(/(\\*)$/,"$1$1"),r=`"${r}"`,r=r.replace(PS,"^$1"),e&&(r=r.replace(PS,"^$1")),r}kS.exports.command=Cfe;kS.exports.argument=mfe});var eU=I((cZe,$K)=>{"use strict";$K.exports=/^#!(.*)/});var rU=I((uZe,tU)=>{"use strict";var Efe=eU();tU.exports=(r="")=>{let e=r.match(Efe);if(!e)return null;let[t,i]=e[0].replace(/#! ?/,"").split(" "),n=t.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var nU=I((gZe,iU)=>{"use strict";var DS=J("fs"),Ife=rU();function yfe(r){let t=Buffer.alloc(150),i;try{i=DS.openSync(r,"r"),DS.readSync(i,t,0,150,0),DS.closeSync(i)}catch{}return Ife(t.toString())}iU.exports=yfe});var AU=I((fZe,aU)=>{"use strict";var wfe=J("path"),sU=ZK(),oU=_K(),Bfe=nU(),Qfe=process.platform==="win32",bfe=/\.(?:com|exe)$/i,Sfe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function vfe(r){r.file=sU(r);let e=r.file&&Bfe(r.file);return e?(r.args.unshift(r.file),r.command=e,sU(r)):r.file}function xfe(r){if(!Qfe)return r;let e=vfe(r),t=!bfe.test(e);if(r.options.forceShell||t){let i=Sfe.test(e);r.command=wfe.normalize(r.command),r.command=oU.command(r.command),r.args=r.args.map(s=>oU.argument(s,i));let n=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${n}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function Pfe(r,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let i={command:r,args:e,options:t,file:void 0,original:{command:r,args:e}};return t.shell?i:xfe(i)}aU.exports=Pfe});var uU=I((hZe,cU)=>{"use strict";var RS=process.platform==="win32";function FS(r,e){return Object.assign(new Error(`${e} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${r.command}`,path:r.command,spawnargs:r.args})}function kfe(r,e){if(!RS)return;let t=r.emit;r.emit=function(i,n){if(i==="exit"){let s=lU(n,e,"spawn");if(s)return t.call(r,"error",s)}return t.apply(r,arguments)}}function lU(r,e){return RS&&r===1&&!e.file?FS(e.original,"spawn"):null}function Dfe(r,e){return RS&&r===1&&!e.file?FS(e.original,"spawnSync"):null}cU.exports={hookChildProcess:kfe,verifyENOENT:lU,verifyENOENTSync:Dfe,notFoundError:FS}});var LS=I((pZe,Rg)=>{"use strict";var gU=J("child_process"),NS=AU(),TS=uU();function fU(r,e,t){let i=NS(r,e,t),n=gU.spawn(i.command,i.args,i.options);return TS.hookChildProcess(n,i),n}function Rfe(r,e,t){let i=NS(r,e,t),n=gU.spawnSync(i.command,i.args,i.options);return n.error=n.error||TS.verifyENOENTSync(n.status,i),n}Rg.exports=fU;Rg.exports.spawn=fU;Rg.exports.sync=Rfe;Rg.exports._parse=NS;Rg.exports._enoent=TS});var pU=I((dZe,hU)=>{"use strict";function Ffe(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function $l(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,$l)}Ffe($l,Error);$l.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,h=1;g>",re=Ke(">>",!1),de=">&",Ze=Ke(">&",!1),vt=">",mt=Ke(">",!1),Tr="<<<",ei=Ke("<<<",!1),ci="<&",gr=Ke("<&",!1),ui="<",ti=Ke("<",!1),Ms=function(C){return{type:"argument",segments:[].concat(...C)}},fr=function(C){return C},Ei="$'",ts=Ke("$'",!1),ua="'",CA=Ke("'",!1),gg=function(C){return[{type:"text",text:C}]},rs='""',mA=Ke('""',!1),ga=function(){return{type:"text",text:""}},Bp='"',EA=Ke('"',!1),IA=function(C){return C},Ir=function(C){return{type:"arithmetic",arithmetic:C,quoted:!0}},Nl=function(C){return{type:"shell",shell:C,quoted:!0}},fg=function(C){return{type:"variable",...C,quoted:!0}},Io=function(C){return{type:"text",text:C}},hg=function(C){return{type:"arithmetic",arithmetic:C,quoted:!1}},Qp=function(C){return{type:"shell",shell:C,quoted:!1}},bp=function(C){return{type:"variable",...C,quoted:!1}},br=function(C){return{type:"glob",pattern:C}},ne=/^[^']/,yo=Ve(["'"],!0,!1),Fn=function(C){return C.join("")},pg=/^[^$"]/,yt=Ve(["$",'"'],!0,!1),Tl=`\\ -`,Nn=Ke(`\\ -`,!1),is=function(){return""},ns="\\",ut=Ke("\\",!1),wo=/^[\\$"`]/,At=Ve(["\\","$",'"',"`"],!1,!1),An=function(C){return C},b="\\a",Ft=Ke("\\a",!1),dg=function(){return"a"},Ll="\\b",Sp=Ke("\\b",!1),vp=function(){return"\b"},xp=/^[Ee]/,Pp=Ve(["E","e"],!1,!1),kp=function(){return"\x1B"},G="\\f",Et=Ke("\\f",!1),yA=function(){return"\f"},Wi="\\n",Ol=Ke("\\n",!1),ze=function(){return` -`},fa="\\r",Cg=Ke("\\r",!1),KE=function(){return"\r"},Dp="\\t",UE=Ke("\\t",!1),sr=function(){return" "},Tn="\\v",Ml=Ke("\\v",!1),Rp=function(){return"\v"},Ks=/^[\\'"?]/,ha=Ve(["\\","'",'"',"?"],!1,!1),ln=function(C){return String.fromCharCode(parseInt(C,16))},Ne="\\x",mg=Ke("\\x",!1),Kl="\\u",Us=Ke("\\u",!1),Ul="\\U",wA=Ke("\\U",!1),Eg=function(C){return String.fromCodePoint(parseInt(C,16))},Ig=/^[0-7]/,pa=Ve([["0","7"]],!1,!1),da=/^[0-9a-fA-f]/,tt=Ve([["0","9"],["a","f"],["A","f"]],!1,!1),Bo=it(),BA="{}",Fp=Ke("{}",!1),Ca=function(){return"{}"},Hl="-",Gl=Ke("-",!1),QA="+",ma=Ke("+",!1),Np=".",HE=Ke(".",!1),Yl=function(C,Q,R){return{type:"number",value:(C==="-"?-1:1)*parseFloat(Q.join("")+"."+R.join(""))}},GE=function(C,Q){return{type:"number",value:(C==="-"?-1:1)*parseInt(Q.join(""))}},Tp=function(C){return{type:"variable",...C}},jl=function(C){return{type:"variable",name:C}},Lr=function(C){return C},YE="*",Hs=Ke("*",!1),Gs="/",yg=Ke("/",!1),bA=function(C,Q,R){return{type:Q==="*"?"multiplication":"division",right:R}},D=function(C,Q){return Q.reduce((R,U)=>({left:R,...U}),C)},j=function(C,Q,R){return{type:Q==="+"?"addition":"subtraction",right:R}},pe="$((",Le=Ke("$((",!1),ke="))",Je=Ke("))",!1),pt=function(C){return C},Xt="$(",Ea=Ke("$(",!1),R1=function(C){return C},Ys="${",wg=Ke("${",!1),Wb=":-",F1=Ke(":-",!1),N1=function(C,Q){return{name:C,defaultValue:Q}},zb=":-}",T1=Ke(":-}",!1),L1=function(C){return{name:C,defaultValue:[]}},Vb=":+",O1=Ke(":+",!1),M1=function(C,Q){return{name:C,alternativeValue:Q}},Xb=":+}",K1=Ke(":+}",!1),U1=function(C){return{name:C,alternativeValue:[]}},Zb=function(C){return{name:C}},H1="$",G1=Ke("$",!1),Y1=function(C){return e.isGlobPattern(C)},j1=function(C){return C},_b=/^[a-zA-Z0-9_]/,$b=Ve([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),eS=function(){return Ie()},ql=/^[$@*?#a-zA-Z0-9_\-]/,jE=Ve(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),tS=/^[()}<>$|&; \t"']/,rS=Ve(["(",")","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),iS=/^[<>&; \t"']/,qE=Ve(["<",">","&",";"," "," ",'"',"'"],!1,!1),Jl=/^[ \t]/,Bg=Ve([" "," "],!1,!1),f=0,E=0,w=[{line:1,column:1}],k=0,L=[],T=0,$;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 Ie(){return r.substring(E,f)}function Oe(){return ri(E,f)}function rt(C,Q){throw Q=Q!==void 0?Q:ri(E,f),Ln([Ii(C)],r.substring(E,f),Q)}function ot(C,Q){throw Q=Q!==void 0?Q:ri(E,f),yi(C,Q)}function Ke(C,Q){return{type:"literal",text:C,ignoreCase:Q}}function Ve(C,Q,R){return{type:"class",parts:C,inverted:Q,ignoreCase:R}}function it(){return{type:"any"}}function wt(){return{type:"end"}}function Ii(C){return{type:"other",description:C}}function cn(C){var Q=w[C],R;if(Q)return Q;for(R=C-1;!w[R];)R--;for(Q=w[R],Q={line:Q.line,column:Q.column};Rk&&(k=f,L=[]),L.push(C))}function yi(C,Q){return new $l(C,null,null,Q)}function Ln(C,Q,R){return new $l($l.buildMessage(C,Q),C,Q,R)}function Ia(){var C,Q,R;for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();return Q!==t?(R=Sr(),R===t&&(R=null),R!==t?(E=C,Q=s(R),C=Q):(f=C,C=t)):(f=C,C=t),C}function Sr(){var C,Q,R,U,le;if(C=f,Q=nS(),Q!==t){for(R=[],U=Me();U!==t;)R.push(U),U=Me();R!==t?(U=q1(),U!==t?(le=Cge(),le===t&&(le=null),le!==t?(E=C,Q=o(Q,U,le),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t)}else f=C,C=t;if(C===t)if(C=f,Q=nS(),Q!==t){for(R=[],U=Me();U!==t;)R.push(U),U=Me();R!==t?(U=q1(),U===t&&(U=null),U!==t?(E=C,Q=a(Q,U),C=Q):(f=C,C=t)):(f=C,C=t)}else f=C,C=t;return C}function Cge(){var C,Q,R,U,le;for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();if(Q!==t)if(R=Sr(),R!==t){for(U=[],le=Me();le!==t;)U.push(le),le=Me();U!==t?(E=C,Q=l(R),C=Q):(f=C,C=t)}else f=C,C=t;else f=C,C=t;return C}function q1(){var C;return r.charCodeAt(f)===59?(C=c,f++):(C=t,T===0&&Be(u)),C===t&&(r.charCodeAt(f)===38?(C=g,f++):(C=t,T===0&&Be(h))),C}function nS(){var C,Q,R;return C=f,Q=J1(),Q!==t?(R=mge(),R===t&&(R=null),R!==t?(E=C,Q=p(Q,R),C=Q):(f=C,C=t)):(f=C,C=t),C}function mge(){var C,Q,R,U,le,Qe,ft;for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();if(Q!==t)if(R=Ege(),R!==t){for(U=[],le=Me();le!==t;)U.push(le),le=Me();if(U!==t)if(le=nS(),le!==t){for(Qe=[],ft=Me();ft!==t;)Qe.push(ft),ft=Me();Qe!==t?(E=C,Q=d(R,le),C=Q):(f=C,C=t)}else f=C,C=t;else f=C,C=t}else f=C,C=t;else f=C,C=t;return C}function Ege(){var C;return r.substr(f,2)===m?(C=m,f+=2):(C=t,T===0&&Be(y)),C===t&&(r.substr(f,2)===B?(C=B,f+=2):(C=t,T===0&&Be(S))),C}function J1(){var C,Q,R;return C=f,Q=wge(),Q!==t?(R=Ige(),R===t&&(R=null),R!==t?(E=C,Q=P(Q,R),C=Q):(f=C,C=t)):(f=C,C=t),C}function Ige(){var C,Q,R,U,le,Qe,ft;for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();if(Q!==t)if(R=yge(),R!==t){for(U=[],le=Me();le!==t;)U.push(le),le=Me();if(U!==t)if(le=J1(),le!==t){for(Qe=[],ft=Me();ft!==t;)Qe.push(ft),ft=Me();Qe!==t?(E=C,Q=F(R,le),C=Q):(f=C,C=t)}else f=C,C=t;else f=C,C=t}else f=C,C=t;else f=C,C=t;return C}function yge(){var C;return r.substr(f,2)===H?(C=H,f+=2):(C=t,T===0&&Be(q)),C===t&&(r.charCodeAt(f)===124?(C=_,f++):(C=t,T===0&&Be(X))),C}function JE(){var C,Q,R,U,le,Qe;if(C=f,Q=nK(),Q!==t)if(r.charCodeAt(f)===61?(R=W,f++):(R=t,T===0&&Be(Z)),R!==t)if(U=V1(),U!==t){for(le=[],Qe=Me();Qe!==t;)le.push(Qe),Qe=Me();le!==t?(E=C,Q=A(Q,U),C=Q):(f=C,C=t)}else f=C,C=t;else f=C,C=t;else f=C,C=t;if(C===t)if(C=f,Q=nK(),Q!==t)if(r.charCodeAt(f)===61?(R=W,f++):(R=t,T===0&&Be(Z)),R!==t){for(U=[],le=Me();le!==t;)U.push(le),le=Me();U!==t?(E=C,Q=se(Q),C=Q):(f=C,C=t)}else f=C,C=t;else f=C,C=t;return C}function wge(){var C,Q,R,U,le,Qe,ft,It,Gr,gi,ss;for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();if(Q!==t)if(r.charCodeAt(f)===40?(R=ue,f++):(R=t,T===0&&Be(ee)),R!==t){for(U=[],le=Me();le!==t;)U.push(le),le=Me();if(U!==t)if(le=Sr(),le!==t){for(Qe=[],ft=Me();ft!==t;)Qe.push(ft),ft=Me();if(Qe!==t)if(r.charCodeAt(f)===41?(ft=O,f++):(ft=t,T===0&&Be(N)),ft!==t){for(It=[],Gr=Me();Gr!==t;)It.push(Gr),Gr=Me();if(It!==t){for(Gr=[],gi=Lp();gi!==t;)Gr.push(gi),gi=Lp();if(Gr!==t){for(gi=[],ss=Me();ss!==t;)gi.push(ss),ss=Me();gi!==t?(E=C,Q=ce(le,Gr),C=Q):(f=C,C=t)}else f=C,C=t}else f=C,C=t}else f=C,C=t;else f=C,C=t}else f=C,C=t;else f=C,C=t}else f=C,C=t;else f=C,C=t;if(C===t){for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();if(Q!==t)if(r.charCodeAt(f)===123?(R=he,f++):(R=t,T===0&&Be(Pe)),R!==t){for(U=[],le=Me();le!==t;)U.push(le),le=Me();if(U!==t)if(le=Sr(),le!==t){for(Qe=[],ft=Me();ft!==t;)Qe.push(ft),ft=Me();if(Qe!==t)if(r.charCodeAt(f)===125?(ft=De,f++):(ft=t,T===0&&Be(Re)),ft!==t){for(It=[],Gr=Me();Gr!==t;)It.push(Gr),Gr=Me();if(It!==t){for(Gr=[],gi=Lp();gi!==t;)Gr.push(gi),gi=Lp();if(Gr!==t){for(gi=[],ss=Me();ss!==t;)gi.push(ss),ss=Me();gi!==t?(E=C,Q=oe(le,Gr),C=Q):(f=C,C=t)}else f=C,C=t}else f=C,C=t}else f=C,C=t;else f=C,C=t}else f=C,C=t;else f=C,C=t}else f=C,C=t;else f=C,C=t;if(C===t){for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();if(Q!==t){for(R=[],U=JE();U!==t;)R.push(U),U=JE();if(R!==t){for(U=[],le=Me();le!==t;)U.push(le),le=Me();if(U!==t){if(le=[],Qe=z1(),Qe!==t)for(;Qe!==t;)le.push(Qe),Qe=z1();else le=t;if(le!==t){for(Qe=[],ft=Me();ft!==t;)Qe.push(ft),ft=Me();Qe!==t?(E=C,Q=Ae(R,le),C=Q):(f=C,C=t)}else f=C,C=t}else f=C,C=t}else f=C,C=t}else f=C,C=t;if(C===t){for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();if(Q!==t){if(R=[],U=JE(),U!==t)for(;U!==t;)R.push(U),U=JE();else R=t;if(R!==t){for(U=[],le=Me();le!==t;)U.push(le),le=Me();U!==t?(E=C,Q=ye(R),C=Q):(f=C,C=t)}else f=C,C=t}else f=C,C=t}}}return C}function W1(){var C,Q,R,U,le;for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();if(Q!==t){if(R=[],U=WE(),U!==t)for(;U!==t;)R.push(U),U=WE();else R=t;if(R!==t){for(U=[],le=Me();le!==t;)U.push(le),le=Me();U!==t?(E=C,Q=ge(R),C=Q):(f=C,C=t)}else f=C,C=t}else f=C,C=t;return C}function z1(){var C,Q,R;for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();if(Q!==t?(R=Lp(),R!==t?(E=C,Q=ae(R),C=Q):(f=C,C=t)):(f=C,C=t),C===t){for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();Q!==t?(R=WE(),R!==t?(E=C,Q=ae(R),C=Q):(f=C,C=t)):(f=C,C=t)}return C}function Lp(){var C,Q,R,U,le;for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();return Q!==t?(je.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(ie)),R===t&&(R=null),R!==t?(U=Bge(),U!==t?(le=WE(),le!==t?(E=C,Q=Y(R,U,le),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t)):(f=C,C=t),C}function Bge(){var C;return r.substr(f,2)===fe?(C=fe,f+=2):(C=t,T===0&&Be(re)),C===t&&(r.substr(f,2)===de?(C=de,f+=2):(C=t,T===0&&Be(Ze)),C===t&&(r.charCodeAt(f)===62?(C=vt,f++):(C=t,T===0&&Be(mt)),C===t&&(r.substr(f,3)===Tr?(C=Tr,f+=3):(C=t,T===0&&Be(ei)),C===t&&(r.substr(f,2)===ci?(C=ci,f+=2):(C=t,T===0&&Be(gr)),C===t&&(r.charCodeAt(f)===60?(C=ui,f++):(C=t,T===0&&Be(ti))))))),C}function WE(){var C,Q,R;for(C=f,Q=[],R=Me();R!==t;)Q.push(R),R=Me();return Q!==t?(R=V1(),R!==t?(E=C,Q=ae(R),C=Q):(f=C,C=t)):(f=C,C=t),C}function V1(){var C,Q,R;if(C=f,Q=[],R=X1(),R!==t)for(;R!==t;)Q.push(R),R=X1();else Q=t;return Q!==t&&(E=C,Q=Ms(Q)),C=Q,C}function X1(){var C,Q;return C=f,Q=Qge(),Q!==t&&(E=C,Q=fr(Q)),C=Q,C===t&&(C=f,Q=bge(),Q!==t&&(E=C,Q=fr(Q)),C=Q,C===t&&(C=f,Q=Sge(),Q!==t&&(E=C,Q=fr(Q)),C=Q,C===t&&(C=f,Q=vge(),Q!==t&&(E=C,Q=fr(Q)),C=Q))),C}function Qge(){var C,Q,R,U;return C=f,r.substr(f,2)===Ei?(Q=Ei,f+=2):(Q=t,T===0&&Be(ts)),Q!==t?(R=kge(),R!==t?(r.charCodeAt(f)===39?(U=ua,f++):(U=t,T===0&&Be(CA)),U!==t?(E=C,Q=gg(R),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t),C}function bge(){var C,Q,R,U;return C=f,r.charCodeAt(f)===39?(Q=ua,f++):(Q=t,T===0&&Be(CA)),Q!==t?(R=xge(),R!==t?(r.charCodeAt(f)===39?(U=ua,f++):(U=t,T===0&&Be(CA)),U!==t?(E=C,Q=gg(R),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t),C}function Sge(){var C,Q,R,U;if(C=f,r.substr(f,2)===rs?(Q=rs,f+=2):(Q=t,T===0&&Be(mA)),Q!==t&&(E=C,Q=ga()),C=Q,C===t)if(C=f,r.charCodeAt(f)===34?(Q=Bp,f++):(Q=t,T===0&&Be(EA)),Q!==t){for(R=[],U=Z1();U!==t;)R.push(U),U=Z1();R!==t?(r.charCodeAt(f)===34?(U=Bp,f++):(U=t,T===0&&Be(EA)),U!==t?(E=C,Q=IA(R),C=Q):(f=C,C=t)):(f=C,C=t)}else f=C,C=t;return C}function vge(){var C,Q,R;if(C=f,Q=[],R=_1(),R!==t)for(;R!==t;)Q.push(R),R=_1();else Q=t;return Q!==t&&(E=C,Q=IA(Q)),C=Q,C}function Z1(){var C,Q;return C=f,Q=rK(),Q!==t&&(E=C,Q=Ir(Q)),C=Q,C===t&&(C=f,Q=iK(),Q!==t&&(E=C,Q=Nl(Q)),C=Q,C===t&&(C=f,Q=AS(),Q!==t&&(E=C,Q=fg(Q)),C=Q,C===t&&(C=f,Q=Pge(),Q!==t&&(E=C,Q=Io(Q)),C=Q))),C}function _1(){var C,Q;return C=f,Q=rK(),Q!==t&&(E=C,Q=hg(Q)),C=Q,C===t&&(C=f,Q=iK(),Q!==t&&(E=C,Q=Qp(Q)),C=Q,C===t&&(C=f,Q=AS(),Q!==t&&(E=C,Q=bp(Q)),C=Q,C===t&&(C=f,Q=Fge(),Q!==t&&(E=C,Q=br(Q)),C=Q,C===t&&(C=f,Q=Rge(),Q!==t&&(E=C,Q=Io(Q)),C=Q)))),C}function xge(){var C,Q,R;for(C=f,Q=[],ne.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(yo));R!==t;)Q.push(R),ne.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(yo));return Q!==t&&(E=C,Q=Fn(Q)),C=Q,C}function Pge(){var C,Q,R;if(C=f,Q=[],R=$1(),R===t&&(pg.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(yt))),R!==t)for(;R!==t;)Q.push(R),R=$1(),R===t&&(pg.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(yt)));else Q=t;return Q!==t&&(E=C,Q=Fn(Q)),C=Q,C}function $1(){var C,Q,R;return C=f,r.substr(f,2)===Tl?(Q=Tl,f+=2):(Q=t,T===0&&Be(Nn)),Q!==t&&(E=C,Q=is()),C=Q,C===t&&(C=f,r.charCodeAt(f)===92?(Q=ns,f++):(Q=t,T===0&&Be(ut)),Q!==t?(wo.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(At)),R!==t?(E=C,Q=An(R),C=Q):(f=C,C=t)):(f=C,C=t)),C}function kge(){var C,Q,R;for(C=f,Q=[],R=eK(),R===t&&(ne.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(yo)));R!==t;)Q.push(R),R=eK(),R===t&&(ne.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(yo)));return Q!==t&&(E=C,Q=Fn(Q)),C=Q,C}function eK(){var C,Q,R;return C=f,r.substr(f,2)===b?(Q=b,f+=2):(Q=t,T===0&&Be(Ft)),Q!==t&&(E=C,Q=dg()),C=Q,C===t&&(C=f,r.substr(f,2)===Ll?(Q=Ll,f+=2):(Q=t,T===0&&Be(Sp)),Q!==t&&(E=C,Q=vp()),C=Q,C===t&&(C=f,r.charCodeAt(f)===92?(Q=ns,f++):(Q=t,T===0&&Be(ut)),Q!==t?(xp.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(Pp)),R!==t?(E=C,Q=kp(),C=Q):(f=C,C=t)):(f=C,C=t),C===t&&(C=f,r.substr(f,2)===G?(Q=G,f+=2):(Q=t,T===0&&Be(Et)),Q!==t&&(E=C,Q=yA()),C=Q,C===t&&(C=f,r.substr(f,2)===Wi?(Q=Wi,f+=2):(Q=t,T===0&&Be(Ol)),Q!==t&&(E=C,Q=ze()),C=Q,C===t&&(C=f,r.substr(f,2)===fa?(Q=fa,f+=2):(Q=t,T===0&&Be(Cg)),Q!==t&&(E=C,Q=KE()),C=Q,C===t&&(C=f,r.substr(f,2)===Dp?(Q=Dp,f+=2):(Q=t,T===0&&Be(UE)),Q!==t&&(E=C,Q=sr()),C=Q,C===t&&(C=f,r.substr(f,2)===Tn?(Q=Tn,f+=2):(Q=t,T===0&&Be(Ml)),Q!==t&&(E=C,Q=Rp()),C=Q,C===t&&(C=f,r.charCodeAt(f)===92?(Q=ns,f++):(Q=t,T===0&&Be(ut)),Q!==t?(Ks.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(ha)),R!==t?(E=C,Q=An(R),C=Q):(f=C,C=t)):(f=C,C=t),C===t&&(C=Dge()))))))))),C}function Dge(){var C,Q,R,U,le,Qe,ft,It,Gr,gi,ss,lS;return C=f,r.charCodeAt(f)===92?(Q=ns,f++):(Q=t,T===0&&Be(ut)),Q!==t?(R=sS(),R!==t?(E=C,Q=ln(R),C=Q):(f=C,C=t)):(f=C,C=t),C===t&&(C=f,r.substr(f,2)===Ne?(Q=Ne,f+=2):(Q=t,T===0&&Be(mg)),Q!==t?(R=f,U=f,le=sS(),le!==t?(Qe=On(),Qe!==t?(le=[le,Qe],U=le):(f=U,U=t)):(f=U,U=t),U===t&&(U=sS()),U!==t?R=r.substring(R,f):R=U,R!==t?(E=C,Q=ln(R),C=Q):(f=C,C=t)):(f=C,C=t),C===t&&(C=f,r.substr(f,2)===Kl?(Q=Kl,f+=2):(Q=t,T===0&&Be(Us)),Q!==t?(R=f,U=f,le=On(),le!==t?(Qe=On(),Qe!==t?(ft=On(),ft!==t?(It=On(),It!==t?(le=[le,Qe,ft,It],U=le):(f=U,U=t)):(f=U,U=t)):(f=U,U=t)):(f=U,U=t),U!==t?R=r.substring(R,f):R=U,R!==t?(E=C,Q=ln(R),C=Q):(f=C,C=t)):(f=C,C=t),C===t&&(C=f,r.substr(f,2)===Ul?(Q=Ul,f+=2):(Q=t,T===0&&Be(wA)),Q!==t?(R=f,U=f,le=On(),le!==t?(Qe=On(),Qe!==t?(ft=On(),ft!==t?(It=On(),It!==t?(Gr=On(),Gr!==t?(gi=On(),gi!==t?(ss=On(),ss!==t?(lS=On(),lS!==t?(le=[le,Qe,ft,It,Gr,gi,ss,lS],U=le):(f=U,U=t)):(f=U,U=t)):(f=U,U=t)):(f=U,U=t)):(f=U,U=t)):(f=U,U=t)):(f=U,U=t)):(f=U,U=t),U!==t?R=r.substring(R,f):R=U,R!==t?(E=C,Q=Eg(R),C=Q):(f=C,C=t)):(f=C,C=t)))),C}function sS(){var C;return Ig.test(r.charAt(f))?(C=r.charAt(f),f++):(C=t,T===0&&Be(pa)),C}function On(){var C;return da.test(r.charAt(f))?(C=r.charAt(f),f++):(C=t,T===0&&Be(tt)),C}function Rge(){var C,Q,R,U,le;if(C=f,Q=[],R=f,r.charCodeAt(f)===92?(U=ns,f++):(U=t,T===0&&Be(ut)),U!==t?(r.length>f?(le=r.charAt(f),f++):(le=t,T===0&&Be(Bo)),le!==t?(E=R,U=An(le),R=U):(f=R,R=t)):(f=R,R=t),R===t&&(R=f,r.substr(f,2)===BA?(U=BA,f+=2):(U=t,T===0&&Be(Fp)),U!==t&&(E=R,U=Ca()),R=U,R===t&&(R=f,U=f,T++,le=sK(),T--,le===t?U=void 0:(f=U,U=t),U!==t?(r.length>f?(le=r.charAt(f),f++):(le=t,T===0&&Be(Bo)),le!==t?(E=R,U=An(le),R=U):(f=R,R=t)):(f=R,R=t))),R!==t)for(;R!==t;)Q.push(R),R=f,r.charCodeAt(f)===92?(U=ns,f++):(U=t,T===0&&Be(ut)),U!==t?(r.length>f?(le=r.charAt(f),f++):(le=t,T===0&&Be(Bo)),le!==t?(E=R,U=An(le),R=U):(f=R,R=t)):(f=R,R=t),R===t&&(R=f,r.substr(f,2)===BA?(U=BA,f+=2):(U=t,T===0&&Be(Fp)),U!==t&&(E=R,U=Ca()),R=U,R===t&&(R=f,U=f,T++,le=sK(),T--,le===t?U=void 0:(f=U,U=t),U!==t?(r.length>f?(le=r.charAt(f),f++):(le=t,T===0&&Be(Bo)),le!==t?(E=R,U=An(le),R=U):(f=R,R=t)):(f=R,R=t)));else Q=t;return Q!==t&&(E=C,Q=Fn(Q)),C=Q,C}function oS(){var C,Q,R,U,le,Qe;if(C=f,r.charCodeAt(f)===45?(Q=Hl,f++):(Q=t,T===0&&Be(Gl)),Q===t&&(r.charCodeAt(f)===43?(Q=QA,f++):(Q=t,T===0&&Be(ma))),Q===t&&(Q=null),Q!==t){if(R=[],je.test(r.charAt(f))?(U=r.charAt(f),f++):(U=t,T===0&&Be(ie)),U!==t)for(;U!==t;)R.push(U),je.test(r.charAt(f))?(U=r.charAt(f),f++):(U=t,T===0&&Be(ie));else R=t;if(R!==t)if(r.charCodeAt(f)===46?(U=Np,f++):(U=t,T===0&&Be(HE)),U!==t){if(le=[],je.test(r.charAt(f))?(Qe=r.charAt(f),f++):(Qe=t,T===0&&Be(ie)),Qe!==t)for(;Qe!==t;)le.push(Qe),je.test(r.charAt(f))?(Qe=r.charAt(f),f++):(Qe=t,T===0&&Be(ie));else le=t;le!==t?(E=C,Q=Yl(Q,R,le),C=Q):(f=C,C=t)}else f=C,C=t;else f=C,C=t}else f=C,C=t;if(C===t){if(C=f,r.charCodeAt(f)===45?(Q=Hl,f++):(Q=t,T===0&&Be(Gl)),Q===t&&(r.charCodeAt(f)===43?(Q=QA,f++):(Q=t,T===0&&Be(ma))),Q===t&&(Q=null),Q!==t){if(R=[],je.test(r.charAt(f))?(U=r.charAt(f),f++):(U=t,T===0&&Be(ie)),U!==t)for(;U!==t;)R.push(U),je.test(r.charAt(f))?(U=r.charAt(f),f++):(U=t,T===0&&Be(ie));else R=t;R!==t?(E=C,Q=GE(Q,R),C=Q):(f=C,C=t)}else f=C,C=t;if(C===t&&(C=f,Q=AS(),Q!==t&&(E=C,Q=Tp(Q)),C=Q,C===t&&(C=f,Q=Wl(),Q!==t&&(E=C,Q=jl(Q)),C=Q,C===t)))if(C=f,r.charCodeAt(f)===40?(Q=ue,f++):(Q=t,T===0&&Be(ee)),Q!==t){for(R=[],U=Me();U!==t;)R.push(U),U=Me();if(R!==t)if(U=tK(),U!==t){for(le=[],Qe=Me();Qe!==t;)le.push(Qe),Qe=Me();le!==t?(r.charCodeAt(f)===41?(Qe=O,f++):(Qe=t,T===0&&Be(N)),Qe!==t?(E=C,Q=Lr(U),C=Q):(f=C,C=t)):(f=C,C=t)}else f=C,C=t;else f=C,C=t}else f=C,C=t}return C}function aS(){var C,Q,R,U,le,Qe,ft,It;if(C=f,Q=oS(),Q!==t){for(R=[],U=f,le=[],Qe=Me();Qe!==t;)le.push(Qe),Qe=Me();if(le!==t)if(r.charCodeAt(f)===42?(Qe=YE,f++):(Qe=t,T===0&&Be(Hs)),Qe===t&&(r.charCodeAt(f)===47?(Qe=Gs,f++):(Qe=t,T===0&&Be(yg))),Qe!==t){for(ft=[],It=Me();It!==t;)ft.push(It),It=Me();ft!==t?(It=oS(),It!==t?(E=U,le=bA(Q,Qe,It),U=le):(f=U,U=t)):(f=U,U=t)}else f=U,U=t;else f=U,U=t;for(;U!==t;){for(R.push(U),U=f,le=[],Qe=Me();Qe!==t;)le.push(Qe),Qe=Me();if(le!==t)if(r.charCodeAt(f)===42?(Qe=YE,f++):(Qe=t,T===0&&Be(Hs)),Qe===t&&(r.charCodeAt(f)===47?(Qe=Gs,f++):(Qe=t,T===0&&Be(yg))),Qe!==t){for(ft=[],It=Me();It!==t;)ft.push(It),It=Me();ft!==t?(It=oS(),It!==t?(E=U,le=bA(Q,Qe,It),U=le):(f=U,U=t)):(f=U,U=t)}else f=U,U=t;else f=U,U=t}R!==t?(E=C,Q=D(Q,R),C=Q):(f=C,C=t)}else f=C,C=t;return C}function tK(){var C,Q,R,U,le,Qe,ft,It;if(C=f,Q=aS(),Q!==t){for(R=[],U=f,le=[],Qe=Me();Qe!==t;)le.push(Qe),Qe=Me();if(le!==t)if(r.charCodeAt(f)===43?(Qe=QA,f++):(Qe=t,T===0&&Be(ma)),Qe===t&&(r.charCodeAt(f)===45?(Qe=Hl,f++):(Qe=t,T===0&&Be(Gl))),Qe!==t){for(ft=[],It=Me();It!==t;)ft.push(It),It=Me();ft!==t?(It=aS(),It!==t?(E=U,le=j(Q,Qe,It),U=le):(f=U,U=t)):(f=U,U=t)}else f=U,U=t;else f=U,U=t;for(;U!==t;){for(R.push(U),U=f,le=[],Qe=Me();Qe!==t;)le.push(Qe),Qe=Me();if(le!==t)if(r.charCodeAt(f)===43?(Qe=QA,f++):(Qe=t,T===0&&Be(ma)),Qe===t&&(r.charCodeAt(f)===45?(Qe=Hl,f++):(Qe=t,T===0&&Be(Gl))),Qe!==t){for(ft=[],It=Me();It!==t;)ft.push(It),It=Me();ft!==t?(It=aS(),It!==t?(E=U,le=j(Q,Qe,It),U=le):(f=U,U=t)):(f=U,U=t)}else f=U,U=t;else f=U,U=t}R!==t?(E=C,Q=D(Q,R),C=Q):(f=C,C=t)}else f=C,C=t;return C}function rK(){var C,Q,R,U,le,Qe;if(C=f,r.substr(f,3)===pe?(Q=pe,f+=3):(Q=t,T===0&&Be(Le)),Q!==t){for(R=[],U=Me();U!==t;)R.push(U),U=Me();if(R!==t)if(U=tK(),U!==t){for(le=[],Qe=Me();Qe!==t;)le.push(Qe),Qe=Me();le!==t?(r.substr(f,2)===ke?(Qe=ke,f+=2):(Qe=t,T===0&&Be(Je)),Qe!==t?(E=C,Q=pt(U),C=Q):(f=C,C=t)):(f=C,C=t)}else f=C,C=t;else f=C,C=t}else f=C,C=t;return C}function iK(){var C,Q,R,U;return C=f,r.substr(f,2)===Xt?(Q=Xt,f+=2):(Q=t,T===0&&Be(Ea)),Q!==t?(R=Sr(),R!==t?(r.charCodeAt(f)===41?(U=O,f++):(U=t,T===0&&Be(N)),U!==t?(E=C,Q=R1(R),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t),C}function AS(){var C,Q,R,U,le,Qe;return C=f,r.substr(f,2)===Ys?(Q=Ys,f+=2):(Q=t,T===0&&Be(wg)),Q!==t?(R=Wl(),R!==t?(r.substr(f,2)===Wb?(U=Wb,f+=2):(U=t,T===0&&Be(F1)),U!==t?(le=W1(),le!==t?(r.charCodeAt(f)===125?(Qe=De,f++):(Qe=t,T===0&&Be(Re)),Qe!==t?(E=C,Q=N1(R,le),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t)):(f=C,C=t)):(f=C,C=t),C===t&&(C=f,r.substr(f,2)===Ys?(Q=Ys,f+=2):(Q=t,T===0&&Be(wg)),Q!==t?(R=Wl(),R!==t?(r.substr(f,3)===zb?(U=zb,f+=3):(U=t,T===0&&Be(T1)),U!==t?(E=C,Q=L1(R),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t),C===t&&(C=f,r.substr(f,2)===Ys?(Q=Ys,f+=2):(Q=t,T===0&&Be(wg)),Q!==t?(R=Wl(),R!==t?(r.substr(f,2)===Vb?(U=Vb,f+=2):(U=t,T===0&&Be(O1)),U!==t?(le=W1(),le!==t?(r.charCodeAt(f)===125?(Qe=De,f++):(Qe=t,T===0&&Be(Re)),Qe!==t?(E=C,Q=M1(R,le),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t)):(f=C,C=t)):(f=C,C=t),C===t&&(C=f,r.substr(f,2)===Ys?(Q=Ys,f+=2):(Q=t,T===0&&Be(wg)),Q!==t?(R=Wl(),R!==t?(r.substr(f,3)===Xb?(U=Xb,f+=3):(U=t,T===0&&Be(K1)),U!==t?(E=C,Q=U1(R),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t),C===t&&(C=f,r.substr(f,2)===Ys?(Q=Ys,f+=2):(Q=t,T===0&&Be(wg)),Q!==t?(R=Wl(),R!==t?(r.charCodeAt(f)===125?(U=De,f++):(U=t,T===0&&Be(Re)),U!==t?(E=C,Q=Zb(R),C=Q):(f=C,C=t)):(f=C,C=t)):(f=C,C=t),C===t&&(C=f,r.charCodeAt(f)===36?(Q=H1,f++):(Q=t,T===0&&Be(G1)),Q!==t?(R=Wl(),R!==t?(E=C,Q=Zb(R),C=Q):(f=C,C=t)):(f=C,C=t)))))),C}function Fge(){var C,Q,R;return C=f,Q=Nge(),Q!==t?(E=f,R=Y1(Q),R?R=void 0:R=t,R!==t?(E=C,Q=j1(Q),C=Q):(f=C,C=t)):(f=C,C=t),C}function Nge(){var C,Q,R,U,le;if(C=f,Q=[],R=f,U=f,T++,le=oK(),T--,le===t?U=void 0:(f=U,U=t),U!==t?(r.length>f?(le=r.charAt(f),f++):(le=t,T===0&&Be(Bo)),le!==t?(E=R,U=An(le),R=U):(f=R,R=t)):(f=R,R=t),R!==t)for(;R!==t;)Q.push(R),R=f,U=f,T++,le=oK(),T--,le===t?U=void 0:(f=U,U=t),U!==t?(r.length>f?(le=r.charAt(f),f++):(le=t,T===0&&Be(Bo)),le!==t?(E=R,U=An(le),R=U):(f=R,R=t)):(f=R,R=t);else Q=t;return Q!==t&&(E=C,Q=Fn(Q)),C=Q,C}function nK(){var C,Q,R;if(C=f,Q=[],_b.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be($b)),R!==t)for(;R!==t;)Q.push(R),_b.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be($b));else Q=t;return Q!==t&&(E=C,Q=eS()),C=Q,C}function Wl(){var C,Q,R;if(C=f,Q=[],ql.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(jE)),R!==t)for(;R!==t;)Q.push(R),ql.test(r.charAt(f))?(R=r.charAt(f),f++):(R=t,T===0&&Be(jE));else Q=t;return Q!==t&&(E=C,Q=eS()),C=Q,C}function sK(){var C;return tS.test(r.charAt(f))?(C=r.charAt(f),f++):(C=t,T===0&&Be(rS)),C}function oK(){var C;return iS.test(r.charAt(f))?(C=r.charAt(f),f++):(C=t,T===0&&Be(qE)),C}function Me(){var C,Q;if(C=[],Jl.test(r.charAt(f))?(Q=r.charAt(f),f++):(Q=t,T===0&&Be(Bg)),Q!==t)for(;Q!==t;)C.push(Q),Jl.test(r.charAt(f))?(Q=r.charAt(f),f++):(Q=t,T===0&&Be(Bg));else C=t;return C}if($=n(),$!==t&&f===r.length)return $;throw $!==t&&f{"use strict";function Ofe(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function tc(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,tc)}Ofe(tc,Error);tc.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,h=1;gH&&(H=S,q=[]),q.push(ie))}function Re(ie,Y){return new tc(ie,null,null,Y)}function oe(ie,Y,fe){return new tc(tc.buildMessage(ie,Y),ie,Y,fe)}function Ae(){var ie,Y,fe,re;return ie=S,Y=ye(),Y!==t?(r.charCodeAt(S)===47?(fe=s,S++):(fe=t,_===0&&De(o)),fe!==t?(re=ye(),re!==t?(P=ie,Y=a(Y,re),ie=Y):(S=ie,ie=t)):(S=ie,ie=t)):(S=ie,ie=t),ie===t&&(ie=S,Y=ye(),Y!==t&&(P=ie,Y=l(Y)),ie=Y),ie}function ye(){var ie,Y,fe,re;return ie=S,Y=ge(),Y!==t?(r.charCodeAt(S)===64?(fe=c,S++):(fe=t,_===0&&De(u)),fe!==t?(re=je(),re!==t?(P=ie,Y=g(Y,re),ie=Y):(S=ie,ie=t)):(S=ie,ie=t)):(S=ie,ie=t),ie===t&&(ie=S,Y=ge(),Y!==t&&(P=ie,Y=h(Y)),ie=Y),ie}function ge(){var ie,Y,fe,re,de;return ie=S,r.charCodeAt(S)===64?(Y=c,S++):(Y=t,_===0&&De(u)),Y!==t?(fe=ae(),fe!==t?(r.charCodeAt(S)===47?(re=s,S++):(re=t,_===0&&De(o)),re!==t?(de=ae(),de!==t?(P=ie,Y=p(),ie=Y):(S=ie,ie=t)):(S=ie,ie=t)):(S=ie,ie=t)):(S=ie,ie=t),ie===t&&(ie=S,Y=ae(),Y!==t&&(P=ie,Y=p()),ie=Y),ie}function ae(){var ie,Y,fe;if(ie=S,Y=[],d.test(r.charAt(S))?(fe=r.charAt(S),S++):(fe=t,_===0&&De(m)),fe!==t)for(;fe!==t;)Y.push(fe),d.test(r.charAt(S))?(fe=r.charAt(S),S++):(fe=t,_===0&&De(m));else Y=t;return Y!==t&&(P=ie,Y=p()),ie=Y,ie}function je(){var ie,Y,fe;if(ie=S,Y=[],y.test(r.charAt(S))?(fe=r.charAt(S),S++):(fe=t,_===0&&De(B)),fe!==t)for(;fe!==t;)Y.push(fe),y.test(r.charAt(S))?(fe=r.charAt(S),S++):(fe=t,_===0&&De(B));else Y=t;return Y!==t&&(P=ie,Y=p()),ie=Y,ie}if(X=n(),X!==t&&S===r.length)return X;throw X!==t&&S{"use strict";function wU(r){return typeof r>"u"||r===null}function Kfe(r){return typeof r=="object"&&r!==null}function Ufe(r){return Array.isArray(r)?r:wU(r)?[]:[r]}function Hfe(r,e){var t,i,n,s;if(e)for(s=Object.keys(e),t=0,i=s.length;t{"use strict";function Zp(r,e){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Zp.prototype=Object.create(Error.prototype);Zp.prototype.constructor=Zp;Zp.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t};BU.exports=Zp});var SU=I((NZe,bU)=>{"use strict";var QU=ic();function GS(r,e,t,i,n){this.name=r,this.buffer=e,this.position=t,this.line=i,this.column=n}GS.prototype.getSnippet=function(e,t){var i,n,s,o,a;if(!this.buffer)return null;for(e=e||4,t=t||75,i="",n=this.position;n>0&&`\0\r -\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;ot/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(n,o),QU.repeat(" ",e)+i+a+s+` -`+QU.repeat(" ",e+this.position-n+i.length)+"^"};GS.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};bU.exports=GS});var ii=I((TZe,xU)=>{"use strict";var vU=Tg(),jfe=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],qfe=["scalar","sequence","mapping"];function Jfe(r){var e={};return r!==null&&Object.keys(r).forEach(function(t){r[t].forEach(function(i){e[String(i)]=t})}),e}function Wfe(r,e){if(e=e||{},Object.keys(e).forEach(function(t){if(jfe.indexOf(t)===-1)throw new vU('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=Jfe(e.styleAliases||null),qfe.indexOf(this.kind)===-1)throw new vU('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')}xU.exports=Wfe});var nc=I((LZe,kU)=>{"use strict";var PU=ic(),CI=Tg(),zfe=ii();function YS(r,e,t){var i=[];return r.include.forEach(function(n){t=YS(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 Vfe(){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{"use strict";var Xfe=ii();DU.exports=new Xfe("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}})});var NU=I((MZe,FU)=>{"use strict";var Zfe=ii();FU.exports=new Zfe("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}})});var LU=I((KZe,TU)=>{"use strict";var _fe=ii();TU.exports=new _fe("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}})});var mI=I((UZe,OU)=>{"use strict";var $fe=nc();OU.exports=new $fe({explicit:[RU(),NU(),LU()]})});var KU=I((HZe,MU)=>{"use strict";var ehe=ii();function the(r){if(r===null)return!0;var e=r.length;return e===1&&r==="~"||e===4&&(r==="null"||r==="Null"||r==="NULL")}function rhe(){return null}function ihe(r){return r===null}MU.exports=new ehe("tag:yaml.org,2002:null",{kind:"scalar",resolve:the,construct:rhe,predicate:ihe,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var HU=I((GZe,UU)=>{"use strict";var nhe=ii();function she(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 ohe(r){return r==="true"||r==="True"||r==="TRUE"}function ahe(r){return Object.prototype.toString.call(r)==="[object Boolean]"}UU.exports=new nhe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:she,construct:ohe,predicate:ahe,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 YU=I((YZe,GU)=>{"use strict";var Ahe=ic(),lhe=ii();function che(r){return 48<=r&&r<=57||65<=r&&r<=70||97<=r&&r<=102}function uhe(r){return 48<=r&&r<=55}function ghe(r){return 48<=r&&r<=57}function fhe(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=0?"0b"+r.toString(2):"-0b"+r.toString(2).slice(1)},octal:function(r){return r>=0?"0"+r.toString(8):"-0"+r.toString(8).slice(1)},decimal:function(r){return r.toString(10)},hexadecimal:function(r){return r>=0?"0x"+r.toString(16).toUpperCase():"-0x"+r.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var JU=I((jZe,qU)=>{"use strict";var jU=ic(),dhe=ii(),Che=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function mhe(r){return!(r===null||!Che.test(r)||r[r.length-1]==="_")}function Ehe(r){var e,t,i,n;return e=r.replace(/_/g,"").toLowerCase(),t=e[0]==="-"?-1:1,n=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:e.indexOf(":")>=0?(e.split(":").forEach(function(s){n.unshift(parseFloat(s,10))}),e=0,i=1,n.forEach(function(s){e+=s*i,i*=60}),t*e):t*parseFloat(e,10)}var Ihe=/^[-+]?[0-9]+e/;function yhe(r,e){var t;if(isNaN(r))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===r)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===r)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(jU.isNegativeZero(r))return"-0.0";return t=r.toString(10),Ihe.test(t)?t.replace("e",".e"):t}function whe(r){return Object.prototype.toString.call(r)==="[object Number]"&&(r%1!==0||jU.isNegativeZero(r))}qU.exports=new dhe("tag:yaml.org,2002:float",{kind:"scalar",resolve:mhe,construct:Ehe,predicate:whe,represent:yhe,defaultStyle:"lowercase"})});var jS=I((qZe,WU)=>{"use strict";var Bhe=nc();WU.exports=new Bhe({include:[mI()],implicit:[KU(),HU(),YU(),JU()]})});var qS=I((JZe,zU)=>{"use strict";var Qhe=nc();zU.exports=new Qhe({include:[jS()]})});var _U=I((WZe,ZU)=>{"use strict";var bhe=ii(),VU=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),XU=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function She(r){return r===null?!1:VU.exec(r)!==null||XU.exec(r)!==null}function vhe(r){var e,t,i,n,s,o,a,l=0,c=null,u,g,h;if(e=VU.exec(r),e===null&&(e=XU.exec(r)),e===null)throw new Error("Date resolve error");if(t=+e[1],i=+e[2]-1,n=+e[3],!e[4])return new Date(Date.UTC(t,i,n));if(s=+e[4],o=+e[5],a=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=+e[10],g=+(e[11]||0),c=(u*60+g)*6e4,e[9]==="-"&&(c=-c)),h=new Date(Date.UTC(t,i,n,s,o,a,l)),c&&h.setTime(h.getTime()-c),h}function xhe(r){return r.toISOString()}ZU.exports=new bhe("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:She,construct:vhe,instanceOf:Date,represent:xhe})});var e2=I((zZe,$U)=>{"use strict";var Phe=ii();function khe(r){return r==="<<"||r===null}$U.exports=new Phe("tag:yaml.org,2002:merge",{kind:"scalar",resolve:khe})});var i2=I((VZe,r2)=>{"use strict";var sc;try{t2=J,sc=t2("buffer").Buffer}catch{}var t2,Dhe=ii(),JS=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= -\r`;function Rhe(r){if(r===null)return!1;var e,t,i=0,n=r.length,s=JS;for(t=0;t64)){if(e<0)return!1;i+=6}return i%8===0}function Fhe(r){var e,t,i=r.replace(/[\r\n=]/g,""),n=i.length,s=JS,o=0,a=[];for(e=0;e>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),sc?sc.from?sc.from(a):new sc(a):a}function Nhe(r){var e="",t=0,i,n,s=r.length,o=JS;for(i=0;i>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 The(r){return sc&&sc.isBuffer(r)}r2.exports=new Dhe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Rhe,construct:Fhe,predicate:The,represent:Nhe})});var s2=I((ZZe,n2)=>{"use strict";var Lhe=ii(),Ohe=Object.prototype.hasOwnProperty,Mhe=Object.prototype.toString;function Khe(r){if(r===null)return!0;var e=[],t,i,n,s,o,a=r;for(t=0,i=a.length;t{"use strict";var Hhe=ii(),Ghe=Object.prototype.toString;function Yhe(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{"use strict";var qhe=ii(),Jhe=Object.prototype.hasOwnProperty;function Whe(r){if(r===null)return!0;var e,t=r;for(e in t)if(Jhe.call(t,e)&&t[e]!==null)return!1;return!0}function zhe(r){return r!==null?r:{}}A2.exports=new qhe("tag:yaml.org,2002:set",{kind:"mapping",resolve:Whe,construct:zhe})});var Og=I((e_e,c2)=>{"use strict";var Vhe=nc();c2.exports=new Vhe({include:[qS()],implicit:[_U(),e2()],explicit:[i2(),s2(),a2(),l2()]})});var g2=I((t_e,u2)=>{"use strict";var Xhe=ii();function Zhe(){return!0}function _he(){}function $he(){return""}function epe(r){return typeof r>"u"}u2.exports=new Xhe("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:Zhe,construct:_he,predicate:epe,represent:$he})});var h2=I((r_e,f2)=>{"use strict";var tpe=ii();function rpe(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 ipe(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 npe(r){var e="/"+r.source+"/";return r.global&&(e+="g"),r.multiline&&(e+="m"),r.ignoreCase&&(e+="i"),e}function spe(r){return Object.prototype.toString.call(r)==="[object RegExp]"}f2.exports=new tpe("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:rpe,construct:ipe,predicate:spe,represent:npe})});var C2=I((i_e,d2)=>{"use strict";var EI;try{p2=J,EI=p2("esprima")}catch{typeof window<"u"&&(EI=window.esprima)}var p2,ope=ii();function ape(r){if(r===null)return!1;try{var e="("+r+")",t=EI.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 Ape(r){var e="("+r+")",t=EI.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 lpe(r){return r.toString()}function cpe(r){return Object.prototype.toString.call(r)==="[object Function]"}d2.exports=new ope("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:ape,construct:Ape,predicate:cpe,represent:lpe})});var _p=I((s_e,E2)=>{"use strict";var m2=nc();E2.exports=m2.DEFAULT=new m2({include:[Og()],explicit:[g2(),h2(),C2()]})});var M2=I((o_e,$p)=>{"use strict";var Qa=ic(),S2=Tg(),upe=SU(),v2=Og(),gpe=_p(),kA=Object.prototype.hasOwnProperty,II=1,x2=2,P2=3,yI=4,WS=1,fpe=2,I2=3,hpe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ppe=/[\x85\u2028\u2029]/,dpe=/[,\[\]\{\}]/,k2=/^(?:!|!!|![a-z\-]+!)$/i,D2=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function y2(r){return Object.prototype.toString.call(r)}function vo(r){return r===10||r===13}function ac(r){return r===9||r===32}function fn(r){return r===9||r===32||r===10||r===13}function Mg(r){return r===44||r===91||r===93||r===123||r===125}function Cpe(r){var e;return 48<=r&&r<=57?r-48:(e=r|32,97<=e&&e<=102?e-97+10:-1)}function mpe(r){return r===120?2:r===117?4:r===85?8:0}function Epe(r){return 48<=r&&r<=57?r-48:-1}function w2(r){return r===48?"\0":r===97?"\x07":r===98?"\b":r===116||r===9?" ":r===110?` -`: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 Ipe(r){return r<=65535?String.fromCharCode(r):String.fromCharCode((r-65536>>10)+55296,(r-65536&1023)+56320)}var R2=new Array(256),F2=new Array(256);for(oc=0;oc<256;oc++)R2[oc]=w2(oc)?1:0,F2[oc]=w2(oc);var oc;function ype(r,e){this.input=r,this.filename=e.filename||null,this.schema=e.schema||gpe,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 N2(r,e){return new S2(e,new upe(r.filename,r.input,r.position,r.line,r.position-r.lineStart))}function gt(r,e){throw N2(r,e)}function wI(r,e){r.onWarning&&r.onWarning.call(null,N2(r,e))}var B2={YAML:function(e,t,i){var n,s,o;e.version!==null&>(e,"duplication of %YAML directive"),i.length!==1&>(e,"YAML directive accepts exactly one argument"),n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),n===null&>(e,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),o=parseInt(n[2],10),s!==1&>(e,"unacceptable YAML version of the document"),e.version=i[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&wI(e,"unsupported YAML version of the document")},TAG:function(e,t,i){var n,s;i.length!==2&>(e,"TAG directive accepts exactly two arguments"),n=i[0],s=i[1],k2.test(n)||gt(e,"ill-formed tag handle (first argument) of the TAG directive"),kA.call(e.tagMap,n)&>(e,'there is a previously declared suffix for "'+n+'" tag handle'),D2.test(s)||gt(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(e1&&(r.result+=Qa.repeat(` -`,e-1))}function wpe(r,e,t){var i,n,s,o,a,l,c,u,g=r.kind,h=r.result,p;if(p=r.input.charCodeAt(r.position),fn(p)||Mg(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(n=r.input.charCodeAt(r.position+1),fn(n)||t&&Mg(n)))return!1;for(r.kind="scalar",r.result="",s=o=r.position,a=!1;p!==0;){if(p===58){if(n=r.input.charCodeAt(r.position+1),fn(n)||t&&Mg(n))break}else if(p===35){if(i=r.input.charCodeAt(r.position-1),fn(i))break}else{if(r.position===r.lineStart&&BI(r)||t&&Mg(p))break;if(vo(p))if(l=r.line,c=r.lineStart,u=r.lineIndent,qr(r,!1,-1),r.lineIndent>=e){a=!0,p=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),VS(r,r.line-l),s=o=r.position,a=!1),ac(p)||(o=r.position+1),p=r.input.charCodeAt(++r.position)}return PA(r,s,o,!1),r.result?!0:(r.kind=g,r.result=h,!1)}function Bpe(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),VS(r,qr(r,!1,e)),i=n=r.position):r.position===r.lineStart&&BI(r)?gt(r,"unexpected end of the document within a single quoted scalar"):(r.position++,n=r.position);gt(r,"unexpected end of the stream within a single quoted scalar")}function Qpe(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))qr(r,!1,e);else if(a<256&&R2[a])r.result+=F2[a],r.position++;else if((o=mpe(a))>0){for(n=o,s=0;n>0;n--)a=r.input.charCodeAt(++r.position),(o=Cpe(a))>=0?s=(s<<4)+o:gt(r,"expected hexadecimal character");r.result+=Ipe(s),r.position++}else gt(r,"unknown escape sequence");t=i=r.position}else vo(a)?(PA(r,t,i,!0),VS(r,qr(r,!1,e)),t=i=r.position):r.position===r.lineStart&&BI(r)?gt(r,"unexpected end of the document within a double quoted scalar"):(r.position++,i=r.position)}gt(r,"unexpected end of the stream within a double quoted scalar")}function bpe(r,e){var t=!0,i,n=r.tag,s,o=r.anchor,a,l,c,u,g,h={},p,d,m,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(qr(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||gt(r,"missed comma between flow collection entries"),d=p=m=null,c=u=!1,y===63&&(a=r.input.charCodeAt(r.position+1),fn(a)&&(c=u=!0,r.position++,qr(r,!0,e))),i=r.line,Ug(r,e,II,!1,!0),d=r.tag,p=r.result,qr(r,!0,e),y=r.input.charCodeAt(r.position),(u||r.line===i)&&y===58&&(c=!0,y=r.input.charCodeAt(++r.position),qr(r,!0,e),Ug(r,e,II,!1,!0),m=r.result),g?Kg(r,s,h,d,p,m):c?s.push(Kg(r,null,h,d,p,m)):s.push(p),qr(r,!0,e),y=r.input.charCodeAt(r.position),y===44?(t=!0,y=r.input.charCodeAt(++r.position)):t=!1}gt(r,"unexpected end of the stream within a flow collection")}function Spe(r,e){var t,i,n=WS,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)WS===n?n=g===43?I2:fpe:gt(r,"repeat of a chomping mode identifier");else if((u=Epe(g))>=0)u===0?gt(r,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?gt(r,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(ac(g)){do g=r.input.charCodeAt(++r.position);while(ac(g));if(g===35)do g=r.input.charCodeAt(++r.position);while(!vo(g)&&g!==0)}for(;g!==0;){for(zS(r),r.lineIndent=0,g=r.input.charCodeAt(r.position);(!o||r.lineIndenta&&(a=r.lineIndent),vo(g)){l++;continue}if(r.lineIndente)&&l!==0)gt(r,"bad indentation of a sequence entry");else if(r.lineIndente)&&(Ug(r,e,yI,!0,n)&&(d?h=r.result:p=r.result),d||(Kg(r,c,u,g,h,p,s,o),g=h=p=null),qr(r,!0,-1),y=r.input.charCodeAt(r.position)),r.lineIndent>e&&y!==0)gt(r,"bad indentation of a mapping entry");else if(r.lineIndente?l=1:r.lineIndent===e?l=0:r.lineIndente?l=1:r.lineIndent===e?l=0:r.lineIndent tag; it should be "scalar", not "'+r.kind+'"'),g=0,h=r.implicitTypes.length;g tag; it should be "'+p.kind+'", not "'+r.kind+'"'),p.resolve(r.result)?(r.result=p.construct(r.result),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):gt(r,"cannot resolve a node with !<"+r.tag+"> explicit tag")):gt(r,"unknown tag !<"+r.tag+">");return r.listener!==null&&r.listener("close",r),r.tag!==null||r.anchor!==null||u}function Dpe(r){var e=r.position,t,i,n,s=!1,o;for(r.version=null,r.checkLineBreaks=r.legacy,r.tagMap={},r.anchorMap={};(o=r.input.charCodeAt(r.position))!==0&&(qr(r,!0,-1),o=r.input.charCodeAt(r.position),!(r.lineIndent>0||o!==37));){for(s=!0,o=r.input.charCodeAt(++r.position),t=r.position;o!==0&&!fn(o);)o=r.input.charCodeAt(++r.position);for(i=r.input.slice(t,r.position),n=[],i.length<1&>(r,"directive name must not be less than one character in length");o!==0;){for(;ac(o);)o=r.input.charCodeAt(++r.position);if(o===35){do o=r.input.charCodeAt(++r.position);while(o!==0&&!vo(o));break}if(vo(o))break;for(t=r.position;o!==0&&!fn(o);)o=r.input.charCodeAt(++r.position);n.push(r.input.slice(t,r.position))}o!==0&&zS(r),kA.call(B2,i)?B2[i](r,i,n):wI(r,'unknown document directive "'+i+'"')}if(qr(r,!0,-1),r.lineIndent===0&&r.input.charCodeAt(r.position)===45&&r.input.charCodeAt(r.position+1)===45&&r.input.charCodeAt(r.position+2)===45?(r.position+=3,qr(r,!0,-1)):s&>(r,"directives end mark is expected"),Ug(r,r.lineIndent-1,yI,!1,!0),qr(r,!0,-1),r.checkLineBreaks&&ppe.test(r.input.slice(e,r.position))&&wI(r,"non-ASCII line breaks are interpreted as content"),r.documents.push(r.result),r.position===r.lineStart&&BI(r)){r.input.charCodeAt(r.position)===46&&(r.position+=3,qr(r,!0,-1));return}if(r.position"u"&&(t=e,e=null);var i=T2(r,t);if(typeof e!="function")return i;for(var n=0,s=i.length;n"u"&&(t=e,e=null),L2(r,e,Qa.extend({schema:v2},t))}function Fpe(r,e){return O2(r,Qa.extend({schema:v2},e))}$p.exports.loadAll=L2;$p.exports.load=O2;$p.exports.safeLoadAll=Rpe;$p.exports.safeLoad=Fpe});var aH=I((a_e,$S)=>{"use strict";var td=ic(),rd=Tg(),Npe=_p(),Tpe=Og(),J2=Object.prototype.toString,W2=Object.prototype.hasOwnProperty,Lpe=9,ed=10,Ope=13,Mpe=32,Kpe=33,Upe=34,z2=35,Hpe=37,Gpe=38,Ype=39,jpe=42,V2=44,qpe=45,X2=58,Jpe=61,Wpe=62,zpe=63,Vpe=64,Z2=91,_2=93,Xpe=96,$2=123,Zpe=124,eH=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 _pe=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function $pe(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;n0?r.charCodeAt(s-1):null,h=h&&H2(o,a)}else{for(s=0;si&&r[g+1]!==" ",g=s);else if(!Hg(o))return QI;a=s>0?r.charCodeAt(s-1):null,h=h&&H2(o,a)}c=c||u&&s-g-1>i&&r[g+1]!==" "}return!l&&!c?h&&!n(r)?rH:iH:t>9&&tH(r)?QI:c?sH:nH}function sde(r,e,t,i){r.dump=function(){if(e.length===0)return"''";if(!r.noCompatMode&&_pe.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 tde(r,l)}switch(nde(e,o,r.indent,s,a)){case rH:return e;case iH:return"'"+e.replace(/'/g,"''")+"'";case nH:return"|"+G2(e,r.indent)+Y2(U2(e,n));case sH:return">"+G2(e,r.indent)+Y2(U2(ode(e,s),n));case QI:return'"'+ade(e,s)+'"';default:throw new rd("impossible error: invalid scalar style")}}()}function G2(r,e){var t=tH(r)?String(e):"",i=r[r.length-1]===` -`,n=i&&(r[r.length-2]===` -`||r===` -`),s=n?"+":i?"":"-";return t+s+` -`}function Y2(r){return r[r.length-1]===` -`?r.slice(0,-1):r}function ode(r,e){for(var t=/(\n+)([^\n]*)/g,i=function(){var c=r.indexOf(` -`);return c=c!==-1?c:r.length,t.lastIndex=c,j2(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!==""?` -`:"")+j2(l,e),n=s}return i}function j2(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 ade(r){for(var e="",t,i,n,s=0;s=55296&&t<=56319&&(i=r.charCodeAt(s+1),i>=56320&&i<=57343)){e+=K2((t-55296)*1024+i-56320+65536),s++;continue}n=Ni[t],e+=!n&&Hg(t)?r[s]:n||K2(t)}return e}function Ade(r,e,t){var i="",n=r.tag,s,o;for(s=0,o=t.length;s1024&&(u+="? "),u+=r.dump+(r.condenseFlow?'"':"")+":"+(r.condenseFlow?"":" "),Ac(r,e,c,!1,!1)&&(u+=r.dump,i+=u));r.tag=n,r.dump="{"+i+"}"}function ude(r,e,t,i){var n="",s=r.tag,o=Object.keys(t),a,l,c,u,g,h;if(r.sortKeys===!0)o.sort();else if(typeof r.sortKeys=="function")o.sort(r.sortKeys);else if(r.sortKeys)throw new rd("sortKeys must be a boolean or a function");for(a=0,l=o.length;a1024,g&&(r.dump&&ed===r.dump.charCodeAt(0)?h+="?":h+="? "),h+=r.dump,g&&(h+=XS(r,e)),Ac(r,e+1,u,!0,g)&&(r.dump&&ed===r.dump.charCodeAt(0)?h+=":":h+=": ",h+=r.dump,n+=h));r.tag=s,r.dump=n||"{}"}function q2(r,e,t){var i,n,s,o,a,l;for(n=t?r.explicitTypes:r.implicitTypes,s=0,o=n.length;s tag resolver accepts not "'+l+'" style');r.dump=i}return!0}return!1}function Ac(r,e,t,i,n,s){r.tag=null,r.dump=t,q2(r,t,!1)||q2(r,t,!0);var o=J2.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?(ude(r,e,r.dump,n),c&&(r.dump="&ref_"+l+r.dump)):(cde(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?(lde(r,u,r.dump,n),c&&(r.dump="&ref_"+l+r.dump)):(Ade(r,u,r.dump),c&&(r.dump="&ref_"+l+" "+r.dump))}else if(o==="[object String]")r.tag!=="?"&&sde(r,r.dump,e,s);else{if(r.skipInvalid)return!1;throw new rd("unacceptable kind of an object to dump "+o)}r.tag!==null&&r.tag!=="?"&&(r.dump="!<"+r.tag+"> "+r.dump)}return!0}function gde(r,e){var t=[],i=[],n,s;for(ZS(r,t,i),n=0,s=i.length;n{"use strict";var bI=M2(),AH=aH();function SI(r){return function(){throw new Error("Function "+r+" is deprecated and cannot be used.")}}Dr.exports.Type=ii();Dr.exports.Schema=nc();Dr.exports.FAILSAFE_SCHEMA=mI();Dr.exports.JSON_SCHEMA=jS();Dr.exports.CORE_SCHEMA=qS();Dr.exports.DEFAULT_SAFE_SCHEMA=Og();Dr.exports.DEFAULT_FULL_SCHEMA=_p();Dr.exports.load=bI.load;Dr.exports.loadAll=bI.loadAll;Dr.exports.safeLoad=bI.safeLoad;Dr.exports.safeLoadAll=bI.safeLoadAll;Dr.exports.dump=AH.dump;Dr.exports.safeDump=AH.safeDump;Dr.exports.YAMLException=Tg();Dr.exports.MINIMAL_SCHEMA=mI();Dr.exports.SAFE_SCHEMA=Og();Dr.exports.DEFAULT_SCHEMA=_p();Dr.exports.scan=SI("scan");Dr.exports.parse=SI("parse");Dr.exports.compose=SI("compose");Dr.exports.addConstructor=SI("addConstructor")});var uH=I((l_e,cH)=>{"use strict";var hde=lH();cH.exports=hde});var fH=I((c_e,gH)=>{"use strict";function pde(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function lc(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,lc)}pde(lc,Error);lc.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,h=1;g({[Le]:pe})))},H=function(D){return D},q=function(D){return D},_=Ks("correct indentation"),X=" ",W=sr(" ",!1),Z=function(D){return D.length===bA*yg},A=function(D){return D.length===(bA+1)*yg},se=function(){return bA++,!0},ue=function(){return bA--,!0},ee=function(){return Cg()},O=Ks("pseudostring"),N=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,ce=Tn(["\r",` -`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),he=/^[^\r\n\t ,\][{}:#"']/,Pe=Tn(["\r",` -`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),De=function(){return Cg().replace(/^ *| *$/g,"")},Re="--",oe=sr("--",!1),Ae=/^[a-zA-Z\/0-9]/,ye=Tn([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),ge=/^[^\r\n\t :,]/,ae=Tn(["\r",` -`," "," ",":",","],!0,!1),je="null",ie=sr("null",!1),Y=function(){return null},fe="true",re=sr("true",!1),de=function(){return!0},Ze="false",vt=sr("false",!1),mt=function(){return!1},Tr=Ks("string"),ei='"',ci=sr('"',!1),gr=function(){return""},ui=function(D){return D},ti=function(D){return D.join("")},Ms=/^[^"\\\0-\x1F\x7F]/,fr=Tn(['"',"\\",["\0",""],"\x7F"],!0,!1),Ei='\\"',ts=sr('\\"',!1),ua=function(){return'"'},CA="\\\\",gg=sr("\\\\",!1),rs=function(){return"\\"},mA="\\/",ga=sr("\\/",!1),Bp=function(){return"/"},EA="\\b",IA=sr("\\b",!1),Ir=function(){return"\b"},Nl="\\f",fg=sr("\\f",!1),Io=function(){return"\f"},hg="\\n",Qp=sr("\\n",!1),bp=function(){return` -`},br="\\r",ne=sr("\\r",!1),yo=function(){return"\r"},Fn="\\t",pg=sr("\\t",!1),yt=function(){return" "},Tl="\\u",Nn=sr("\\u",!1),is=function(D,j,pe,Le){return String.fromCharCode(parseInt(`0x${D}${j}${pe}${Le}`))},ns=/^[0-9a-fA-F]/,ut=Tn([["0","9"],["a","f"],["A","F"]],!1,!1),wo=Ks("blank space"),At=/^[ \t]/,An=Tn([" "," "],!1,!1),b=Ks("white space"),Ft=/^[ \t\n\r]/,dg=Tn([" "," ",` -`,"\r"],!1,!1),Ll=`\r -`,Sp=sr(`\r -`,!1),vp=` -`,xp=sr(` -`,!1),Pp="\r",kp=sr("\r",!1),G=0,Et=0,yA=[{line:1,column:1}],Wi=0,Ol=[],ze=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 Cg(){return r.substring(Et,G)}function KE(){return ln(Et,G)}function Dp(D,j){throw j=j!==void 0?j:ln(Et,G),Kl([Ks(D)],r.substring(Et,G),j)}function UE(D,j){throw j=j!==void 0?j:ln(Et,G),mg(D,j)}function sr(D,j){return{type:"literal",text:D,ignoreCase:j}}function Tn(D,j,pe){return{type:"class",parts:D,inverted:j,ignoreCase:pe}}function Ml(){return{type:"any"}}function Rp(){return{type:"end"}}function Ks(D){return{type:"other",description:D}}function ha(D){var j=yA[D],pe;if(j)return j;for(pe=D-1;!yA[pe];)pe--;for(j=yA[pe],j={line:j.line,column:j.column};peWi&&(Wi=G,Ol=[]),Ol.push(D))}function mg(D,j){return new lc(D,null,null,j)}function Kl(D,j,pe){return new lc(lc.buildMessage(D,j),D,j,pe)}function Us(){var D;return D=Eg(),D}function Ul(){var D,j,pe;for(D=G,j=[],pe=wA();pe!==t;)j.push(pe),pe=wA();return j!==t&&(Et=D,j=s(j)),D=j,D}function wA(){var D,j,pe,Le,ke;return D=G,j=da(),j!==t?(r.charCodeAt(G)===45?(pe=o,G++):(pe=t,ze===0&&Ne(a)),pe!==t?(Le=Lr(),Le!==t?(ke=pa(),ke!==t?(Et=D,j=l(ke),D=j):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t),D}function Eg(){var D,j,pe;for(D=G,j=[],pe=Ig();pe!==t;)j.push(pe),pe=Ig();return j!==t&&(Et=D,j=c(j)),D=j,D}function Ig(){var D,j,pe,Le,ke,Je,pt,Xt,Ea;if(D=G,j=Lr(),j===t&&(j=null),j!==t){if(pe=G,r.charCodeAt(G)===35?(Le=u,G++):(Le=t,ze===0&&Ne(g)),Le!==t){if(ke=[],Je=G,pt=G,ze++,Xt=Gs(),ze--,Xt===t?pt=void 0:(G=pt,pt=t),pt!==t?(r.length>G?(Xt=r.charAt(G),G++):(Xt=t,ze===0&&Ne(h)),Xt!==t?(pt=[pt,Xt],Je=pt):(G=Je,Je=t)):(G=Je,Je=t),Je!==t)for(;Je!==t;)ke.push(Je),Je=G,pt=G,ze++,Xt=Gs(),ze--,Xt===t?pt=void 0:(G=pt,pt=t),pt!==t?(r.length>G?(Xt=r.charAt(G),G++):(Xt=t,ze===0&&Ne(h)),Xt!==t?(pt=[pt,Xt],Je=pt):(G=Je,Je=t)):(G=Je,Je=t);else ke=t;ke!==t?(Le=[Le,ke],pe=Le):(G=pe,pe=t)}else G=pe,pe=t;if(pe===t&&(pe=null),pe!==t){if(Le=[],ke=Hs(),ke!==t)for(;ke!==t;)Le.push(ke),ke=Hs();else Le=t;Le!==t?(Et=D,j=p(),D=j):(G=D,D=t)}else G=D,D=t}else G=D,D=t;if(D===t&&(D=G,j=da(),j!==t?(pe=Fp(),pe!==t?(Le=Lr(),Le===t&&(Le=null),Le!==t?(r.charCodeAt(G)===58?(ke=d,G++):(ke=t,ze===0&&Ne(m)),ke!==t?(Je=Lr(),Je===t&&(Je=null),Je!==t?(pt=pa(),pt!==t?(Et=D,j=y(pe,pt),D=j):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t),D===t&&(D=G,j=da(),j!==t?(pe=Ca(),pe!==t?(Le=Lr(),Le===t&&(Le=null),Le!==t?(r.charCodeAt(G)===58?(ke=d,G++):(ke=t,ze===0&&Ne(m)),ke!==t?(Je=Lr(),Je===t&&(Je=null),Je!==t?(pt=pa(),pt!==t?(Et=D,j=y(pe,pt),D=j):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t),D===t))){if(D=G,j=da(),j!==t)if(pe=Ca(),pe!==t)if(Le=Lr(),Le!==t)if(ke=Gl(),ke!==t){if(Je=[],pt=Hs(),pt!==t)for(;pt!==t;)Je.push(pt),pt=Hs();else Je=t;Je!==t?(Et=D,j=y(pe,ke),D=j):(G=D,D=t)}else G=D,D=t;else G=D,D=t;else G=D,D=t;else G=D,D=t;if(D===t)if(D=G,j=da(),j!==t)if(pe=Ca(),pe!==t){if(Le=[],ke=G,Je=Lr(),Je===t&&(Je=null),Je!==t?(r.charCodeAt(G)===44?(pt=B,G++):(pt=t,ze===0&&Ne(S)),pt!==t?(Xt=Lr(),Xt===t&&(Xt=null),Xt!==t?(Ea=Ca(),Ea!==t?(Et=ke,Je=P(pe,Ea),ke=Je):(G=ke,ke=t)):(G=ke,ke=t)):(G=ke,ke=t)):(G=ke,ke=t),ke!==t)for(;ke!==t;)Le.push(ke),ke=G,Je=Lr(),Je===t&&(Je=null),Je!==t?(r.charCodeAt(G)===44?(pt=B,G++):(pt=t,ze===0&&Ne(S)),pt!==t?(Xt=Lr(),Xt===t&&(Xt=null),Xt!==t?(Ea=Ca(),Ea!==t?(Et=ke,Je=P(pe,Ea),ke=Je):(G=ke,ke=t)):(G=ke,ke=t)):(G=ke,ke=t)):(G=ke,ke=t);else Le=t;Le!==t?(ke=Lr(),ke===t&&(ke=null),ke!==t?(r.charCodeAt(G)===58?(Je=d,G++):(Je=t,ze===0&&Ne(m)),Je!==t?(pt=Lr(),pt===t&&(pt=null),pt!==t?(Xt=pa(),Xt!==t?(Et=D,j=F(pe,Le,Xt),D=j):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)}else G=D,D=t;else G=D,D=t}return D}function pa(){var D,j,pe,Le,ke,Je,pt;if(D=G,j=G,ze++,pe=G,Le=Gs(),Le!==t?(ke=tt(),ke!==t?(r.charCodeAt(G)===45?(Je=o,G++):(Je=t,ze===0&&Ne(a)),Je!==t?(pt=Lr(),pt!==t?(Le=[Le,ke,Je,pt],pe=Le):(G=pe,pe=t)):(G=pe,pe=t)):(G=pe,pe=t)):(G=pe,pe=t),ze--,pe!==t?(G=j,j=void 0):j=t,j!==t?(pe=Hs(),pe!==t?(Le=Bo(),Le!==t?(ke=Ul(),ke!==t?(Je=BA(),Je!==t?(Et=D,j=H(ke),D=j):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t),D===t&&(D=G,j=Gs(),j!==t?(pe=Bo(),pe!==t?(Le=Eg(),Le!==t?(ke=BA(),ke!==t?(Et=D,j=H(Le),D=j):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t),D===t))if(D=G,j=Hl(),j!==t){if(pe=[],Le=Hs(),Le!==t)for(;Le!==t;)pe.push(Le),Le=Hs();else pe=t;pe!==t?(Et=D,j=q(j),D=j):(G=D,D=t)}else G=D,D=t;return D}function da(){var D,j,pe;for(ze++,D=G,j=[],r.charCodeAt(G)===32?(pe=X,G++):(pe=t,ze===0&&Ne(W));pe!==t;)j.push(pe),r.charCodeAt(G)===32?(pe=X,G++):(pe=t,ze===0&&Ne(W));return j!==t?(Et=G,pe=Z(j),pe?pe=void 0:pe=t,pe!==t?(j=[j,pe],D=j):(G=D,D=t)):(G=D,D=t),ze--,D===t&&(j=t,ze===0&&Ne(_)),D}function tt(){var D,j,pe;for(D=G,j=[],r.charCodeAt(G)===32?(pe=X,G++):(pe=t,ze===0&&Ne(W));pe!==t;)j.push(pe),r.charCodeAt(G)===32?(pe=X,G++):(pe=t,ze===0&&Ne(W));return j!==t?(Et=G,pe=A(j),pe?pe=void 0:pe=t,pe!==t?(j=[j,pe],D=j):(G=D,D=t)):(G=D,D=t),D}function Bo(){var D;return Et=G,D=se(),D?D=void 0:D=t,D}function BA(){var D;return Et=G,D=ue(),D?D=void 0:D=t,D}function Fp(){var D;return D=Yl(),D===t&&(D=QA()),D}function Ca(){var D,j,pe;if(D=Yl(),D===t){if(D=G,j=[],pe=ma(),pe!==t)for(;pe!==t;)j.push(pe),pe=ma();else j=t;j!==t&&(Et=D,j=ee()),D=j}return D}function Hl(){var D;return D=Np(),D===t&&(D=HE(),D===t&&(D=Yl(),D===t&&(D=QA()))),D}function Gl(){var D;return D=Np(),D===t&&(D=Yl(),D===t&&(D=ma())),D}function QA(){var D,j,pe,Le,ke,Je;if(ze++,D=G,N.test(r.charAt(G))?(j=r.charAt(G),G++):(j=t,ze===0&&Ne(ce)),j!==t){for(pe=[],Le=G,ke=Lr(),ke===t&&(ke=null),ke!==t?(he.test(r.charAt(G))?(Je=r.charAt(G),G++):(Je=t,ze===0&&Ne(Pe)),Je!==t?(ke=[ke,Je],Le=ke):(G=Le,Le=t)):(G=Le,Le=t);Le!==t;)pe.push(Le),Le=G,ke=Lr(),ke===t&&(ke=null),ke!==t?(he.test(r.charAt(G))?(Je=r.charAt(G),G++):(Je=t,ze===0&&Ne(Pe)),Je!==t?(ke=[ke,Je],Le=ke):(G=Le,Le=t)):(G=Le,Le=t);pe!==t?(Et=D,j=De(),D=j):(G=D,D=t)}else G=D,D=t;return ze--,D===t&&(j=t,ze===0&&Ne(O)),D}function ma(){var D,j,pe,Le,ke;if(D=G,r.substr(G,2)===Re?(j=Re,G+=2):(j=t,ze===0&&Ne(oe)),j===t&&(j=null),j!==t)if(Ae.test(r.charAt(G))?(pe=r.charAt(G),G++):(pe=t,ze===0&&Ne(ye)),pe!==t){for(Le=[],ge.test(r.charAt(G))?(ke=r.charAt(G),G++):(ke=t,ze===0&&Ne(ae));ke!==t;)Le.push(ke),ge.test(r.charAt(G))?(ke=r.charAt(G),G++):(ke=t,ze===0&&Ne(ae));Le!==t?(Et=D,j=De(),D=j):(G=D,D=t)}else G=D,D=t;else G=D,D=t;return D}function Np(){var D,j;return D=G,r.substr(G,4)===je?(j=je,G+=4):(j=t,ze===0&&Ne(ie)),j!==t&&(Et=D,j=Y()),D=j,D}function HE(){var D,j;return D=G,r.substr(G,4)===fe?(j=fe,G+=4):(j=t,ze===0&&Ne(re)),j!==t&&(Et=D,j=de()),D=j,D===t&&(D=G,r.substr(G,5)===Ze?(j=Ze,G+=5):(j=t,ze===0&&Ne(vt)),j!==t&&(Et=D,j=mt()),D=j),D}function Yl(){var D,j,pe,Le;return ze++,D=G,r.charCodeAt(G)===34?(j=ei,G++):(j=t,ze===0&&Ne(ci)),j!==t?(r.charCodeAt(G)===34?(pe=ei,G++):(pe=t,ze===0&&Ne(ci)),pe!==t?(Et=D,j=gr(),D=j):(G=D,D=t)):(G=D,D=t),D===t&&(D=G,r.charCodeAt(G)===34?(j=ei,G++):(j=t,ze===0&&Ne(ci)),j!==t?(pe=GE(),pe!==t?(r.charCodeAt(G)===34?(Le=ei,G++):(Le=t,ze===0&&Ne(ci)),Le!==t?(Et=D,j=ui(pe),D=j):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)),ze--,D===t&&(j=t,ze===0&&Ne(Tr)),D}function GE(){var D,j,pe;if(D=G,j=[],pe=Tp(),pe!==t)for(;pe!==t;)j.push(pe),pe=Tp();else j=t;return j!==t&&(Et=D,j=ti(j)),D=j,D}function Tp(){var D,j,pe,Le,ke,Je;return Ms.test(r.charAt(G))?(D=r.charAt(G),G++):(D=t,ze===0&&Ne(fr)),D===t&&(D=G,r.substr(G,2)===Ei?(j=Ei,G+=2):(j=t,ze===0&&Ne(ts)),j!==t&&(Et=D,j=ua()),D=j,D===t&&(D=G,r.substr(G,2)===CA?(j=CA,G+=2):(j=t,ze===0&&Ne(gg)),j!==t&&(Et=D,j=rs()),D=j,D===t&&(D=G,r.substr(G,2)===mA?(j=mA,G+=2):(j=t,ze===0&&Ne(ga)),j!==t&&(Et=D,j=Bp()),D=j,D===t&&(D=G,r.substr(G,2)===EA?(j=EA,G+=2):(j=t,ze===0&&Ne(IA)),j!==t&&(Et=D,j=Ir()),D=j,D===t&&(D=G,r.substr(G,2)===Nl?(j=Nl,G+=2):(j=t,ze===0&&Ne(fg)),j!==t&&(Et=D,j=Io()),D=j,D===t&&(D=G,r.substr(G,2)===hg?(j=hg,G+=2):(j=t,ze===0&&Ne(Qp)),j!==t&&(Et=D,j=bp()),D=j,D===t&&(D=G,r.substr(G,2)===br?(j=br,G+=2):(j=t,ze===0&&Ne(ne)),j!==t&&(Et=D,j=yo()),D=j,D===t&&(D=G,r.substr(G,2)===Fn?(j=Fn,G+=2):(j=t,ze===0&&Ne(pg)),j!==t&&(Et=D,j=yt()),D=j,D===t&&(D=G,r.substr(G,2)===Tl?(j=Tl,G+=2):(j=t,ze===0&&Ne(Nn)),j!==t?(pe=jl(),pe!==t?(Le=jl(),Le!==t?(ke=jl(),ke!==t?(Je=jl(),Je!==t?(Et=D,j=is(pe,Le,ke,Je),D=j):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)):(G=D,D=t)))))))))),D}function jl(){var D;return ns.test(r.charAt(G))?(D=r.charAt(G),G++):(D=t,ze===0&&Ne(ut)),D}function Lr(){var D,j;if(ze++,D=[],At.test(r.charAt(G))?(j=r.charAt(G),G++):(j=t,ze===0&&Ne(An)),j!==t)for(;j!==t;)D.push(j),At.test(r.charAt(G))?(j=r.charAt(G),G++):(j=t,ze===0&&Ne(An));else D=t;return ze--,D===t&&(j=t,ze===0&&Ne(wo)),D}function YE(){var D,j;if(ze++,D=[],Ft.test(r.charAt(G))?(j=r.charAt(G),G++):(j=t,ze===0&&Ne(dg)),j!==t)for(;j!==t;)D.push(j),Ft.test(r.charAt(G))?(j=r.charAt(G),G++):(j=t,ze===0&&Ne(dg));else D=t;return ze--,D===t&&(j=t,ze===0&&Ne(b)),D}function Hs(){var D,j,pe,Le,ke,Je;if(D=G,j=Gs(),j!==t){for(pe=[],Le=G,ke=Lr(),ke===t&&(ke=null),ke!==t?(Je=Gs(),Je!==t?(ke=[ke,Je],Le=ke):(G=Le,Le=t)):(G=Le,Le=t);Le!==t;)pe.push(Le),Le=G,ke=Lr(),ke===t&&(ke=null),ke!==t?(Je=Gs(),Je!==t?(ke=[ke,Je],Le=ke):(G=Le,Le=t)):(G=Le,Le=t);pe!==t?(j=[j,pe],D=j):(G=D,D=t)}else G=D,D=t;return D}function Gs(){var D;return r.substr(G,2)===Ll?(D=Ll,G+=2):(D=t,ze===0&&Ne(Sp)),D===t&&(r.charCodeAt(G)===10?(D=vp,G++):(D=t,ze===0&&Ne(xp)),D===t&&(r.charCodeAt(G)===13?(D=Pp,G++):(D=t,ze===0&&Ne(kp)))),D}let yg=2,bA=0;if(fa=n(),fa!==t&&G===r.length)return fa;throw fa!==t&&G{"use strict";var yde=r=>{let e=!1,t=!1,i=!1;for(let n=0;n{if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let t=n=>e.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n;return Array.isArray(r)?r=r.map(n=>n.trim()).filter(n=>n.length).join("-"):r=r.trim(),r.length===0?"":r.length===1?e.pascalCase?r.toUpperCase():r.toLowerCase():(r!==r.toLowerCase()&&(r=yde(r)),r=r.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(n,s)=>s.toUpperCase()).replace(/\d+(\w|$)/g,n=>n.toUpperCase()),t(r))};tv.exports=mH;tv.exports.default=mH});var IH=I((d_e,wde)=>{wde.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vercel",constant:"VERCEL",env:"NOW_BUILDER"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"}]});var cc=I(Kn=>{"use strict";var wH=IH(),xo=process.env;Object.defineProperty(Kn,"_vendors",{value:wH.map(function(r){return r.constant})});Kn.name=null;Kn.isPR=null;wH.forEach(function(r){let t=(Array.isArray(r.env)?r.env:[r.env]).every(function(i){return yH(i)});if(Kn[r.constant]=t,t)switch(Kn.name=r.name,typeof r.pr){case"string":Kn.isPR=!!xo[r.pr];break;case"object":"env"in r.pr?Kn.isPR=r.pr.env in xo&&xo[r.pr.env]!==r.pr.ne:"any"in r.pr?Kn.isPR=r.pr.any.some(function(i){return!!xo[i]}):Kn.isPR=yH(r.pr);break;default:Kn.isPR=null}});Kn.isCI=!!(xo.CI||xo.CONTINUOUS_INTEGRATION||xo.BUILD_NUMBER||xo.RUN_ID||Kn.name);function yH(r){return typeof r=="string"?!!xo[r]:Object.keys(r).every(function(e){return xo[e]===r[e]})}});var hn={};ct(hn,{KeyRelationship:()=>uc,applyCascade:()=>Ad,base64RegExp:()=>vH,colorStringAlphaRegExp:()=>SH,colorStringRegExp:()=>bH,computeKey:()=>DA,getPrintable:()=>Jr,hasExactLength:()=>RH,hasForbiddenKeys:()=>eCe,hasKeyRelationship:()=>Av,hasMaxLength:()=>Ode,hasMinLength:()=>Lde,hasMutuallyExclusiveKeys:()=>tCe,hasRequiredKeys:()=>$de,hasUniqueItems:()=>Mde,isArray:()=>xde,isAtLeast:()=>Hde,isAtMost:()=>Gde,isBase64:()=>Zde,isBoolean:()=>bde,isDate:()=>vde,isDict:()=>kde,isEnum:()=>Xi,isHexColor:()=>Xde,isISO8601:()=>Vde,isInExclusiveRange:()=>jde,isInInclusiveRange:()=>Yde,isInstanceOf:()=>Rde,isInteger:()=>qde,isJSON:()=>_de,isLiteral:()=>Bde,isLowerCase:()=>Jde,isNegative:()=>Kde,isNullable:()=>Tde,isNumber:()=>Sde,isObject:()=>Dde,isOneOf:()=>Fde,isOptional:()=>Nde,isPositive:()=>Ude,isString:()=>ad,isTuple:()=>Pde,isUUID4:()=>zde,isUnknown:()=>DH,isUpperCase:()=>Wde,iso8601RegExp:()=>av,makeCoercionFn:()=>gc,makeSetter:()=>kH,makeTrait:()=>PH,makeValidator:()=>Bt,matchesRegExp:()=>ld,plural:()=>RI,pushError:()=>ht,simpleKeyRegExp:()=>QH,uuid4RegExp:()=>xH});function Bt({test:r}){return PH(r)()}function Jr(r){return r===null?"null":r===void 0?"undefined":r===""?"an empty string":JSON.stringify(r)}function DA(r,e){var t,i,n;return typeof e=="number"?`${(t=r==null?void 0:r.p)!==null&&t!==void 0?t:"."}[${e}]`:QH.test(e)?`${(i=r==null?void 0:r.p)!==null&&i!==void 0?i:""}.${e}`:`${(n=r==null?void 0:r.p)!==null&&n!==void 0?n:"."}[${JSON.stringify(e)}]`}function gc(r,e){return t=>{let i=r[e];return r[e]=t,gc(r,e).bind(null,i)}}function kH(r,e){return t=>{r[e]=t}}function RI(r,e,t){return r===1?e:t}function ht({errors:r,p:e}={},t){return r==null||r.push(`${e!=null?e:"."}: ${t}`),!1}function Bde(r){return Bt({test:(e,t)=>e!==r?ht(t,`Expected a literal (got ${Jr(r)})`):!0})}function Xi(r){let e=Array.isArray(r)?r:Object.values(r),t=new Set(e);return Bt({test:(i,n)=>t.has(i)?!0:ht(n,`Expected a valid enumeration value (got ${Jr(i)})`)})}var QH,bH,SH,vH,xH,av,PH,DH,ad,Qde,bde,Sde,vde,xde,Pde,kde,Dde,Rde,Fde,Ad,Nde,Tde,Lde,Ode,RH,Mde,Kde,Ude,Hde,Gde,Yde,jde,qde,ld,Jde,Wde,zde,Vde,Xde,Zde,_de,$de,eCe,tCe,uc,rCe,Av,as=Uge(()=>{QH=/^[a-zA-Z_][a-zA-Z0-9_]*$/,bH=/^#[0-9a-f]{6}$/i,SH=/^#[0-9a-f]{6}([0-9a-f]{2})?$/i,vH=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,xH=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i,av=/^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/,PH=r=>()=>r;DH=()=>Bt({test:(r,e)=>!0});ad=()=>Bt({test:(r,e)=>typeof r!="string"?ht(e,`Expected a string (got ${Jr(r)})`):!0});Qde=new Map([["true",!0],["True",!0],["1",!0],[1,!0],["false",!1],["False",!1],["0",!1],[0,!1]]),bde=()=>Bt({test:(r,e)=>{var t;if(typeof r!="boolean"){if(typeof(e==null?void 0:e.coercions)<"u"){if(typeof(e==null?void 0:e.coercion)>"u")return ht(e,"Unbound coercion result");let i=Qde.get(r);if(typeof i<"u")return e.coercions.push([(t=e.p)!==null&&t!==void 0?t:".",e.coercion.bind(null,i)]),!0}return ht(e,`Expected a boolean (got ${Jr(r)})`)}return!0}}),Sde=()=>Bt({test:(r,e)=>{var t;if(typeof r!="number"){if(typeof(e==null?void 0:e.coercions)<"u"){if(typeof(e==null?void 0:e.coercion)>"u")return ht(e,"Unbound coercion result");let i;if(typeof r=="string"){let n;try{n=JSON.parse(r)}catch{}if(typeof n=="number")if(JSON.stringify(n)===r)i=n;else return ht(e,`Received a number that can't be safely represented by the runtime (${r})`)}if(typeof i<"u")return e.coercions.push([(t=e.p)!==null&&t!==void 0?t:".",e.coercion.bind(null,i)]),!0}return ht(e,`Expected a number (got ${Jr(r)})`)}return!0}}),vde=()=>Bt({test:(r,e)=>{var t;if(!(r instanceof Date)){if(typeof(e==null?void 0:e.coercions)<"u"){if(typeof(e==null?void 0:e.coercion)>"u")return ht(e,"Unbound coercion result");let i;if(typeof r=="string"&&av.test(r))i=new Date(r);else{let n;if(typeof r=="string"){let s;try{s=JSON.parse(r)}catch{}typeof s=="number"&&(n=s)}else typeof r=="number"&&(n=r);if(typeof n<"u")if(Number.isSafeInteger(n)||!Number.isSafeInteger(n*1e3))i=new Date(n*1e3);else return ht(e,`Received a timestamp that can't be safely represented by the runtime (${r})`)}if(typeof i<"u")return e.coercions.push([(t=e.p)!==null&&t!==void 0?t:".",e.coercion.bind(null,i)]),!0}return ht(e,`Expected a date (got ${Jr(r)})`)}return!0}}),xde=(r,{delimiter:e}={})=>Bt({test:(t,i)=>{var n;if(typeof t=="string"&&typeof e<"u"&&typeof(i==null?void 0:i.coercions)<"u"){if(typeof(i==null?void 0:i.coercion)>"u")return ht(i,"Unbound coercion result");t=t.split(e),i.coercions.push([(n=i.p)!==null&&n!==void 0?n:".",i.coercion.bind(null,t)])}if(!Array.isArray(t))return ht(i,`Expected an array (got ${Jr(t)})`);let s=!0;for(let o=0,a=t.length;o{let t=RH(r.length);return Bt({test:(i,n)=>{var s;if(typeof i=="string"&&typeof e<"u"&&typeof(n==null?void 0:n.coercions)<"u"){if(typeof(n==null?void 0:n.coercion)>"u")return ht(n,"Unbound coercion result");i=i.split(e),n.coercions.push([(s=n.p)!==null&&s!==void 0?s:".",n.coercion.bind(null,i)])}if(!Array.isArray(i))return ht(n,`Expected a tuple (got ${Jr(i)})`);let o=t(i,Object.assign({},n));for(let a=0,l=i.length;aBt({test:(t,i)=>{if(typeof t!="object"||t===null)return ht(i,`Expected an object (got ${Jr(t)})`);let n=Object.keys(t),s=!0;for(let o=0,a=n.length;o{let t=Object.keys(r);return Bt({test:(i,n)=>{if(typeof i!="object"||i===null)return ht(n,`Expected an object (got ${Jr(i)})`);let s=new Set([...t,...Object.keys(i)]),o={},a=!0;for(let l of s){if(l==="constructor"||l==="__proto__")a=ht(Object.assign(Object.assign({},n),{p:DA(n,l)}),"Unsafe property name");else{let c=Object.prototype.hasOwnProperty.call(r,l)?r[l]:void 0,u=Object.prototype.hasOwnProperty.call(i,l)?i[l]:void 0;typeof c<"u"?a=c(u,Object.assign(Object.assign({},n),{p:DA(n,l),coercion:gc(i,l)}))&&a:e===null?a=ht(Object.assign(Object.assign({},n),{p:DA(n,l)}),`Extraneous property (got ${Jr(u)})`):Object.defineProperty(o,l,{enumerable:!0,get:()=>u,set:kH(i,l)})}if(!a&&(n==null?void 0:n.errors)==null)break}return e!==null&&(a||(n==null?void 0:n.errors)!=null)&&(a=e(o,n)&&a),a}})},Rde=r=>Bt({test:(e,t)=>e instanceof r?!0:ht(t,`Expected an instance of ${r.name} (got ${Jr(e)})`)}),Fde=(r,{exclusive:e=!1}={})=>Bt({test:(t,i)=>{var n,s,o;let a=[],l=typeof(i==null?void 0:i.errors)<"u"?[]:void 0;for(let c=0,u=r.length;c1?ht(i,`Expected to match exactly a single predicate (matched ${a.join(", ")})`):(o=i==null?void 0:i.errors)===null||o===void 0||o.push(...l),!1}}),Ad=(r,e)=>Bt({test:(t,i)=>{var n,s;let o={value:t},a=typeof(i==null?void 0:i.coercions)<"u"?gc(o,"value"):void 0,l=typeof(i==null?void 0:i.coercions)<"u"?[]:void 0;if(!r(t,Object.assign(Object.assign({},i),{coercion:a,coercions:l})))return!1;let c=[];if(typeof l<"u")for(let[,u]of l)c.push(u());try{if(typeof(i==null?void 0:i.coercions)<"u"){if(o.value!==t){if(typeof(i==null?void 0:i.coercion)>"u")return ht(i,"Unbound coercion result");i.coercions.push([(n=i.p)!==null&&n!==void 0?n:".",i.coercion.bind(null,o.value)])}(s=i==null?void 0:i.coercions)===null||s===void 0||s.push(...l)}return e.every(u=>u(o.value,i))}finally{for(let u of c)u()}}}),Nde=r=>Bt({test:(e,t)=>typeof e>"u"?!0:r(e,t)}),Tde=r=>Bt({test:(e,t)=>e===null?!0:r(e,t)}),Lde=r=>Bt({test:(e,t)=>e.length>=r?!0:ht(t,`Expected to have a length of at least ${r} elements (got ${e.length})`)}),Ode=r=>Bt({test:(e,t)=>e.length<=r?!0:ht(t,`Expected to have a length of at most ${r} elements (got ${e.length})`)}),RH=r=>Bt({test:(e,t)=>e.length!==r?ht(t,`Expected to have a length of exactly ${r} elements (got ${e.length})`):!0}),Mde=({map:r}={})=>Bt({test:(e,t)=>{let i=new Set,n=new Set;for(let s=0,o=e.length;sBt({test:(r,e)=>r<=0?!0:ht(e,`Expected to be negative (got ${r})`)}),Ude=()=>Bt({test:(r,e)=>r>=0?!0:ht(e,`Expected to be positive (got ${r})`)}),Hde=r=>Bt({test:(e,t)=>e>=r?!0:ht(t,`Expected to be at least ${r} (got ${e})`)}),Gde=r=>Bt({test:(e,t)=>e<=r?!0:ht(t,`Expected to be at most ${r} (got ${e})`)}),Yde=(r,e)=>Bt({test:(t,i)=>t>=r&&t<=e?!0:ht(i,`Expected to be in the [${r}; ${e}] range (got ${t})`)}),jde=(r,e)=>Bt({test:(t,i)=>t>=r&&tBt({test:(e,t)=>e!==Math.round(e)?ht(t,`Expected to be an integer (got ${e})`):Number.isSafeInteger(e)?!0:ht(t,`Expected to be a safe integer (got ${e})`)}),ld=r=>Bt({test:(e,t)=>r.test(e)?!0:ht(t,`Expected to match the pattern ${r.toString()} (got ${Jr(e)})`)}),Jde=()=>Bt({test:(r,e)=>r!==r.toLowerCase()?ht(e,`Expected to be all-lowercase (got ${r})`):!0}),Wde=()=>Bt({test:(r,e)=>r!==r.toUpperCase()?ht(e,`Expected to be all-uppercase (got ${r})`):!0}),zde=()=>Bt({test:(r,e)=>xH.test(r)?!0:ht(e,`Expected to be a valid UUID v4 (got ${Jr(r)})`)}),Vde=()=>Bt({test:(r,e)=>av.test(r)?!1:ht(e,`Expected to be a valid ISO 8601 date string (got ${Jr(r)})`)}),Xde=({alpha:r=!1})=>Bt({test:(e,t)=>(r?bH.test(e):SH.test(e))?!0:ht(t,`Expected to be a valid hexadecimal color string (got ${Jr(e)})`)}),Zde=()=>Bt({test:(r,e)=>vH.test(r)?!0:ht(e,`Expected to be a valid base 64 string (got ${Jr(r)})`)}),_de=(r=DH())=>Bt({test:(e,t)=>{let i;try{i=JSON.parse(e)}catch{return ht(t,`Expected to be a valid JSON string (got ${Jr(e)})`)}return r(i,t)}}),$de=r=>{let e=new Set(r);return Bt({test:(t,i)=>{let n=new Set(Object.keys(t)),s=[];for(let o of e)n.has(o)||s.push(o);return s.length>0?ht(i,`Missing required ${RI(s.length,"property","properties")} ${s.map(o=>`"${o}"`).join(", ")}`):!0}})},eCe=r=>{let e=new Set(r);return Bt({test:(t,i)=>{let n=new Set(Object.keys(t)),s=[];for(let o of e)n.has(o)&&s.push(o);return s.length>0?ht(i,`Forbidden ${RI(s.length,"property","properties")} ${s.map(o=>`"${o}"`).join(", ")}`):!0}})},tCe=r=>{let e=new Set(r);return Bt({test:(t,i)=>{let n=new Set(Object.keys(t)),s=[];for(let o of e)n.has(o)&&s.push(o);return s.length>1?ht(i,`Mutually exclusive properties ${s.map(o=>`"${o}"`).join(", ")}`):!0}})};(function(r){r.Forbids="Forbids",r.Requires="Requires"})(uc||(uc={}));rCe={[uc.Forbids]:{expect:!1,message:"forbids using"},[uc.Requires]:{expect:!0,message:"requires using"}},Av=(r,e,t,{ignore:i=[]}={})=>{let n=new Set(i),s=new Set(t),o=rCe[e];return Bt({test:(a,l)=>{let c=new Set(Object.keys(a));if(!c.has(r)||n.has(a[r]))return!0;let u=[];for(let g of s)(c.has(g)&&!n.has(a[g]))!==o.expect&&u.push(g);return u.length>=1?ht(l,`Property "${r}" ${o.message} ${RI(u.length,"property","properties")} ${u.map(g=>`"${g}"`).join(", ")}`):!0}})}});var VH=I((d$e,zH)=>{"use strict";zH.exports=(r,...e)=>new Promise(t=>{t(r(...e))})});var Wg=I((C$e,dv)=>{"use strict";var ECe=VH(),XH=r=>{if(r<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=[],t=0,i=()=>{t--,e.length>0&&e.shift()()},n=(a,l,...c)=>{t++;let u=ECe(a,...c);l(u),u.then(i,i)},s=(a,l,...c)=>{tnew Promise(c=>s(a,c,...l));return Object.defineProperties(o,{activeCount:{get:()=>t},pendingCount:{get:()=>e.length}}),o};dv.exports=XH;dv.exports.default=XH});var hd=I((E$e,ZH)=>{var ICe="2.0.0",yCe=Number.MAX_SAFE_INTEGER||9007199254740991,wCe=16;ZH.exports={SEMVER_SPEC_VERSION:ICe,MAX_LENGTH:256,MAX_SAFE_INTEGER:yCe,MAX_SAFE_COMPONENT_LENGTH:wCe}});var pd=I((I$e,_H)=>{var BCe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};_H.exports=BCe});var fc=I((FA,$H)=>{var{MAX_SAFE_COMPONENT_LENGTH:Cv}=hd(),QCe=pd();FA=$H.exports={};var bCe=FA.re=[],$e=FA.src=[],et=FA.t={},SCe=0,Qt=(r,e,t)=>{let i=SCe++;QCe(i,e),et[r]=i,$e[i]=e,bCe[i]=new RegExp(e,t?"g":void 0)};Qt("NUMERICIDENTIFIER","0|[1-9]\\d*");Qt("NUMERICIDENTIFIERLOOSE","[0-9]+");Qt("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");Qt("MAINVERSION",`(${$e[et.NUMERICIDENTIFIER]})\\.(${$e[et.NUMERICIDENTIFIER]})\\.(${$e[et.NUMERICIDENTIFIER]})`);Qt("MAINVERSIONLOOSE",`(${$e[et.NUMERICIDENTIFIERLOOSE]})\\.(${$e[et.NUMERICIDENTIFIERLOOSE]})\\.(${$e[et.NUMERICIDENTIFIERLOOSE]})`);Qt("PRERELEASEIDENTIFIER",`(?:${$e[et.NUMERICIDENTIFIER]}|${$e[et.NONNUMERICIDENTIFIER]})`);Qt("PRERELEASEIDENTIFIERLOOSE",`(?:${$e[et.NUMERICIDENTIFIERLOOSE]}|${$e[et.NONNUMERICIDENTIFIER]})`);Qt("PRERELEASE",`(?:-(${$e[et.PRERELEASEIDENTIFIER]}(?:\\.${$e[et.PRERELEASEIDENTIFIER]})*))`);Qt("PRERELEASELOOSE",`(?:-?(${$e[et.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${$e[et.PRERELEASEIDENTIFIERLOOSE]})*))`);Qt("BUILDIDENTIFIER","[0-9A-Za-z-]+");Qt("BUILD",`(?:\\+(${$e[et.BUILDIDENTIFIER]}(?:\\.${$e[et.BUILDIDENTIFIER]})*))`);Qt("FULLPLAIN",`v?${$e[et.MAINVERSION]}${$e[et.PRERELEASE]}?${$e[et.BUILD]}?`);Qt("FULL",`^${$e[et.FULLPLAIN]}$`);Qt("LOOSEPLAIN",`[v=\\s]*${$e[et.MAINVERSIONLOOSE]}${$e[et.PRERELEASELOOSE]}?${$e[et.BUILD]}?`);Qt("LOOSE",`^${$e[et.LOOSEPLAIN]}$`);Qt("GTLT","((?:<|>)?=?)");Qt("XRANGEIDENTIFIERLOOSE",`${$e[et.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Qt("XRANGEIDENTIFIER",`${$e[et.NUMERICIDENTIFIER]}|x|X|\\*`);Qt("XRANGEPLAIN",`[v=\\s]*(${$e[et.XRANGEIDENTIFIER]})(?:\\.(${$e[et.XRANGEIDENTIFIER]})(?:\\.(${$e[et.XRANGEIDENTIFIER]})(?:${$e[et.PRERELEASE]})?${$e[et.BUILD]}?)?)?`);Qt("XRANGEPLAINLOOSE",`[v=\\s]*(${$e[et.XRANGEIDENTIFIERLOOSE]})(?:\\.(${$e[et.XRANGEIDENTIFIERLOOSE]})(?:\\.(${$e[et.XRANGEIDENTIFIERLOOSE]})(?:${$e[et.PRERELEASELOOSE]})?${$e[et.BUILD]}?)?)?`);Qt("XRANGE",`^${$e[et.GTLT]}\\s*${$e[et.XRANGEPLAIN]}$`);Qt("XRANGELOOSE",`^${$e[et.GTLT]}\\s*${$e[et.XRANGEPLAINLOOSE]}$`);Qt("COERCE",`(^|[^\\d])(\\d{1,${Cv}})(?:\\.(\\d{1,${Cv}}))?(?:\\.(\\d{1,${Cv}}))?(?:$|[^\\d])`);Qt("COERCERTL",$e[et.COERCE],!0);Qt("LONETILDE","(?:~>?)");Qt("TILDETRIM",`(\\s*)${$e[et.LONETILDE]}\\s+`,!0);FA.tildeTrimReplace="$1~";Qt("TILDE",`^${$e[et.LONETILDE]}${$e[et.XRANGEPLAIN]}$`);Qt("TILDELOOSE",`^${$e[et.LONETILDE]}${$e[et.XRANGEPLAINLOOSE]}$`);Qt("LONECARET","(?:\\^)");Qt("CARETTRIM",`(\\s*)${$e[et.LONECARET]}\\s+`,!0);FA.caretTrimReplace="$1^";Qt("CARET",`^${$e[et.LONECARET]}${$e[et.XRANGEPLAIN]}$`);Qt("CARETLOOSE",`^${$e[et.LONECARET]}${$e[et.XRANGEPLAINLOOSE]}$`);Qt("COMPARATORLOOSE",`^${$e[et.GTLT]}\\s*(${$e[et.LOOSEPLAIN]})$|^$`);Qt("COMPARATOR",`^${$e[et.GTLT]}\\s*(${$e[et.FULLPLAIN]})$|^$`);Qt("COMPARATORTRIM",`(\\s*)${$e[et.GTLT]}\\s*(${$e[et.LOOSEPLAIN]}|${$e[et.XRANGEPLAIN]})`,!0);FA.comparatorTrimReplace="$1$2$3";Qt("HYPHENRANGE",`^\\s*(${$e[et.XRANGEPLAIN]})\\s+-\\s+(${$e[et.XRANGEPLAIN]})\\s*$`);Qt("HYPHENRANGELOOSE",`^\\s*(${$e[et.XRANGEPLAINLOOSE]})\\s+-\\s+(${$e[et.XRANGEPLAINLOOSE]})\\s*$`);Qt("STAR","(<|>)?=?\\s*\\*");Qt("GTE0","^\\s*>=\\s*0.0.0\\s*$");Qt("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")});var dd=I((y$e,eG)=>{var vCe=["includePrerelease","loose","rtl"],xCe=r=>r?typeof r!="object"?{loose:!0}:vCe.filter(e=>r[e]).reduce((e,t)=>(e[t]=!0,e),{}):{};eG.exports=xCe});var MI=I((w$e,iG)=>{var tG=/^[0-9]+$/,rG=(r,e)=>{let t=tG.test(r),i=tG.test(e);return t&&i&&(r=+r,e=+e),r===e?0:t&&!i?-1:i&&!t?1:rrG(e,r);iG.exports={compareIdentifiers:rG,rcompareIdentifiers:PCe}});var Li=I((B$e,aG)=>{var KI=pd(),{MAX_LENGTH:nG,MAX_SAFE_INTEGER:UI}=hd(),{re:sG,t:oG}=fc(),kCe=dd(),{compareIdentifiers:Cd}=MI(),Gn=class{constructor(e,t){if(t=kCe(t),e instanceof Gn){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>nG)throw new TypeError(`version is longer than ${nG} characters`);KI("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let i=e.trim().match(t.loose?sG[oG.LOOSE]:sG[oG.FULL]);if(!i)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>UI||this.major<0)throw new TypeError("Invalid major version");if(this.minor>UI||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>UI||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);i===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};aG.exports=Gn});var hc=I((Q$e,uG)=>{var{MAX_LENGTH:DCe}=hd(),{re:AG,t:lG}=fc(),cG=Li(),RCe=dd(),FCe=(r,e)=>{if(e=RCe(e),r instanceof cG)return r;if(typeof r!="string"||r.length>DCe||!(e.loose?AG[lG.LOOSE]:AG[lG.FULL]).test(r))return null;try{return new cG(r,e)}catch{return null}};uG.exports=FCe});var fG=I((b$e,gG)=>{var NCe=hc(),TCe=(r,e)=>{let t=NCe(r,e);return t?t.version:null};gG.exports=TCe});var pG=I((S$e,hG)=>{var LCe=hc(),OCe=(r,e)=>{let t=LCe(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null};hG.exports=OCe});var CG=I((v$e,dG)=>{var MCe=Li(),KCe=(r,e,t,i)=>{typeof t=="string"&&(i=t,t=void 0);try{return new MCe(r,t).inc(e,i).version}catch{return null}};dG.exports=KCe});var As=I((x$e,EG)=>{var mG=Li(),UCe=(r,e,t)=>new mG(r,t).compare(new mG(e,t));EG.exports=UCe});var HI=I((P$e,IG)=>{var HCe=As(),GCe=(r,e,t)=>HCe(r,e,t)===0;IG.exports=GCe});var BG=I((k$e,wG)=>{var yG=hc(),YCe=HI(),jCe=(r,e)=>{if(YCe(r,e))return null;{let t=yG(r),i=yG(e),n=t.prerelease.length||i.prerelease.length,s=n?"pre":"",o=n?"prerelease":"";for(let a in t)if((a==="major"||a==="minor"||a==="patch")&&t[a]!==i[a])return s+a;return o}};wG.exports=jCe});var bG=I((D$e,QG)=>{var qCe=Li(),JCe=(r,e)=>new qCe(r,e).major;QG.exports=JCe});var vG=I((R$e,SG)=>{var WCe=Li(),zCe=(r,e)=>new WCe(r,e).minor;SG.exports=zCe});var PG=I((F$e,xG)=>{var VCe=Li(),XCe=(r,e)=>new VCe(r,e).patch;xG.exports=XCe});var DG=I((N$e,kG)=>{var ZCe=hc(),_Ce=(r,e)=>{let t=ZCe(r,e);return t&&t.prerelease.length?t.prerelease:null};kG.exports=_Ce});var FG=I((T$e,RG)=>{var $Ce=As(),eme=(r,e,t)=>$Ce(e,r,t);RG.exports=eme});var TG=I((L$e,NG)=>{var tme=As(),rme=(r,e)=>tme(r,e,!0);NG.exports=rme});var GI=I((O$e,OG)=>{var LG=Li(),ime=(r,e,t)=>{let i=new LG(r,t),n=new LG(e,t);return i.compare(n)||i.compareBuild(n)};OG.exports=ime});var KG=I((M$e,MG)=>{var nme=GI(),sme=(r,e)=>r.sort((t,i)=>nme(t,i,e));MG.exports=sme});var HG=I((K$e,UG)=>{var ome=GI(),ame=(r,e)=>r.sort((t,i)=>ome(i,t,e));UG.exports=ame});var md=I((U$e,GG)=>{var Ame=As(),lme=(r,e,t)=>Ame(r,e,t)>0;GG.exports=lme});var YI=I((H$e,YG)=>{var cme=As(),ume=(r,e,t)=>cme(r,e,t)<0;YG.exports=ume});var mv=I((G$e,jG)=>{var gme=As(),fme=(r,e,t)=>gme(r,e,t)!==0;jG.exports=fme});var jI=I((Y$e,qG)=>{var hme=As(),pme=(r,e,t)=>hme(r,e,t)>=0;qG.exports=pme});var qI=I((j$e,JG)=>{var dme=As(),Cme=(r,e,t)=>dme(r,e,t)<=0;JG.exports=Cme});var Ev=I((q$e,WG)=>{var mme=HI(),Eme=mv(),Ime=md(),yme=jI(),wme=YI(),Bme=qI(),Qme=(r,e,t,i)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return mme(r,t,i);case"!=":return Eme(r,t,i);case">":return Ime(r,t,i);case">=":return yme(r,t,i);case"<":return wme(r,t,i);case"<=":return Bme(r,t,i);default:throw new TypeError(`Invalid operator: ${e}`)}};WG.exports=Qme});var VG=I((J$e,zG)=>{var bme=Li(),Sme=hc(),{re:JI,t:WI}=fc(),vme=(r,e)=>{if(r instanceof bme)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;e=e||{};let t=null;if(!e.rtl)t=r.match(JI[WI.COERCE]);else{let i;for(;(i=JI[WI.COERCERTL].exec(r))&&(!t||t.index+t[0].length!==r.length);)(!t||i.index+i[0].length!==t.index+t[0].length)&&(t=i),JI[WI.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;JI[WI.COERCERTL].lastIndex=-1}return t===null?null:Sme(`${t[2]}.${t[3]||"0"}.${t[4]||"0"}`,e)};zG.exports=vme});var ZG=I((W$e,XG)=>{"use strict";XG.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var zI=I((z$e,_G)=>{"use strict";_G.exports=Mt;Mt.Node=pc;Mt.create=Mt;function Mt(r){var e=this;if(e instanceof Mt||(e=new Mt),e.tail=null,e.head=null,e.length=0,r&&typeof r.forEach=="function")r.forEach(function(n){e.push(n)});else if(arguments.length>0)for(var t=0,i=arguments.length;t1)t=e;else if(this.head)i=this.head.next,t=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;i!==null;n++)t=r(t,i.value,n),i=i.next;return t};Mt.prototype.reduceReverse=function(r,e){var t,i=this.tail;if(arguments.length>1)t=e;else if(this.tail)i=this.tail.prev,t=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=this.length-1;i!==null;n--)t=r(t,i.value,n),i=i.prev;return t};Mt.prototype.toArray=function(){for(var r=new Array(this.length),e=0,t=this.head;t!==null;e++)r[e]=t.value,t=t.next;return r};Mt.prototype.toArrayReverse=function(){for(var r=new Array(this.length),e=0,t=this.tail;t!==null;e++)r[e]=t.value,t=t.prev;return r};Mt.prototype.slice=function(r,e){e=e||this.length,e<0&&(e+=this.length),r=r||0,r<0&&(r+=this.length);var t=new Mt;if(ethis.length&&(e=this.length);for(var i=0,n=this.head;n!==null&&ithis.length&&(e=this.length);for(var i=this.length,n=this.tail;n!==null&&i>e;i--)n=n.prev;for(;n!==null&&i>r;i--,n=n.prev)t.push(n.value);return t};Mt.prototype.splice=function(r,e,...t){r>this.length&&(r=this.length-1),r<0&&(r=this.length+r);for(var i=0,n=this.head;n!==null&&i{"use strict";var Dme=zI(),dc=Symbol("max"),xa=Symbol("length"),zg=Symbol("lengthCalculator"),Id=Symbol("allowStale"),Cc=Symbol("maxAge"),va=Symbol("dispose"),$G=Symbol("noDisposeOnSet"),hi=Symbol("lruList"),Xs=Symbol("cache"),tY=Symbol("updateAgeOnGet"),Iv=()=>1,wv=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let t=this[dc]=e.max||1/0,i=e.length||Iv;if(this[zg]=typeof i!="function"?Iv:i,this[Id]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[Cc]=e.maxAge||0,this[va]=e.dispose,this[$G]=e.noDisposeOnSet||!1,this[tY]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[dc]=e||1/0,Ed(this)}get max(){return this[dc]}set allowStale(e){this[Id]=!!e}get allowStale(){return this[Id]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[Cc]=e,Ed(this)}get maxAge(){return this[Cc]}set lengthCalculator(e){typeof e!="function"&&(e=Iv),e!==this[zg]&&(this[zg]=e,this[xa]=0,this[hi].forEach(t=>{t.length=this[zg](t.value,t.key),this[xa]+=t.length})),Ed(this)}get lengthCalculator(){return this[zg]}get length(){return this[xa]}get itemCount(){return this[hi].length}rforEach(e,t){t=t||this;for(let i=this[hi].tail;i!==null;){let n=i.prev;eY(this,e,i,t),i=n}}forEach(e,t){t=t||this;for(let i=this[hi].head;i!==null;){let n=i.next;eY(this,e,i,t),i=n}}keys(){return this[hi].toArray().map(e=>e.key)}values(){return this[hi].toArray().map(e=>e.value)}reset(){this[va]&&this[hi]&&this[hi].length&&this[hi].forEach(e=>this[va](e.key,e.value)),this[Xs]=new Map,this[hi]=new Dme,this[xa]=0}dump(){return this[hi].map(e=>VI(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[hi]}set(e,t,i){if(i=i||this[Cc],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let n=i?Date.now():0,s=this[zg](t,e);if(this[Xs].has(e)){if(s>this[dc])return Vg(this,this[Xs].get(e)),!1;let l=this[Xs].get(e).value;return this[va]&&(this[$G]||this[va](e,l.value)),l.now=n,l.maxAge=i,l.value=t,this[xa]+=s-l.length,l.length=s,this.get(e),Ed(this),!0}let o=new Bv(e,t,s,n,i);return o.length>this[dc]?(this[va]&&this[va](e,t),!1):(this[xa]+=o.length,this[hi].unshift(o),this[Xs].set(e,this[hi].head),Ed(this),!0)}has(e){if(!this[Xs].has(e))return!1;let t=this[Xs].get(e).value;return!VI(this,t)}get(e){return yv(this,e,!0)}peek(e){return yv(this,e,!1)}pop(){let e=this[hi].tail;return e?(Vg(this,e),e.value):null}del(e){Vg(this,this[Xs].get(e))}load(e){this.reset();let t=Date.now();for(let i=e.length-1;i>=0;i--){let n=e[i],s=n.e||0;if(s===0)this.set(n.k,n.v);else{let o=s-t;o>0&&this.set(n.k,n.v,o)}}}prune(){this[Xs].forEach((e,t)=>yv(this,t,!1))}},yv=(r,e,t)=>{let i=r[Xs].get(e);if(i){let n=i.value;if(VI(r,n)){if(Vg(r,i),!r[Id])return}else t&&(r[tY]&&(i.value.now=Date.now()),r[hi].unshiftNode(i));return n.value}},VI=(r,e)=>{if(!e||!e.maxAge&&!r[Cc])return!1;let t=Date.now()-e.now;return e.maxAge?t>e.maxAge:r[Cc]&&t>r[Cc]},Ed=r=>{if(r[xa]>r[dc])for(let e=r[hi].tail;r[xa]>r[dc]&&e!==null;){let t=e.prev;Vg(r,e),e=t}},Vg=(r,e)=>{if(e){let t=e.value;r[va]&&r[va](t.key,t.value),r[xa]-=t.length,r[Xs].delete(t.key),r[hi].removeNode(e)}},Bv=class{constructor(e,t,i,n,s){this.key=e,this.value=t,this.length=i,this.now=n,this.maxAge=s||0}},eY=(r,e,t,i)=>{let n=t.value;VI(r,n)&&(Vg(r,t),r[Id]||(n=void 0)),n&&e.call(i,n.value,n.key,r)};rY.exports=wv});var ls=I((X$e,aY)=>{var mc=class{constructor(e,t){if(t=Fme(t),e instanceof mc)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new mc(e.raw,t);if(e instanceof Qv)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(n=>!sY(n[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&Mme(n[0])){this.set=[n];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();let i=`parseRange:${Object.keys(this.options).join(",")}:${e}`,n=nY.get(i);if(n)return n;let s=this.options.loose,o=s?Oi[bi.HYPHENRANGELOOSE]:Oi[bi.HYPHENRANGE];e=e.replace(o,zme(this.options.includePrerelease)),Mr("hyphen replace",e),e=e.replace(Oi[bi.COMPARATORTRIM],Tme),Mr("comparator trim",e,Oi[bi.COMPARATORTRIM]),e=e.replace(Oi[bi.TILDETRIM],Lme),e=e.replace(Oi[bi.CARETTRIM],Ome),e=e.split(/\s+/).join(" ");let a=s?Oi[bi.COMPARATORLOOSE]:Oi[bi.COMPARATOR],l=e.split(" ").map(h=>Kme(h,this.options)).join(" ").split(/\s+/).map(h=>Wme(h,this.options)).filter(this.options.loose?h=>!!h.match(a):()=>!0).map(h=>new Qv(h,this.options)),c=l.length,u=new Map;for(let h of l){if(sY(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let g=[...u.values()];return nY.set(i,g),g}intersects(e,t){if(!(e instanceof mc))throw new TypeError("a Range is required");return this.set.some(i=>oY(i,t)&&e.set.some(n=>oY(n,t)&&i.every(s=>n.every(o=>s.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Nme(e,this.options)}catch{return!1}for(let t=0;tr.value==="<0.0.0-0",Mme=r=>r.value==="",oY=(r,e)=>{let t=!0,i=r.slice(),n=i.pop();for(;t&&i.length;)t=i.every(s=>n.intersects(s,e)),n=i.pop();return t},Kme=(r,e)=>(Mr("comp",r,e),r=Gme(r,e),Mr("caret",r),r=Ume(r,e),Mr("tildes",r),r=jme(r,e),Mr("xrange",r),r=Jme(r,e),Mr("stars",r),r),_i=r=>!r||r.toLowerCase()==="x"||r==="*",Ume=(r,e)=>r.trim().split(/\s+/).map(t=>Hme(t,e)).join(" "),Hme=(r,e)=>{let t=e.loose?Oi[bi.TILDELOOSE]:Oi[bi.TILDE];return r.replace(t,(i,n,s,o,a)=>{Mr("tilde",r,i,n,s,o,a);let l;return _i(n)?l="":_i(s)?l=`>=${n}.0.0 <${+n+1}.0.0-0`:_i(o)?l=`>=${n}.${s}.0 <${n}.${+s+1}.0-0`:a?(Mr("replaceTilde pr",a),l=`>=${n}.${s}.${o}-${a} <${n}.${+s+1}.0-0`):l=`>=${n}.${s}.${o} <${n}.${+s+1}.0-0`,Mr("tilde return",l),l})},Gme=(r,e)=>r.trim().split(/\s+/).map(t=>Yme(t,e)).join(" "),Yme=(r,e)=>{Mr("caret",r,e);let t=e.loose?Oi[bi.CARETLOOSE]:Oi[bi.CARET],i=e.includePrerelease?"-0":"";return r.replace(t,(n,s,o,a,l)=>{Mr("caret",r,n,s,o,a,l);let c;return _i(s)?c="":_i(o)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:_i(a)?s==="0"?c=`>=${s}.${o}.0${i} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${i} <${+s+1}.0.0-0`:l?(Mr("replaceCaret pr",l),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${l} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${l} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${l} <${+s+1}.0.0-0`):(Mr("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${i} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${i} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),Mr("caret return",c),c})},jme=(r,e)=>(Mr("replaceXRanges",r,e),r.split(/\s+/).map(t=>qme(t,e)).join(" ")),qme=(r,e)=>{r=r.trim();let t=e.loose?Oi[bi.XRANGELOOSE]:Oi[bi.XRANGE];return r.replace(t,(i,n,s,o,a,l)=>{Mr("xRange",r,i,n,s,o,a,l);let c=_i(s),u=c||_i(o),g=u||_i(a),h=g;return n==="="&&h&&(n=""),l=e.includePrerelease?"-0":"",c?n===">"||n==="<"?i="<0.0.0-0":i="*":n&&h?(u&&(o=0),a=0,n===">"?(n=">=",u?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",u?s=+s+1:o=+o+1),n==="<"&&(l="-0"),i=`${n+s}.${o}.${a}${l}`):u?i=`>=${s}.0.0${l} <${+s+1}.0.0-0`:g&&(i=`>=${s}.${o}.0${l} <${s}.${+o+1}.0-0`),Mr("xRange return",i),i})},Jme=(r,e)=>(Mr("replaceStars",r,e),r.trim().replace(Oi[bi.STAR],"")),Wme=(r,e)=>(Mr("replaceGTE0",r,e),r.trim().replace(Oi[e.includePrerelease?bi.GTE0PRE:bi.GTE0],"")),zme=r=>(e,t,i,n,s,o,a,l,c,u,g,h,p)=>(_i(i)?t="":_i(n)?t=`>=${i}.0.0${r?"-0":""}`:_i(s)?t=`>=${i}.${n}.0${r?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,_i(c)?l="":_i(u)?l=`<${+c+1}.0.0-0`:_i(g)?l=`<${c}.${+u+1}.0-0`:h?l=`<=${c}.${u}.${g}-${h}`:r?l=`<${c}.${u}.${+g+1}-0`:l=`<=${l}`,`${t} ${l}`.trim()),Vme=(r,e,t)=>{for(let i=0;i0){let n=r[i].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var yd=I((Z$e,gY)=>{var wd=Symbol("SemVer ANY"),Xg=class{static get ANY(){return wd}constructor(e,t){if(t=Xme(t),e instanceof Xg){if(e.loose===!!t.loose)return e;e=e.value}Sv("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===wd?this.value="":this.value=this.operator+this.semver.version,Sv("comp",this)}parse(e){let t=this.options.loose?AY[lY.COMPARATORLOOSE]:AY[lY.COMPARATOR],i=e.match(t);if(!i)throw new TypeError(`Invalid comparator: ${e}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new cY(i[2],this.options.loose):this.semver=wd}toString(){return this.value}test(e){if(Sv("Comparator.test",e,this.options.loose),this.semver===wd||e===wd)return!0;if(typeof e=="string")try{e=new cY(e,this.options)}catch{return!1}return bv(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Xg))throw new TypeError("a Comparator is required");if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""?!0:new uY(e.value,t).test(this.value);if(e.operator==="")return e.value===""?!0:new uY(this.value,t).test(e.semver);let i=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">"),n=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<"),s=this.semver.version===e.semver.version,o=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<="),a=bv(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),l=bv(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return i||n||s&&o||a||l}};gY.exports=Xg;var Xme=dd(),{re:AY,t:lY}=fc(),bv=Ev(),Sv=pd(),cY=Li(),uY=ls()});var Bd=I((_$e,fY)=>{var Zme=ls(),_me=(r,e,t)=>{try{e=new Zme(e,t)}catch{return!1}return e.test(r)};fY.exports=_me});var pY=I(($$e,hY)=>{var $me=ls(),eEe=(r,e)=>new $me(r,e).set.map(t=>t.map(i=>i.value).join(" ").trim().split(" "));hY.exports=eEe});var CY=I((eet,dY)=>{var tEe=Li(),rEe=ls(),iEe=(r,e,t)=>{let i=null,n=null,s=null;try{s=new rEe(e,t)}catch{return null}return r.forEach(o=>{s.test(o)&&(!i||n.compare(o)===-1)&&(i=o,n=new tEe(i,t))}),i};dY.exports=iEe});var EY=I((tet,mY)=>{var nEe=Li(),sEe=ls(),oEe=(r,e,t)=>{let i=null,n=null,s=null;try{s=new sEe(e,t)}catch{return null}return r.forEach(o=>{s.test(o)&&(!i||n.compare(o)===1)&&(i=o,n=new nEe(i,t))}),i};mY.exports=oEe});var wY=I((ret,yY)=>{var vv=Li(),aEe=ls(),IY=md(),AEe=(r,e)=>{r=new aEe(r,e);let t=new vv("0.0.0");if(r.test(t)||(t=new vv("0.0.0-0"),r.test(t)))return t;t=null;for(let i=0;i{let a=new vv(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||IY(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!t||IY(t,s))&&(t=s)}return t&&r.test(t)?t:null};yY.exports=AEe});var QY=I((iet,BY)=>{var lEe=ls(),cEe=(r,e)=>{try{return new lEe(r,e).range||"*"}catch{return null}};BY.exports=cEe});var XI=I((net,xY)=>{var uEe=Li(),vY=yd(),{ANY:gEe}=vY,fEe=ls(),hEe=Bd(),bY=md(),SY=YI(),pEe=qI(),dEe=jI(),CEe=(r,e,t,i)=>{r=new uEe(r,i),e=new fEe(e,i);let n,s,o,a,l;switch(t){case">":n=bY,s=pEe,o=SY,a=">",l=">=";break;case"<":n=SY,s=dEe,o=bY,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(hEe(r,e,i))return!1;for(let c=0;c{p.semver===gEe&&(p=new vY(">=0.0.0")),g=g||p,h=h||p,n(p.semver,g.semver,i)?g=p:o(p.semver,h.semver,i)&&(h=p)}),g.operator===a||g.operator===l||(!h.operator||h.operator===a)&&s(r,h.semver))return!1;if(h.operator===l&&o(r,h.semver))return!1}return!0};xY.exports=CEe});var kY=I((set,PY)=>{var mEe=XI(),EEe=(r,e,t)=>mEe(r,e,">",t);PY.exports=EEe});var RY=I((oet,DY)=>{var IEe=XI(),yEe=(r,e,t)=>IEe(r,e,"<",t);DY.exports=yEe});var TY=I((aet,NY)=>{var FY=ls(),wEe=(r,e,t)=>(r=new FY(r,t),e=new FY(e,t),r.intersects(e));NY.exports=wEe});var OY=I((Aet,LY)=>{var BEe=Bd(),QEe=As();LY.exports=(r,e,t)=>{let i=[],n=null,s=null,o=r.sort((u,g)=>QEe(u,g,t));for(let u of o)BEe(u,e,t)?(s=u,n||(n=u)):(s&&i.push([n,s]),s=null,n=null);n&&i.push([n,null]);let a=[];for(let[u,g]of i)u===g?a.push(u):!g&&u===o[0]?a.push("*"):g?u===o[0]?a.push(`<=${g}`):a.push(`${u} - ${g}`):a.push(`>=${u}`);let l=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return l.length{var MY=ls(),ZI=yd(),{ANY:xv}=ZI,Qd=Bd(),Pv=As(),bEe=(r,e,t={})=>{if(r===e)return!0;r=new MY(r,t),e=new MY(e,t);let i=!1;e:for(let n of r.set){for(let s of e.set){let o=SEe(n,s,t);if(i=i||o!==null,o)continue e}if(i)return!1}return!0},SEe=(r,e,t)=>{if(r===e)return!0;if(r.length===1&&r[0].semver===xv){if(e.length===1&&e[0].semver===xv)return!0;t.includePrerelease?r=[new ZI(">=0.0.0-0")]:r=[new ZI(">=0.0.0")]}if(e.length===1&&e[0].semver===xv){if(t.includePrerelease)return!0;e=[new ZI(">=0.0.0")]}let i=new Set,n,s;for(let p of r)p.operator===">"||p.operator===">="?n=KY(n,p,t):p.operator==="<"||p.operator==="<="?s=UY(s,p,t):i.add(p.semver);if(i.size>1)return null;let o;if(n&&s){if(o=Pv(n.semver,s.semver,t),o>0)return null;if(o===0&&(n.operator!==">="||s.operator!=="<="))return null}for(let p of i){if(n&&!Qd(p,String(n),t)||s&&!Qd(p,String(s),t))return null;for(let d of e)if(!Qd(p,String(d),t))return!1;return!0}let a,l,c,u,g=s&&!t.includePrerelease&&s.semver.prerelease.length?s.semver:!1,h=n&&!t.includePrerelease&&n.semver.prerelease.length?n.semver:!1;g&&g.prerelease.length===1&&s.operator==="<"&&g.prerelease[0]===0&&(g=!1);for(let p of e){if(u=u||p.operator===">"||p.operator===">=",c=c||p.operator==="<"||p.operator==="<=",n){if(h&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===h.major&&p.semver.minor===h.minor&&p.semver.patch===h.patch&&(h=!1),p.operator===">"||p.operator===">="){if(a=KY(n,p,t),a===p&&a!==n)return!1}else if(n.operator===">="&&!Qd(n.semver,String(p),t))return!1}if(s){if(g&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===g.major&&p.semver.minor===g.minor&&p.semver.patch===g.patch&&(g=!1),p.operator==="<"||p.operator==="<="){if(l=UY(s,p,t),l===p&&l!==s)return!1}else if(s.operator==="<="&&!Qd(s.semver,String(p),t))return!1}if(!p.operator&&(s||n)&&o!==0)return!1}return!(n&&c&&!s&&o!==0||s&&u&&!n&&o!==0||h||g)},KY=(r,e,t)=>{if(!r)return e;let i=Pv(r.semver,e.semver,t);return i>0?r:i<0||e.operator===">"&&r.operator===">="?e:r},UY=(r,e,t)=>{if(!r)return e;let i=Pv(r.semver,e.semver,t);return i<0?r:i>0||e.operator==="<"&&r.operator==="<="?e:r};HY.exports=bEe});var Wr=I((uet,YY)=>{var kv=fc();YY.exports={re:kv.re,src:kv.src,tokens:kv.t,SEMVER_SPEC_VERSION:hd().SEMVER_SPEC_VERSION,SemVer:Li(),compareIdentifiers:MI().compareIdentifiers,rcompareIdentifiers:MI().rcompareIdentifiers,parse:hc(),valid:fG(),clean:pG(),inc:CG(),diff:BG(),major:bG(),minor:vG(),patch:PG(),prerelease:DG(),compare:As(),rcompare:FG(),compareLoose:TG(),compareBuild:GI(),sort:KG(),rsort:HG(),gt:md(),lt:YI(),eq:HI(),neq:mv(),gte:jI(),lte:qI(),cmp:Ev(),coerce:VG(),Comparator:yd(),Range:ls(),satisfies:Bd(),toComparators:pY(),maxSatisfying:CY(),minSatisfying:EY(),minVersion:wY(),validRange:QY(),outside:XI(),gtr:kY(),ltr:RY(),intersects:TY(),simplifyRange:OY(),subset:GY()}});var Dv=I(_I=>{"use strict";Object.defineProperty(_I,"__esModule",{value:!0});_I.VERSION=void 0;_I.VERSION="9.1.0"});var Kt=I((exports,module)=>{"use strict";var __spreadArray=exports&&exports.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i{(function(r,e){typeof define=="function"&&define.amd?define([],e):typeof $I=="object"&&$I.exports?$I.exports=e():r.regexpToAst=e()})(typeof self<"u"?self:jY,function(){function r(){}r.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},r.prototype.restoreState=function(d){this.idx=d.idx,this.input=d.input,this.groupIdx=d.groupIdx},r.prototype.pattern=function(d){this.idx=0,this.input=d,this.groupIdx=0,this.consumeChar("/");var m=this.disjunction();this.consumeChar("/");for(var y={type:"Flags",loc:{begin:this.idx,end:d.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":o(y,"global");break;case"i":o(y,"ignoreCase");break;case"m":o(y,"multiLine");break;case"u":o(y,"unicode");break;case"y":o(y,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:y,value:m,loc:this.loc(0)}},r.prototype.disjunction=function(){var d=[],m=this.idx;for(d.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),d.push(this.alternative());return{type:"Disjunction",value:d,loc:this.loc(m)}},r.prototype.alternative=function(){for(var d=[],m=this.idx;this.isTerm();)d.push(this.term());return{type:"Alternative",value:d,loc:this.loc(m)}},r.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},r.prototype.assertion=function(){var d=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(d)};case"$":return{type:"EndAnchor",loc:this.loc(d)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(d)};case"B":return{type:"NonWordBoundary",loc:this.loc(d)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var m;switch(this.popChar()){case"=":m="Lookahead";break;case"!":m="NegativeLookahead";break}a(m);var y=this.disjunction();return this.consumeChar(")"),{type:m,value:y,loc:this.loc(d)}}l()},r.prototype.quantifier=function(d){var m,y=this.idx;switch(this.popChar()){case"*":m={atLeast:0,atMost:1/0};break;case"+":m={atLeast:1,atMost:1/0};break;case"?":m={atLeast:0,atMost:1};break;case"{":var B=this.integerIncludingZero();switch(this.popChar()){case"}":m={atLeast:B,atMost:B};break;case",":var S;this.isDigit()?(S=this.integerIncludingZero(),m={atLeast:B,atMost:S}):m={atLeast:B,atMost:1/0},this.consumeChar("}");break}if(d===!0&&m===void 0)return;a(m);break}if(!(d===!0&&m===void 0))return a(m),this.peekChar(0)==="?"?(this.consumeChar("?"),m.greedy=!1):m.greedy=!0,m.type="Quantifier",m.loc=this.loc(y),m},r.prototype.atom=function(){var d,m=this.idx;switch(this.peekChar()){case".":d=this.dotAll();break;case"\\":d=this.atomEscape();break;case"[":d=this.characterClass();break;case"(":d=this.group();break}return d===void 0&&this.isPatternCharacter()&&(d=this.patternCharacter()),a(d),d.loc=this.loc(m),this.isQuantifier()&&(d.quantifier=this.quantifier()),d},r.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[n(` -`),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 d=this.positiveInteger();return{type:"GroupBackReference",value:d}},r.prototype.characterClassEscape=function(){var d,m=!1;switch(this.popChar()){case"d":d=u;break;case"D":d=u,m=!0;break;case"s":d=h;break;case"S":d=h,m=!0;break;case"w":d=g;break;case"W":d=g,m=!0;break}return a(d),{type:"Set",value:d,complement:m}},r.prototype.controlEscapeAtom=function(){var d;switch(this.popChar()){case"f":d=n("\f");break;case"n":d=n(` -`);break;case"r":d=n("\r");break;case"t":d=n(" ");break;case"v":d=n("\v");break}return a(d),{type:"Character",value:d}},r.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var d=this.popChar();if(/[a-zA-Z]/.test(d)===!1)throw Error("Invalid ");var m=d.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:m}},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 d=this.popChar();return{type:"Character",value:n(d)}},r.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case` -`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var d=this.popChar();return{type:"Character",value:n(d)}}},r.prototype.characterClass=function(){var d=[],m=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),m=!0);this.isClassAtom();){var y=this.classAtom(),B=y.type==="Character";if(B&&this.isRangeDash()){this.consumeChar("-");var S=this.classAtom(),P=S.type==="Character";if(P){if(S.value=this.input.length)throw Error("Unexpected end of input");this.idx++},r.prototype.loc=function(d){return{begin:d,end:this.idx}};var e=/[0-9a-fA-F]/,t=/[0-9]/,i=/[1-9]/;function n(d){return d.charCodeAt(0)}function s(d,m){d.length!==void 0?d.forEach(function(y){m.push(y)}):m.push(d)}function o(d,m){if(d[m]===!0)throw"duplicate flag "+m;d[m]=!0}function a(d){if(d===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 h=[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 p(){}return p.prototype.visitChildren=function(d){for(var m in d){var y=d[m];d.hasOwnProperty(m)&&(y.type!==void 0?this.visit(y):Array.isArray(y)&&y.forEach(function(B){this.visit(B)},this))}},p.prototype.visit=function(d){switch(d.type){case"Pattern":this.visitPattern(d);break;case"Flags":this.visitFlags(d);break;case"Disjunction":this.visitDisjunction(d);break;case"Alternative":this.visitAlternative(d);break;case"StartAnchor":this.visitStartAnchor(d);break;case"EndAnchor":this.visitEndAnchor(d);break;case"WordBoundary":this.visitWordBoundary(d);break;case"NonWordBoundary":this.visitNonWordBoundary(d);break;case"Lookahead":this.visitLookahead(d);break;case"NegativeLookahead":this.visitNegativeLookahead(d);break;case"Character":this.visitCharacter(d);break;case"Set":this.visitSet(d);break;case"Group":this.visitGroup(d);break;case"GroupBackReference":this.visitGroupBackReference(d);break;case"Quantifier":this.visitQuantifier(d);break}this.visitChildren(d)},p.prototype.visitPattern=function(d){},p.prototype.visitFlags=function(d){},p.prototype.visitDisjunction=function(d){},p.prototype.visitAlternative=function(d){},p.prototype.visitStartAnchor=function(d){},p.prototype.visitEndAnchor=function(d){},p.prototype.visitWordBoundary=function(d){},p.prototype.visitNonWordBoundary=function(d){},p.prototype.visitLookahead=function(d){},p.prototype.visitNegativeLookahead=function(d){},p.prototype.visitCharacter=function(d){},p.prototype.visitSet=function(d){},p.prototype.visitGroup=function(d){},p.prototype.visitGroupBackReference=function(d){},p.prototype.visitQuantifier=function(d){},{RegExpParser:r,BaseRegExpVisitor:p,VERSION:"0.5.0"}})});var ry=I(Zg=>{"use strict";Object.defineProperty(Zg,"__esModule",{value:!0});Zg.clearRegExpParserCache=Zg.getRegExpAst=void 0;var vEe=ey(),ty={},xEe=new vEe.RegExpParser;function PEe(r){var e=r.toString();if(ty.hasOwnProperty(e))return ty[e];var t=xEe.pattern(e);return ty[e]=t,t}Zg.getRegExpAst=PEe;function kEe(){ty={}}Zg.clearRegExpParserCache=kEe});var VY=I(Cn=>{"use strict";var DEe=Cn&&Cn.__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(Cn,"__esModule",{value:!0});Cn.canMatchCharCode=Cn.firstCharOptimizedIndices=Cn.getOptimizedStartCodesIndices=Cn.failedOptimizationPrefixMsg=void 0;var JY=ey(),cs=Kt(),WY=ry(),Pa=Fv(),zY="Complement Sets are not supported for first char optimization";Cn.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations: -`;function REe(r,e){e===void 0&&(e=!1);try{var t=(0,WY.getRegExpAst)(r),i=ny(t.value,{},t.flags.ignoreCase);return i}catch(s){if(s.message===zY)e&&(0,cs.PRINT_WARNING)(""+Cn.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)(Cn.failedOptimizationPrefixMsg+` -`+(" Failed parsing: < "+r.toString()+` > -`)+(" Using the regexp-to-ast library version: "+JY.VERSION+` -`)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+n)}}return[]}Cn.getOptimizedStartCodesIndices=REe;function ny(r,e,t){switch(r.type){case"Disjunction":for(var i=0;i=Pa.minOptimizationVal)for(var h=u.from>=Pa.minOptimizationVal?u.from:Pa.minOptimizationVal,p=u.to,d=(0,Pa.charCodeToOptimizedIndex)(h),m=(0,Pa.charCodeToOptimizedIndex)(p),y=d;y<=m;y++)e[y]=y}}});break;case"Group":ny(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"&&Rv(o)===!1||o.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return(0,cs.values)(e)}Cn.firstCharOptimizedIndices=ny;function iy(r,e,t){var i=(0,Pa.charCodeToOptimizedIndex)(r);e[i]=i,t===!0&&FEe(r,e)}function FEe(r,e){var t=String.fromCharCode(r),i=t.toUpperCase();if(i!==t){var n=(0,Pa.charCodeToOptimizedIndex)(i.charCodeAt(0));e[n]=n}else{var s=t.toLowerCase();if(s!==t){var n=(0,Pa.charCodeToOptimizedIndex)(s.charCodeAt(0));e[n]=n}}}function qY(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 Rv(r){return r.quantifier&&r.quantifier.atLeast===0?!0:r.value?(0,cs.isArray)(r.value)?(0,cs.every)(r.value,Rv):Rv(r.value):!1}var NEe=function(r){DEe(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?qY(t,this.targetCharCodes)===void 0&&(this.found=!0):qY(t,this.targetCharCodes)!==void 0&&(this.found=!0)},e}(JY.BaseRegExpVisitor);function TEe(r,e){if(e instanceof RegExp){var t=(0,WY.getRegExpAst)(e),i=new NEe(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}Cn.canMatchCharCode=TEe});var Fv=I(We=>{"use strict";var XY=We&&We.__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(We,"__esModule",{value:!0});We.charCodeToOptimizedIndex=We.minOptimizationVal=We.buildLineBreakIssueMessage=We.LineTerminatorOptimizedTester=We.isShortPattern=We.isCustomPattern=We.cloneEmptyGroups=We.performWarningRuntimeChecks=We.performRuntimeChecks=We.addStickyFlag=We.addStartOfInput=We.findUnreachablePatterns=We.findModesThatDoNotExist=We.findInvalidGroupType=We.findDuplicatePatterns=We.findUnsupportedFlags=We.findStartOfInputAnchor=We.findEmptyMatchRegExps=We.findEndOfInputAnchor=We.findInvalidPatterns=We.findMissingPatterns=We.validatePatterns=We.analyzeTokenTypes=We.enableSticky=We.disableSticky=We.SUPPORT_STICKY=We.MODES=We.DEFAULT_MODE=void 0;var ZY=ey(),tr=bd(),Se=Kt(),_g=VY(),_Y=ry(),ko="PATTERN";We.DEFAULT_MODE="defaultMode";We.MODES="modes";We.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function LEe(){We.SUPPORT_STICKY=!1}We.disableSticky=LEe;function OEe(){We.SUPPORT_STICKY=!0}We.enableSticky=OEe;function MEe(r,e){e=(0,Se.defaults)(e,{useSticky:We.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` -`],tracer:function(S,P){return P()}});var t=e.tracer;t("initCharCodeToOptimizedIndexMap",function(){zEe()});var i;t("Reject Lexer.NA",function(){i=(0,Se.reject)(r,function(S){return S[ko]===tr.Lexer.NA})});var n=!1,s;t("Transform Patterns",function(){n=!1,s=(0,Se.map)(i,function(S){var P=S[ko];if((0,Se.isRegExp)(P)){var F=P.source;return F.length===1&&F!=="^"&&F!=="$"&&F!=="."&&!P.ignoreCase?F:F.length===2&&F[0]==="\\"&&!(0,Se.contains)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],F[1])?F[1]:e.useSticky?Lv(P):Tv(P)}else{if((0,Se.isFunction)(P))return n=!0,{exec:P};if((0,Se.has)(P,"exec"))return n=!0,P;if(typeof P=="string"){if(P.length===1)return P;var H=P.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),q=new RegExp(H);return e.useSticky?Lv(q):Tv(q)}else throw Error("non exhaustive match")}})});var o,a,l,c,u;t("misc mapping",function(){o=(0,Se.map)(i,function(S){return S.tokenTypeIdx}),a=(0,Se.map)(i,function(S){var P=S.GROUP;if(P!==tr.Lexer.SKIPPED){if((0,Se.isString)(P))return P;if((0,Se.isUndefined)(P))return!1;throw Error("non exhaustive match")}}),l=(0,Se.map)(i,function(S){var P=S.LONGER_ALT;if(P){var F=(0,Se.isArray)(P)?(0,Se.map)(P,function(H){return(0,Se.indexOf)(i,H)}):[(0,Se.indexOf)(i,P)];return F}}),c=(0,Se.map)(i,function(S){return S.PUSH_MODE}),u=(0,Se.map)(i,function(S){return(0,Se.has)(S,"POP_MODE")})});var g;t("Line Terminator Handling",function(){var S=gj(e.lineTerminatorCharacters);g=(0,Se.map)(i,function(P){return!1}),e.positionTracking!=="onlyOffset"&&(g=(0,Se.map)(i,function(P){if((0,Se.has)(P,"LINE_BREAKS"))return P.LINE_BREAKS;if(cj(P,S)===!1)return(0,_g.canMatchCharCode)(S,P.PATTERN)}))});var h,p,d,m;t("Misc Mapping #2",function(){h=(0,Se.map)(i,Mv),p=(0,Se.map)(s,lj),d=(0,Se.reduce)(i,function(S,P){var F=P.GROUP;return(0,Se.isString)(F)&&F!==tr.Lexer.SKIPPED&&(S[F]=[]),S},{}),m=(0,Se.map)(s,function(S,P){return{pattern:s[P],longerAlt:l[P],canLineTerminator:g[P],isCustom:h[P],short:p[P],group:a[P],push:c[P],pop:u[P],tokenTypeIdx:o[P],tokenType:i[P]}})});var y=!0,B=[];return e.safeMode||t("First Char Optimization",function(){B=(0,Se.reduce)(i,function(S,P,F){if(typeof P.PATTERN=="string"){var H=P.PATTERN.charCodeAt(0),q=Ov(H);Nv(S,q,m[F])}else if((0,Se.isArray)(P.START_CHARS_HINT)){var _;(0,Se.forEach)(P.START_CHARS_HINT,function(W){var Z=typeof W=="string"?W.charCodeAt(0):W,A=Ov(Z);_!==A&&(_=A,Nv(S,A,m[F]))})}else if((0,Se.isRegExp)(P.PATTERN))if(P.PATTERN.unicode)y=!1,e.ensureOptimizations&&(0,Se.PRINT_ERROR)(""+_g.failedOptimizationPrefixMsg+(" Unable to analyze < "+P.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 X=(0,_g.getOptimizedStartCodesIndices)(P.PATTERN,e.ensureOptimizations);(0,Se.isEmpty)(X)&&(y=!1),(0,Se.forEach)(X,function(W){Nv(S,W,m[F])})}else e.ensureOptimizations&&(0,Se.PRINT_ERROR)(""+_g.failedOptimizationPrefixMsg+(" TokenType: <"+P.name+`> is using a custom token pattern without providing 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 S},[])}),t("ArrayPacking",function(){B=(0,Se.packArray)(B)}),{emptyGroups:d,patternIdxToConfig:m,charCodeToPatternIdxToConfig:B,hasCustom:n,canBeOptimized:y}}We.analyzeTokenTypes=MEe;function KEe(r,e){var t=[],i=$Y(r);t=t.concat(i.errors);var n=ej(i.valid),s=n.valid;return t=t.concat(n.errors),t=t.concat(UEe(s)),t=t.concat(oj(s)),t=t.concat(aj(s,e)),t=t.concat(Aj(s)),t}We.validatePatterns=KEe;function UEe(r){var e=[],t=(0,Se.filter)(r,function(i){return(0,Se.isRegExp)(i[ko])});return e=e.concat(tj(t)),e=e.concat(ij(t)),e=e.concat(nj(t)),e=e.concat(sj(t)),e=e.concat(rj(t)),e}function $Y(r){var e=(0,Se.filter)(r,function(n){return!(0,Se.has)(n,ko)}),t=(0,Se.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- missing static 'PATTERN' property",type:tr.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[n]}}),i=(0,Se.difference)(r,e);return{errors:t,valid:i}}We.findMissingPatterns=$Y;function ej(r){var e=(0,Se.filter)(r,function(n){var s=n[ko];return!(0,Se.isRegExp)(s)&&!(0,Se.isFunction)(s)&&!(0,Se.has)(s,"exec")&&!(0,Se.isString)(s)}),t=(0,Se.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:tr.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[n]}}),i=(0,Se.difference)(r,e);return{errors:t,valid:i}}We.findInvalidPatterns=ej;var HEe=/[^\\][\$]/;function tj(r){var e=function(n){XY(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}(ZY.BaseRegExpVisitor),t=(0,Se.filter)(r,function(n){var s=n[ko];try{var o=(0,_Y.getRegExpAst)(s),a=new e;return a.visit(o),a.found}catch{return HEe.test(s.source)}}),i=(0,Se.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:tr.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[n]}});return i}We.findEndOfInputAnchor=tj;function rj(r){var e=(0,Se.filter)(r,function(i){var n=i[ko];return n.test("")}),t=(0,Se.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' must not match an empty string",type:tr.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[i]}});return t}We.findEmptyMatchRegExps=rj;var GEe=/[^\\[][\^]|^\^/;function ij(r){var e=function(n){XY(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}(ZY.BaseRegExpVisitor),t=(0,Se.filter)(r,function(n){var s=n[ko];try{var o=(0,_Y.getRegExpAst)(s),a=new e;return a.visit(o),a.found}catch{return GEe.test(s.source)}}),i=(0,Se.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:tr.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[n]}});return i}We.findStartOfInputAnchor=ij;function nj(r){var e=(0,Se.filter)(r,function(i){var n=i[ko];return n instanceof RegExp&&(n.multiline||n.global)}),t=(0,Se.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:tr.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[i]}});return t}We.findUnsupportedFlags=nj;function sj(r){var e=[],t=(0,Se.map)(r,function(s){return(0,Se.reduce)(r,function(o,a){return s.PATTERN.source===a.PATTERN.source&&!(0,Se.contains)(e,a)&&a.PATTERN!==tr.Lexer.NA&&(e.push(a),o.push(a)),o},[])});t=(0,Se.compact)(t);var i=(0,Se.filter)(t,function(s){return s.length>1}),n=(0,Se.map)(i,function(s){var o=(0,Se.map)(s,function(l){return l.name}),a=(0,Se.first)(s).PATTERN;return{message:"The same RegExp pattern ->"+a+"<-"+("has been used in all of the following Token Types: "+o.join(", ")+" <-"),type:tr.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}});return n}We.findDuplicatePatterns=sj;function oj(r){var e=(0,Se.filter)(r,function(i){if(!(0,Se.has)(i,"GROUP"))return!1;var n=i.GROUP;return n!==tr.Lexer.SKIPPED&&n!==tr.Lexer.NA&&!(0,Se.isString)(n)}),t=(0,Se.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:tr.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[i]}});return t}We.findInvalidGroupType=oj;function aj(r,e){var t=(0,Se.filter)(r,function(n){return n.PUSH_MODE!==void 0&&!(0,Se.contains)(e,n.PUSH_MODE)}),i=(0,Se.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:tr.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[n]}});return i}We.findModesThatDoNotExist=aj;function Aj(r){var e=[],t=(0,Se.reduce)(r,function(i,n,s){var o=n.PATTERN;return o===tr.Lexer.NA||((0,Se.isString)(o)?i.push({str:o,idx:s,tokenType:n}):(0,Se.isRegExp)(o)&&jEe(o)&&i.push({str:o.source,idx:s,tokenType:n})),i},[]);return(0,Se.forEach)(r,function(i,n){(0,Se.forEach)(t,function(s){var o=s.str,a=s.idx,l=s.tokenType;if(n"+i.name+"<-")+`in the lexer's definition. -See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:tr.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[i,l]})}})}),e}We.findUnreachablePatterns=Aj;function YEe(r,e){if((0,Se.isRegExp)(e)){var t=e.exec(r);return t!==null&&t.index===0}else{if((0,Se.isFunction)(e))return e(r,0,[],{});if((0,Se.has)(e,"exec"))return e.exec(r,0,[],{});if(typeof e=="string")return e===r;throw Error("non exhaustive match")}}function jEe(r){var e=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return(0,Se.find)(e,function(t){return r.source.indexOf(t)!==-1})===void 0}function Tv(r){var e=r.ignoreCase?"i":"";return new RegExp("^(?:"+r.source+")",e)}We.addStartOfInput=Tv;function Lv(r){var e=r.ignoreCase?"iy":"y";return new RegExp(""+r.source,e)}We.addStickyFlag=Lv;function qEe(r,e,t){var i=[];return(0,Se.has)(r,We.DEFAULT_MODE)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+We.DEFAULT_MODE+`> property in its definition -`,type:tr.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,Se.has)(r,We.MODES)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+We.MODES+`> property in its definition -`,type:tr.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,Se.has)(r,We.MODES)&&(0,Se.has)(r,We.DEFAULT_MODE)&&!(0,Se.has)(r.modes,r.defaultMode)&&i.push({message:"A MultiMode Lexer cannot be initialized with a "+We.DEFAULT_MODE+": <"+r.defaultMode+`>which does not exist -`,type:tr.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,Se.has)(r,We.MODES)&&(0,Se.forEach)(r.modes,function(n,s){(0,Se.forEach)(n,function(o,a){(0,Se.isUndefined)(o)&&i.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+s+"> at index: <"+a+`> -`),type:tr.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),i}We.performRuntimeChecks=qEe;function JEe(r,e,t){var i=[],n=!1,s=(0,Se.compact)((0,Se.flatten)((0,Se.mapValues)(r.modes,function(l){return l}))),o=(0,Se.reject)(s,function(l){return l[ko]===tr.Lexer.NA}),a=gj(t);return e&&(0,Se.forEach)(o,function(l){var c=cj(l,a);if(c!==!1){var u=uj(l,c),g={message:u,type:c.issue,tokenType:l};i.push(g)}else(0,Se.has)(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(n=!0):(0,_g.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:tr.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),i}We.performWarningRuntimeChecks=JEe;function WEe(r){var e={},t=(0,Se.keys)(r);return(0,Se.forEach)(t,function(i){var n=r[i];if((0,Se.isArray)(n))e[i]=[];else throw Error("non exhaustive match")}),e}We.cloneEmptyGroups=WEe;function Mv(r){var e=r.PATTERN;if((0,Se.isRegExp)(e))return!1;if((0,Se.isFunction)(e))return!0;if((0,Se.has)(e,"exec"))return!0;if((0,Se.isString)(e))return!1;throw Error("non exhaustive match")}We.isCustomPattern=Mv;function lj(r){return(0,Se.isString)(r)&&r.length===1?r.charCodeAt(0):!1}We.isShortPattern=lj;We.LineTerminatorOptimizedTester={test:function(r){for(var e=r.length,t=this.lastIndex;t Token Type -`)+(" Root cause: "+e.errMsg+`. -`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(e.issue===tr.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the 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")}We.buildLineBreakIssueMessage=uj;function gj(r){var e=(0,Se.map)(r,function(t){return(0,Se.isString)(t)&&t.length>0?t.charCodeAt(0):t});return e}function Nv(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}We.minOptimizationVal=256;var sy=[];function Ov(r){return r255?255+~~(r/255):r}}});var $g=I(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.isTokenType=Dt.hasExtendingTokensTypesMapProperty=Dt.hasExtendingTokensTypesProperty=Dt.hasCategoriesProperty=Dt.hasShortKeyProperty=Dt.singleAssignCategoriesToksMap=Dt.assignCategoriesMapProp=Dt.assignCategoriesTokensProp=Dt.assignTokenDefaultProps=Dt.expandCategories=Dt.augmentTokenTypes=Dt.tokenIdxToClass=Dt.tokenShortNameIdx=Dt.tokenStructuredMatcherNoCategories=Dt.tokenStructuredMatcher=void 0;var zr=Kt();function VEe(r,e){var t=r.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}Dt.tokenStructuredMatcher=VEe;function XEe(r,e){return r.tokenTypeIdx===e.tokenTypeIdx}Dt.tokenStructuredMatcherNoCategories=XEe;Dt.tokenShortNameIdx=1;Dt.tokenIdxToClass={};function ZEe(r){var e=fj(r);hj(e),dj(e),pj(e),(0,zr.forEach)(e,function(t){t.isParent=t.categoryMatches.length>0})}Dt.augmentTokenTypes=ZEe;function fj(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}Dt.expandCategories=fj;function hj(r){(0,zr.forEach)(r,function(e){Cj(e)||(Dt.tokenIdxToClass[Dt.tokenShortNameIdx]=e,e.tokenTypeIdx=Dt.tokenShortNameIdx++),Kv(e)&&!(0,zr.isArray)(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Kv(e)||(e.CATEGORIES=[]),mj(e)||(e.categoryMatches=[]),Ej(e)||(e.categoryMatchesMap={})})}Dt.assignTokenDefaultProps=hj;function pj(r){(0,zr.forEach)(r,function(e){e.categoryMatches=[],(0,zr.forEach)(e.categoryMatchesMap,function(t,i){e.categoryMatches.push(Dt.tokenIdxToClass[i].tokenTypeIdx)})})}Dt.assignCategoriesTokensProp=pj;function dj(r){(0,zr.forEach)(r,function(e){Uv([],e)})}Dt.assignCategoriesMapProp=dj;function Uv(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)||Uv(i,t)})}Dt.singleAssignCategoriesToksMap=Uv;function Cj(r){return(0,zr.has)(r,"tokenTypeIdx")}Dt.hasShortKeyProperty=Cj;function Kv(r){return(0,zr.has)(r,"CATEGORIES")}Dt.hasCategoriesProperty=Kv;function mj(r){return(0,zr.has)(r,"categoryMatches")}Dt.hasExtendingTokensTypesProperty=mj;function Ej(r){return(0,zr.has)(r,"categoryMatchesMap")}Dt.hasExtendingTokensTypesMapProperty=Ej;function _Ee(r){return(0,zr.has)(r,"tokenTypeIdx")}Dt.isTokenType=_Ee});var Hv=I(oy=>{"use strict";Object.defineProperty(oy,"__esModule",{value:!0});oy.defaultLexerErrorProvider=void 0;oy.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 bd=I(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.Lexer=Ec.LexerDefinitionErrorType=void 0;var Zs=Fv(),rr=Kt(),$Ee=$g(),eIe=Hv(),tIe=ry(),rIe;(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"})(rIe=Ec.LexerDefinitionErrorType||(Ec.LexerDefinitionErrorType={}));var Sd={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` -`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:eIe.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(Sd);var iIe=function(){function r(e,t){var i=this;if(t===void 0&&(t=Sd),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,rr.merge)(Sd,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===Sd.lineTerminatorsPattern)i.config.lineTerminatorsPattern=Zs.LineTerminatorOptimizedTester;else if(i.config.lineTerminatorCharacters===Sd.lineTerminatorCharacters)throw Error(`Error: Missing 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,rr.isArray)(e)?(s={modes:{}},s.modes[Zs.DEFAULT_MODE]=(0,rr.cloneArr)(e),s[Zs.DEFAULT_MODE]=Zs.DEFAULT_MODE):(o=!1,s=(0,rr.cloneObj)(e))}),i.config.skipValidations===!1&&(i.TRACE_INIT("performRuntimeChecks",function(){i.lexerDefinitionErrors=i.lexerDefinitionErrors.concat((0,Zs.performRuntimeChecks)(s,i.trackStartLines,i.config.lineTerminatorCharacters))}),i.TRACE_INIT("performWarningRuntimeChecks",function(){i.lexerDefinitionWarning=i.lexerDefinitionWarning.concat((0,Zs.performWarningRuntimeChecks)(s,i.trackStartLines,i.config.lineTerminatorCharacters))})),s.modes=s.modes?s.modes:{},(0,rr.forEach)(s.modes,function(u,g){s.modes[g]=(0,rr.reject)(u,function(h){return(0,rr.isUndefined)(h)})});var a=(0,rr.keys)(s.modes);if((0,rr.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,Zs.validatePatterns)(u,a))}),(0,rr.isEmpty)(i.lexerDefinitionErrors)){(0,$Ee.augmentTokenTypes)(u);var h;i.TRACE_INIT("analyzeTokenTypes",function(){h=(0,Zs.analyzeTokenTypes)(u,{lineTerminatorCharacters:i.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:i.TRACE_INIT.bind(i)})}),i.patternIdxToConfig[g]=h.patternIdxToConfig,i.charCodeToPatternIdxToConfig[g]=h.charCodeToPatternIdxToConfig,i.emptyGroups=(0,rr.merge)(i.emptyGroups,h.emptyGroups),i.hasCustom=h.hasCustom||i.hasCustom,i.canModeBeOptimized[g]=h.canBeOptimized}})}),i.defaultMode=s.defaultMode,!(0,rr.isEmpty)(i.lexerDefinitionErrors)&&!i.config.deferDefinitionErrorsHandling){var l=(0,rr.map)(i.lexerDefinitionErrors,function(u){return u.message}),c=l.join(`----------------------- -`);throw new Error(`Errors detected in definition of Lexer: -`+c)}(0,rr.forEach)(i.lexerDefinitionWarning,function(u){(0,rr.PRINT_WARNING)(u.message)}),i.TRACE_INIT("Choosing sub-methods implementations",function(){if(Zs.SUPPORT_STICKY?(i.chopInput=rr.IDENTITY,i.match=i.matchWithTest):(i.updateLastIndex=rr.NOOP,i.match=i.matchWithExec),o&&(i.handleModes=rr.NOOP),i.trackStartLines===!1&&(i.computeNewColumn=rr.IDENTITY),i.trackEndLines===!1&&(i.updateTokenEndLineColumnLocation=rr.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 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,rr.reduce)(i.canModeBeOptimized,function(g,h,p){return h===!1&&g.push(p),g},[]);if(t.ensureOptimizations&&!(0,rr.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,tIe.clearRegExpParserCache)()}),i.TRACE_INIT("toFastProperties",function(){(0,rr.toFastProperties)(i)})})}return r.prototype.tokenize=function(e,t){if(t===void 0&&(t=this.defaultMode),!(0,rr.isEmpty)(this.lexerDefinitionErrors)){var i=(0,rr.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,h,p,d,m,y,B,S,P,F=e,H=F.length,q=0,_=0,X=this.hasCustom?0:Math.floor(e.length/10),W=new Array(X),Z=[],A=this.trackStartLines?1:void 0,se=this.trackStartLines?1:void 0,ue=(0,Zs.cloneEmptyGroups)(this.emptyGroups),ee=this.trackStartLines,O=this.config.lineTerminatorsPattern,N=0,ce=[],he=[],Pe=[],De=[];Object.freeze(De);var Re=void 0;function oe(){return ce}function Ae(fr){var Ei=(0,Zs.charCodeToOptimizedIndex)(fr),ts=he[Ei];return ts===void 0?De:ts}var ye=function(fr){if(Pe.length===1&&fr.tokenType.PUSH_MODE===void 0){var Ei=i.config.errorMessageProvider.buildUnableToPopLexerModeMessage(fr);Z.push({offset:fr.startOffset,line:fr.startLine!==void 0?fr.startLine:void 0,column:fr.startColumn!==void 0?fr.startColumn:void 0,length:fr.image.length,message:Ei})}else{Pe.pop();var ts=(0,rr.last)(Pe);ce=i.patternIdxToConfig[ts],he=i.charCodeToPatternIdxToConfig[ts],N=ce.length;var ua=i.canModeBeOptimized[ts]&&i.config.safeMode===!1;he&&ua?Re=Ae:Re=oe}};function ge(fr){Pe.push(fr),he=this.charCodeToPatternIdxToConfig[fr],ce=this.patternIdxToConfig[fr],N=ce.length,N=ce.length;var Ei=this.canModeBeOptimized[fr]&&this.config.safeMode===!1;he&&Ei?Re=Ae:Re=oe}ge.call(this,t);for(var ae;qc.length){c=a,u=g,ae=Ze;break}}}break}}if(c!==null){if(h=c.length,p=ae.group,p!==void 0&&(d=ae.tokenTypeIdx,m=this.createTokenInstance(c,q,d,ae.tokenType,A,se,h),this.handlePayload(m,u),p===!1?_=this.addToken(W,_,m):ue[p].push(m)),e=this.chopInput(e,h),q=q+h,se=this.computeNewColumn(se,h),ee===!0&&ae.canLineTerminator===!0){var mt=0,Tr=void 0,ei=void 0;O.lastIndex=0;do Tr=O.test(c),Tr===!0&&(ei=O.lastIndex-1,mt++);while(Tr===!0);mt!==0&&(A=A+mt,se=h-ei,this.updateTokenEndLineColumnLocation(m,p,ei,mt,A,se,h))}this.handleModes(ae,ye,ge,m)}else{for(var ci=q,gr=A,ui=se,ti=!1;!ti&&q <"+e+">");var n=(0,rr.timer)(t),s=n.time,o=n.value,a=s>10?console.warn:console.log;return this.traceInitIndent time: "+s+"ms"),this.traceInitIndent--,o}else return t()},r.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",r.NA=/NOT_APPLICABLE/,r}();Ec.Lexer=iIe});var NA=I(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.tokenMatcher=Si.createTokenInstance=Si.EOF=Si.createToken=Si.hasTokenLabel=Si.tokenName=Si.tokenLabel=void 0;var _s=Kt(),nIe=bd(),Gv=$g();function sIe(r){return xj(r)?r.LABEL:r.name}Si.tokenLabel=sIe;function oIe(r){return r.name}Si.tokenName=oIe;function xj(r){return(0,_s.isString)(r.LABEL)&&r.LABEL!==""}Si.hasTokenLabel=xj;var aIe="parent",Ij="categories",yj="label",wj="group",Bj="push_mode",Qj="pop_mode",bj="longer_alt",Sj="line_breaks",vj="start_chars_hint";function Pj(r){return AIe(r)}Si.createToken=Pj;function AIe(r){var e=r.pattern,t={};if(t.name=r.name,(0,_s.isUndefined)(e)||(t.PATTERN=e),(0,_s.has)(r,aIe))throw`The parent property is no longer supported. -See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return(0,_s.has)(r,Ij)&&(t.CATEGORIES=r[Ij]),(0,Gv.augmentTokenTypes)([t]),(0,_s.has)(r,yj)&&(t.LABEL=r[yj]),(0,_s.has)(r,wj)&&(t.GROUP=r[wj]),(0,_s.has)(r,Qj)&&(t.POP_MODE=r[Qj]),(0,_s.has)(r,Bj)&&(t.PUSH_MODE=r[Bj]),(0,_s.has)(r,bj)&&(t.LONGER_ALT=r[bj]),(0,_s.has)(r,Sj)&&(t.LINE_BREAKS=r[Sj]),(0,_s.has)(r,vj)&&(t.START_CHARS_HINT=r[vj]),t}Si.EOF=Pj({name:"EOF",pattern:nIe.Lexer.NA});(0,Gv.augmentTokenTypes)([Si.EOF]);function lIe(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}}Si.createTokenInstance=lIe;function cIe(r,e){return(0,Gv.tokenStructuredMatcher)(r,e)}Si.tokenMatcher=cIe});var mn=I(qt=>{"use strict";var ka=qt&&qt.__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(qt,"__esModule",{value:!0});qt.serializeProduction=qt.serializeGrammar=qt.Terminal=qt.Alternation=qt.RepetitionWithSeparator=qt.Repetition=qt.RepetitionMandatoryWithSeparator=qt.RepetitionMandatory=qt.Option=qt.Alternative=qt.Rule=qt.NonTerminal=qt.AbstractProduction=void 0;var or=Kt(),uIe=NA(),Do=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,or.forEach)(this.definition,function(t){t.accept(e)})},r}();qt.AbstractProduction=Do;var kj=function(r){ka(e,r);function e(t){var i=r.call(this,[])||this;return i.idx=1,(0,or.assign)(i,(0,or.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}(Do);qt.NonTerminal=kj;var Dj=function(r){ka(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.orgText="",(0,or.assign)(i,(0,or.pick)(t,function(n){return n!==void 0})),i}return e}(Do);qt.Rule=Dj;var Rj=function(r){ka(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.ignoreAmbiguities=!1,(0,or.assign)(i,(0,or.pick)(t,function(n){return n!==void 0})),i}return e}(Do);qt.Alternative=Rj;var Fj=function(r){ka(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,or.assign)(i,(0,or.pick)(t,function(n){return n!==void 0})),i}return e}(Do);qt.Option=Fj;var Nj=function(r){ka(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,or.assign)(i,(0,or.pick)(t,function(n){return n!==void 0})),i}return e}(Do);qt.RepetitionMandatory=Nj;var Tj=function(r){ka(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,or.assign)(i,(0,or.pick)(t,function(n){return n!==void 0})),i}return e}(Do);qt.RepetitionMandatoryWithSeparator=Tj;var Lj=function(r){ka(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,or.assign)(i,(0,or.pick)(t,function(n){return n!==void 0})),i}return e}(Do);qt.Repetition=Lj;var Oj=function(r){ka(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,or.assign)(i,(0,or.pick)(t,function(n){return n!==void 0})),i}return e}(Do);qt.RepetitionWithSeparator=Oj;var Mj=function(r){ka(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,i.ignoreAmbiguities=!1,i.hasPredicates=!1,(0,or.assign)(i,(0,or.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}(Do);qt.Alternation=Mj;var ay=function(){function r(e){this.idx=1,(0,or.assign)(this,(0,or.pick)(e,function(t){return t!==void 0}))}return r.prototype.accept=function(e){e.visit(this)},r}();qt.Terminal=ay;function gIe(r){return(0,or.map)(r,vd)}qt.serializeGrammar=gIe;function vd(r){function e(s){return(0,or.map)(s,vd)}if(r instanceof kj){var t={type:"NonTerminal",name:r.nonTerminalName,idx:r.idx};return(0,or.isString)(r.label)&&(t.label=r.label),t}else{if(r instanceof Rj)return{type:"Alternative",definition:e(r.definition)};if(r instanceof Fj)return{type:"Option",idx:r.idx,definition:e(r.definition)};if(r instanceof Nj)return{type:"RepetitionMandatory",idx:r.idx,definition:e(r.definition)};if(r instanceof Tj)return{type:"RepetitionMandatoryWithSeparator",idx:r.idx,separator:vd(new ay({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof Oj)return{type:"RepetitionWithSeparator",idx:r.idx,separator:vd(new ay({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof Lj)return{type:"Repetition",idx:r.idx,definition:e(r.definition)};if(r instanceof Mj)return{type:"Alternation",idx:r.idx,definition:e(r.definition)};if(r instanceof ay){var i={type:"Terminal",name:r.terminalType.name,label:(0,uIe.tokenLabel)(r.terminalType),idx:r.idx};(0,or.isString)(r.label)&&(i.terminalLabel=r.label);var n=r.terminalType.PATTERN;return r.terminalType.PATTERN&&(i.pattern=(0,or.isRegExp)(n)?n.source:n),i}else{if(r instanceof Dj)return{type:"Rule",name:r.name,orgText:r.orgText,definition:e(r.definition)};throw Error("non exhaustive match")}}}qt.serializeProduction=vd});var ly=I(Ay=>{"use strict";Object.defineProperty(Ay,"__esModule",{value:!0});Ay.RestWalker=void 0;var Yv=Kt(),En=mn(),fIe=function(){function r(){}return r.prototype.walk=function(e,t){var i=this;t===void 0&&(t=[]),(0,Yv.forEach)(e.definition,function(n,s){var o=(0,Yv.drop)(e.definition,s+1);if(n instanceof En.NonTerminal)i.walkProdRef(n,o,t);else if(n instanceof En.Terminal)i.walkTerminal(n,o,t);else if(n instanceof En.Alternative)i.walkFlat(n,o,t);else if(n instanceof En.Option)i.walkOption(n,o,t);else if(n instanceof En.RepetitionMandatory)i.walkAtLeastOne(n,o,t);else if(n instanceof En.RepetitionMandatoryWithSeparator)i.walkAtLeastOneSep(n,o,t);else if(n instanceof En.RepetitionWithSeparator)i.walkManySep(n,o,t);else if(n instanceof En.Repetition)i.walkMany(n,o,t);else if(n instanceof En.Alternation)i.walkOr(n,o,t);else throw Error("non exhaustive match")})},r.prototype.walkTerminal=function(e,t,i){},r.prototype.walkProdRef=function(e,t,i){},r.prototype.walkFlat=function(e,t,i){var n=t.concat(i);this.walk(e,n)},r.prototype.walkOption=function(e,t,i){var n=t.concat(i);this.walk(e,n)},r.prototype.walkAtLeastOne=function(e,t,i){var n=[new En.Option({definition:e.definition})].concat(t,i);this.walk(e,n)},r.prototype.walkAtLeastOneSep=function(e,t,i){var n=Kj(e,t,i);this.walk(e,n)},r.prototype.walkMany=function(e,t,i){var n=[new En.Option({definition:e.definition})].concat(t,i);this.walk(e,n)},r.prototype.walkManySep=function(e,t,i){var n=Kj(e,t,i);this.walk(e,n)},r.prototype.walkOr=function(e,t,i){var n=this,s=t.concat(i);(0,Yv.forEach)(e.definition,function(o){var a=new En.Alternative({definition:[o]});n.walk(a,s)})},r}();Ay.RestWalker=fIe;function Kj(r,e,t){var i=[new En.Option({definition:[new En.Terminal({terminalType:r.separator})].concat(r.definition)})],n=i.concat(e,t);return n}});var ef=I(cy=>{"use strict";Object.defineProperty(cy,"__esModule",{value:!0});cy.GAstVisitor=void 0;var Ro=mn(),hIe=function(){function r(){}return r.prototype.visit=function(e){var t=e;switch(t.constructor){case Ro.NonTerminal:return this.visitNonTerminal(t);case Ro.Alternative:return this.visitAlternative(t);case Ro.Option:return this.visitOption(t);case Ro.RepetitionMandatory:return this.visitRepetitionMandatory(t);case Ro.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(t);case Ro.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(t);case Ro.Repetition:return this.visitRepetition(t);case Ro.Alternation:return this.visitAlternation(t);case Ro.Terminal:return this.visitTerminal(t);case Ro.Rule:return this.visitRule(t);default:throw Error("non exhaustive match")}},r.prototype.visitNonTerminal=function(e){},r.prototype.visitAlternative=function(e){},r.prototype.visitOption=function(e){},r.prototype.visitRepetition=function(e){},r.prototype.visitRepetitionMandatory=function(e){},r.prototype.visitRepetitionMandatoryWithSeparator=function(e){},r.prototype.visitRepetitionWithSeparator=function(e){},r.prototype.visitAlternation=function(e){},r.prototype.visitTerminal=function(e){},r.prototype.visitRule=function(e){},r}();cy.GAstVisitor=hIe});var Pd=I(Mi=>{"use strict";var pIe=Mi&&Mi.__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(Mi,"__esModule",{value:!0});Mi.collectMethods=Mi.DslMethodsCollectorVisitor=Mi.getProductionDslName=Mi.isBranchingProd=Mi.isOptionalProd=Mi.isSequenceProd=void 0;var xd=Kt(),wr=mn(),dIe=ef();function CIe(r){return r instanceof wr.Alternative||r instanceof wr.Option||r instanceof wr.Repetition||r instanceof wr.RepetitionMandatory||r instanceof wr.RepetitionMandatoryWithSeparator||r instanceof wr.RepetitionWithSeparator||r instanceof wr.Terminal||r instanceof wr.Rule}Mi.isSequenceProd=CIe;function jv(r,e){e===void 0&&(e=[]);var t=r instanceof wr.Option||r instanceof wr.Repetition||r instanceof wr.RepetitionWithSeparator;return t?!0:r instanceof wr.Alternation?(0,xd.some)(r.definition,function(i){return jv(i,e)}):r instanceof wr.NonTerminal&&(0,xd.contains)(e,r)?!1:r instanceof wr.AbstractProduction?(r instanceof wr.NonTerminal&&e.push(r),(0,xd.every)(r.definition,function(i){return jv(i,e)})):!1}Mi.isOptionalProd=jv;function mIe(r){return r instanceof wr.Alternation}Mi.isBranchingProd=mIe;function EIe(r){if(r instanceof wr.NonTerminal)return"SUBRULE";if(r instanceof wr.Option)return"OPTION";if(r instanceof wr.Alternation)return"OR";if(r instanceof wr.RepetitionMandatory)return"AT_LEAST_ONE";if(r instanceof wr.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(r instanceof wr.RepetitionWithSeparator)return"MANY_SEP";if(r instanceof wr.Repetition)return"MANY";if(r instanceof wr.Terminal)return"CONSUME";throw Error("non exhaustive match")}Mi.getProductionDslName=EIe;var Uj=function(r){pIe(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.separator="-",t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return e.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},e.prototype.visitTerminal=function(t){var i=t.terminalType.name+this.separator+"Terminal";(0,xd.has)(this.dslMethods,i)||(this.dslMethods[i]=[]),this.dslMethods[i].push(t)},e.prototype.visitNonTerminal=function(t){var i=t.nonTerminalName+this.separator+"Terminal";(0,xd.has)(this.dslMethods,i)||(this.dslMethods[i]=[]),this.dslMethods[i].push(t)},e.prototype.visitOption=function(t){this.dslMethods.option.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.dslMethods.repetitionWithSeparator.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.dslMethods.repetitionMandatory.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)},e.prototype.visitRepetition=function(t){this.dslMethods.repetition.push(t)},e.prototype.visitAlternation=function(t){this.dslMethods.alternation.push(t)},e}(dIe.GAstVisitor);Mi.DslMethodsCollectorVisitor=Uj;var uy=new Uj;function IIe(r){uy.reset(),r.accept(uy);var e=uy.dslMethods;return uy.reset(),e}Mi.collectMethods=IIe});var Jv=I(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.firstForTerminal=Fo.firstForBranching=Fo.firstForSequence=Fo.first=void 0;var gy=Kt(),Hj=mn(),qv=Pd();function fy(r){if(r instanceof Hj.NonTerminal)return fy(r.referencedRule);if(r instanceof Hj.Terminal)return jj(r);if((0,qv.isSequenceProd)(r))return Gj(r);if((0,qv.isBranchingProd)(r))return Yj(r);throw Error("non exhaustive match")}Fo.first=fy;function Gj(r){for(var e=[],t=r.definition,i=0,n=t.length>i,s,o=!0;n&&o;)s=t[i],o=(0,qv.isOptionalProd)(s),e=e.concat(fy(s)),i=i+1,n=t.length>i;return(0,gy.uniq)(e)}Fo.firstForSequence=Gj;function Yj(r){var e=(0,gy.map)(r.definition,function(t){return fy(t)});return(0,gy.uniq)((0,gy.flatten)(e))}Fo.firstForBranching=Yj;function jj(r){return[r.terminalType]}Fo.firstForTerminal=jj});var Wv=I(hy=>{"use strict";Object.defineProperty(hy,"__esModule",{value:!0});hy.IN=void 0;hy.IN="_~IN~_"});var Vj=I(us=>{"use strict";var yIe=us&&us.__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(us,"__esModule",{value:!0});us.buildInProdFollowPrefix=us.buildBetweenProdsFollowPrefix=us.computeAllProdsFollows=us.ResyncFollowsWalker=void 0;var wIe=ly(),BIe=Jv(),qj=Kt(),Jj=Wv(),QIe=mn(),Wj=function(r){yIe(e,r);function e(t){var i=r.call(this)||this;return i.topProd=t,i.follows={},i}return e.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},e.prototype.walkTerminal=function(t,i,n){},e.prototype.walkProdRef=function(t,i,n){var s=zj(t.referencedRule,t.idx)+this.topProd.name,o=i.concat(n),a=new QIe.Alternative({definition:o}),l=(0,BIe.first)(a);this.follows[s]=l},e}(wIe.RestWalker);us.ResyncFollowsWalker=Wj;function bIe(r){var e={};return(0,qj.forEach)(r,function(t){var i=new Wj(t).startWalking();(0,qj.assign)(e,i)}),e}us.computeAllProdsFollows=bIe;function zj(r,e){return r.name+e+Jj.IN}us.buildBetweenProdsFollowPrefix=zj;function SIe(r){var e=r.terminalType.name;return e+r.idx+Jj.IN}us.buildInProdFollowPrefix=SIe});var kd=I(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.defaultGrammarValidatorErrorProvider=Da.defaultGrammarResolverErrorProvider=Da.defaultParserErrorProvider=void 0;var tf=NA(),vIe=Kt(),$s=Kt(),zv=mn(),Xj=Pd();Da.defaultParserErrorProvider={buildMismatchTokenMessage:function(r){var e=r.expected,t=r.actual,i=r.previous,n=r.ruleName,s=(0,tf.hasTokenLabel)(e),o=s?"--> "+(0,tf.tokenLabel)(e)+" <--":"token of type --> "+e.name+" <--",a="Expecting "+o+" but found --> '"+t.image+"' <--";return a},buildNotAllInputParsedMessage:function(r){var e=r.firstRedundant,t=r.ruleName;return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage:function(r){var e=r.expectedPathsPerAlt,t=r.actual,i=r.previous,n=r.customUserDescription,s=r.ruleName,o="Expecting: ",a=(0,$s.first)(t).image,l=` -but found: '`+a+"'";if(n)return o+n+l;var c=(0,$s.reduce)(e,function(p,d){return p.concat(d)},[]),u=(0,$s.map)(c,function(p){return"["+(0,$s.map)(p,function(d){return(0,tf.tokenLabel)(d)}).join(", ")+"]"}),g=(0,$s.map)(u,function(p,d){return" "+(d+1)+". "+p}),h=`one of these possible Token sequences: -`+g.join(` -`);return o+h+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,tf.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(Da.defaultParserErrorProvider);Da.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}};Da.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(r,e){function t(u){return u instanceof zv.Terminal?u.terminalType.name:u instanceof zv.NonTerminal?u.nonTerminalName:""}var i=r.name,n=(0,$s.first)(e),s=n.idx,o=(0,Xj.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,tf.tokenLabel)(n)}).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,i="Ambiguous alternatives: <"+r.ambiguityIndices.join(" ,")+`> due to common lookahead prefix -`+("in 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,tf.tokenLabel)(n)}).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,i="Ambiguous Alternatives Detected: <"+r.ambiguityIndices.join(" ,")+"> in "+(" 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,Xj.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 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: -`+(" inside <"+r.topLevelRule.name+`> Rule. - has `+(r.alternation.definition.length+1)+" alternatives.");return e},buildLeftRecursionError:function(r){var e=r.topLevelRule.name,t=vIe.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 zv.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 $j=I(TA=>{"use strict";var xIe=TA&&TA.__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(TA,"__esModule",{value:!0});TA.GastRefResolverVisitor=TA.resolveGrammar=void 0;var PIe=Yn(),Zj=Kt(),kIe=ef();function DIe(r,e){var t=new _j(r,e);return t.resolveRefs(),t.errors}TA.resolveGrammar=DIe;var _j=function(r){xIe(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,Zj.forEach)((0,Zj.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:PIe.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}},e}(kIe.GAstVisitor);TA.GastRefResolverVisitor=_j});var Rd=I(Rr=>{"use strict";var Ic=Rr&&Rr.__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(Rr,"__esModule",{value:!0});Rr.nextPossibleTokensAfter=Rr.possiblePathsFrom=Rr.NextTerminalAfterAtLeastOneSepWalker=Rr.NextTerminalAfterAtLeastOneWalker=Rr.NextTerminalAfterManySepWalker=Rr.NextTerminalAfterManyWalker=Rr.AbstractNextTerminalAfterProductionWalker=Rr.NextAfterTokenWalker=Rr.AbstractNextPossibleTokensWalker=void 0;var eq=ly(),Lt=Kt(),RIe=Jv(),Pt=mn(),tq=function(r){Ic(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,Lt.cloneArr)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,Lt.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,Lt.isEmpty)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},e}(eq.RestWalker);Rr.AbstractNextPossibleTokensWalker=tq;var FIe=function(r){Ic(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 Pt.Alternative({definition:s});this.possibleTokTypes=(0,RIe.first)(o),this.found=!0}},e}(tq);Rr.NextAfterTokenWalker=FIe;var Dd=function(r){Ic(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}(eq.RestWalker);Rr.AbstractNextTerminalAfterProductionWalker=Dd;var NIe=function(r){Ic(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,Lt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof Pt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkMany.call(this,t,i,n)},e}(Dd);Rr.NextTerminalAfterManyWalker=NIe;var TIe=function(r){Ic(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkManySep=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Lt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof Pt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkManySep.call(this,t,i,n)},e}(Dd);Rr.NextTerminalAfterManySepWalker=TIe;var LIe=function(r){Ic(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOne=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Lt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof Pt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkAtLeastOne.call(this,t,i,n)},e}(Dd);Rr.NextTerminalAfterAtLeastOneWalker=LIe;var OIe=function(r){Ic(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOneSep=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Lt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof Pt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkAtLeastOneSep.call(this,t,i,n)},e}(Dd);Rr.NextTerminalAfterAtLeastOneSepWalker=OIe;function rq(r,e,t){t===void 0&&(t=[]),t=(0,Lt.cloneArr)(t);var i=[],n=0;function s(c){return c.concat((0,Lt.drop)(r,n+1))}function o(c){var u=rq(s(c),e,t);return i.concat(u)}for(;t.length=0;ue--){var ee=B.definition[ue],O={idx:d,def:ee.definition.concat((0,Lt.drop)(p)),ruleStack:m,occurrenceStack:y};g.push(O),g.push(o)}else if(B instanceof Pt.Alternative)g.push({idx:d,def:B.definition.concat((0,Lt.drop)(p)),ruleStack:m,occurrenceStack:y});else if(B instanceof Pt.Rule)g.push(KIe(B,d,m,y));else throw Error("non exhaustive match")}}return u}Rr.nextPossibleTokensAfter=MIe;function KIe(r,e,t,i){var n=(0,Lt.cloneArr)(t);n.push(r.name);var s=(0,Lt.cloneArr)(i);return s.push(1),{idx:e,def:r.definition,ruleStack:n,occurrenceStack:s}}});var Fd=I(zt=>{"use strict";var sq=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.areTokenCategoriesNotUsed=zt.isStrictPrefixOfPath=zt.containsPath=zt.getLookaheadPathsForOptionalProd=zt.getLookaheadPathsForOr=zt.lookAheadSequenceFromAlternatives=zt.buildSingleAlternativeLookaheadFunction=zt.buildAlternativesLookAheadFunc=zt.buildLookaheadFuncForOptionalProd=zt.buildLookaheadFuncForOr=zt.getProdType=zt.PROD_TYPE=void 0;var ir=Kt(),iq=Rd(),UIe=ly(),py=$g(),LA=mn(),HIe=ef(),ni;(function(r){r[r.OPTION=0]="OPTION",r[r.REPETITION=1]="REPETITION",r[r.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",r[r.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",r[r.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",r[r.ALTERNATION=5]="ALTERNATION"})(ni=zt.PROD_TYPE||(zt.PROD_TYPE={}));function GIe(r){if(r instanceof LA.Option)return ni.OPTION;if(r instanceof LA.Repetition)return ni.REPETITION;if(r instanceof LA.RepetitionMandatory)return ni.REPETITION_MANDATORY;if(r instanceof LA.RepetitionMandatoryWithSeparator)return ni.REPETITION_MANDATORY_WITH_SEPARATOR;if(r instanceof LA.RepetitionWithSeparator)return ni.REPETITION_WITH_SEPARATOR;if(r instanceof LA.Alternation)return ni.ALTERNATION;throw Error("non exhaustive match")}zt.getProdType=GIe;function YIe(r,e,t,i,n,s){var o=aq(r,e,t),a=Zv(o)?py.tokenStructuredMatcherNoCategories:py.tokenStructuredMatcher;return s(o,i,a,n)}zt.buildLookaheadFuncForOr=YIe;function jIe(r,e,t,i,n,s){var o=Aq(r,e,n,t),a=Zv(o)?py.tokenStructuredMatcherNoCategories:py.tokenStructuredMatcher;return s(o[0],a,i)}zt.buildLookaheadFuncForOptionalProd=jIe;function qIe(r,e,t,i){var n=r.length,s=(0,ir.every)(r,function(l){return(0,ir.every)(l,function(c){return c.length===1})});if(e)return function(l){for(var c=(0,ir.map)(l,function(P){return P.GATE}),u=0;u{"use strict";var _v=Jt&&Jt.__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(Jt,"__esModule",{value:!0});Jt.checkPrefixAlternativesAmbiguities=Jt.validateSomeNonEmptyLookaheadPath=Jt.validateTooManyAlts=Jt.RepetionCollector=Jt.validateAmbiguousAlternationAlternatives=Jt.validateEmptyOrAlternative=Jt.getFirstNoneTerminal=Jt.validateNoLeftRecursion=Jt.validateRuleIsOverridden=Jt.validateRuleDoesNotAlreadyExist=Jt.OccurrenceValidationCollector=Jt.identifyProductionForDuplicates=Jt.validateGrammar=void 0;var _t=Kt(),Br=Kt(),No=Yn(),$v=Pd(),rf=Fd(),XIe=Rd(),eo=mn(),ex=ef();function ZIe(r,e,t,i,n){var s=_t.map(r,function(p){return _Ie(p,i)}),o=_t.map(r,function(p){return tx(p,p,i)}),a=[],l=[],c=[];(0,Br.every)(o,Br.isEmpty)&&(a=(0,Br.map)(r,function(p){return hq(p,i)}),l=(0,Br.map)(r,function(p){return pq(p,e,i)}),c=mq(r,e,i));var u=tye(r,t,i),g=(0,Br.map)(r,function(p){return Cq(p,i)}),h=(0,Br.map)(r,function(p){return fq(p,r,n,i)});return _t.flatten(s.concat(c,o,a,l,u,g,h))}Jt.validateGrammar=ZIe;function _Ie(r,e){var t=new gq;r.accept(t);var i=t.allProductions,n=_t.groupBy(i,cq),s=_t.pick(n,function(a){return a.length>1}),o=_t.map(_t.values(s),function(a){var l=_t.first(a),c=e.buildDuplicateFoundError(r,a),u=(0,$v.getProductionDslName)(l),g={message:c,type:No.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:r.name,dslName:u,occurrence:l.idx},h=uq(l);return h&&(g.parameter=h),g});return o}function cq(r){return(0,$v.getProductionDslName)(r)+"_#_"+r.idx+"_#_"+uq(r)}Jt.identifyProductionForDuplicates=cq;function uq(r){return r instanceof eo.Terminal?r.terminalType.name:r instanceof eo.NonTerminal?r.nonTerminalName:""}var gq=function(r){_v(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitNonTerminal=function(t){this.allProductions.push(t)},e.prototype.visitOption=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e.prototype.visitAlternation=function(t){this.allProductions.push(t)},e.prototype.visitTerminal=function(t){this.allProductions.push(t)},e}(ex.GAstVisitor);Jt.OccurrenceValidationCollector=gq;function fq(r,e,t,i){var n=[],s=(0,Br.reduce)(e,function(a,l){return l.name===r.name?a+1:a},0);if(s>1){var o=i.buildDuplicateRuleNameError({topLevelRule:r,grammarName:t});n.push({message:o,type:No.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:r.name})}return n}Jt.validateRuleDoesNotAlreadyExist=fq;function $Ie(r,e,t){var i=[],n;return _t.contains(e,r)||(n="Invalid rule override, rule: ->"+r+"<- cannot be overridden in the grammar: ->"+t+"<-as it is not defined in any of the super grammars ",i.push({message:n,type:No.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:r})),i}Jt.validateRuleIsOverridden=$Ie;function tx(r,e,t,i){i===void 0&&(i=[]);var n=[],s=Nd(e.definition);if(_t.isEmpty(s))return[];var o=r.name,a=_t.contains(s,r);a&&n.push({message:t.buildLeftRecursionError({topLevelRule:r,leftRecursionPath:i}),type:No.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:o});var l=_t.difference(s,i.concat([r])),c=_t.map(l,function(u){var g=_t.cloneArr(i);return g.push(u),tx(r,u,t,g)});return n.concat(_t.flatten(c))}Jt.validateNoLeftRecursion=tx;function Nd(r){var e=[];if(_t.isEmpty(r))return e;var t=_t.first(r);if(t instanceof eo.NonTerminal)e.push(t.referencedRule);else if(t instanceof eo.Alternative||t instanceof eo.Option||t instanceof eo.RepetitionMandatory||t instanceof eo.RepetitionMandatoryWithSeparator||t instanceof eo.RepetitionWithSeparator||t instanceof eo.Repetition)e=e.concat(Nd(t.definition));else if(t instanceof eo.Alternation)e=_t.flatten(_t.map(t.definition,function(o){return Nd(o.definition)}));else if(!(t instanceof eo.Terminal))throw Error("non exhaustive match");var i=(0,$v.isOptionalProd)(t),n=r.length>1;if(i&&n){var s=_t.drop(r);return e.concat(Nd(s))}else return e}Jt.getFirstNoneTerminal=Nd;var rx=function(r){_v(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.alternations=[],t}return e.prototype.visitAlternation=function(t){this.alternations.push(t)},e}(ex.GAstVisitor);function hq(r,e){var t=new rx;r.accept(t);var i=t.alternations,n=_t.reduce(i,function(s,o){var a=_t.dropRight(o.definition),l=_t.map(a,function(c,u){var g=(0,XIe.nextPossibleTokensAfter)([c],[],null,1);return _t.isEmpty(g)?{message:e.buildEmptyAlternationError({topLevelRule:r,alternation:o,emptyChoiceIdx:u}),type:No.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:o.idx,alternative:u+1}:null});return s.concat(_t.compact(l))},[]);return n}Jt.validateEmptyOrAlternative=hq;function pq(r,e,t){var i=new rx;r.accept(i);var n=i.alternations;n=(0,Br.reject)(n,function(o){return o.ignoreAmbiguities===!0});var s=_t.reduce(n,function(o,a){var l=a.idx,c=a.maxLookahead||e,u=(0,rf.getLookaheadPathsForOr)(l,r,c,a),g=eye(u,a,r,t),h=Eq(u,a,r,t);return o.concat(g,h)},[]);return s}Jt.validateAmbiguousAlternationAlternatives=pq;var dq=function(r){_v(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e}(ex.GAstVisitor);Jt.RepetionCollector=dq;function Cq(r,e){var t=new rx;r.accept(t);var i=t.alternations,n=_t.reduce(i,function(s,o){return o.definition.length>255&&s.push({message:e.buildTooManyAlternativesError({topLevelRule:r,alternation:o}),type:No.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:r.name,occurrence:o.idx}),s},[]);return n}Jt.validateTooManyAlts=Cq;function mq(r,e,t){var i=[];return(0,Br.forEach)(r,function(n){var s=new dq;n.accept(s);var o=s.allProductions;(0,Br.forEach)(o,function(a){var l=(0,rf.getProdType)(a),c=a.maxLookahead||e,u=a.idx,g=(0,rf.getLookaheadPathsForOptionalProd)(u,n,l,c),h=g[0];if((0,Br.isEmpty)((0,Br.flatten)(h))){var p=t.buildEmptyRepetitionError({topLevelRule:n,repetition:a});i.push({message:p,type:No.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:n.name})}})}),i}Jt.validateSomeNonEmptyLookaheadPath=mq;function eye(r,e,t,i){var n=[],s=(0,Br.reduce)(r,function(a,l,c){return e.definition[c].ignoreAmbiguities===!0||(0,Br.forEach)(l,function(u){var g=[c];(0,Br.forEach)(r,function(h,p){c!==p&&(0,rf.containsPath)(h,u)&&e.definition[p].ignoreAmbiguities!==!0&&g.push(p)}),g.length>1&&!(0,rf.containsPath)(n,u)&&(n.push(u),a.push({alts:g,path:u}))}),a},[]),o=_t.map(s,function(a){var l=(0,Br.map)(a.alts,function(u){return u+1}),c=i.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:l,prefixPath:a.path});return{message:c,type:No.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:[a.alts]}});return o}function Eq(r,e,t,i){var n=[],s=(0,Br.reduce)(r,function(o,a,l){var c=(0,Br.map)(a,function(u){return{idx:l,path:u}});return o.concat(c)},[]);return(0,Br.forEach)(s,function(o){var a=e.definition[o.idx];if(a.ignoreAmbiguities!==!0){var l=o.idx,c=o.path,u=(0,Br.findAll)(s,function(h){return e.definition[h.idx].ignoreAmbiguities!==!0&&h.idx{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});nf.validateGrammar=nf.resolveGrammar=void 0;var nx=Kt(),rye=$j(),iye=ix(),Iq=kd();function nye(r){r=(0,nx.defaults)(r,{errMsgProvider:Iq.defaultGrammarResolverErrorProvider});var e={};return(0,nx.forEach)(r.rules,function(t){e[t.name]=t}),(0,rye.resolveGrammar)(e,r.errMsgProvider)}nf.resolveGrammar=nye;function sye(r){return r=(0,nx.defaults)(r,{errMsgProvider:Iq.defaultGrammarValidatorErrorProvider}),(0,iye.validateGrammar)(r.rules,r.maxLookahead,r.tokenTypes,r.errMsgProvider,r.grammarName)}nf.validateGrammar=sye});var sf=I(In=>{"use strict";var Td=In&&In.__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(In,"__esModule",{value:!0});In.EarlyExitException=In.NotAllInputParsedException=In.NoViableAltException=In.MismatchedTokenException=In.isRecognitionException=void 0;var oye=Kt(),wq="MismatchedTokenException",Bq="NoViableAltException",Qq="EarlyExitException",bq="NotAllInputParsedException",Sq=[wq,Bq,Qq,bq];Object.freeze(Sq);function aye(r){return(0,oye.contains)(Sq,r.name)}In.isRecognitionException=aye;var dy=function(r){Td(e,r);function e(t,i){var n=this.constructor,s=r.call(this,t)||this;return s.token=i,s.resyncedTokens=[],Object.setPrototypeOf(s,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(s,s.constructor),s}return e}(Error),Aye=function(r){Td(e,r);function e(t,i,n){var s=r.call(this,t,i)||this;return s.previousToken=n,s.name=wq,s}return e}(dy);In.MismatchedTokenException=Aye;var lye=function(r){Td(e,r);function e(t,i,n){var s=r.call(this,t,i)||this;return s.previousToken=n,s.name=Bq,s}return e}(dy);In.NoViableAltException=lye;var cye=function(r){Td(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.name=bq,n}return e}(dy);In.NotAllInputParsedException=cye;var uye=function(r){Td(e,r);function e(t,i,n){var s=r.call(this,t,i)||this;return s.previousToken=n,s.name=Qq,s}return e}(dy);In.EarlyExitException=uye});var ox=I(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.attemptInRepetitionRecovery=Ki.Recoverable=Ki.InRuleRecoveryException=Ki.IN_RULE_RECOVERY_EXCEPTION=Ki.EOF_FOLLOW_KEY=void 0;var Cy=NA(),gs=Kt(),gye=sf(),fye=Wv(),hye=Yn();Ki.EOF_FOLLOW_KEY={};Ki.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function sx(r){this.name=Ki.IN_RULE_RECOVERY_EXCEPTION,this.message=r}Ki.InRuleRecoveryException=sx;sx.prototype=Error.prototype;var pye=function(){function r(){}return r.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,gs.has)(e,"recoveryEnabled")?e.recoveryEnabled:hye.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=vq)},r.prototype.getTokenToInsert=function(e){var t=(0,Cy.createTokenInstance)(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t},r.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},r.prototype.tryInRepetitionRecovery=function(e,t,i,n){for(var s=this,o=this.findReSyncTokenType(),a=this.exportLexerState(),l=[],c=!1,u=this.LA(1),g=this.LA(1),h=function(){var p=s.LA(0),d=s.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:u,previous:p,ruleName:s.getCurrRuleFullName()}),m=new gye.MismatchedTokenException(d,u,s.LA(0));m.resyncedTokens=(0,gs.dropRight)(l),s.SAVE_ERROR(m)};!c;)if(this.tokenMatcher(g,n)){h();return}else if(i.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(g,o)?c=!0:(g=this.SKIP_TOKEN(),this.addToResyncTokens(g,l));this.importLexerState(a)},r.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,i){return!(i===!1||e===void 0||t===void 0||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))},r.prototype.getFollowsForInRuleRecovery=function(e,t){var i=this.getCurrentGrammarPath(e,t),n=this.getNextPossibleTokenTypes(i);return n},r.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t)){var i=this.getTokenToInsert(e);return i}if(this.canRecoverWithSingleTokenDeletion(e)){var n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new sx("sad sad panda")},r.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},r.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var i=this;if(!this.canTokenTypeBeInsertedInRecovery(e)||(0,gs.isEmpty)(t))return!1;var n=this.LA(1),s=(0,gs.find)(t,function(o){return i.tokenMatcher(n,o)})!==void 0;return s},r.prototype.canRecoverWithSingleTokenDeletion=function(e){var t=this.tokenMatcher(this.LA(2),e);return t},r.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),i=this.getFollowSetFromFollowKey(t);return(0,gs.contains)(i,e)},r.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),i=2;;){var n=t.tokenType;if((0,gs.contains)(e,n))return n;t=this.LA(i),i++}},r.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return Ki.EOF_FOLLOW_KEY;var e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),i=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(i)}},r.prototype.buildFullFollowKeyStack=function(){var e=this,t=this.RULE_STACK,i=this.RULE_OCCURRENCE_STACK;return(0,gs.map)(t,function(n,s){return s===0?Ki.EOF_FOLLOW_KEY:{ruleName:e.shortRuleNameToFullName(n),idxInCallingRule:i[s],inRule:e.shortRuleNameToFullName(t[s-1])}})},r.prototype.flattenFollowSet=function(){var e=this,t=(0,gs.map)(this.buildFullFollowKeyStack(),function(i){return e.getFollowSetFromFollowKey(i)});return(0,gs.flatten)(t)},r.prototype.getFollowSetFromFollowKey=function(e){if(e===Ki.EOF_FOLLOW_KEY)return[Cy.EOF];var t=e.ruleName+e.idxInCallingRule+fye.IN+e.inRule;return this.resyncFollows[t]},r.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,Cy.EOF)||t.push(e),t},r.prototype.reSyncTo=function(e){for(var t=[],i=this.LA(1);this.tokenMatcher(i,e)===!1;)i=this.SKIP_TOKEN(),this.addToResyncTokens(i,t);return(0,gs.dropRight)(t)},r.prototype.attemptInRepetitionRecovery=function(e,t,i,n,s,o,a){},r.prototype.getCurrentGrammarPath=function(e,t){var i=this.getHumanReadableRuleStack(),n=(0,gs.cloneArr)(this.RULE_OCCURRENCE_STACK),s={ruleStack:i,occurrenceStack:n,lastTok:e,lastTokOccurrence:t};return s},r.prototype.getHumanReadableRuleStack=function(){var e=this;return(0,gs.map)(this.RULE_STACK,function(t){return e.shortRuleNameToFullName(t)})},r}();Ki.Recoverable=pye;function vq(r,e,t,i,n,s,o){var a=this.getKeyForAutomaticLookahead(i,n),l=this.firstAfterRepMap[a];if(l===void 0){var c=this.getCurrRuleFullName(),u=this.getGAstProductions()[c],g=new s(u,n);l=g.startWalking(),this.firstAfterRepMap[a]=l}var h=l.token,p=l.occurrence,d=l.isEndOfRule;this.RULE_STACK.length===1&&d&&h===void 0&&(h=Cy.EOF,p=1),this.shouldInRepetitionRecoveryBeTried(h,p,o)&&this.tryInRepetitionRecovery(r,e,t,h)}Ki.attemptInRepetitionRecovery=vq});var my=I(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.getKeyForAutomaticLookahead=Yt.AT_LEAST_ONE_SEP_IDX=Yt.MANY_SEP_IDX=Yt.AT_LEAST_ONE_IDX=Yt.MANY_IDX=Yt.OPTION_IDX=Yt.OR_IDX=Yt.BITS_FOR_ALT_IDX=Yt.BITS_FOR_RULE_IDX=Yt.BITS_FOR_OCCURRENCE_IDX=Yt.BITS_FOR_METHOD_TYPE=void 0;Yt.BITS_FOR_METHOD_TYPE=4;Yt.BITS_FOR_OCCURRENCE_IDX=8;Yt.BITS_FOR_RULE_IDX=12;Yt.BITS_FOR_ALT_IDX=8;Yt.OR_IDX=1<{"use strict";Object.defineProperty(Ey,"__esModule",{value:!0});Ey.LooksAhead=void 0;var Ra=Fd(),to=Kt(),xq=Yn(),Fa=my(),yc=Pd(),Cye=function(){function r(){}return r.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=(0,to.has)(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:xq.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=(0,to.has)(e,"maxLookahead")?e.maxLookahead:xq.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=(0,to.isES2015MapSupported)()?new Map:[],(0,to.isES2015MapSupported)()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},r.prototype.preComputeLookaheadFunctions=function(e){var t=this;(0,to.forEach)(e,function(i){t.TRACE_INIT(i.name+" Rule Lookahead",function(){var n=(0,yc.collectMethods)(i),s=n.alternation,o=n.repetition,a=n.option,l=n.repetitionMandatory,c=n.repetitionMandatoryWithSeparator,u=n.repetitionWithSeparator;(0,to.forEach)(s,function(g){var h=g.idx===0?"":g.idx;t.TRACE_INIT(""+(0,yc.getProductionDslName)(g)+h,function(){var p=(0,Ra.buildLookaheadFuncForOr)(g.idx,i,g.maxLookahead||t.maxLookahead,g.hasPredicates,t.dynamicTokensEnabled,t.lookAheadBuilderForAlternatives),d=(0,Fa.getKeyForAutomaticLookahead)(t.fullRuleNameToShort[i.name],Fa.OR_IDX,g.idx);t.setLaFuncCache(d,p)})}),(0,to.forEach)(o,function(g){t.computeLookaheadFunc(i,g.idx,Fa.MANY_IDX,Ra.PROD_TYPE.REPETITION,g.maxLookahead,(0,yc.getProductionDslName)(g))}),(0,to.forEach)(a,function(g){t.computeLookaheadFunc(i,g.idx,Fa.OPTION_IDX,Ra.PROD_TYPE.OPTION,g.maxLookahead,(0,yc.getProductionDslName)(g))}),(0,to.forEach)(l,function(g){t.computeLookaheadFunc(i,g.idx,Fa.AT_LEAST_ONE_IDX,Ra.PROD_TYPE.REPETITION_MANDATORY,g.maxLookahead,(0,yc.getProductionDslName)(g))}),(0,to.forEach)(c,function(g){t.computeLookaheadFunc(i,g.idx,Fa.AT_LEAST_ONE_SEP_IDX,Ra.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,g.maxLookahead,(0,yc.getProductionDslName)(g))}),(0,to.forEach)(u,function(g){t.computeLookaheadFunc(i,g.idx,Fa.MANY_SEP_IDX,Ra.PROD_TYPE.REPETITION_WITH_SEPARATOR,g.maxLookahead,(0,yc.getProductionDslName)(g))})})})},r.prototype.computeLookaheadFunc=function(e,t,i,n,s,o){var a=this;this.TRACE_INIT(""+o+(t===0?"":t),function(){var l=(0,Ra.buildLookaheadFuncForOptionalProd)(t,e,s||a.maxLookahead,a.dynamicTokensEnabled,n,a.lookAheadBuilderForOptional),c=(0,Fa.getKeyForAutomaticLookahead)(a.fullRuleNameToShort[e.name],i,t);a.setLaFuncCache(c,l)})},r.prototype.lookAheadBuilderForOptional=function(e,t,i){return(0,Ra.buildSingleAlternativeLookaheadFunction)(e,t,i)},r.prototype.lookAheadBuilderForAlternatives=function(e,t,i,n){return(0,Ra.buildAlternativesLookAheadFunc)(e,t,i,n)},r.prototype.getKeyForAutomaticLookahead=function(e,t){var i=this.getLastExplicitRuleShortName();return(0,Fa.getKeyForAutomaticLookahead)(i,e,t)},r.prototype.getLaFuncFromCache=function(e){},r.prototype.getLaFuncFromMap=function(e){return this.lookAheadFuncsCache.get(e)},r.prototype.getLaFuncFromObj=function(e){return this.lookAheadFuncsCache[e]},r.prototype.setLaFuncCache=function(e,t){},r.prototype.setLaFuncCacheUsingMap=function(e,t){this.lookAheadFuncsCache.set(e,t)},r.prototype.setLaFuncUsingObj=function(e,t){this.lookAheadFuncsCache[e]=t},r}();Ey.LooksAhead=Cye});var kq=I(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.addNoneTerminalToCst=To.addTerminalToCst=To.setNodeLocationFull=To.setNodeLocationOnlyOffset=void 0;function mye(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.endOffset=e.endOffset):r.endOffset{"use strict";Object.defineProperty(OA,"__esModule",{value:!0});OA.defineNameProp=OA.functionName=OA.classNameFromInstance=void 0;var wye=Kt();function Bye(r){return Rq(r.constructor)}OA.classNameFromInstance=Bye;var Dq="name";function Rq(r){var e=r.name;return e||"anonymous"}OA.functionName=Rq;function Qye(r,e){var t=Object.getOwnPropertyDescriptor(r,Dq);return(0,wye.isUndefined)(t)||t.configurable?(Object.defineProperty(r,Dq,{enumerable:!1,configurable:!0,writable:!1,value:e}),!0):!1}OA.defineNameProp=Qye});var Oq=I(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.validateRedundantMethods=vi.validateMissingCstMethods=vi.validateVisitor=vi.CstVisitorDefinitionError=vi.createBaseVisitorConstructorWithDefaults=vi.createBaseSemanticVisitorConstructor=vi.defaultVisit=void 0;var fs=Kt(),Ld=ax();function Fq(r,e){for(var t=(0,fs.keys)(r),i=t.length,n=0;n: - `+(""+s.join(` - -`).replace(/\n/g,` - `)))}}};return t.prototype=i,t.prototype.constructor=t,t._RULE_NAMES=e,t}vi.createBaseSemanticVisitorConstructor=bye;function Sye(r,e,t){var i=function(){};(0,Ld.defineNameProp)(i,r+"BaseSemanticsWithDefaults");var n=Object.create(t.prototype);return(0,fs.forEach)(e,function(s){n[s]=Fq}),i.prototype=n,i.prototype.constructor=i,i}vi.createBaseVisitorConstructorWithDefaults=Sye;var Ax;(function(r){r[r.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",r[r.MISSING_METHOD=1]="MISSING_METHOD"})(Ax=vi.CstVisitorDefinitionError||(vi.CstVisitorDefinitionError={}));function Nq(r,e){var t=Tq(r,e),i=Lq(r,e);return t.concat(i)}vi.validateVisitor=Nq;function Tq(r,e){var t=(0,fs.map)(e,function(i){if(!(0,fs.isFunction)(r[i]))return{msg:"Missing visitor method: <"+i+"> on "+(0,Ld.functionName)(r.constructor)+" CST Visitor.",type:Ax.MISSING_METHOD,methodName:i}});return(0,fs.compact)(t)}vi.validateMissingCstMethods=Tq;var vye=["constructor","visit","validateVisitor"];function Lq(r,e){var t=[];for(var i in r)(0,fs.isFunction)(r[i])&&!(0,fs.contains)(vye,i)&&!(0,fs.contains)(e,i)&&t.push({msg:"Redundant visitor method: <"+i+"> on "+(0,Ld.functionName)(r.constructor)+` CST Visitor -There is no Grammar Rule corresponding to this method's name. -`,type:Ax.REDUNDANT_METHOD,methodName:i});return t}vi.validateRedundantMethods=Lq});var Kq=I(Iy=>{"use strict";Object.defineProperty(Iy,"__esModule",{value:!0});Iy.TreeBuilder=void 0;var of=kq(),Vr=Kt(),Mq=Oq(),xye=Yn(),Pye=function(){function r(){}return r.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=(0,Vr.has)(e,"nodeLocationTracking")?e.nodeLocationTracking:xye.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Vr.NOOP,this.cstFinallyStateUpdate=Vr.NOOP,this.cstPostTerminal=Vr.NOOP,this.cstPostNonTerminal=Vr.NOOP,this.cstPostRule=Vr.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=of.setNodeLocationFull,this.setNodeLocationFromNode=of.setNodeLocationFull,this.cstPostRule=Vr.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Vr.NOOP,this.setNodeLocationFromNode=Vr.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=of.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=of.setNodeLocationOnlyOffset,this.cstPostRule=Vr.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Vr.NOOP,this.setNodeLocationFromNode=Vr.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Vr.NOOP,this.setNodeLocationFromNode=Vr.NOOP,this.cstPostRule=Vr.NOOP,this.setInitialNodeLocation=Vr.NOOP;else throw Error('Invalid 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,of.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,of.addNoneTerminalToCst)(i,t,e),this.setNodeLocationFromNode(i.location,e.location)},r.prototype.getBaseCstVisitorConstructor=function(){if((0,Vr.isUndefined)(this.baseCstVisitorConstructor)){var e=(0,Mq.createBaseSemanticVisitorConstructor)(this.className,(0,Vr.keys)(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},r.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,Vr.isUndefined)(this.baseCstVisitorWithDefaultsConstructor)){var e=(0,Mq.createBaseVisitorConstructorWithDefaults)(this.className,(0,Vr.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}();Iy.TreeBuilder=Pye});var Hq=I(yy=>{"use strict";Object.defineProperty(yy,"__esModule",{value:!0});yy.LexerAdapter=void 0;var Uq=Yn(),kye=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 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.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Uq.END_OF_FILE},r.prototype.LA=function(e){var t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Uq.END_OF_FILE:this.tokVector[t]},r.prototype.consumeToken=function(){this.currIdx++},r.prototype.exportLexerState=function(){return this.currIdx},r.prototype.importLexerState=function(e){this.currIdx=e},r.prototype.resetLexerState=function(){this.currIdx=-1},r.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},r.prototype.getLexerPosition=function(){return this.exportLexerState()},r}();yy.LexerAdapter=kye});var Yq=I(wy=>{"use strict";Object.defineProperty(wy,"__esModule",{value:!0});wy.RecognizerApi=void 0;var Gq=Kt(),Dye=sf(),lx=Yn(),Rye=kd(),Fye=ix(),Nye=mn(),Tye=function(){function r(){}return r.prototype.ACTION=function(e){return e.call(this)},r.prototype.consume=function(e,t,i){return this.consumeInternal(t,e,i)},r.prototype.subrule=function(e,t,i){return this.subruleInternal(t,e,i)},r.prototype.option=function(e,t){return this.optionInternal(t,e)},r.prototype.or=function(e,t){return this.orInternal(t,e)},r.prototype.many=function(e,t){return this.manyInternal(e,t)},r.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},r.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},r.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},r.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},r.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},r.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},r.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},r.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},r.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},r.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},r.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},r.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},r.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},r.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},r.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},r.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},r.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},r.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},r.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},r.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},r.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},r.prototype.OPTION=function(e){return this.optionInternal(e,0)},r.prototype.OPTION1=function(e){return this.optionInternal(e,1)},r.prototype.OPTION2=function(e){return this.optionInternal(e,2)},r.prototype.OPTION3=function(e){return this.optionInternal(e,3)},r.prototype.OPTION4=function(e){return this.optionInternal(e,4)},r.prototype.OPTION5=function(e){return this.optionInternal(e,5)},r.prototype.OPTION6=function(e){return this.optionInternal(e,6)},r.prototype.OPTION7=function(e){return this.optionInternal(e,7)},r.prototype.OPTION8=function(e){return this.optionInternal(e,8)},r.prototype.OPTION9=function(e){return this.optionInternal(e,9)},r.prototype.OR=function(e){return this.orInternal(e,0)},r.prototype.OR1=function(e){return this.orInternal(e,1)},r.prototype.OR2=function(e){return this.orInternal(e,2)},r.prototype.OR3=function(e){return this.orInternal(e,3)},r.prototype.OR4=function(e){return this.orInternal(e,4)},r.prototype.OR5=function(e){return this.orInternal(e,5)},r.prototype.OR6=function(e){return this.orInternal(e,6)},r.prototype.OR7=function(e){return this.orInternal(e,7)},r.prototype.OR8=function(e){return this.orInternal(e,8)},r.prototype.OR9=function(e){return this.orInternal(e,9)},r.prototype.MANY=function(e){this.manyInternal(0,e)},r.prototype.MANY1=function(e){this.manyInternal(1,e)},r.prototype.MANY2=function(e){this.manyInternal(2,e)},r.prototype.MANY3=function(e){this.manyInternal(3,e)},r.prototype.MANY4=function(e){this.manyInternal(4,e)},r.prototype.MANY5=function(e){this.manyInternal(5,e)},r.prototype.MANY6=function(e){this.manyInternal(6,e)},r.prototype.MANY7=function(e){this.manyInternal(7,e)},r.prototype.MANY8=function(e){this.manyInternal(8,e)},r.prototype.MANY9=function(e){this.manyInternal(9,e)},r.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},r.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},r.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},r.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},r.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},r.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},r.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},r.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},r.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},r.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},r.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},r.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},r.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},r.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},r.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},r.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},r.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},r.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},r.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},r.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},r.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},r.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},r.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},r.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},r.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},r.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},r.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},r.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},r.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},r.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},r.prototype.RULE=function(e,t,i){if(i===void 0&&(i=lx.DEFAULT_RULE_CONFIG),(0,Gq.contains)(this.definedRulesNames,e)){var n=Rye.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),s={message:n,type:lx.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);var o=this.defineRule(e,t,i);return this[e]=o,o},r.prototype.OVERRIDE_RULE=function(e,t,i){i===void 0&&(i=lx.DEFAULT_RULE_CONFIG);var n=[];n=n.concat((0,Fye.validateRuleIsOverridden)(e,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(n);var s=this.defineRule(e,t,i);return this[e]=s,s},r.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var i=this.saveRecogState();try{return e.apply(this,t),!0}catch(n){if((0,Dye.isRecognitionException)(n))return!1;throw n}finally{this.reloadRecogState(i),this.isBackTrackingStack.pop()}}},r.prototype.getGAstProductions=function(){return this.gastProductionsCache},r.prototype.getSerializedGastProductions=function(){return(0,Nye.serializeGrammar)((0,Gq.values)(this.gastProductionsCache))},r}();wy.RecognizerApi=Tye});var Wq=I(Qy=>{"use strict";Object.defineProperty(Qy,"__esModule",{value:!0});Qy.RecognizerEngine=void 0;var xr=Kt(),jn=my(),By=sf(),jq=Fd(),af=Rd(),qq=Yn(),Lye=ox(),Jq=NA(),Od=$g(),Oye=ax(),Mye=function(){function r(){}return r.prototype.initRecognizerEngine=function(e,t){if(this.className=(0,Oye.classNameFromInstance)(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Od.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,xr.has)(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. - See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0 - For Further details.`);if((0,xr.isArray)(e)){if((0,xr.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,xr.isArray)(e))this.tokensMap=(0,xr.reduce)(e,function(o,a){return o[a.name]=a,o},{});else if((0,xr.has)(e,"modes")&&(0,xr.every)((0,xr.flatten)((0,xr.values)(e.modes)),Od.isTokenType)){var i=(0,xr.flatten)((0,xr.values)(e.modes)),n=(0,xr.uniq)(i);this.tokensMap=(0,xr.reduce)(n,function(o,a){return o[a.name]=a,o},{})}else if((0,xr.isObject)(e))this.tokensMap=(0,xr.cloneObj)(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Jq.EOF;var s=(0,xr.every)((0,xr.values)(e),function(o){return(0,xr.isEmpty)(o.categoryMatches)});this.tokenMatcher=s?Od.tokenStructuredMatcherNoCategories:Od.tokenStructuredMatcher,(0,Od.augmentTokenTypes)((0,xr.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,xr.has)(i,"resyncEnabled")?i.resyncEnabled:qq.DEFAULT_RULE_CONFIG.resyncEnabled,s=(0,xr.has)(i,"recoveryValueFunc")?i.recoveryValueFunc:qq.DEFAULT_RULE_CONFIG.recoveryValueFunc,o=this.ruleShortNameIdx<t},r.prototype.orInternal=function(e,t){var i=this.getKeyForAutomaticLookahead(jn.OR_IDX,t),n=(0,xr.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.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new By.NotAllInputParsedException(t,e))}},r.prototype.subruleInternal=function(e,t,i){var n;try{var s=i!==void 0?i.ARGS:void 0;return n=e.call(this,t,s),this.cstPostNonTerminal(n,i!==void 0&&i.LABEL!==void 0?i.LABEL:e.ruleName),n}catch(o){this.subruleInternalError(o,i,e.ruleName)}},r.prototype.subruleInternalError=function(e,t,i){throw(0,By.isRecognitionException)(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:i),delete e.partialCstResult),e},r.prototype.consumeInternal=function(e,t,i){var n;try{var s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),n=s):this.consumeInternalError(e,s,i)}catch(o){n=this.consumeInternalRecovery(e,t,o)}return this.cstPostTerminal(i!==void 0&&i.LABEL!==void 0?i.LABEL:e.name,n),n},r.prototype.consumeInternalError=function(e,t,i){var n,s=this.LA(0);throw i!==void 0&&i.ERR_MSG?n=i.ERR_MSG:n=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new By.MismatchedTokenException(n,t,s))},r.prototype.consumeInternalRecovery=function(e,t,i){if(this.recoveryEnabled&&i.name==="MismatchedTokenException"&&!this.isBackTracking()){var n=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,n)}catch(s){throw s.name===Lye.IN_RULE_RECOVERY_EXCEPTION?i:s}}else throw i},r.prototype.saveRecogState=function(){var e=this.errors,t=(0,xr.cloneArr)(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}},r.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},r.prototype.ruleInvocationStateUpdate=function(e,t,i){this.RULE_OCCURRENCE_STACK.push(i),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t,e)},r.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},r.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},r.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},r.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),Jq.EOF)},r.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},r}();Qy.RecognizerEngine=Mye});var Vq=I(by=>{"use strict";Object.defineProperty(by,"__esModule",{value:!0});by.ErrorHandler=void 0;var cx=sf(),ux=Kt(),zq=Fd(),Kye=Yn(),Uye=function(){function r(){}return r.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=(0,ux.has)(e,"errorMessageProvider")?e.errorMessageProvider:Kye.DEFAULT_PARSER_CONFIG.errorMessageProvider},r.prototype.SAVE_ERROR=function(e){if((0,cx.isRecognitionException)(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,ux.cloneArr)(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(r.prototype,"errors",{get:function(){return(0,ux.cloneArr)(this._errors)},set:function(e){this._errors=e},enumerable:!1,configurable:!0}),r.prototype.raiseEarlyExitException=function(e,t,i){for(var n=this.getCurrRuleFullName(),s=this.getGAstProductions()[n],o=(0,zq.getLookaheadPathsForOptionalProd)(e,s,t,this.maxLookahead),a=o[0],l=[],c=1;c<=this.maxLookahead;c++)l.push(this.LA(c));var u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:l,previous:this.LA(0),customUserDescription:i,ruleName:n});throw this.SAVE_ERROR(new cx.EarlyExitException(u,this.LA(1),this.LA(0)))},r.prototype.raiseNoAltException=function(e,t){for(var i=this.getCurrRuleFullName(),n=this.getGAstProductions()[i],s=(0,zq.getLookaheadPathsForOr)(e,n,this.maxLookahead),o=[],a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));var l=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:l,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new cx.NoViableAltException(c,this.LA(1),l))},r}();by.ErrorHandler=Uye});var _q=I(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:!0});Sy.ContentAssist=void 0;var Xq=Rd(),Zq=Kt(),Hye=function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(e,t){var i=this.gastProductionsCache[e];if((0,Zq.isUndefined)(i))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return(0,Xq.nextPossibleTokensAfter)([i],t,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(e){var t=(0,Zq.first)(e.ruleStack),i=this.getGAstProductions(),n=i[t],s=new Xq.NextAfterTokenWalker(n,e).startWalking();return s},r}();Sy.ContentAssist=Hye});var oJ=I(Py=>{"use strict";Object.defineProperty(Py,"__esModule",{value:!0});Py.GastRecorder=void 0;var yn=Kt(),Lo=mn(),Gye=bd(),rJ=$g(),iJ=NA(),Yye=Yn(),jye=my(),xy={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(xy);var $q=!0,eJ=Math.pow(2,jye.BITS_FOR_OCCURRENCE_IDX)-1,nJ=(0,iJ.createToken)({name:"RECORDING_PHASE_TOKEN",pattern:Gye.Lexer.NA});(0,rJ.augmentTokenTypes)([nJ]);var sJ=(0,iJ.createTokenInstance)(nJ,`This IToken indicates the Parser is in Recording Phase - See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(sJ);var qye={name:`This CSTNode indicates the Parser is in Recording Phase - See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Jye=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 Yye.END_OF_FILE},r.prototype.topLevelRuleRecord=function(e,t){try{var i=new Lo.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 Md.call(this,Lo.Option,e,t)},r.prototype.atLeastOneInternalRecord=function(e,t){Md.call(this,Lo.RepetitionMandatory,t,e)},r.prototype.atLeastOneSepFirstInternalRecord=function(e,t){Md.call(this,Lo.RepetitionMandatoryWithSeparator,t,e,$q)},r.prototype.manyInternalRecord=function(e,t){Md.call(this,Lo.Repetition,t,e)},r.prototype.manySepFirstInternalRecord=function(e,t){Md.call(this,Lo.RepetitionWithSeparator,t,e,$q)},r.prototype.orInternalRecord=function(e,t){return Wye.call(this,e,t)},r.prototype.subruleInternalRecord=function(e,t,i){if(vy(t),!e||(0,yn.has)(e,"ruleName")===!1){var n=new Error(" 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,yn.peek)(this.recordingProdStack),o=e.ruleName,a=new Lo.NonTerminal({idx:t,nonTerminalName:o,label:i==null?void 0:i.LABEL,referencedRule:void 0});return s.definition.push(a),this.outputCst?qye:xy},r.prototype.consumeInternalRecord=function(e,t,i){if(vy(t),!(0,rJ.hasShortKeyProperty)(e)){var n=new Error(" 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,yn.peek)(this.recordingProdStack),o=new Lo.Terminal({idx:t,terminalType:e,label:i==null?void 0:i.LABEL});return s.definition.push(o),sJ},r}();Py.GastRecorder=Jye;function Md(r,e,t,i){i===void 0&&(i=!1),vy(t);var n=(0,yn.peek)(this.recordingProdStack),s=(0,yn.isFunction)(e)?e:e.DEF,o=new r({definition:[],idx:t});return i&&(o.separator=e.SEP),(0,yn.has)(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),n.definition.push(o),this.recordingProdStack.pop(),xy}function Wye(r,e){var t=this;vy(e);var i=(0,yn.peek)(this.recordingProdStack),n=(0,yn.isArray)(r)===!1,s=n===!1?r:r.DEF,o=new Lo.Alternation({definition:[],idx:e,ignoreAmbiguities:n&&r.IGNORE_AMBIGUITIES===!0});(0,yn.has)(r,"MAX_LOOKAHEAD")&&(o.maxLookahead=r.MAX_LOOKAHEAD);var a=(0,yn.some)(s,function(l){return(0,yn.isFunction)(l.GATE)});return o.hasPredicates=a,i.definition.push(o),(0,yn.forEach)(s,function(l){var c=new Lo.Alternative({definition:[]});o.definition.push(c),(0,yn.has)(l,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=l.IGNORE_AMBIGUITIES:(0,yn.has)(l,"GATE")&&(c.ignoreAmbiguities=!0),t.recordingProdStack.push(c),l.ALT.call(t),t.recordingProdStack.pop()}),xy}function tJ(r){return r===0?"":""+r}function vy(r){if(r<0||r>eJ){var e=new Error("Invalid DSL Method idx value: <"+r+`> - `+("Idx value must be a none negative value smaller than "+(eJ+1)));throw e.KNOWN_RECORDER_ERROR=!0,e}}});var AJ=I(ky=>{"use strict";Object.defineProperty(ky,"__esModule",{value:!0});ky.PerformanceTracer=void 0;var aJ=Kt(),zye=Yn(),Vye=function(){function r(){}return r.prototype.initPerformanceTracer=function(e){if((0,aJ.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=zye.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 <"+e+">");var n=(0,aJ.timer)(t),s=n.time,o=n.value,a=s>10?console.warn:console.log;return this.traceInitIndent time: "+s+"ms"),this.traceInitIndent--,o}else return t()},r}();ky.PerformanceTracer=Vye});var lJ=I(Dy=>{"use strict";Object.defineProperty(Dy,"__esModule",{value:!0});Dy.applyMixins=void 0;function Xye(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]}})})}Dy.applyMixins=Xye});var Yn=I(hr=>{"use strict";var gJ=hr&&hr.__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(hr,"__esModule",{value:!0});hr.EmbeddedActionsParser=hr.CstParser=hr.Parser=hr.EMPTY_ALT=hr.ParserDefinitionErrorType=hr.DEFAULT_RULE_CONFIG=hr.DEFAULT_PARSER_CONFIG=hr.END_OF_FILE=void 0;var $i=Kt(),Zye=Vj(),cJ=NA(),fJ=kd(),uJ=yq(),_ye=ox(),$ye=Pq(),ewe=Kq(),twe=Hq(),rwe=Yq(),iwe=Wq(),nwe=Vq(),swe=_q(),owe=oJ(),awe=AJ(),Awe=lJ();hr.END_OF_FILE=(0,cJ.createTokenInstance)(cJ.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(hr.END_OF_FILE);hr.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:fJ.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1});hr.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});var lwe;(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"})(lwe=hr.ParserDefinitionErrorType||(hr.ParserDefinitionErrorType={}));function cwe(r){return r===void 0&&(r=void 0),function(){return r}}hr.EMPTY_ALT=cwe;var Ry=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 IParserConfig property has been deprecated. - Please use the 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:hr.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,uJ.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,uJ.validateGrammar)({rules:(0,$i.values)(e.gastProductionsCache),maxLookahead:e.maxLookahead,tokenTypes:(0,$i.values)(e.tokensMap),errMsgProvider:fJ.defaultGrammarValidatorErrorProvider,grammarName:i});e.definitionErrors=e.definitionErrors.concat(s)}}),(0,$i.isEmpty)(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT("computeAllProdsFollows",function(){var s=(0,Zye.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}();hr.Parser=Ry;(0,Awe.applyMixins)(Ry,[_ye.Recoverable,$ye.LooksAhead,ewe.TreeBuilder,twe.LexerAdapter,iwe.RecognizerEngine,rwe.RecognizerApi,nwe.ErrorHandler,swe.ContentAssist,owe.GastRecorder,awe.PerformanceTracer]);var uwe=function(r){gJ(e,r);function e(t,i){i===void 0&&(i=hr.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}(Ry);hr.CstParser=uwe;var gwe=function(r){gJ(e,r);function e(t,i){i===void 0&&(i=hr.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}(Ry);hr.EmbeddedActionsParser=gwe});var pJ=I(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:!0});Fy.createSyntaxDiagramsCode=void 0;var hJ=Dv();function fwe(r,e){var t=e===void 0?{}:e,i=t.resourceBase,n=i===void 0?"https://unpkg.com/chevrotain@"+hJ.VERSION+"/diagrams/":i,s=t.css,o=s===void 0?"https://unpkg.com/chevrotain@"+hJ.VERSION+"/diagrams/diagrams.css":s,a=` - - - - - -`,l=` - -`,c=` -' + 'href="/favicon.png" />\n' + + ' ' ) writeFile(rwPaths.web.html, indexHtml, { @@ -179,19 +276,31 @@ export const handler = async ({ force, verbose }) => { }, }, { - title: 'Overwrite entry.client.tsx...', + title: 'Overwriting index.css...', task: async () => { - const entryClientTemplate = fs.readFileSync( - path.resolve( - __dirname, - 'templates', - 'rsc', - 'entry.client.tsx.template' - ), + const template = fs.readFileSync( + path.resolve(__dirname, 'templates', 'rsc', 'index.css.template'), + 'utf-8' + ) + const filePath = path.join(rwPaths.web.src, 'index.css') + + writeFile(filePath, template, { + overwriteExisting: true, + }) + }, + }, + { + title: 'Overwrite App.tsx...', + task: async () => { + const appTemplate = fs.readFileSync( + path.resolve(__dirname, 'templates', 'rsc', 'App.tsx.template'), 'utf-8' ) - writeFile(rwPaths.web.entryClient, entryClientTemplate, { + const appPath = + rwPaths.web.app ?? path.join(rwPaths.web.src, 'App.tsx') + + writeFile(appPath, appTemplate, { overwriteExisting: true, }) }, @@ -217,44 +326,19 @@ export const handler = async ({ force, verbose }) => { ) }, }, + // TODO (RSC): Remove this once we have a better way to handle routes. + // This is a total hack right now { - title: 'Patch vite', + title: 'Overwriting routes...', task: async () => { - const vitePatchTemplate = fs.readFileSync( - path.resolve( - __dirname, - 'templates', - 'rsc', - 'vite-npm-4.4.9-e845c1bbf8.patch.template' - ), + const routesTemplate = fs.readFileSync( + path.resolve(__dirname, 'templates', 'rsc', 'Routes.tsx.template'), 'utf-8' ) - const yarnPatchDir = path.join(rwPaths.base, '.yarn', 'patches') - const vitePatchPath = path.join( - yarnPatchDir, - 'vite-npm-4.4.9-e845c1bbf8.patch' - ) - writeFile(vitePatchPath, vitePatchTemplate, { - overwriteExisting: force, - }) - - const packageJsonPath = path.join(rwPaths.base, 'package.json') - const packageJson = JSON.parse( - fs.readFileSync(packageJsonPath, 'utf-8') - ) - packageJson.resolutions = packageJson.resolutions || {} - packageJson.resolutions['vite@4.4.9'] = - 'patch:vite@npm%3A4.4.9#./.yarn/patches/vite-npm-4.4.9-e845c1bbf8.patch' - writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), { + writeFile(rwPaths.web.routes, routesTemplate, { overwriteExisting: true, }) - - await execa('yarn install', { - stdio: 'ignore', - shell: true, - cwd: rwPaths.base, - }) }, }, { diff --git a/packages/cli/src/commands/experimental/setupSentryHandler.js b/packages/cli/src/commands/experimental/setupSentryHandler.js index 14a320ba6b0b..a249a75a4188 100644 --- a/packages/cli/src/commands/experimental/setupSentryHandler.js +++ b/packages/cli/src/commands/experimental/setupSentryHandler.js @@ -1,6 +1,6 @@ -import fs from 'fs' import path from 'path' +import fs from 'fs-extra' import { Listr } from 'listr2' import { @@ -26,15 +26,11 @@ export const handler = async ({ force }) => { const notes = [] const tasks = new Listr([ - addApiPackages([ - '@envelop/sentry@5', - '@sentry/node@7', - '@sentry/tracing@7', - ]), - addWebPackages(['@sentry/react@7', '@sentry/tracing@7']), + addApiPackages(['@envelop/sentry@5', '@sentry/node@7']), + addWebPackages(['@sentry/react@7', '@sentry/browser@7']), addEnvVarTask( 'SENTRY_DSN', - 'https://XXXXXXX@XXXXXXX.ingest.sentry.io/XXXXXXX', + '', 'https://docs.sentry.io/product/sentry-basics/dsn-explainer/' ), { @@ -182,7 +178,7 @@ export const handler = async ({ force }) => { ) } else { notes.push( - "Check out RedwoodJS' docs for more: https://redwoodjs.com/docs/cli-commands#setup-sentry" + "Check out RedwoodJS forums' for more: https://community.redwoodjs.com/t/sentry-error-and-performance-monitoring-experimental/4880" ) } }, diff --git a/packages/cli/src/commands/experimental/setupServerFileHandler.js b/packages/cli/src/commands/experimental/setupServerFileHandler.js index 33a406efed67..b6140dae8971 100644 --- a/packages/cli/src/commands/experimental/setupServerFileHandler.js +++ b/packages/cli/src/commands/experimental/setupServerFileHandler.js @@ -1,6 +1,6 @@ -import fs from 'fs' import path from 'path' +import fs from 'fs-extra' import { Listr } from 'listr2' import { addApiPackages } from '@redwoodjs/cli-helpers' diff --git a/packages/cli/src/commands/experimental/setupStreamingSsrHandler.js b/packages/cli/src/commands/experimental/setupStreamingSsrHandler.js index 9c431b5a41f7..28f8e658f982 100644 --- a/packages/cli/src/commands/experimental/setupStreamingSsrHandler.js +++ b/packages/cli/src/commands/experimental/setupStreamingSsrHandler.js @@ -1,6 +1,6 @@ -import fs from 'fs' import path from 'path' +import fs from 'fs-extra' import { Listr } from 'listr2' import { addWebPackages } from '@redwoodjs/cli-helpers' diff --git a/packages/cli/src/commands/experimental/studioHandler.js b/packages/cli/src/commands/experimental/studioHandler.js index e1a7cdaf0e4f..4ca9d7000d2b 100644 --- a/packages/cli/src/commands/experimental/studioHandler.js +++ b/packages/cli/src/commands/experimental/studioHandler.js @@ -1,4 +1,4 @@ -import fs from 'fs' +import fs from 'fs-extra' import { getConfigPath } from '@redwoodjs/project-config' diff --git a/packages/cli/src/commands/experimental/templates/docker/Dockerfile b/packages/cli/src/commands/experimental/templates/docker/Dockerfile index 14ddba3caf4f..0fe3539046aa 100644 --- a/packages/cli/src/commands/experimental/templates/docker/Dockerfile +++ b/packages/cli/src/commands/experimental/templates/docker/Dockerfile @@ -1,7 +1,12 @@ # base # ------------------------------------------------ -FROM node:18-bookworm-slim as base +FROM node:20-bookworm-slim as base +RUN corepack enable + +# We tried to make the Dockerfile as lean as possible. In some cases, that means we excluded a dependency your project needs. +# By far the most common is Python. If you're running into build errors because `python3` isn't available, +# uncomment the line below here and in other stages as necessary: RUN apt-get update && apt-get install -y \ openssl \ # python3 make gcc \ @@ -10,14 +15,14 @@ RUN apt-get update && apt-get install -y \ USER node WORKDIR /home/node/app -COPY --chown=node:node .yarn/plugins .yarn/plugins -COPY --chown=node:node .yarn/releases .yarn/releases COPY --chown=node:node .yarnrc.yml . COPY --chown=node:node package.json . COPY --chown=node:node api/package.json api/ COPY --chown=node:node web/package.json web/ COPY --chown=node:node yarn.lock . +RUN mkdir -p /home/node/.yarn/berry/index + RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,uid=1000 \ --mount=type=cache,target=/home/node/.cache,uid=1000 \ CI=1 yarn install @@ -54,7 +59,9 @@ RUN yarn redwood build web --no-prerender # serve api # ------------------------------------------------ -FROM node:18-bookworm-slim as api_serve +FROM node:20-bookworm-slim as api_serve + +RUN corepack enable RUN apt-get update && apt-get install -y \ openssl \ @@ -64,12 +71,13 @@ RUN apt-get update && apt-get install -y \ USER node WORKDIR /home/node/app -COPY --chown=node:node .yarn/plugins .yarn/plugins -COPY --chown=node:node .yarn/releases .yarn/releases COPY --chown=node:node .yarnrc.yml . -COPY --chown=node:node api/package.json . +COPY --chown=node:node package.json . +COPY --chown=node:node api/package.json api/ COPY --chown=node:node yarn.lock . +RUN mkdir -p /home/node/.yarn/berry/index + RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,uid=1000 \ --mount=type=cache,target=/home/node/.cache,uid=1000 \ CI=1 yarn workspaces focus api --production @@ -88,17 +96,20 @@ CMD [ "node_modules/.bin/rw-server", "api", "--load-env-files" ] # serve web # ------------------------------------------------ -FROM node:18-bookworm-slim as web_serve +FROM node:20-bookworm-slim as web_serve + +RUN corepack enable USER node WORKDIR /home/node/app -COPY --chown=node:node .yarn/plugins .yarn/plugins -COPY --chown=node:node .yarn/releases .yarn/releases COPY --chown=node:node .yarnrc.yml . -COPY --chown=node:node web/package.json . +COPY --chown=node:node package.json . +COPY --chown=node:node web/package.json web/ COPY --chown=node:node yarn.lock . +RUN mkdir -p /home/node/.yarn/berry/index + RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,uid=1000 \ --mount=type=cache,target=/home/node/.cache,uid=1000 \ CI=1 yarn workspaces focus web --production diff --git a/packages/cli/src/commands/experimental/templates/docker/docker-compose.dev.yml b/packages/cli/src/commands/experimental/templates/docker/docker-compose.dev.yml index 0f72aff91d1c..d5ae4c4f07cd 100644 --- a/packages/cli/src/commands/experimental/templates/docker/docker-compose.dev.yml +++ b/packages/cli/src/commands/experimental/templates/docker/docker-compose.dev.yml @@ -22,7 +22,7 @@ services: - NODE_ENV=development db: - image: postgres:15-bookworm + image: postgres:16-bookworm environment: POSTGRES_USER: redwood POSTGRES_PASSWORD: redwood diff --git a/packages/cli/src/commands/experimental/templates/docker/docker-compose.prod.yml b/packages/cli/src/commands/experimental/templates/docker/docker-compose.prod.yml index 81df1981081b..a921f7603051 100644 --- a/packages/cli/src/commands/experimental/templates/docker/docker-compose.prod.yml +++ b/packages/cli/src/commands/experimental/templates/docker/docker-compose.prod.yml @@ -28,7 +28,7 @@ services: - API_HOST=http://api:8911 db: - image: postgres:15-bookworm + image: postgres:16-bookworm environment: POSTGRES_USER: redwood POSTGRES_PASSWORD: redwood diff --git a/packages/cli/src/commands/experimental/templates/opentelemetry.ts.template b/packages/cli/src/commands/experimental/templates/opentelemetry.ts.template index 6d4f5592f7db..a73897fac5cc 100644 --- a/packages/cli/src/commands/experimental/templates/opentelemetry.ts.template +++ b/packages/cli/src/commands/experimental/templates/opentelemetry.ts.template @@ -1,19 +1,17 @@ -const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api') -const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http') -const { registerInstrumentations } = require('@opentelemetry/instrumentation') -const { - FastifyInstrumentation, -} = require('@opentelemetry/instrumentation-fastify') -const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http') -const { Resource } = require('@opentelemetry/resources') -const { +import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api' +import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http' +import { registerInstrumentations } from '@opentelemetry/instrumentation' +import { FastifyInstrumentation } from '@opentelemetry/instrumentation-fastify' +import { HttpInstrumentation } from '@opentelemetry/instrumentation-http' +import { Resource } from '@opentelemetry/resources' +import { NodeTracerProvider, SimpleSpanProcessor, -} = require('@opentelemetry/sdk-trace-node') -const { - SemanticResourceAttributes, -} = require('@opentelemetry/semantic-conventions') -const { PrismaInstrumentation } = require ('@prisma/instrumentation') +} from '@opentelemetry/sdk-trace-node' +import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' +import { PrismaInstrumentation } from '@prisma/instrumentation' + +import { getConfig } from '@redwoodjs/project-config' // You may wish to set this to DiagLogLevel.DEBUG when you need to debug opentelemetry itself diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO) @@ -25,10 +23,13 @@ const resource = Resource.default().merge( }) ) +const studioPort = getConfig().experimental.studio.basePort const exporter = new OTLPTraceExporter({ // Update this URL to point to where your OTLP compatible collector is listening - // The redwood development studio (`yarn rw exp studio`) can collect your telemetry at `http://127.0.0.1:4318/v1/traces` - url: 'http://127.0.0.1:4318/v1/traces', + // The redwood development studio (`yarn rw exp studio`) can collect your + // telemetry at `http://127.0.0.1:/v1/traces` (default PORT is 4318) + url: `http://127.0.0.1:${studioPort}/v1/traces`, + concurrencyLimit: 64, }) // You may wish to switch to BatchSpanProcessor in production as it is the recommended choice for performance reasons @@ -47,7 +48,7 @@ registerInstrumentations({ new FastifyInstrumentation(), new PrismaInstrumentation({ middleware: true, - }) + }), ], }) diff --git a/packages/cli/src/commands/experimental/templates/rsc/AboutCounter.tsx.template b/packages/cli/src/commands/experimental/templates/rsc/AboutCounter.tsx.template new file mode 100644 index 000000000000..c86915e87f8b --- /dev/null +++ b/packages/cli/src/commands/experimental/templates/rsc/AboutCounter.tsx.template @@ -0,0 +1,20 @@ +'use client' + +import React from 'react' + +// @ts-expect-error no types +import styles from './Counter.module.css' +import './Counter.css' + +export const AboutCounter = () => { + const [count, setCount] = React.useState(0) + + return ( +
+

Count: {count}

+ +

This is a client component.

+

RSC on client: {globalThis.RWJS_EXP_RSC ? 'enabled' : 'disabled'}

+
+ ) +} diff --git a/packages/cli/src/commands/experimental/templates/rsc/AboutPage.css.template b/packages/cli/src/commands/experimental/templates/rsc/AboutPage.css.template new file mode 100644 index 000000000000..995b3bbde1e0 --- /dev/null +++ b/packages/cli/src/commands/experimental/templates/rsc/AboutPage.css.template @@ -0,0 +1,2 @@ +.about-page { +} diff --git a/packages/cli/src/commands/experimental/templates/rsc/AboutPage.tsx.template b/packages/cli/src/commands/experimental/templates/rsc/AboutPage.tsx.template new file mode 100644 index 000000000000..2706e12e63db --- /dev/null +++ b/packages/cli/src/commands/experimental/templates/rsc/AboutPage.tsx.template @@ -0,0 +1,27 @@ +import { Assets } from '@redwoodjs/vite/assets' +import { ProdRwRscServerGlobal } from '@redwoodjs/vite/rwRscGlobal' + +import { AboutCounter } from '../../components/Counter/AboutCounter' + +import './AboutPage.css' + +// TODO (RSC) Something like this will probably be needed +// const RwRscGlobal = import.meta.env.PROD ? ProdRwRscServerGlobal : DevRwRscServerGlobal; + +globalThis.rwRscGlobal = new ProdRwRscServerGlobal() + +const AboutPage = () => { + return ( +
+ {/* TODO (RSC) should be part of the router later */} + +
+

About Redwood

+ +

RSC on server: {globalThis.RWJS_EXP_RSC ? 'enabled' : 'disabled'}

+
+
+ ) +} + +export default AboutPage diff --git a/packages/cli/src/commands/experimental/templates/rsc/App.css.template b/packages/cli/src/commands/experimental/templates/rsc/App.css.template deleted file mode 100644 index b2d3dc07c3d1..000000000000 --- a/packages/cli/src/commands/experimental/templates/rsc/App.css.template +++ /dev/null @@ -1,3 +0,0 @@ -h1 { - text-decoration: underline; -} diff --git a/packages/cli/src/commands/experimental/templates/rsc/App.tsx.template b/packages/cli/src/commands/experimental/templates/rsc/App.tsx.template index eeef58d34680..27cb83121ff7 100644 --- a/packages/cli/src/commands/experimental/templates/rsc/App.tsx.template +++ b/packages/cli/src/commands/experimental/templates/rsc/App.tsx.template @@ -1,29 +1,19 @@ -import { Assets } from '@redwoodjs/vite/assets' -import { ProdRwRscServerGlobal } from '@redwoodjs/vite/rwRscGlobal' +import { FatalErrorBoundary, RedwoodProvider } from '@redwoodjs/web' +import { RedwoodApolloProvider } from '@redwoodjs/web/apollo' -// @ts-expect-error no types -import styles from './App.module.css' -import { Counter } from './Counter' +import FatalErrorPage from './pages/FatalErrorPage/FatalErrorPage' +import Routes from './Routes' -import './App.css' +import './index.css' -// TODO (RSC) Something like this will probably be needed -// const RwRscGlobal = import.meta.env.PROD ? ProdRwRscServerGlobal : DevRwRscServerGlobal; - -globalThis.rwRscGlobal = new ProdRwRscServerGlobal() - -const App = ({ name = 'Anonymous' }) => { - return ( - <> - {/* TODO (RSC) should be part of the router later */} - -
-

Hello {name}!!

-

This is a server component.

- -
- - ) -} +const App = () => ( + + + + + + + +) export default App diff --git a/packages/cli/src/commands/experimental/templates/rsc/HomePage.css.template b/packages/cli/src/commands/experimental/templates/rsc/HomePage.css.template new file mode 100644 index 000000000000..9be6b50cd8f7 --- /dev/null +++ b/packages/cli/src/commands/experimental/templates/rsc/HomePage.css.template @@ -0,0 +1,2 @@ +.home-page { +} diff --git a/packages/cli/src/commands/experimental/templates/rsc/App.module.css.template b/packages/cli/src/commands/experimental/templates/rsc/HomePage.module.css.template similarity index 100% rename from packages/cli/src/commands/experimental/templates/rsc/App.module.css.template rename to packages/cli/src/commands/experimental/templates/rsc/HomePage.module.css.template diff --git a/packages/cli/src/commands/experimental/templates/rsc/HomePage.tsx.template b/packages/cli/src/commands/experimental/templates/rsc/HomePage.tsx.template new file mode 100644 index 000000000000..ad75dbcfa24e --- /dev/null +++ b/packages/cli/src/commands/experimental/templates/rsc/HomePage.tsx.template @@ -0,0 +1,29 @@ +import { Assets } from '@redwoodjs/vite/assets' +import { ProdRwRscServerGlobal } from '@redwoodjs/vite/rwRscGlobal' + +import { Counter } from '../../components/Counter/Counter' +// @ts-expect-error no types +import styles from './HomePage.module.css' + +import './HomePage.css' + +// TODO (RSC) Something like this will probably be needed +// const RwRscGlobal = import.meta.env.PROD ? ProdRwRscServerGlobal : DevRwRscServerGlobal; + +globalThis.rwRscGlobal = new ProdRwRscServerGlobal() + +const HomePage = ({ name = 'Anonymous' }) => { + return ( +
+ {/* TODO (RSC) should be part of the router later */} + +
+

Hello {name}!!

+

This is a server component.

+ +
+
+ ) +} + +export default HomePage diff --git a/packages/cli/src/commands/experimental/templates/rsc/NavigationLayout.css.template b/packages/cli/src/commands/experimental/templates/rsc/NavigationLayout.css.template new file mode 100644 index 000000000000..a3e7be665c31 --- /dev/null +++ b/packages/cli/src/commands/experimental/templates/rsc/NavigationLayout.css.template @@ -0,0 +1,32 @@ +.navigation-layout { + & nav { + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px; + background-color: color-mix(in srgb, yellow 50%, transparent); + border-bottom: 2px dashed color-mix(in srgb, yellow 90%, black); + } + + & ul { + list-style: none; + display: flex; + margin: 0; + padding: 0; + } + + & li { + margin-right: 10px; + } + + & a { + text-decoration: none; + color: #333; + padding: 5px; + border-bottom: 2px solid transparent; + } + + & a:hover { + border-bottom: 2px solid #333; + } +} diff --git a/packages/cli/src/commands/experimental/templates/rsc/NavigationLayout.tsx.template b/packages/cli/src/commands/experimental/templates/rsc/NavigationLayout.tsx.template new file mode 100644 index 000000000000..4f13e197309a --- /dev/null +++ b/packages/cli/src/commands/experimental/templates/rsc/NavigationLayout.tsx.template @@ -0,0 +1,27 @@ +import { Link, routes } from '@redwoodjs/router' + +import './NavigationLayout.css' + +type NavigationLayoutProps = { + children?: React.ReactNode +} + +const NavigationLayout = ({ children }: NavigationLayoutProps) => { + return ( +
+ +
{children}
+
+ ) +} + +export default NavigationLayout diff --git a/packages/cli/src/commands/experimental/templates/rsc/Routes.tsx.template b/packages/cli/src/commands/experimental/templates/rsc/Routes.tsx.template new file mode 100644 index 000000000000..89a1df33eef0 --- /dev/null +++ b/packages/cli/src/commands/experimental/templates/rsc/Routes.tsx.template @@ -0,0 +1,31 @@ +// In this file, all Page components from 'src/pages` are auto-imported. Nested +// directories are supported, and should be uppercase. Each subdirectory will be +// prepended onto the component name. +// +// Examples: +// +// 'src/pages/HomePage/HomePage.js' -> HomePage +// 'src/pages/Admin/BooksPage/BooksPage.js' -> AdminBooksPage + +import { Router, Route, Set } from '@redwoodjs/router' +import { serve } from '@redwoodjs/vite/client' + +import NavigationLayout from './layouts/NavigationLayout/NavigationLayout' +import NotFoundPage from './pages/NotFoundPage/NotFoundPage' + +const AboutPage = serve('AboutPage') +const HomePage = serve('HomePage') + +const Routes = () => { + return ( + + + + + + + + ) +} + +export default Routes diff --git a/packages/cli/src/commands/experimental/templates/rsc/entries.ts.template b/packages/cli/src/commands/experimental/templates/rsc/entries.ts.template index f6fc2a9a6d58..6259057e245b 100644 --- a/packages/cli/src/commands/experimental/templates/rsc/entries.ts.template +++ b/packages/cli/src/commands/experimental/templates/rsc/entries.ts.template @@ -4,8 +4,10 @@ export default defineEntries( // getEntry async (id) => { switch (id) { - case 'App': - return import('./App') + case 'AboutPage': + return import('./pages/AboutPage/AboutPage') + case 'HomePage': + return import('./pages/HomePage/HomePage') default: return null } diff --git a/packages/cli/src/commands/experimental/templates/rsc/entry.client.tsx.template b/packages/cli/src/commands/experimental/templates/rsc/entry.client.tsx.template deleted file mode 100644 index b6f912acb0cd..000000000000 --- a/packages/cli/src/commands/experimental/templates/rsc/entry.client.tsx.template +++ /dev/null @@ -1,10 +0,0 @@ -import { createRoot } from 'react-dom/client' - -import { serve } from '@redwoodjs/vite/client' - -const redwoodAppElement = document.getElementById('redwood-app') - -const App = serve('App') - -const root = createRoot(redwoodAppElement) -root.render() diff --git a/packages/cli/src/commands/experimental/templates/rsc/index.css.template b/packages/cli/src/commands/experimental/templates/rsc/index.css.template new file mode 100644 index 000000000000..57c14ee231a9 --- /dev/null +++ b/packages/cli/src/commands/experimental/templates/rsc/index.css.template @@ -0,0 +1,4 @@ +html, body { + margin: 0; + padding: 0; +} diff --git a/packages/cli/src/commands/experimental/templates/rsc/vite-npm-4.4.9-e845c1bbf8.patch.template b/packages/cli/src/commands/experimental/templates/rsc/vite-npm-4.4.9-e845c1bbf8.patch.template deleted file mode 100644 index eb67d7906284..000000000000 --- a/packages/cli/src/commands/experimental/templates/rsc/vite-npm-4.4.9-e845c1bbf8.patch.template +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/dist/node/chunks/dep-df561101.js b/dist/node/chunks/dep-df561101.js -index 1bc8674177fe73120171b22436e6104713c5d764..f0fee7b385868cb01c6d47b80d7f64a7368c0412 100644 ---- a/dist/node/chunks/dep-df561101.js -+++ b/dist/node/chunks/dep-df561101.js -@@ -55890,12 +55890,12 @@ async function instantiateModule(url, server, context = { global }, urlStack = [ - }; - urlStack = urlStack.concat(url); - const isCircular = (url) => urlStack.includes(url); -- const { isProduction, resolve: { dedupe, preserveSymlinks }, root, } = server.config; -+ const { isProduction, resolve: { dedupe, preserveSymlinks, conditions }, root, } = server.config; - const resolveOptions = { - mainFields: ['main'], - browserField: true, - conditions: [], -- overrideConditions: ['production', 'development'], -+ overrideConditions: [...conditions, 'production', 'development'], - extensions: ['.js', '.cjs', '.json'], - dedupe, - preserveSymlinks, diff --git a/packages/cli/src/commands/experimental/templates/sentryApi.ts.template b/packages/cli/src/commands/experimental/templates/sentryApi.ts.template index 29565f4977c6..dcb781fcb611 100644 --- a/packages/cli/src/commands/experimental/templates/sentryApi.ts.template +++ b/packages/cli/src/commands/experimental/templates/sentryApi.ts.template @@ -1,12 +1,14 @@ import * as Sentry from '@sentry/node' -import * as Tracing from '@sentry/tracing' import { db as client } from 'src/lib/db' Sentry.init({ dsn: process.env.SENTRY_DSN, environment: process.env.NODE_ENV, - integrations: [new Tracing.Integrations.Prisma({ client })], + integrations: [ + new Sentry.Integrations.Prisma({ client }), + new Sentry.Integrations.Http({ tracing: true }), + ], tracesSampleRate: 1.0, }) diff --git a/packages/cli/src/commands/experimental/templates/sentryWeb.ts.template b/packages/cli/src/commands/experimental/templates/sentryWeb.ts.template index 4441183e29fb..1bf3051a226e 100644 --- a/packages/cli/src/commands/experimental/templates/sentryWeb.ts.template +++ b/packages/cli/src/commands/experimental/templates/sentryWeb.ts.template @@ -1,10 +1,30 @@ import * as Sentry from '@sentry/react' -import { BrowserTracing } from '@sentry/tracing' + +let dsn = '' +let environment = 'development' + +if (typeof process === 'undefined' || !process.env?.SENTRY_DSN) { + console.error( + 'Missing SENTRY_DSN environment variable. Did you forget to add it to ' + + 'your redwood.toml file in `includeEnvironmentVariables`?' + ) + console.info(`Copy this into your redwood.toml file:`) + console.info(` + includeEnvironmentVariables = [ + "SENTRY_DSN" + ] + + `) + console.error('Sentry is disabled for now') +} else { + dsn = process.env.SENTRY_DSN + environment = process.env.NODE_ENV +} Sentry.init({ - dsn: process.env.SENTRY_DSN, - environment: process.env.NODE_ENV, - integrations: [new BrowserTracing()], + dsn, + environment, + integrations: [new Sentry.BrowserTracing()], tracesSampleRate: 1.0, }) diff --git a/packages/cli/src/commands/experimental/util.js b/packages/cli/src/commands/experimental/util.js index ba84efad2118..d55b130e787a 100644 --- a/packages/cli/src/commands/experimental/util.js +++ b/packages/cli/src/commands/experimental/util.js @@ -1,7 +1,7 @@ -import fs from 'fs' import path from 'path' import chalk from 'chalk' +import fs from 'fs-extra' import terminalLink from 'terminal-link' import { getPaths } from '../../lib' diff --git a/packages/cli/src/commands/generate/__tests__/helpers.test.js b/packages/cli/src/commands/generate/__tests__/helpers.test.js index 35bf51fb02cd..1714901af7f0 100644 --- a/packages/cli/src/commands/generate/__tests__/helpers.test.js +++ b/packages/cli/src/commands/generate/__tests__/helpers.test.js @@ -1,6 +1,7 @@ -import fs from 'fs' import path from 'path' +import fs from 'fs-extra' + // Setup test mocks globalThis.__dirname = __dirname import '../../../lib/test' @@ -9,12 +10,12 @@ import * as helpers from '../helpers' import * as page from '../page/page' const PAGE_TEMPLATE_OUTPUT = `import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' const FooBarPage = () => { return ( <> - +

FooBarPage

diff --git a/packages/cli/src/commands/generate/cell/__tests__/__snapshots__/cell.test.js.snap b/packages/cli/src/commands/generate/cell/__tests__/__snapshots__/cell.test.js.snap index 0a0702dce540..fdea4f2615ef 100644 --- a/packages/cli/src/commands/generate/cell/__tests__/__snapshots__/cell.test.js.snap +++ b/packages/cli/src/commands/generate/cell/__tests__/__snapshots__/cell.test.js.snap @@ -52,6 +52,240 @@ export const Success = ({ equipment }) => { " `; +exports[`Custom Id Field files List cell creates a cell list component with a custom id field 1`] = ` +"export const QUERY = gql\` + query CustomIdFieldsQuery { + customIdFields { + uuid + } + } +\` + +export const Loading = () =>

Loading...
+ +export const Empty = () =>
Empty
+ +export const Failure = ({ error }) => ( +
Error: {error?.message}
+) + +export const Success = ({ customIdFields }) => { + return ( +
    + {customIdFields.map((item) => { + return
  • {JSON.stringify(item)}
  • + })} +
+ ) +} +" +`; + +exports[`Custom Id Field files List cell creates a cell list mock with a custom id field 1`] = ` +"// Define your own mock data here: +export const standard = (/* vars, { ctx, req } */) => ({ + customIdFields: [{ uuid: '42' }, { uuid: '43' }, { uuid: '44' }], +}) +" +`; + +exports[`Custom Id Field files List cell creates a cell list stories with a custom id field 1`] = ` +"import { Loading, Empty, Failure, Success } from './CustomIdFieldsCell' +import { standard } from './CustomIdFieldsCell.mock' + +const meta = { + title: 'Cells/CustomIdFieldsCell', + tags: ['autodocs'], +} + +export default meta + +export const loading = { + render: () => { + return Loading ? : <> + }, +} + +export const empty = { + render: () => { + return Empty ? : <> + }, +} + +export const failure = { + render: (args) => { + return Failure ? : <> + }, +} + +export const success = { + render: (args) => { + return Success ? : <> + }, +} +" +`; + +exports[`Custom Id Field files List cell creates a cell list test with a custom id field 1`] = ` +"import { render } from '@redwoodjs/testing/web' +import { Loading, Empty, Failure, Success } from './CustomIdFieldsCell' +import { standard } from './CustomIdFieldsCell.mock' + +// Generated boilerplate tests do not account for all circumstances +// and can fail without adjustments, e.g. Float and DateTime types. +// Please refer to the RedwoodJS Testing Docs: +// https://redwoodjs.com/docs/testing#testing-cells +// https://redwoodjs.com/docs/testing#jest-expect-type-considerations + +describe('CustomIdFieldsCell', () => { + it('renders Loading successfully', () => { + expect(() => { + render() + }).not.toThrow() + }) + + it('renders Empty successfully', async () => { + expect(() => { + render() + }).not.toThrow() + }) + + it('renders Failure successfully', async () => { + expect(() => { + render() + }).not.toThrow() + }) + + // When you're ready to test the actual output of your component render + // you could test that, for example, certain text is present: + // + // 1. import { screen } from '@redwoodjs/testing/web' + // 2. Add test: expect(screen.getByText('Hello, world')).toBeInTheDocument() + + it('renders Success successfully', async () => { + expect(() => { + render() + }).not.toThrow() + }) +}) +" +`; + +exports[`Custom Id Field files Single cell creates a cell component with a custom id field 1`] = ` +"export const QUERY = gql\` + query FindCustomIdFieldQuery($id: String!) { + customIdField: customIdField(uuid: $id) { + uuid + } + } +\` + +export const Loading = () =>
Loading...
+ +export const Empty = () =>
Empty
+ +export const Failure = ({ error }) => ( +
Error: {error?.message}
+) + +export const Success = ({ customIdField }) => { + return
{JSON.stringify(customIdField)}
+} +" +`; + +exports[`Custom Id Field files Single cell creates a cell mock with a custom id field 1`] = ` +"// Define your own mock data here: +export const standard = (/* vars, { ctx, req } */) => ({ + customIdField: { + uuid: '42', + }, +}) +" +`; + +exports[`Custom Id Field files Single cell creates a cell stories with a custom id field 1`] = ` +"import { Loading, Empty, Failure, Success } from './CustomIdFieldCell' +import { standard } from './CustomIdFieldCell.mock' + +const meta = { + title: 'Cells/CustomIdFieldCell', + tags: ['autodocs'], +} + +export default meta + +export const loading = { + render: () => { + return Loading ? : <> + }, +} + +export const empty = { + render: () => { + return Empty ? : <> + }, +} + +export const failure = { + render: (args) => { + return Failure ? : <> + }, +} + +export const success = { + render: (args) => { + return Success ? : <> + }, +} +" +`; + +exports[`Custom Id Field files Single cell creates a cell test with a custom id field 1`] = ` +"import { render } from '@redwoodjs/testing/web' +import { Loading, Empty, Failure, Success } from './CustomIdFieldCell' +import { standard } from './CustomIdFieldCell.mock' + +// Generated boilerplate tests do not account for all circumstances +// and can fail without adjustments, e.g. Float and DateTime types. +// Please refer to the RedwoodJS Testing Docs: +// https://redwoodjs.com/docs/testing#testing-cells +// https://redwoodjs.com/docs/testing#jest-expect-type-considerations + +describe('CustomIdFieldCell', () => { + it('renders Loading successfully', () => { + expect(() => { + render() + }).not.toThrow() + }) + + it('renders Empty successfully', async () => { + expect(() => { + render() + }).not.toThrow() + }) + + it('renders Failure successfully', async () => { + expect(() => { + render() + }).not.toThrow() + }) + + // When you're ready to test the actual output of your component render + // you could test that, for example, certain text is present: + // + // 1. import { screen } from '@redwoodjs/testing/web' + // 2. Add test: expect(screen.getByText('Hello, world')).toBeInTheDocument() + + it('renders Success successfully', async () => { + expect(() => { + render() + }).not.toThrow() + }) +}) +" +`; + exports[`Kebab case words creates a cell component with a kebabCase word name 1`] = ` "export const QUERY = gql\` query FindUserProfileQuery($id: Int!) { @@ -91,6 +325,7 @@ import { standard } from './UserProfileCell.mock' const meta = { title: 'Cells/UserProfileCell', + tags: ['autodocs'], } export default meta @@ -205,6 +440,7 @@ import { standard } from './UserProfileCell.mock' const meta = { title: 'Cells/UserProfileCell', + tags: ['autodocs'], } export default meta @@ -319,6 +555,7 @@ import { standard } from './UserCell.mock' const meta = { title: 'Cells/UserCell', + tags: ['autodocs'], } export default meta @@ -433,6 +670,7 @@ import { standard } from './UserProfileCell.mock' const meta = { title: 'Cells/UserProfileCell', + tags: ['autodocs'], } export default meta @@ -511,9 +749,16 @@ describe('UserProfileCell', () => { exports[`TypeScript: generates list cells if list flag passed in 1`] = ` "import type { FindBazingaQuery, FindBazingaQueryVariables } from 'types/graphql' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' -export const QUERY = gql\` +export const QUERY: TypedDocumentNode< + FindBazingaQuery, + FindBazingaQueryVariables +> = gql\` query FindBazingaQuery($id: Int!) { bazinga: bazinga(id: $id) { id @@ -592,6 +837,7 @@ import { standard } from './BazingaCell.mock' const meta: Meta = { title: 'Cells/BazingaCell', + tags: ['autodocs'], } export default meta @@ -633,11 +879,18 @@ export const standard = (/* vars, { ctx, req } */) => ({ `; exports[`TypeScript: generates list cells if name is plural 1`] = ` -"import type { MembersQuery } from 'types/graphql' - -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' - -export const QUERY = gql\` +"import type { MembersQuery, MembersQueryVariables } from 'types/graphql' + +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' + +export const QUERY: TypedDocumentNode< + MembersQuery, + MembersQueryVariables +> = gql\` query MembersQuery { members { id @@ -704,6 +957,7 @@ import { standard } from './UserProfileCell.mock' const meta = { title: 'Cells/UserProfileCell', + tags: ['autodocs'], } export default meta @@ -853,6 +1107,7 @@ import { standard } from './AddressCell.mock' const meta = { title: 'Cells/AddressCell', + tags: ['autodocs'], } export default meta @@ -973,6 +1228,7 @@ import { standard } from './AddressesCell.mock' const meta = { title: 'Cells/AddressesCell', + tags: ['autodocs'], } export default meta @@ -1091,6 +1347,7 @@ import { standard } from './MembersCell.mock' const meta = { title: 'Cells/MembersCell', + tags: ['autodocs'], } export default meta diff --git a/packages/cli/src/commands/generate/cell/__tests__/cell.test.js b/packages/cli/src/commands/generate/cell/__tests__/cell.test.js index a52684c7280e..cd72445c048b 100644 --- a/packages/cli/src/commands/generate/cell/__tests__/cell.test.js +++ b/packages/cli/src/commands/generate/cell/__tests__/cell.test.js @@ -686,3 +686,118 @@ describe('Custom query names', () => { ) }) }) + +describe('Custom Id Field files', () => { + let customIdFieldFiles + let customIdFieldListFiles + + describe('Single cell', () => { + beforeAll(async () => { + customIdFieldFiles = await cell.files({ + name: 'CustomIdField', + tests: true, + stories: true, + list: false, + }) + }) + + it('returns exactly 4 files', () => { + expect(Object.keys(customIdFieldFiles).length).toEqual(4) + }) + + it('creates a cell component with a custom id field', () => { + expect( + customIdFieldFiles[ + path.normalize( + '/path/to/project/web/src/components/CustomIdFieldCell/CustomIdFieldCell.jsx' + ) + ] + ).toMatchSnapshot() + }) + + it('creates a cell test with a custom id field', () => { + expect( + customIdFieldFiles[ + path.normalize( + '/path/to/project/web/src/components/CustomIdFieldCell/CustomIdFieldCell.test.jsx' + ) + ] + ).toMatchSnapshot() + }) + + it('creates a cell stories with a custom id field', () => { + expect( + customIdFieldFiles[ + path.normalize( + '/path/to/project/web/src/components/CustomIdFieldCell/CustomIdFieldCell.stories.jsx' + ) + ] + ).toMatchSnapshot() + }) + + it('creates a cell mock with a custom id field', () => { + expect( + customIdFieldFiles[ + path.normalize( + '/path/to/project/web/src/components/CustomIdFieldCell/CustomIdFieldCell.mock.js' + ) + ] + ).toMatchSnapshot() + }) + }) + + describe('List cell', () => { + beforeAll(async () => { + customIdFieldListFiles = await cell.files({ + name: 'CustomIdField', + tests: true, + stories: true, + list: true, + }) + }) + + it('returns exactly 4 files', () => { + expect(Object.keys(customIdFieldFiles).length).toEqual(4) + }) + + it('creates a cell list component with a custom id field', () => { + expect( + customIdFieldListFiles[ + path.normalize( + '/path/to/project/web/src/components/CustomIdFieldsCell/CustomIdFieldsCell.jsx' + ) + ] + ).toMatchSnapshot() + }) + + it('creates a cell list test with a custom id field', () => { + expect( + customIdFieldListFiles[ + path.normalize( + '/path/to/project/web/src/components/CustomIdFieldsCell/CustomIdFieldsCell.test.jsx' + ) + ] + ).toMatchSnapshot() + }) + + it('creates a cell list stories with a custom id field', () => { + expect( + customIdFieldListFiles[ + path.normalize( + '/path/to/project/web/src/components/CustomIdFieldsCell/CustomIdFieldsCell.stories.jsx' + ) + ] + ).toMatchSnapshot() + }) + + it('creates a cell list mock with a custom id field', () => { + expect( + customIdFieldListFiles[ + path.normalize( + '/path/to/project/web/src/components/CustomIdFieldsCell/CustomIdFieldsCell.mock.js' + ) + ] + ).toMatchSnapshot() + }) + }) +}) diff --git a/packages/cli/src/commands/generate/cell/__tests__/fixtures/schema.prisma b/packages/cli/src/commands/generate/cell/__tests__/fixtures/schema.prisma index 6946cb17bbbb..30eb90bdce41 100644 --- a/packages/cli/src/commands/generate/cell/__tests__/fixtures/schema.prisma +++ b/packages/cli/src/commands/generate/cell/__tests__/fixtures/schema.prisma @@ -30,3 +30,8 @@ model Address { city String country String } + +model CustomIdField { + uuid String @id @default(uuid()) + name String +} diff --git a/packages/cli/src/commands/generate/cell/cell.js b/packages/cli/src/commands/generate/cell/cell.js index 00342139444a..e54fb95fd737 100644 --- a/packages/cli/src/commands/generate/cell/cell.js +++ b/packages/cli/src/commands/generate/cell/cell.js @@ -17,6 +17,7 @@ import { import { checkProjectForQueryField, + getIdName, getIdType, operationNameIsUnique, uniqueOperationName, @@ -27,6 +28,7 @@ const REDWOOD_WEB_PATH_NAME = 'components' export const files = async ({ name, typescript, ...options }) => { let cellName = removeGeneratorName(name, 'cell') + let idName = 'id' let idType, mockIdValues = [42, 43, 44], model = null @@ -41,6 +43,7 @@ export const files = async ({ name, typescript, ...options }) => { // needed for the singular cell GQL query find by id case try { model = await getSchema(pascalcase(singularize(cellName))) + idName = getIdName(model) idType = getIdType(model) mockIdValues = idType === 'String' @@ -84,6 +87,7 @@ export const files = async ({ name, typescript, ...options }) => { templatePath: `cell${templateNameSuffix}.tsx.template`, templateVars: { operationName, + idName, idType, }, }) @@ -114,6 +118,7 @@ export const files = async ({ name, typescript, ...options }) => { generator: 'cell', templatePath: `mock${templateNameSuffix}.js.template`, templateVars: { + idName, mockIdValues, }, }) diff --git a/packages/cli/src/commands/generate/cell/templates/cell.tsx.template b/packages/cli/src/commands/generate/cell/templates/cell.tsx.template index 264ef6031ec9..e5d2ce24f31b 100644 --- a/packages/cli/src/commands/generate/cell/templates/cell.tsx.template +++ b/packages/cli/src/commands/generate/cell/templates/cell.tsx.template @@ -1,11 +1,18 @@ import type { ${operationName}, ${operationName}Variables } from 'types/graphql' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' -export const QUERY = gql` +export const QUERY: TypedDocumentNode< + ${operationName}, + ${operationName}Variables +> = gql` query ${operationName}($id: ${idType}!) { - ${camelName}: ${camelName}(id: $id) { - id + ${camelName}: ${camelName}(${idName}: $id) { + ${idName} } } ` diff --git a/packages/cli/src/commands/generate/cell/templates/cellList.tsx.template b/packages/cli/src/commands/generate/cell/templates/cellList.tsx.template index c4d434893132..51c823d13760 100644 --- a/packages/cli/src/commands/generate/cell/templates/cellList.tsx.template +++ b/packages/cli/src/commands/generate/cell/templates/cellList.tsx.template @@ -1,12 +1,18 @@ -import type { ${operationName} } from 'types/graphql' +import type { ${operationName}, ${operationName}Variables } from 'types/graphql' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' - -export const QUERY = gql` +export const QUERY: TypedDocumentNode< + ${operationName}, + ${operationName}Variables +> = gql` query ${operationName} { ${camelName} { - id + ${idName} } } ` @@ -23,7 +29,7 @@ export const Success = ({ ${camelName} }: CellSuccessProps<${operationName}>) => return (
    {${camelName}.map((item) => { - return
  • {JSON.stringify(item)}
  • + return
  • {JSON.stringify(item)}
  • })}
) diff --git a/packages/cli/src/commands/generate/cell/templates/mock.js.template b/packages/cli/src/commands/generate/cell/templates/mock.js.template index b96dd185377a..63db0e4616cf 100644 --- a/packages/cli/src/commands/generate/cell/templates/mock.js.template +++ b/packages/cli/src/commands/generate/cell/templates/mock.js.template @@ -1,6 +1,6 @@ // Define your own mock data here: export const standard = (/* vars, { ctx, req } */) => ({ ${camelName}: { - id: ${mockIdValues[0]} + ${idName}: ${mockIdValues[0]} } }) diff --git a/packages/cli/src/commands/generate/cell/templates/mockList.js.template b/packages/cli/src/commands/generate/cell/templates/mockList.js.template index 9ed5cafed329..237dc4a8ae46 100644 --- a/packages/cli/src/commands/generate/cell/templates/mockList.js.template +++ b/packages/cli/src/commands/generate/cell/templates/mockList.js.template @@ -1,8 +1,8 @@ // Define your own mock data here: export const standard = (/* vars, { ctx, req } */) => ({ ${camelName}: [ - { id: ${mockIdValues[0]} }, - { id: ${mockIdValues[1]} }, - { id: ${mockIdValues[2]} } + { ${idName}: ${mockIdValues[0]} }, + { ${idName}: ${mockIdValues[1]} }, + { ${idName}: ${mockIdValues[2]} } ] }) diff --git a/packages/cli/src/commands/generate/cell/templates/stories.tsx.template b/packages/cli/src/commands/generate/cell/templates/stories.tsx.template index 925d90b0d6df..1194bd07b1ee 100644 --- a/packages/cli/src/commands/generate/cell/templates/stories.tsx.template +++ b/packages/cli/src/commands/generate/cell/templates/stories.tsx.template @@ -5,6 +5,7 @@ import { standard } from './${pascalName}Cell.mock' const meta: Meta = { title: 'Cells/${pascalName}Cell', + tags: ['autodocs'] } export default meta diff --git a/packages/cli/src/commands/generate/cell/utils/utils.js b/packages/cli/src/commands/generate/cell/utils/utils.js index 347bcd0ebfe4..efca1d8f5bcd 100644 --- a/packages/cli/src/commands/generate/cell/utils/utils.js +++ b/packages/cli/src/commands/generate/cell/utils/utils.js @@ -43,6 +43,9 @@ export const getIdType = (model) => { return model.fields.find((field) => field.isId)?.type } +export const getIdName = (model) => { + return model.fields.find((field) => field.isId)?.name +} /** * * This function checks the project for the field name supplied, diff --git a/packages/cli/src/commands/generate/component/templates/stories.tsx.template b/packages/cli/src/commands/generate/component/templates/stories.tsx.template index acb55f297732..5311ada81bbd 100644 --- a/packages/cli/src/commands/generate/component/templates/stories.tsx.template +++ b/packages/cli/src/commands/generate/component/templates/stories.tsx.template @@ -16,6 +16,7 @@ import ${pascalName} from './${pascalName}' const meta: Meta = { component: ${pascalName}, + tags: ['autodocs'] } export default meta diff --git a/packages/cli/src/commands/generate/dataMigration/dataMigration.js b/packages/cli/src/commands/generate/dataMigration/dataMigration.js index 20babf10228a..719272e17bcc 100644 --- a/packages/cli/src/commands/generate/dataMigration/dataMigration.js +++ b/packages/cli/src/commands/generate/dataMigration/dataMigration.js @@ -1,6 +1,6 @@ -import fs from 'fs' import path from 'path' +import fs from 'fs-extra' import { Listr } from 'listr2' import { paramCase } from 'param-case' import terminalLink from 'terminal-link' diff --git a/packages/cli/src/commands/generate/dbAuth/__tests__/__snapshots__/dbAuth.test.js.snap b/packages/cli/src/commands/generate/dbAuth/__tests__/__snapshots__/dbAuth.test.js.snap index 2007b4e010c9..2229d11ab60c 100644 --- a/packages/cli/src/commands/generate/dbAuth/__tests__/__snapshots__/dbAuth.test.js.snap +++ b/packages/cli/src/commands/generate/dbAuth/__tests__/__snapshots__/dbAuth.test.js.snap @@ -13,7 +13,7 @@ exports[`dbAuth handler produces the correct files with custom password set via import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -48,7 +48,7 @@ const ForgotPasswordPage = () => { return ( <> - +
@@ -115,7 +115,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -151,7 +151,7 @@ const LoginPage = () => { return ( <> - +
@@ -251,7 +251,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -302,7 +302,7 @@ const ResetPasswordPage = ({ resetToken }) => { return ( <> - +
@@ -376,7 +376,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -414,7 +414,7 @@ const SignupPage = () => { return ( <> - +
@@ -501,7 +501,7 @@ exports[`dbAuth handler produces the correct files with custom password set via import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -536,7 +536,7 @@ const ForgotPasswordPage = () => { return ( <> - +
@@ -603,7 +603,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -639,7 +639,7 @@ const LoginPage = () => { return ( <> - +
@@ -739,7 +739,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -790,7 +790,7 @@ const ResetPasswordPage = ({ resetToken }) => { return ( <> - +
@@ -864,7 +864,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -902,7 +902,7 @@ const SignupPage = () => { return ( <> - +
@@ -989,7 +989,7 @@ exports[`dbAuth handler produces the correct files with custom username and pass import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -1024,7 +1024,7 @@ const ForgotPasswordPage = () => { return ( <> - +
@@ -1091,7 +1091,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -1127,7 +1127,7 @@ const LoginPage = () => { return ( <> - +
@@ -1227,7 +1227,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -1278,7 +1278,7 @@ const ResetPasswordPage = ({ resetToken }) => { return ( <> - +
@@ -1352,7 +1352,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -1390,7 +1390,7 @@ const SignupPage = () => { return ( <> - +
@@ -1477,7 +1477,7 @@ exports[`dbAuth handler produces the correct files with custom username and pass import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -1512,7 +1512,7 @@ const ForgotPasswordPage = () => { return ( <> - +
@@ -1579,7 +1579,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -1615,7 +1615,7 @@ const LoginPage = () => { return ( <> - +
@@ -1715,7 +1715,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -1766,7 +1766,7 @@ const ResetPasswordPage = ({ resetToken }) => { return ( <> - +
@@ -1840,7 +1840,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -1878,7 +1878,7 @@ const SignupPage = () => { return ( <> - +
@@ -1965,7 +1965,7 @@ exports[`dbAuth handler produces the correct files with custom username and pass import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -2000,7 +2000,7 @@ const ForgotPasswordPage = () => { return ( <> - +
@@ -2067,7 +2067,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -2299,7 +2299,7 @@ const LoginPage = ({ type }) => { return ( <> - +
@@ -2335,7 +2335,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -2386,7 +2386,7 @@ const ResetPasswordPage = ({ resetToken }) => { return ( <> - +
@@ -2460,7 +2460,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -2498,7 +2498,7 @@ const SignupPage = () => { return ( <> - +
@@ -2585,7 +2585,7 @@ exports[`dbAuth handler produces the correct files with custom username and pass import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -2620,7 +2620,7 @@ const ForgotPasswordPage = () => { return ( <> - +
@@ -2687,7 +2687,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -2723,7 +2723,7 @@ const LoginPage = () => { return ( <> - +
@@ -2823,7 +2823,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -2874,7 +2874,7 @@ const ResetPasswordPage = ({ resetToken }) => { return ( <> - +
@@ -2948,7 +2948,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -2986,7 +2986,7 @@ const SignupPage = () => { return ( <> - +
@@ -3073,7 +3073,7 @@ exports[`dbAuth handler produces the correct files with custom username set via import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -3110,7 +3110,7 @@ const ForgotPasswordPage = () => { return ( <> - +
@@ -3179,7 +3179,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -3215,7 +3215,7 @@ const LoginPage = () => { return ( <> - +
@@ -3315,7 +3315,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -3366,7 +3366,7 @@ const ResetPasswordPage = ({ resetToken }) => { return ( <> - +
@@ -3442,7 +3442,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -3480,7 +3480,7 @@ const SignupPage = () => { return ( <> - +
@@ -3567,7 +3567,7 @@ exports[`dbAuth handler produces the correct files with custom username set via import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -3604,7 +3604,7 @@ const ForgotPasswordPage = () => { return ( <> - +
@@ -3673,7 +3673,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -3709,7 +3709,7 @@ const LoginPage = () => { return ( <> - +
@@ -3809,7 +3809,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -3860,7 +3860,7 @@ const ResetPasswordPage = ({ resetToken }) => { return ( <> - +
@@ -3936,7 +3936,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -3974,7 +3974,7 @@ const SignupPage = () => { return ( <> - +
@@ -4061,7 +4061,7 @@ exports[`dbAuth handler produces the correct files with default labels 1`] = ` import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -4098,7 +4098,7 @@ const ForgotPasswordPage = () => { return ( <> - +
@@ -4167,7 +4167,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -4203,7 +4203,7 @@ const LoginPage = () => { return ( <> - +
@@ -4303,7 +4303,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -4354,7 +4354,7 @@ const ResetPasswordPage = ({ resetToken }) => { return ( <> - +
@@ -4430,7 +4430,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -4468,7 +4468,7 @@ const SignupPage = () => { return ( <> - +
diff --git a/packages/cli/src/commands/generate/dbAuth/__tests__/dbAuth.test.js b/packages/cli/src/commands/generate/dbAuth/__tests__/dbAuth.test.js index 08797506d27a..5031ad25c8a7 100644 --- a/packages/cli/src/commands/generate/dbAuth/__tests__/dbAuth.test.js +++ b/packages/cli/src/commands/generate/dbAuth/__tests__/dbAuth.test.js @@ -2,7 +2,6 @@ global.__dirname = __dirname jest.mock('fs') -import fs from 'fs' import path from 'path' // Load mocks @@ -10,6 +9,7 @@ import '../../../../lib/test' const realfs = jest.requireActual('fs') import Enquirer from 'enquirer' +import fs from 'fs-extra' import { getPaths } from '../../../../lib' import * as dbAuth from '../dbAuth' diff --git a/packages/cli/src/commands/generate/dbAuth/dbAuth.js b/packages/cli/src/commands/generate/dbAuth/dbAuth.js index 14afe2affd7c..00924554e756 100644 --- a/packages/cli/src/commands/generate/dbAuth/dbAuth.js +++ b/packages/cli/src/commands/generate/dbAuth/dbAuth.js @@ -1,8 +1,8 @@ -import fs from 'fs' import path from 'path' import { camelCase } from 'camel-case' import Enquirer from 'enquirer' +import fs from 'fs-extra' import { Listr } from 'listr2' import terminalLink from 'terminal-link' import { titleCase } from 'title-case' diff --git a/packages/cli/src/commands/generate/dbAuth/templates/forgotPassword.tsx.template b/packages/cli/src/commands/generate/dbAuth/templates/forgotPassword.tsx.template index cf72f6efcb1e..06c34f0eaf64 100644 --- a/packages/cli/src/commands/generate/dbAuth/templates/forgotPassword.tsx.template +++ b/packages/cli/src/commands/generate/dbAuth/templates/forgotPassword.tsx.template @@ -2,7 +2,7 @@ import { useEffect, useRef } from 'react' import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -39,7 +39,7 @@ const ForgotPasswordPage = () => { return ( <> - +
diff --git a/packages/cli/src/commands/generate/dbAuth/templates/login.tsx.template b/packages/cli/src/commands/generate/dbAuth/templates/login.tsx.template index b09688c201e5..88fac90acf42 100644 --- a/packages/cli/src/commands/generate/dbAuth/templates/login.tsx.template +++ b/packages/cli/src/commands/generate/dbAuth/templates/login.tsx.template @@ -10,7 +10,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -43,7 +43,7 @@ const LoginPage = () => { return ( <> - +
diff --git a/packages/cli/src/commands/generate/dbAuth/templates/login.webAuthn.tsx.template b/packages/cli/src/commands/generate/dbAuth/templates/login.webAuthn.tsx.template index eadd3d4222c9..bf25bef4cb64 100644 --- a/packages/cli/src/commands/generate/dbAuth/templates/login.webAuthn.tsx.template +++ b/packages/cli/src/commands/generate/dbAuth/templates/login.webAuthn.tsx.template @@ -10,7 +10,7 @@ import { FieldError, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -241,7 +241,7 @@ const LoginPage = ({ type }) => { return ( <> - +
diff --git a/packages/cli/src/commands/generate/dbAuth/templates/resetPassword.tsx.template b/packages/cli/src/commands/generate/dbAuth/templates/resetPassword.tsx.template index 232eaf8de0f2..bd84a9783d6b 100644 --- a/packages/cli/src/commands/generate/dbAuth/templates/resetPassword.tsx.template +++ b/packages/cli/src/commands/generate/dbAuth/templates/resetPassword.tsx.template @@ -8,7 +8,7 @@ import { FieldError, } from '@redwoodjs/forms' import { navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -59,7 +59,7 @@ const ResetPasswordPage = ({ resetToken }: { resetToken: string }) => { return ( <> - +
diff --git a/packages/cli/src/commands/generate/dbAuth/templates/signup.tsx.template b/packages/cli/src/commands/generate/dbAuth/templates/signup.tsx.template index e84e61ce0012..e3e1196f9b34 100644 --- a/packages/cli/src/commands/generate/dbAuth/templates/signup.tsx.template +++ b/packages/cli/src/commands/generate/dbAuth/templates/signup.tsx.template @@ -10,7 +10,7 @@ import { Submit, } from '@redwoodjs/forms' import { Link, navigate, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' import { toast, Toaster } from '@redwoodjs/web/toast' import { useAuth } from 'src/auth' @@ -45,7 +45,7 @@ const SignupPage = () => { return ( <> - +
diff --git a/packages/cli/src/commands/generate/helpers.js b/packages/cli/src/commands/generate/helpers.js index c76490a62c47..e3d48ff99c7d 100644 --- a/packages/cli/src/commands/generate/helpers.js +++ b/packages/cli/src/commands/generate/helpers.js @@ -1,6 +1,6 @@ -import fs from 'fs' import path from 'path' +import fs from 'fs-extra' import { Listr } from 'listr2' import { paramCase } from 'param-case' import pascalcase from 'pascalcase' diff --git a/packages/cli/src/commands/generate/page/__tests__/__snapshots__/page.test.js.snap b/packages/cli/src/commands/generate/page/__tests__/__snapshots__/page.test.js.snap index 9d727c16f3ea..7557712c9a30 100644 --- a/packages/cli/src/commands/generate/page/__tests__/__snapshots__/page.test.js.snap +++ b/packages/cli/src/commands/generate/page/__tests__/__snapshots__/page.test.js.snap @@ -2,12 +2,12 @@ exports[`Plural word files creates a page component with a plural word for name 1`] = ` "import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' const CatsPage = () => { return ( <> - +

CatsPage

@@ -27,12 +27,12 @@ export default CatsPage exports[`Single world files creates a page component 1`] = ` "import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' const HomePage = () => { return ( <> - +

HomePage

@@ -83,7 +83,7 @@ describe('HomePage', () => { exports[`TS Files TS Params 1`] = ` "import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' type TsParamFilesPageProps = { id: string @@ -92,7 +92,7 @@ type TsParamFilesPageProps = { const TsParamFilesPage = ({ id }: TsParamFilesPageProps) => { return ( <> - +

TsParamFilesPage

@@ -114,7 +114,7 @@ export default TsParamFilesPage exports[`TS Files TS Params with type 1`] = ` "import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' type TsParamTypeFilesPageProps = { id: number @@ -123,7 +123,7 @@ type TsParamTypeFilesPageProps = { const TsParamTypeFilesPage = ({ id }: TsParamTypeFilesPageProps) => { return ( <> - +

TsParamTypeFilesPage

@@ -151,12 +151,12 @@ export default TsParamTypeFilesPage exports[`TS Files generates typescript pages 1`] = ` "import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' const TsFilesPage = () => { return ( <> - +

TsFilesPage

@@ -249,12 +249,12 @@ describe('HomePage', () => { exports[`handler file generation 3`] = ` { "fileContent": "import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' const HomePage = () => { return ( <> - +

HomePage

@@ -333,12 +333,12 @@ describe('PostPage', () => { exports[`handler file generation with route params 3`] = ` { "fileContent": "import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' const PostPage = ({ id }) => { return ( <> - +

PostPage

@@ -380,12 +380,12 @@ export default Routes", exports[`multiWorldFiles creates a page component 1`] = ` "import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' const ContactUsPage = () => { return ( <> - +

ContactUsPage

@@ -436,12 +436,12 @@ describe('ContactUsPage', () => { exports[`paramFiles creates a page component with params 1`] = ` "import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' const PostPage = ({ id }) => { return ( <> - +

PostPage

diff --git a/packages/cli/src/commands/generate/page/__tests__/page.test.js b/packages/cli/src/commands/generate/page/__tests__/page.test.js index 3ad2e4cdfc5f..7836abe2f8dc 100644 --- a/packages/cli/src/commands/generate/page/__tests__/page.test.js +++ b/packages/cli/src/commands/generate/page/__tests__/page.test.js @@ -36,9 +36,10 @@ jest.mock('fs', () => { } }) -import fs from 'fs' import path from 'path' +import fs from 'fs-extra' + // Load mocks import '../../../../lib/test' diff --git a/packages/cli/src/commands/generate/page/page.js b/packages/cli/src/commands/generate/page/page.js index f18fdbcae397..b20425d7e5b6 100644 --- a/packages/cli/src/commands/generate/page/page.js +++ b/packages/cli/src/commands/generate/page/page.js @@ -264,8 +264,8 @@ export const handler = async ({ task: (ctx, task) => { task.title = `One more thing...\n\n` + - ` ${c.warning('Page created! A note about :')}\n\n` + - ` At the top of your newly created page is a component,\n` + + ` ${c.warning('Page created! A note about :')}\n\n` + + ` At the top of your newly created page is a component,\n` + ` which contains the title and description for your page, essential\n` + ` to good SEO. Check out this page for best practices: \n\n` + ` https://developers.google.com/search/docs/advanced/appearance/good-titles-snippets\n` diff --git a/packages/cli/src/commands/generate/page/templates/page.tsx.template b/packages/cli/src/commands/generate/page/templates/page.tsx.template index fc16315a0a96..046843373649 100644 --- a/packages/cli/src/commands/generate/page/templates/page.tsx.template +++ b/packages/cli/src/commands/generate/page/templates/page.tsx.template @@ -1,5 +1,5 @@ import { Link, routes } from '@redwoodjs/router' -import { MetaTags } from '@redwoodjs/web' +import { Metadata } from '@redwoodjs/web' <% if (paramName !== '') { %> type ${pascalName}PageProps = { ${paramName}: ${paramType} @@ -8,7 +8,7 @@ type ${pascalName}PageProps = { const ${pascalName}Page = (<%- paramName === '' ? '' : `${propParam}: ${pascalName}PageProps` %>) => { return ( <> - +

${pascalName}Page

diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffold.test.js.snap b/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffold.test.js.snap index 27db2ae38f1d..4293c83e2c5d 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffold.test.js.snap +++ b/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffold.test.js.snap @@ -578,6 +578,7 @@ export default ScaffoldLayout exports[`in javascript (default) mode creates a new component 1`] = ` "import { navigate, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' + import { toast } from '@redwoodjs/web/toast' import PostForm from 'src/components/Post/PostForm' @@ -624,6 +625,7 @@ export default NewPost exports[`in javascript (default) mode creates a new component with int foreign keys converted in onSave 1`] = ` "import { navigate, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' + import { toast } from '@redwoodjs/web/toast' import UserProfileForm from 'src/components/UserProfile/UserProfileForm' @@ -721,6 +723,7 @@ export const Success = ({ post }) => { exports[`in javascript (default) mode creates a show component 1`] = ` "import { Link, routes, navigate } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' + import { toast } from '@redwoodjs/web/toast' import { checkboxInputTag, jsonDisplay, timeTag } from 'src/lib/formatters' @@ -1269,6 +1272,7 @@ export const QUERY = gql\` } } \` + const UPDATE_USER_PROFILE_MUTATION = gql\` mutation UpdateUserProfileMutation( $id: Int! @@ -1378,6 +1382,7 @@ export const Success = ({ posts }) => { exports[`in javascript (default) mode creates an index component 1`] = ` "import { Link, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' + import { toast } from '@redwoodjs/web/toast' import { QUERY } from 'src/components/Post/PostsCell' @@ -1508,7 +1513,10 @@ export default EditPostPage `; exports[`in typescript mode creates a form component 1`] = ` -"import { +"import type { EditPostById, UpdatePostInput } from 'types/graphql' + +import type { RWGqlError } from '@redwoodjs/forms' +import { Form, FormError, FieldError, @@ -1521,9 +1529,6 @@ exports[`in typescript mode creates a form component 1`] = ` Submit, } from '@redwoodjs/forms' -import type { EditPostById, UpdatePostInput } from 'types/graphql' -import type { RWGqlError } from '@redwoodjs/forms' - const formatDatetime = (value) => { if (value) { return value.replace(/:\\d{2}\\.\\d{3}\\w/, '') @@ -2092,15 +2097,23 @@ export default ScaffoldLayout `; exports[`in typescript mode creates a new component 1`] = ` -"import { navigate, routes } from '@redwoodjs/router' +"import type { + CreatePostMutation, + CreatePostInput, + CreatePostMutationVariables, +} from 'types/graphql' + +import { navigate, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' +import type { TypedDocumentNode } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import PostForm from 'src/components/Post/PostForm' -import type { CreatePostInput } from 'types/graphql' - -const CREATE_POST_MUTATION = gql\` +const CREATE_POST_MUTATION: TypedDocumentNode< + CreatePostMutation, + CreatePostMutationVariables +> = gql\` mutation CreatePostMutation($input: CreatePostInput!) { createPost(input: $input) { id @@ -2140,15 +2153,23 @@ export default NewPost `; exports[`in typescript mode creates a new component with int foreign keys converted in onSave 1`] = ` -"import { navigate, routes } from '@redwoodjs/router' +"import type { + CreateUserProfileMutation, + CreateUserProfileInput, + CreateUserProfileMutationVariables, +} from 'types/graphql' + +import { navigate, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' +import type { TypedDocumentNode } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import UserProfileForm from 'src/components/UserProfile/UserProfileForm' -import type { CreateUserProfileInput } from 'types/graphql' - -const CREATE_USER_PROFILE_MUTATION = gql\` +const CREATE_USER_PROFILE_MUTATION: TypedDocumentNode< + CreateUserProfileMutation, + CreateUserProfileMutationVariables +> = gql\` mutation CreateUserProfileMutation($input: CreateUserProfileInput!) { createUserProfile(input: $input) { id @@ -2202,13 +2223,20 @@ export default NewPostPage `; exports[`in typescript mode creates a show cell 1`] = ` -"import type { FindPostById } from 'types/graphql' +"import type { FindPostById, FindPostByIdVariables } from 'types/graphql' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' import Post from 'src/components/Post/Post' -export const QUERY = gql\` +export const QUERY: TypedDocumentNode< + FindPostById, + FindPostByIdVariables +> = gql\` query FindPostById($id: Int!) { post: post(id: $id) { id @@ -2232,26 +2260,36 @@ export const Loading = () =>

Loading...
export const Empty = () =>
Post not found
-export const Failure = ({ error }: CellFailureProps) => ( +export const Failure = ({ error }: CellFailureProps) => (
{error?.message}
) -export const Success = ({ post }: CellSuccessProps) => { +export const Success = ({ + post, +}: CellSuccessProps) => { return } " `; exports[`in typescript mode creates a show component 1`] = ` -"import { Link, routes, navigate } from '@redwoodjs/router' +"import type { + DeletePostMutation, + DeletePostMutationVariables, + FindPostById, +} from 'types/graphql' + +import { Link, routes, navigate } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' +import type { TypedDocumentNode } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import { checkboxInputTag, jsonDisplay, timeTag } from 'src/lib/formatters' -import type { DeletePostMutationVariables, FindPostById } from 'types/graphql' - -const DELETE_POST_MUTATION = gql\` +const DELETE_POST_MUTATION: TypedDocumentNode< + DeletePostMutation, + DeletePostMutationVariables +> = gql\` mutation DeletePostMutation($id: Int!) { deletePost(id: $id) { id @@ -2785,16 +2823,24 @@ exports[`in typescript mode creates a stylesheet 1`] = ` `; exports[`in typescript mode creates an edit cell 1`] = ` -"import type { EditPostById, UpdatePostInput } from 'types/graphql' +"import type { + EditPostById, + UpdatePostInput, + UpdatePostMutationVariables, +} from 'types/graphql' import { navigate, routes } from '@redwoodjs/router' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' import { useMutation } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import PostForm from 'src/components/Post/PostForm' -export const QUERY = gql\` +export const QUERY: TypedDocumentNode = gql\` query EditPostById($id: Int!) { post: post(id: $id) { id @@ -2813,7 +2859,11 @@ export const QUERY = gql\` } } \` -const UPDATE_POST_MUTATION = gql\` + +const UPDATE_POST_MUTATION: TypedDocumentNode< + EditPostById, + UpdatePostMutationVariables +> = gql\` mutation UpdatePostMutation($id: Int!, $input: UpdatePostInput!) { updatePost(id: $id, input: $input) { id @@ -2871,16 +2921,24 @@ export const Success = ({ post }: CellSuccessProps) => { `; exports[`in typescript mode creates an edit component with int foreign keys converted in onSave 1`] = ` -"import type { EditUserProfileById, UpdateUserProfileInput } from 'types/graphql' +"import type { + EditUserProfileById, + UpdateUserProfileInput, + UpdateUserProfileMutationVariables, +} from 'types/graphql' import { navigate, routes } from '@redwoodjs/router' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' import { useMutation } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import UserProfileForm from 'src/components/UserProfile/UserProfileForm' -export const QUERY = gql\` +export const QUERY: TypedDocumentNode = gql\` query EditUserProfileById($id: Int!) { userProfile: userProfile(id: $id) { id @@ -2889,7 +2947,11 @@ export const QUERY = gql\` } } \` -const UPDATE_USER_PROFILE_MUTATION = gql\` + +const UPDATE_USER_PROFILE_MUTATION: TypedDocumentNode< + EditUserProfileById, + UpdateUserProfileMutationVariables +> = gql\` mutation UpdateUserProfileMutation( $id: Int! $input: UpdateUserProfileInput! @@ -2953,14 +3015,18 @@ export const Success = ({ `; exports[`in typescript mode creates an index cell 1`] = ` -"import type { FindPosts } from 'types/graphql' +"import type { FindPosts, FindPostsVariables } from 'types/graphql' import { Link, routes } from '@redwoodjs/router' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' import Posts from 'src/components/Post/Posts' -export const QUERY = gql\` +export const QUERY: TypedDocumentNode = gql\` query FindPosts { posts { id @@ -2993,19 +3059,28 @@ export const Empty = () => { ) } -export const Failure = ({ error }: CellFailureProps) => ( +export const Failure = ({ error }: CellFailureProps) => (
{error?.message}
) -export const Success = ({ posts }: CellSuccessProps) => { +export const Success = ({ + posts, +}: CellSuccessProps) => { return } " `; exports[`in typescript mode creates an index component 1`] = ` -"import { Link, routes } from '@redwoodjs/router' +"import type { + DeletePostMutation, + DeletePostMutationVariables, + FindPosts, +} from 'types/graphql' + +import { Link, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' +import type { TypedDocumentNode } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import { QUERY } from 'src/components/Post/PostsCell' @@ -3016,9 +3091,10 @@ import { truncate, } from 'src/lib/formatters' -import type { DeletePostMutationVariables, FindPosts } from 'types/graphql' - -const DELETE_POST_MUTATION = gql\` +const DELETE_POST_MUTATION: TypedDocumentNode< + DeletePostMutation, + DeletePostMutationVariables +> = gql\` mutation DeletePostMutation($id: Int!) { deletePost(id: $id) { id diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffoldNoNest.test.js.snap b/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffoldNoNest.test.js.snap index 6b4adb1de0b1..818e8bc936b4 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffoldNoNest.test.js.snap +++ b/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffoldNoNest.test.js.snap @@ -322,6 +322,7 @@ exports[`in javascript (default) mode creates a new component 1`] = `undefined`; exports[`in javascript (default) mode creates a new component with int foreign keys converted in onSave 1`] = ` "import { navigate, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' + import { toast } from '@redwoodjs/web/toast' import UserProfileForm from 'src/components/UserProfileForm' @@ -419,6 +420,7 @@ export const Success = ({ post }) => { exports[`in javascript (default) mode creates a show component 1`] = ` "import { Link, routes, navigate } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' + import { toast } from '@redwoodjs/web/toast' import { checkboxInputTag, jsonDisplay, timeTag } from 'src/lib/formatters' @@ -967,6 +969,7 @@ export const QUERY = gql\` } } \` + const UPDATE_USER_PROFILE_MUTATION = gql\` mutation UpdateUserProfileMutation( $id: Int! @@ -1076,6 +1079,7 @@ export const Success = ({ posts }) => { exports[`in javascript (default) mode creates an index component 1`] = ` "import { Link, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' + import { toast } from '@redwoodjs/web/toast' import { QUERY } from 'src/components/PostsCell' @@ -1206,7 +1210,10 @@ export default EditPostPage `; exports[`in typescript mode creates a form component 1`] = ` -"import { +"import type { EditPostById, UpdatePostInput } from 'types/graphql' + +import type { RWGqlError } from '@redwoodjs/forms' +import { Form, FormError, FieldError, @@ -1219,9 +1226,6 @@ exports[`in typescript mode creates a form component 1`] = ` Submit, } from '@redwoodjs/forms' -import type { EditPostById, UpdatePostInput } from 'types/graphql' -import type { RWGqlError } from '@redwoodjs/forms' - const formatDatetime = (value) => { if (value) { return value.replace(/:\\d{2}\\.\\d{3}\\w/, '') @@ -1534,15 +1538,23 @@ export default ScaffoldLayout exports[`in typescript mode creates a new component 1`] = `undefined`; exports[`in typescript mode creates a new component with int foreign keys converted in onSave 1`] = ` -"import { navigate, routes } from '@redwoodjs/router' +"import type { + CreateUserProfileMutation, + CreateUserProfileInput, + CreateUserProfileMutationVariables, +} from 'types/graphql' + +import { navigate, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' +import type { TypedDocumentNode } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import UserProfileForm from 'src/components/UserProfileForm' -import type { CreateUserProfileInput } from 'types/graphql' - -const CREATE_USER_PROFILE_MUTATION = gql\` +const CREATE_USER_PROFILE_MUTATION: TypedDocumentNode< + CreateUserProfileMutation, + CreateUserProfileMutationVariables +> = gql\` mutation CreateUserProfileMutation($input: CreateUserProfileInput!) { createUserProfile(input: $input) { id @@ -1596,13 +1608,20 @@ export default NewPostPage `; exports[`in typescript mode creates a show cell 1`] = ` -"import type { FindPostById } from 'types/graphql' +"import type { FindPostById, FindPostByIdVariables } from 'types/graphql' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' import Post from 'src/components/Post' -export const QUERY = gql\` +export const QUERY: TypedDocumentNode< + FindPostById, + FindPostByIdVariables +> = gql\` query FindPostById($id: Int!) { post: post(id: $id) { id @@ -1626,26 +1645,36 @@ export const Loading = () =>
Loading...
export const Empty = () =>
Post not found
-export const Failure = ({ error }: CellFailureProps) => ( +export const Failure = ({ error }: CellFailureProps) => (
{error?.message}
) -export const Success = ({ post }: CellSuccessProps) => { +export const Success = ({ + post, +}: CellSuccessProps) => { return } " `; exports[`in typescript mode creates a show component 1`] = ` -"import { Link, routes, navigate } from '@redwoodjs/router' +"import type { + DeletePostMutation, + DeletePostMutationVariables, + FindPostById, +} from 'types/graphql' + +import { Link, routes, navigate } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' +import type { TypedDocumentNode } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import { checkboxInputTag, jsonDisplay, timeTag } from 'src/lib/formatters' -import type { DeletePostMutationVariables, FindPostById } from 'types/graphql' - -const DELETE_POST_MUTATION = gql\` +const DELETE_POST_MUTATION: TypedDocumentNode< + DeletePostMutation, + DeletePostMutationVariables +> = gql\` mutation DeletePostMutation($id: Int!) { deletePost(id: $id) { id @@ -2179,16 +2208,24 @@ exports[`in typescript mode creates a stylesheet 1`] = ` `; exports[`in typescript mode creates an edit cell 1`] = ` -"import type { EditPostById, UpdatePostInput } from 'types/graphql' +"import type { + EditPostById, + UpdatePostInput, + UpdatePostMutationVariables, +} from 'types/graphql' import { navigate, routes } from '@redwoodjs/router' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' import { useMutation } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import PostForm from 'src/components/PostForm' -export const QUERY = gql\` +export const QUERY: TypedDocumentNode = gql\` query EditPostById($id: Int!) { post: post(id: $id) { id @@ -2207,7 +2244,11 @@ export const QUERY = gql\` } } \` -const UPDATE_POST_MUTATION = gql\` + +const UPDATE_POST_MUTATION: TypedDocumentNode< + EditPostById, + UpdatePostMutationVariables +> = gql\` mutation UpdatePostMutation($id: Int!, $input: UpdatePostInput!) { updatePost(id: $id, input: $input) { id @@ -2265,16 +2306,24 @@ export const Success = ({ post }: CellSuccessProps) => { `; exports[`in typescript mode creates an edit component with int foreign keys converted in onSave 1`] = ` -"import type { EditUserProfileById, UpdateUserProfileInput } from 'types/graphql' +"import type { + EditUserProfileById, + UpdateUserProfileInput, + UpdateUserProfileMutationVariables, +} from 'types/graphql' import { navigate, routes } from '@redwoodjs/router' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' import { useMutation } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import UserProfileForm from 'src/components/UserProfileForm' -export const QUERY = gql\` +export const QUERY: TypedDocumentNode = gql\` query EditUserProfileById($id: Int!) { userProfile: userProfile(id: $id) { id @@ -2283,7 +2332,11 @@ export const QUERY = gql\` } } \` -const UPDATE_USER_PROFILE_MUTATION = gql\` + +const UPDATE_USER_PROFILE_MUTATION: TypedDocumentNode< + EditUserProfileById, + UpdateUserProfileMutationVariables +> = gql\` mutation UpdateUserProfileMutation( $id: Int! $input: UpdateUserProfileInput! @@ -2347,14 +2400,18 @@ export const Success = ({ `; exports[`in typescript mode creates an index cell 1`] = ` -"import type { FindPosts } from 'types/graphql' +"import type { FindPosts, FindPostsVariables } from 'types/graphql' import { Link, routes } from '@redwoodjs/router' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' import Posts from 'src/components/Posts' -export const QUERY = gql\` +export const QUERY: TypedDocumentNode = gql\` query FindPosts { posts { id @@ -2387,19 +2444,28 @@ export const Empty = () => { ) } -export const Failure = ({ error }: CellFailureProps) => ( +export const Failure = ({ error }: CellFailureProps) => (
{error?.message}
) -export const Success = ({ posts }: CellSuccessProps) => { +export const Success = ({ + posts, +}: CellSuccessProps) => { return } " `; exports[`in typescript mode creates an index component 1`] = ` -"import { Link, routes } from '@redwoodjs/router' +"import type { + DeletePostMutation, + DeletePostMutationVariables, + FindPosts, +} from 'types/graphql' + +import { Link, routes } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' +import type { TypedDocumentNode } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import { QUERY } from 'src/components/PostsCell' @@ -2410,9 +2476,10 @@ import { truncate, } from 'src/lib/formatters' -import type { DeletePostMutationVariables, FindPosts } from 'types/graphql' - -const DELETE_POST_MUTATION = gql\` +const DELETE_POST_MUTATION: TypedDocumentNode< + DeletePostMutation, + DeletePostMutationVariables +> = gql\` mutation DeletePostMutation($id: Int!) { deletePost(id: $id) { id diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/fixtures/schema.prisma b/packages/cli/src/commands/generate/scaffold/__tests__/fixtures/schema.prisma index 70fc02557b92..252c42590cf4 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/fixtures/schema.prisma +++ b/packages/cli/src/commands/generate/scaffold/__tests__/fixtures/schema.prisma @@ -72,3 +72,8 @@ model Tag { post Post? @relation(fields: [postId], references: [id]) postId Int? } + +model CustomIdField { + uuid String @id @default(uuid()) + name String +} diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldCustomIdName.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldCustomIdName.test.js new file mode 100644 index 000000000000..a138fae5ff9c --- /dev/null +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldCustomIdName.test.js @@ -0,0 +1,91 @@ +globalThis.__dirname = __dirname +import path from 'path' + +// Load mocks +import '../../../../lib/test' + +import { getDefaultArgs } from '../../../../lib' +import { yargsDefaults as defaults } from '../../helpers' +import * as scaffold from '../scaffold' + +jest.mock('execa') + +describe('support custom @id name', () => { + let files + + beforeAll(async () => { + files = await scaffold.files({ + ...getDefaultArgs(defaults), + typescript: true, + model: 'CustomIdField', + tests: true, + nestScaffoldByModel: true, + }) + }) + + test('creates routes with the custom id name', async () => { + const customIdFieldRoutes = await scaffold.routes({ + model: 'CustomIdField', + nestScaffoldByModel: true, + }) + expect(customIdFieldRoutes).toEqual([ + '', + '', + '', + '', + ]) + }) + + test('creates a cell with the custom id name', () => { + const customIdFieldCellPath = + '/path/to/project/web/src/components/CustomIdField/CustomIdFieldCell/CustomIdFieldCell.tsx' + + const cell = files[path.normalize(customIdFieldCellPath)] + expect(cell).toContain('FindCustomIdFieldByUuid($uuid: String!)') + expect(cell).toContain('customIdField: customIdField(uuid: $uuid)') + }) + + test('creates an edit cell with the custom id name', () => { + const customIdFieldEditCellPath = + '/path/to/project/web/src/components/CustomIdField/EditCustomIdFieldCell/EditCustomIdFieldCell.tsx' + + const cell = files[path.normalize(customIdFieldEditCellPath)] + expect(cell).toContain('query EditCustomIdFieldByUuid($uuid: String!)') + }) + + test('creates a component with the custom id name', () => { + const customIdFieldComponentPath = + '/path/to/project/web/src/components/CustomIdField/CustomIdField/CustomIdField.tsx' + + const cell = files[path.normalize(customIdFieldComponentPath)] + expect(cell).toContain('DeleteCustomIdFieldMutation($uuid: String!)') + expect(cell).toContain('deleteCustomIdField(uuid: $uuid)') + expect(cell).toContain('deleteCustomIdField({ variables: { uuid } })') + }) + + test('creates a form with the custom id name', () => { + const customIdFieldFormPath = + '/path/to/project/web/src/components/CustomIdField/CustomIdFieldForm/CustomIdFieldForm.tsx' + + const cell = files[path.normalize(customIdFieldFormPath)] + expect(cell).toContain('props.onSave(data, props?.customIdField?.uuid)') + }) + + test('creates a sdl with the custom id name', () => { + const customIdFieldSdlPath = + '/path/to/project/api/src/graphql/customIdFields.sdl.ts' + + const sdl = files[path.normalize(customIdFieldSdlPath)] + const match = sdl.match(/uuid: String!/g) + expect(match).toHaveLength(4) + }) + + test('creates a service with the custom id name', () => { + const customIdFieldServicePath = + '/path/to/project/api/src/graphql/customIdFields.sdl.ts' + + const sdl = files[path.normalize(customIdFieldServicePath)] + const match = sdl.match(/uuid: String!/g) + expect(match).toHaveLength(4) + }) +}) diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/shouldUseTailwindCSS.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/shouldUseTailwindCSS.test.js index 3c27756a104d..7af86d2d1794 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/shouldUseTailwindCSS.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/shouldUseTailwindCSS.test.js @@ -1,6 +1,6 @@ globalThis.__dirname = __dirname -import fs from 'fs' +import fs from 'fs-extra' import '../../../../lib/test' import { shouldUseTailwindCSS } from '../scaffold' diff --git a/packages/cli/src/commands/generate/scaffold/scaffold.js b/packages/cli/src/commands/generate/scaffold/scaffold.js index 8762ab04da05..177ef4cf7730 100644 --- a/packages/cli/src/commands/generate/scaffold/scaffold.js +++ b/packages/cli/src/commands/generate/scaffold/scaffold.js @@ -1,8 +1,8 @@ -import fs from 'fs' import path from 'path' import camelcase from 'camelcase' import execa from 'execa' +import fs from 'fs-extra' import humanize from 'humanize-string' import { Listr } from 'listr2' import { paramCase } from 'param-case' @@ -56,6 +56,10 @@ const getIdType = (model) => { return model.fields.find((field) => field.isId)?.type } +const getIdName = (model) => { + return model.fields.find((field) => field.isId)?.name +} + const filterAutoGeneratedColumnsForScaffold = (column) => { const autoGeneratedFunctions = ['now', 'autoincrement'] return !( @@ -495,6 +499,7 @@ const pageFiles = async ( const model = await getSchema(singularName) const idType = getIdType(model) const idTsType = mapPrismaScalarToPagePropTsType(idType) + const idName = getIdName(model) let fileList = {} @@ -531,6 +536,7 @@ const pageFiles = async ( }), { idTsType, + idName, name, pascalScaffoldPath, ...templateStrings, @@ -557,6 +563,8 @@ const componentFiles = async ( const singularName = pascalcase(singularize(name)) const model = await getSchema(singularName) const idType = getIdType(model) + const idName = getIdName(model) + const pascalIdName = pascalcase(idName) const intForeignKeys = intForeignKeysForModel(model) let fileList = {} @@ -594,6 +602,8 @@ const componentFiles = async ( { name, idType, + idName, + pascalIdName, intForeignKeys, pascalScaffoldPath, ...templateStrings, @@ -623,6 +633,7 @@ export const routes = async ({ const nameVars = nameVariants(name) const model = await getSchema(nameVars.singularPascalName) const idRouteParam = getIdType(model) === 'Int' ? ':Int' : '' + const idName = getIdName(model) const paramScaffoldPath = scaffoldPath === '' @@ -638,9 +649,9 @@ export const routes = async ({ // new ``, // edit - ``, + ``, // singular - ``, + ``, // plural ``, ] diff --git a/packages/cli/src/commands/generate/scaffold/templates/components/EditNameCell.tsx.template b/packages/cli/src/commands/generate/scaffold/templates/components/EditNameCell.tsx.template index a19836a80250..652d783066ea 100644 --- a/packages/cli/src/commands/generate/scaffold/templates/components/EditNameCell.tsx.template +++ b/packages/cli/src/commands/generate/scaffold/templates/components/EditNameCell.tsx.template @@ -1,22 +1,34 @@ -import type { Edit${singularPascalName}ById, Update${singularPascalName}Input } from 'types/graphql' +import type { + Edit${singularPascalName}By${pascalIdName}, + Update${singularPascalName}Input, + Update${singularPascalName}MutationVariables +} from 'types/graphql' import { navigate, routes } from '@redwoodjs/router' -import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web' +import type { + CellSuccessProps, + CellFailureProps, + TypedDocumentNode, +} from '@redwoodjs/web' import { useMutation } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import ${singularPascalName}Form from '${importComponentNameForm}' -export const QUERY = gql` - query Edit${singularPascalName}ById($id: ${idType}!) { - ${singularCamelName}: ${singularCamelName}(id: $id) {<% columns.forEach(column => { %> +export const QUERY: TypedDocumentNode = gql` + query Edit${singularPascalName}By${pascalIdName}($${idName}: ${idType}!) { + ${singularCamelName}: ${singularCamelName}(${idName}: $${idName}) {<% columns.forEach(column => { %> <%= column.name %><% }) %> } } ` -const UPDATE_${singularConstantName}_MUTATION = gql` - mutation Update${singularPascalName}Mutation($id: ${idType}!, $input: Update${singularPascalName}Input!) { - update${singularPascalName}(id: $id, input: $input) {<% columns.forEach(column => { %> + +const UPDATE_${singularConstantName}_MUTATION: TypedDocumentNode< + Edit${singularPascalName}ById, + Update${singularPascalName}MutationVariables +> = gql` + mutation Update${singularPascalName}Mutation($${idName}: ${idType}!, $input: Update${singularPascalName}Input!) { + update${singularPascalName}(${idName}: $${idName}, input: $input) {<% columns.forEach(column => { %> <%= column.name %><% }) %> } } @@ -28,7 +40,7 @@ export const Failure = ({ error }: CellFailureProps) => (
{error?.message}
) -export const Success = ({ ${singularCamelName} }: CellSuccessProps) => { +export const Success = ({ ${singularCamelName} }: CellSuccessProps) => { const [update${singularPascalName}, { loading, error }] = useMutation( UPDATE_${singularConstantName}_MUTATION, { @@ -44,7 +56,7 @@ export const Success = ({ ${singularCamelName} }: CellSuccessProps { update${singularPascalName}({ variables: { id, input } }) } diff --git a/packages/cli/src/commands/generate/scaffold/templates/components/Name.tsx.template b/packages/cli/src/commands/generate/scaffold/templates/components/Name.tsx.template index 3ea1e078bb90..f95e5e04656a 100644 --- a/packages/cli/src/commands/generate/scaffold/templates/components/Name.tsx.template +++ b/packages/cli/src/commands/generate/scaffold/templates/components/Name.tsx.template @@ -1,22 +1,22 @@ +import type { Delete${singularPascalName}Mutation, Delete${singularPascalName}MutationVariables, Find${singularPascalName}By${pascalIdName} } from 'types/graphql' import { Link, routes, navigate } from '@redwoodjs/router' import { useMutation } from '@redwoodjs/web' +import type { TypedDocumentNode } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import { ${formattersImports} } from 'src/lib/formatters' -import type { Delete${singularPascalName}MutationVariables, Find${singularPascalName}ById } from 'types/graphql' - -const DELETE_${singularConstantName}_MUTATION = gql` - mutation Delete${singularPascalName}Mutation($id: ${idType}!) { - delete${singularPascalName}(id: $id) { - id +const DELETE_${singularConstantName}_MUTATION: TypedDocumentNode = gql` + mutation Delete${singularPascalName}Mutation($${idName}: ${idType}!) { + delete${singularPascalName}(${idName}: $${idName}) { + ${idName} } } ` interface Props { - ${singularCamelName}: NonNullable + ${singularCamelName}: NonNullable } const ${singularPascalName} = ({ ${singularCamelName} }: Props) => { @@ -30,9 +30,9 @@ const ${singularPascalName} = ({ ${singularCamelName} }: Props) => { }, }) - const onDeleteClick = (id: Delete${singularPascalName}MutationVariables['id']) => { - if (confirm('Are you sure you want to delete ${singularCamelName} ' + id + '?')) { - delete${singularPascalName}({ variables: { id } }) + const onDeleteClick = (${idName}: Delete${singularPascalName}MutationVariables['${idName}']) => { + if (confirm('Are you sure you want to delete ${singularCamelName} ' + ${idName} + '?')) { + delete${singularPascalName}({ variables: { ${idName} } }) } } @@ -41,7 +41,7 @@ const ${singularPascalName} = ({ ${singularCamelName} }: Props) => {

- ${singularPascalName} {${singularCamelName}.id} Detail + ${singularPascalName} {${singularCamelName}.${idName}} Detail

@@ -59,7 +59,7 @@ const ${singularPascalName} = ({ ${singularCamelName} }: Props) => { {${pluralCamelName}.map((${singularCamelName}) => ( - <% columns.forEach(column => { %> + <% columns.forEach(column => { %> <% }) %>
{${column.listDisplayFunction}(${singularCamelName}.${column.name})}