diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 800888580518..d3cc248a3826 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -18,8 +18,8 @@ $ https://github.com/Expensify/App/issues/ Do NOT only link the issue number like this: $ # ---> -$ -PROPOSAL: +$ +PROPOSAL: ### Tests @@ -94,17 +94,6 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c - [ ] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests) - [ ] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such - [ ] I verified that if a function's arguments changed that all usages have also been updated correctly -- [ ] If a new component is created I verified that: - - [ ] A similar component doesn't exist in the codebase - - [ ] All props are defined accurately and each prop has a `/** comment above it */` - - [ ] The file is named correctly - - [ ] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone - - [ ] The only data being stored in the state is data necessary for rendering and nothing else - - [ ] If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes - - [ ] For Class Components, any internal methods passed to components event handlers are bound to `this` properly so there are no scoping issues (i.e. for `onClick={this.submit}` the method `this.submit` should be bound to `this` in the constructor) - - [ ] Any internal methods bound to `this` are necessary to be bound (i.e. avoid `this.submit = this.submit.bind(this);` if `this.submit` is never passed to a component event handler like `onClick`) - - [ ] All JSX used for rendering exists in the render method - - [ ] The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions - [ ] If any new file was added I verified that: - [ ] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory - [ ] If a new CSS style is added I verified that: @@ -116,7 +105,6 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c - [ ] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account. - [ ] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page. - [ ] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps. -- [ ] I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR. ### Screenshots/Videos
diff --git a/.github/actions/javascript/authorChecklist/authorChecklist.js b/.github/actions/javascript/authorChecklist/authorChecklist.js index 38695ea984cc..3aecd0d597b0 100644 --- a/.github/actions/javascript/authorChecklist/authorChecklist.js +++ b/.github/actions/javascript/authorChecklist/authorChecklist.js @@ -1,12 +1,56 @@ const core = require('@actions/core'); const github = require('@actions/github'); const https = require('https'); -const GitHubUtils = require('../../../libs/GithubUtils'); +const _ = require('lodash'); +const GithubUtils = require('../../../libs/GithubUtils'); +const CONST = require('../../../libs/CONST'); +const newComponentCategory = require('./newComponentCategory'); const pathToAuthorChecklist = 'https://raw.githubusercontent.com/Expensify/App/main/.github/PULL_REQUEST_TEMPLATE.md'; -const authorChecklistStartsWith = '### PR Author Checklist'; -const reviewerChecklistStartsWith = '

PR Reviewer Checklist

'; -const issue = github.context.payload.issue ? github.context.payload.issue.number : github.context.payload.pull_request.number; +const checklistStartsWith = '### PR Author Checklist'; +const checklistEndsWith = "\r\n### Screenshots/Videos"; + +const prNumber = github.context.payload.pull_request.number; + +const CHECKLIST_CATEGORIES = { + NEW_COMPONENT: newComponentCategory, +}; + +/** + * Look at the contents of the pull request, and determine which checklist categories apply. + * + * @returns {Promise>} + */ +async function getChecklistCategoriesForPullRequest() { + const categories = []; + const changedFiles = await GithubUtils.paginate(GithubUtils.octokit.pulls.listFiles, { + owner: CONST.GITHUB_OWNER, + repo: CONST.APP_REPO, + pull_number: prNumber, + per_page: 100, + }); + + for (const category of _.values(CHECKLIST_CATEGORIES)) { + const {detectFunction, items} = category; + const categoryDetected = await detectFunction(changedFiles); + if (categoryDetected) { + categories.push(items); + } + } + return categories; +} + +/** + * Takes string in markdown, and divides it's content by two contant markers. + * + * @param {String} body + * @returns {[String, String, String]} + */ +function partitionWithChecklist(body) { + const [contentBeforeChecklist, contentAfterStartOfChecklist] = body.split(checklistStartsWith); + const [checklistContent, contentAfterChecklist] = contentAfterStartOfChecklist.split(checklistEndsWith); + return [contentBeforeChecklist, checklistContent, contentAfterChecklist]; +} /** * @returns {Promise} @@ -20,12 +64,10 @@ function getNumberOfItemsFromAuthorChecklist() { fileContents += chunk; }); res.on('end', () => { - // Currently, both the author and reviewer checklists are in the PR template file, so we need to do a little bit of parsing the PR description to get just the author - // checklist. - const contentAfterStartOfAuthorChecklist = fileContents.split(authorChecklistStartsWith).pop(); - const contentBeforeStartOfReviewerChecklist = contentAfterStartOfAuthorChecklist.split(reviewerChecklistStartsWith).shift(); + // eslint-disable-next-line no-unused-vars + const [_start, checklist] = partitionWithChecklist(fileContents); - const numberOfChecklistItems = (contentBeforeStartOfReviewerChecklist.match(/\[ \]/g) || []).length; + const numberOfChecklistItems = (checklist.match(/\[ \]/g) || []).length; resolve(numberOfChecklistItems); }); }) @@ -35,33 +77,107 @@ function getNumberOfItemsFromAuthorChecklist() { /** * @param {Number} numberOfChecklistItems + * @param {String} pullRequestBody */ -function checkIssueForCompletedChecklist(numberOfChecklistItems) { - GitHubUtils.getPullRequestBody(issue).then((pullRequestBody) => { - const contentAfterStartOfAuthorChecklist = pullRequestBody.split(authorChecklistStartsWith).pop(); - const contentOfAuthorChecklist = contentAfterStartOfAuthorChecklist.split(reviewerChecklistStartsWith).shift(); +function checkPRForCompletedChecklist(numberOfChecklistItems, pullRequestBody) { + // eslint-disable-next-line no-unused-vars + const [_start, checklist] = partitionWithChecklist(pullRequestBody); - const numberOfFinishedChecklistItems = (contentOfAuthorChecklist.match(/- \[x\]/gi) || []).length; - const numberOfUnfinishedChecklistItems = (contentOfAuthorChecklist.match(/- \[ \]/g) || []).length; + const numberOfFinishedChecklistItems = (checklist.match(/- \[x\]/gi) || []).length; + const numberOfUnfinishedChecklistItems = (checklist.match(/- \[ \]/g) || []).length; - const maxCompletedItems = numberOfChecklistItems + 2; - const minCompletedItems = numberOfChecklistItems - 2; + const minCompletedItems = numberOfChecklistItems - 2; - console.log(`You completed ${numberOfFinishedChecklistItems} out of ${numberOfChecklistItems} checklist items with ${numberOfUnfinishedChecklistItems} unfinished items`); + console.log(`You completed ${numberOfFinishedChecklistItems} out of ${numberOfChecklistItems} checklist items with ${numberOfUnfinishedChecklistItems} unfinished items`); - if (numberOfFinishedChecklistItems >= minCompletedItems && numberOfFinishedChecklistItems <= maxCompletedItems && numberOfUnfinishedChecklistItems === 0) { - console.log('PR Author checklist is complete 🎉'); - return; - } + if (numberOfFinishedChecklistItems >= minCompletedItems && numberOfUnfinishedChecklistItems === 0) { + console.log('PR Author checklist is complete 🎉'); + return; + } - console.log(`Make sure you are using the most up to date checklist found here: ${pathToAuthorChecklist}`); - core.setFailed("PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item."); - }); + console.log(`Make sure you are using the most up to date checklist found here: ${pathToAuthorChecklist}`); + core.setFailed("PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item."); } -getNumberOfItemsFromAuthorChecklist() - .then(checkIssueForCompletedChecklist) - .catch((err) => { +async function generateDynamicChecksAndCheckForCompletion() { + // Generate dynamic checks + const checks = new Set(); + const categories = await getChecklistCategoriesForPullRequest(); + for (const checksForCategory of categories) { + for (const check of checksForCategory) { + checks.add(check); + } + } + + const body = github.context.payload.pull_request.body; + + // eslint-disable-next-line prefer-const + let [contentBeforeChecklist, checklist, contentAfterChecklist] = partitionWithChecklist(body); + + let isPassing = true; + let checklistChanged = false; + for (const check of checks) { + // Check if it's already in the PR body, capturing the whether or not it's already checked + const regex = new RegExp(`- \\[([ x])] ${_.escapeRegExp(check)}`); + const match = regex.exec(checklist); + if (!match) { + // Add it to the PR body + isPassing = false; + checklist += `- [ ] ${check}\r\n`; + checklistChanged = true; + } else { + const isChecked = match[1] === 'x'; + if (!isChecked) { + isPassing = false; + } + } + } + const allChecks = _.flatten(_.map(_.values(CHECKLIST_CATEGORIES), 'items')); + for (const check of allChecks) { + if (!checks.has(check)) { + // Check if some dynamic check has been added with previous commit, but the check is not relevant anymore + const regex = new RegExp(`- \\[([ x])] ${_.escapeRegExp(check)}\r\n`); + const match = regex.exec(checklist); + if (match) { + // Remove it from the PR body + checklist = checklist.replace(match[0], ''); + checklistChanged = true; + } + } + } + + // Put the PR body back together, need to add the markers back in + const newBody = contentBeforeChecklist + checklistStartsWith + checklist + checklistEndsWith + contentAfterChecklist; + + // Update the PR body + if (checklistChanged) { + await GithubUtils.octokit.pulls.update({ + owner: CONST.GITHUB_OWNER, + repo: CONST.APP_REPO, + pull_number: prNumber, + body: newBody, + }); + console.log('Updated PR checklist'); + } + + if (!isPassing) { + const err = new Error("New checks were added into checklist. Please check every box to verify you've thought about the item."); console.error(err); core.setFailed(err); - }); + } + + // check for completion + try { + const numberofItems = await getNumberOfItemsFromAuthorChecklist(); + checkPRForCompletedChecklist(numberofItems, newBody); + } catch (err) { + console.error(err); + core.setFailed(err); + } +} + +if (require.main === module) { + generateDynamicChecksAndCheckForCompletion(); +} + +module.exports = generateDynamicChecksAndCheckForCompletion; diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index b165c285143f..44aa2c36d4dd 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -6,17 +6,61 @@ module.exports = /******/ var __webpack_modules__ = ({ /***/ 5998: -/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const core = __nccwpck_require__(2186); const github = __nccwpck_require__(5438); const https = __nccwpck_require__(7211); -const GitHubUtils = __nccwpck_require__(7999); +const _ = __nccwpck_require__(250); +const GithubUtils = __nccwpck_require__(7999); +const CONST = __nccwpck_require__(4097); +const newComponentCategory = __nccwpck_require__(8045); const pathToAuthorChecklist = 'https://raw.githubusercontent.com/Expensify/App/main/.github/PULL_REQUEST_TEMPLATE.md'; -const authorChecklistStartsWith = '### PR Author Checklist'; -const reviewerChecklistStartsWith = '

PR Reviewer Checklist

'; -const issue = github.context.payload.issue ? github.context.payload.issue.number : github.context.payload.pull_request.number; +const checklistStartsWith = '### PR Author Checklist'; +const checklistEndsWith = "\r\n### Screenshots/Videos"; + +const prNumber = github.context.payload.pull_request.number; + +const CHECKLIST_CATEGORIES = { + NEW_COMPONENT: newComponentCategory, +}; + +/** + * Look at the contents of the pull request, and determine which checklist categories apply. + * + * @returns {Promise>} + */ +async function getChecklistCategoriesForPullRequest() { + const categories = []; + const changedFiles = await GithubUtils.paginate(GithubUtils.octokit.pulls.listFiles, { + owner: CONST.GITHUB_OWNER, + repo: CONST.APP_REPO, + pull_number: prNumber, + per_page: 100, + }); + + for (const category of _.values(CHECKLIST_CATEGORIES)) { + const {detectFunction, items} = category; + const categoryDetected = await detectFunction(changedFiles); + if (categoryDetected) { + categories.push(items); + } + } + return categories; +} + +/** + * Takes string in markdown, and divides it's content by two contant markers. + * + * @param {String} body + * @returns {[String, String, String]} + */ +function partitionWithChecklist(body) { + const [contentBeforeChecklist, contentAfterStartOfChecklist] = body.split(checklistStartsWith); + const [checklistContent, contentAfterChecklist] = contentAfterStartOfChecklist.split(checklistEndsWith); + return [contentBeforeChecklist, checklistContent, contentAfterChecklist]; +} /** * @returns {Promise} @@ -30,12 +74,10 @@ function getNumberOfItemsFromAuthorChecklist() { fileContents += chunk; }); res.on('end', () => { - // Currently, both the author and reviewer checklists are in the PR template file, so we need to do a little bit of parsing the PR description to get just the author - // checklist. - const contentAfterStartOfAuthorChecklist = fileContents.split(authorChecklistStartsWith).pop(); - const contentBeforeStartOfReviewerChecklist = contentAfterStartOfAuthorChecklist.split(reviewerChecklistStartsWith).shift(); + // eslint-disable-next-line no-unused-vars + const [_start, checklist] = partitionWithChecklist(fileContents); - const numberOfChecklistItems = (contentBeforeStartOfReviewerChecklist.match(/\[ \]/g) || []).length; + const numberOfChecklistItems = (checklist.match(/\[ \]/g) || []).length; resolve(numberOfChecklistItems); }); }) @@ -45,37 +87,207 @@ function getNumberOfItemsFromAuthorChecklist() { /** * @param {Number} numberOfChecklistItems + * @param {String} pullRequestBody */ -function checkIssueForCompletedChecklist(numberOfChecklistItems) { - GitHubUtils.getPullRequestBody(issue).then((pullRequestBody) => { - const contentAfterStartOfAuthorChecklist = pullRequestBody.split(authorChecklistStartsWith).pop(); - const contentOfAuthorChecklist = contentAfterStartOfAuthorChecklist.split(reviewerChecklistStartsWith).shift(); +function checkPRForCompletedChecklist(numberOfChecklistItems, pullRequestBody) { + // eslint-disable-next-line no-unused-vars + const [_start, checklist] = partitionWithChecklist(pullRequestBody); - const numberOfFinishedChecklistItems = (contentOfAuthorChecklist.match(/- \[x\]/gi) || []).length; - const numberOfUnfinishedChecklistItems = (contentOfAuthorChecklist.match(/- \[ \]/g) || []).length; + const numberOfFinishedChecklistItems = (checklist.match(/- \[x\]/gi) || []).length; + const numberOfUnfinishedChecklistItems = (checklist.match(/- \[ \]/g) || []).length; - const maxCompletedItems = numberOfChecklistItems + 2; - const minCompletedItems = numberOfChecklistItems - 2; + const minCompletedItems = numberOfChecklistItems - 2; - console.log(`You completed ${numberOfFinishedChecklistItems} out of ${numberOfChecklistItems} checklist items with ${numberOfUnfinishedChecklistItems} unfinished items`); + console.log(`You completed ${numberOfFinishedChecklistItems} out of ${numberOfChecklistItems} checklist items with ${numberOfUnfinishedChecklistItems} unfinished items`); - if (numberOfFinishedChecklistItems >= minCompletedItems && numberOfFinishedChecklistItems <= maxCompletedItems && numberOfUnfinishedChecklistItems === 0) { - console.log('PR Author checklist is complete 🎉'); - return; - } + if (numberOfFinishedChecklistItems >= minCompletedItems && numberOfUnfinishedChecklistItems === 0) { + console.log('PR Author checklist is complete 🎉'); + return; + } - console.log(`Make sure you are using the most up to date checklist found here: ${pathToAuthorChecklist}`); - core.setFailed("PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item."); - }); + console.log(`Make sure you are using the most up to date checklist found here: ${pathToAuthorChecklist}`); + core.setFailed("PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item."); } -getNumberOfItemsFromAuthorChecklist() - .then(checkIssueForCompletedChecklist) - .catch((err) => { +async function generateDynamicChecksAndCheckForCompletion() { + // Generate dynamic checks + const checks = new Set(); + const categories = await getChecklistCategoriesForPullRequest(); + for (const checksForCategory of categories) { + for (const check of checksForCategory) { + checks.add(check); + } + } + + const body = github.context.payload.pull_request.body; + + // eslint-disable-next-line prefer-const + let [contentBeforeChecklist, checklist, contentAfterChecklist] = partitionWithChecklist(body); + + let isPassing = true; + let checklistChanged = false; + for (const check of checks) { + // Check if it's already in the PR body, capturing the whether or not it's already checked + const regex = new RegExp(`- \\[([ x])] ${_.escapeRegExp(check)}`); + const match = regex.exec(checklist); + if (!match) { + // Add it to the PR body + isPassing = false; + checklist += `- [ ] ${check}\r\n`; + checklistChanged = true; + } else { + const isChecked = match[1] === 'x'; + if (!isChecked) { + isPassing = false; + } + } + } + const allChecks = _.flatten(_.map(_.values(CHECKLIST_CATEGORIES), 'items')); + for (const check of allChecks) { + if (!checks.has(check)) { + // Check if some dynamic check has been added with previous commit, but the check is not relevant anymore + const regex = new RegExp(`- \\[([ x])] ${_.escapeRegExp(check)}\r\n`); + const match = regex.exec(checklist); + if (match) { + // Remove it from the PR body + checklist = checklist.replace(match[0], ''); + checklistChanged = true; + } + } + } + + // Put the PR body back together, need to add the markers back in + const newBody = contentBeforeChecklist + checklistStartsWith + checklist + checklistEndsWith + contentAfterChecklist; + + // Update the PR body + if (checklistChanged) { + await GithubUtils.octokit.pulls.update({ + owner: CONST.GITHUB_OWNER, + repo: CONST.APP_REPO, + pull_number: prNumber, + body: newBody, + }); + console.log('Updated PR checklist'); + } + + if (!isPassing) { + const err = new Error("New checks were added into checklist. Please check every box to verify you've thought about the item."); + console.error(err); + core.setFailed(err); + } + + // check for completion + try { + const numberofItems = await getNumberOfItemsFromAuthorChecklist(); + checkPRForCompletedChecklist(numberofItems, newBody); + } catch (err) { console.error(err); core.setFailed(err); + } +} + +if (require.main === require.cache[eval('__filename')]) { + generateDynamicChecksAndCheckForCompletion(); +} + +module.exports = generateDynamicChecksAndCheckForCompletion; + + +/***/ }), + +/***/ 8045: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const {parse} = __nccwpck_require__(639); +const traverse = __nccwpck_require__(5008).default; +const github = __nccwpck_require__(5438); +const _ = __nccwpck_require__(250); +const CONST = __nccwpck_require__(4097); +const GithubUtils = __nccwpck_require__(7999); + +const items = [ + "I verified that similar component doesn't exist in the codebase", + 'I verified that all props are defined accurately and each prop has a `/** comment above it */`', + 'I verified that each file is named correctly', + 'I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone', + 'I verified that the only data being stored in component state is data necessary for rendering and nothing else', + "In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes", + 'For Class Components, any internal methods passed to components event handlers are bound to `this` properly so there are no scoping issues (i.e. for `onClick={this.submit}` the method `this.submit` should be bound to `this` in the constructor)', + 'I verified that component internal methods bound to `this` are necessary to be bound (i.e. avoid `this.submit = this.submit.bind(this);` if `this.submit` is never passed to a component event handler like `onClick`)', + 'I verified that all JSX used for rendering exists in the render method', + 'I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions', +]; + +function detectReactComponent(code, filename) { + if (!code) { + console.error('failed to get code from a filename', code, filename); + return; + } + const ast = parse(code, { + sourceType: 'module', + plugins: ['jsx'], // enable jsx plugin }); + let isReactComponent = false; + + traverse(ast, { + FunctionDeclaration(path) { + if (isReactComponent) { + return; + } + if (path.node.id && _.some(path.node.body.body, (node) => node.type === 'ReturnStatement' && node.argument.type === 'JSXElement')) { + console.log('Detected react component in file', filename); + isReactComponent = true; + } + }, + }); + + return isReactComponent; +} + +function nodeBase64ToUtf8(data) { + return Buffer.from(data, 'base64').toString('utf-8'); +} + +async function detectReactComponentInFile(filename) { + const params = { + owner: CONST.GITHUB_OWNER, + repo: CONST.APP_REPO, + path: filename, + ref: github.context.payload.pull_request.head.ref, + }; + try { + const {data} = await GithubUtils.octokit.repos.getContent(params); + const content = 'content' in data ? nodeBase64ToUtf8(data.content || '') : data; + return detectReactComponent(content, filename); + } catch (error) { + console.error(`An unknown error occurred with the GitHub API: ${error}, while fetching ${params}`); + } +} + +function filterFiles({filename, status}) { + if (status !== 'added') { + return false; + } + return filename.endsWith('.js') || filename.endsWith('.jsx') || filename.endsWith('.ts') || filename.endsWith('.tsx'); +} + +async function detectFunction(changedFiles) { + const filteredFiles = _.filter(changedFiles, filterFiles); + for (const file of filteredFiles) { + const result = await detectReactComponentInFile(file.filename); + if (result) { + return true; // If the check is true, exit directly + } + } + return false; +} + +module.exports = { + detectFunction, + items, +}; + /***/ }), @@ -3854,313 +4066,42202 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 4193: -/***/ ((__unused_webpack_module, exports) => { +/***/ 5211: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); - -const VERSION = "3.1.0"; - -/** - * Some “list” response that can be paginated have a different response structure - * - * They have a `total_count` key in the response (search also has `incomplete_results`, - * /installation/repositories also has `repository_selection`), as well as a key with - * the list of the items which name varies from endpoint to endpoint. - * - * Octokit normalizes these responses so that paginated results are always returned following - * the same structure. One challenge is that if the list response has only one page, no Link - * header is provided, so this header alone is not sufficient to check wether a response is - * paginated or not. - * - * We check if a "total_count" key is present in the response data, but also make sure that - * a "url" property is not, as the "Get the combined status for a specific ref" endpoint would - * otherwise match: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref - */ -function normalizePaginatedListResponse(response) { - // endpoints can respond with 204 if repository is empty - if (!response.data) { - return { ...response, - data: [] - }; - } - - const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); - if (!responseNeedsNormalization) return response; // keep the additional properties intact as there is currently no other way - // to retrieve the same information. - - const incompleteResults = response.data.incomplete_results; - const repositorySelection = response.data.repository_selection; - const totalCount = response.data.total_count; - delete response.data.incomplete_results; - delete response.data.repository_selection; - delete response.data.total_count; - const namespaceKey = Object.keys(response.data)[0]; - const data = response.data[namespaceKey]; - response.data = data; - - if (typeof incompleteResults !== "undefined") { - response.data.incomplete_results = incompleteResults; - } - - if (typeof repositorySelection !== "undefined") { - response.data.repository_selection = repositorySelection; +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.codeFrameColumns = codeFrameColumns; +exports.default = _default; +var _highlight = __nccwpck_require__(6860); +var _chalk = _interopRequireWildcard(__nccwpck_require__(8707), true); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +let chalkWithForcedColor = undefined; +function getChalk(forceColor) { + if (forceColor) { + var _chalkWithForcedColor; + (_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new _chalk.default.constructor({ + enabled: true, + level: 1 + }); + return chalkWithForcedColor; } - - response.data.total_count = totalCount; - return response; + return _chalk.default; } - -function iterator(octokit, route, parameters) { - const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters); - const requestMethod = typeof route === "function" ? route : octokit.request; - const method = options.method; - const headers = options.headers; - let url = options.url; +let deprecationWarningShown = false; +function getDefs(chalk) { return { - [Symbol.asyncIterator]: () => ({ - async next() { - if (!url) return { - done: true - }; - - try { - const response = await requestMethod({ - method, - url, - headers - }); - const normalizedResponse = normalizePaginatedListResponse(response); // `response.headers.link` format: - // '; rel="next", ; rel="last"' - // sets `url` to undefined if "next" URL is not present or `link` header is not set - - url = ((normalizedResponse.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1]; - return { - value: normalizedResponse - }; - } catch (error) { - if (error.status !== 409) throw error; - url = ""; - return { - value: { - status: 200, - headers: {}, - data: [] - } - }; - } + gutter: chalk.grey, + marker: chalk.red.bold, + message: chalk.red.bold + }; +} +const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; +function getMarkerLines(loc, source, opts) { + const startLoc = Object.assign({ + column: 0, + line: -1 + }, loc.start); + const endLoc = Object.assign({}, startLoc, loc.end); + const { + linesAbove = 2, + linesBelow = 3 + } = opts || {}; + const startLine = startLoc.line; + const startColumn = startLoc.column; + const endLine = endLoc.line; + const endColumn = endLoc.column; + let start = Math.max(startLine - (linesAbove + 1), 0); + let end = Math.min(source.length, endLine + linesBelow); + if (startLine === -1) { + start = 0; + } + if (endLine === -1) { + end = source.length; + } + const lineDiff = endLine - startLine; + const markerLines = {}; + if (lineDiff) { + for (let i = 0; i <= lineDiff; i++) { + const lineNumber = i + startLine; + if (!startColumn) { + markerLines[lineNumber] = true; + } else if (i === 0) { + const sourceLength = source[lineNumber - 1].length; + markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1]; + } else if (i === lineDiff) { + markerLines[lineNumber] = [0, endColumn]; + } else { + const sourceLength = source[lineNumber - i].length; + markerLines[lineNumber] = [0, sourceLength]; } - - }) + } + } else { + if (startColumn === endColumn) { + if (startColumn) { + markerLines[startLine] = [startColumn, 0]; + } else { + markerLines[startLine] = true; + } + } else { + markerLines[startLine] = [startColumn, endColumn - startColumn]; + } + } + return { + start, + end, + markerLines }; } - -function paginate(octokit, route, parameters, mapFn) { - if (typeof parameters === "function") { - mapFn = parameters; - parameters = undefined; +function codeFrameColumns(rawLines, loc, opts = {}) { + const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts); + const chalk = getChalk(opts.forceColor); + const defs = getDefs(chalk); + const maybeHighlight = (chalkFn, string) => { + return highlighted ? chalkFn(string) : string; + }; + const lines = rawLines.split(NEWLINE); + const { + start, + end, + markerLines + } = getMarkerLines(loc, lines, opts); + const hasColumns = loc.start && typeof loc.start.column === "number"; + const numberMaxWidth = String(end).length; + const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines; + let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => { + const number = start + 1 + index; + const paddedNumber = ` ${number}`.slice(-numberMaxWidth); + const gutter = ` ${paddedNumber} |`; + const hasMarker = markerLines[number]; + const lastMarkerLine = !markerLines[number + 1]; + if (hasMarker) { + let markerLine = ""; + if (Array.isArray(hasMarker)) { + const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " "); + const numberOfMarkers = hasMarker[1] || 1; + markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join(""); + if (lastMarkerLine && opts.message) { + markerLine += " " + maybeHighlight(defs.message, opts.message); + } + } + return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join(""); + } else { + return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`; + } + }).join("\n"); + if (opts.message && !hasColumns) { + frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`; + } + if (highlighted) { + return chalk.reset(frame); + } else { + return frame; } - - return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn); } - -function gather(octokit, results, iterator, mapFn) { - return iterator.next().then(result => { - if (result.done) { - return results; +function _default(rawLines, lineNumber, colNumber, opts = {}) { + if (!deprecationWarningShown) { + deprecationWarningShown = true; + const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`."; + if (process.emitWarning) { + process.emitWarning(message, "DeprecationWarning"); + } else { + const deprecationError = new Error(message); + deprecationError.name = "DeprecationWarning"; + console.warn(new Error(message)); } - - let earlyExit = false; - - function done() { - earlyExit = true; + } + colNumber = Math.max(colNumber, 0); + const location = { + start: { + column: colNumber, + line: lineNumber } + }; + return codeFrameColumns(rawLines, location, opts); +} - results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data); +//# sourceMappingURL=index.js.map - if (earlyExit) { - return results; - } - return gather(octokit, results, iterator, mapFn); - }); -} +/***/ }), -const composePaginateRest = Object.assign(paginate, { - iterator -}); +/***/ 7893: +/***/ ((__unused_webpack_module, exports) => { -const paginatingEndpoints = ["GET /app/hook/deliveries", "GET /app/installations", "GET /applications/grants", "GET /authorizations", "GET /enterprises/{enterprise}/actions/permissions/organizations", "GET /enterprises/{enterprise}/actions/runner-groups", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners", "GET /enterprises/{enterprise}/actions/runners", "GET /enterprises/{enterprise}/audit-log", "GET /enterprises/{enterprise}/code-scanning/alerts", "GET /enterprises/{enterprise}/secret-scanning/alerts", "GET /enterprises/{enterprise}/settings/billing/advanced-security", "GET /events", "GET /gists", "GET /gists/public", "GET /gists/starred", "GET /gists/{gist_id}/comments", "GET /gists/{gist_id}/commits", "GET /gists/{gist_id}/forks", "GET /installation/repositories", "GET /issues", "GET /licenses", "GET /marketplace_listing/plans", "GET /marketplace_listing/plans/{plan_id}/accounts", "GET /marketplace_listing/stubbed/plans", "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts", "GET /networks/{owner}/{repo}/events", "GET /notifications", "GET /organizations", "GET /orgs/{org}/actions/cache/usage-by-repository", "GET /orgs/{org}/actions/permissions/repositories", "GET /orgs/{org}/actions/runner-groups", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners", "GET /orgs/{org}/actions/runners", "GET /orgs/{org}/actions/secrets", "GET /orgs/{org}/actions/secrets/{secret_name}/repositories", "GET /orgs/{org}/audit-log", "GET /orgs/{org}/blocks", "GET /orgs/{org}/code-scanning/alerts", "GET /orgs/{org}/codespaces", "GET /orgs/{org}/credential-authorizations", "GET /orgs/{org}/dependabot/secrets", "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories", "GET /orgs/{org}/events", "GET /orgs/{org}/external-groups", "GET /orgs/{org}/failed_invitations", "GET /orgs/{org}/hooks", "GET /orgs/{org}/hooks/{hook_id}/deliveries", "GET /orgs/{org}/installations", "GET /orgs/{org}/invitations", "GET /orgs/{org}/invitations/{invitation_id}/teams", "GET /orgs/{org}/issues", "GET /orgs/{org}/members", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", "GET /orgs/{org}/projects", "GET /orgs/{org}/public_members", "GET /orgs/{org}/repos", "GET /orgs/{org}/secret-scanning/alerts", "GET /orgs/{org}/settings/billing/advanced-security", "GET /orgs/{org}/team-sync/groups", "GET /orgs/{org}/teams", "GET /orgs/{org}/teams/{team_slug}/discussions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/invitations", "GET /orgs/{org}/teams/{team_slug}/members", "GET /orgs/{org}/teams/{team_slug}/projects", "GET /orgs/{org}/teams/{team_slug}/repos", "GET /orgs/{org}/teams/{team_slug}/teams", "GET /projects/columns/{column_id}/cards", "GET /projects/{project_id}/collaborators", "GET /projects/{project_id}/columns", "GET /repos/{owner}/{repo}/actions/artifacts", "GET /repos/{owner}/{repo}/actions/caches", "GET /repos/{owner}/{repo}/actions/runners", "GET /repos/{owner}/{repo}/actions/runs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs", "GET /repos/{owner}/{repo}/actions/secrets", "GET /repos/{owner}/{repo}/actions/workflows", "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs", "GET /repos/{owner}/{repo}/assignees", "GET /repos/{owner}/{repo}/branches", "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", "GET /repos/{owner}/{repo}/code-scanning/alerts", "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", "GET /repos/{owner}/{repo}/code-scanning/analyses", "GET /repos/{owner}/{repo}/codespaces", "GET /repos/{owner}/{repo}/codespaces/devcontainers", "GET /repos/{owner}/{repo}/codespaces/secrets", "GET /repos/{owner}/{repo}/collaborators", "GET /repos/{owner}/{repo}/comments", "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/commits", "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments", "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls", "GET /repos/{owner}/{repo}/commits/{ref}/check-runs", "GET /repos/{owner}/{repo}/commits/{ref}/check-suites", "GET /repos/{owner}/{repo}/commits/{ref}/status", "GET /repos/{owner}/{repo}/commits/{ref}/statuses", "GET /repos/{owner}/{repo}/contributors", "GET /repos/{owner}/{repo}/dependabot/secrets", "GET /repos/{owner}/{repo}/deployments", "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses", "GET /repos/{owner}/{repo}/environments", "GET /repos/{owner}/{repo}/events", "GET /repos/{owner}/{repo}/forks", "GET /repos/{owner}/{repo}/git/matching-refs/{ref}", "GET /repos/{owner}/{repo}/hooks", "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries", "GET /repos/{owner}/{repo}/invitations", "GET /repos/{owner}/{repo}/issues", "GET /repos/{owner}/{repo}/issues/comments", "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/issues/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/comments", "GET /repos/{owner}/{repo}/issues/{issue_number}/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/labels", "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions", "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline", "GET /repos/{owner}/{repo}/keys", "GET /repos/{owner}/{repo}/labels", "GET /repos/{owner}/{repo}/milestones", "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels", "GET /repos/{owner}/{repo}/notifications", "GET /repos/{owner}/{repo}/pages/builds", "GET /repos/{owner}/{repo}/projects", "GET /repos/{owner}/{repo}/pulls", "GET /repos/{owner}/{repo}/pulls/comments", "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments", "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", "GET /repos/{owner}/{repo}/pulls/{pull_number}/files", "GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments", "GET /repos/{owner}/{repo}/releases", "GET /repos/{owner}/{repo}/releases/{release_id}/assets", "GET /repos/{owner}/{repo}/releases/{release_id}/reactions", "GET /repos/{owner}/{repo}/secret-scanning/alerts", "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations", "GET /repos/{owner}/{repo}/stargazers", "GET /repos/{owner}/{repo}/subscribers", "GET /repos/{owner}/{repo}/tags", "GET /repos/{owner}/{repo}/teams", "GET /repos/{owner}/{repo}/topics", "GET /repositories", "GET /repositories/{repository_id}/environments/{environment_name}/secrets", "GET /search/code", "GET /search/commits", "GET /search/issues", "GET /search/labels", "GET /search/repositories", "GET /search/topics", "GET /search/users", "GET /teams/{team_id}/discussions", "GET /teams/{team_id}/discussions/{discussion_number}/comments", "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /teams/{team_id}/discussions/{discussion_number}/reactions", "GET /teams/{team_id}/invitations", "GET /teams/{team_id}/members", "GET /teams/{team_id}/projects", "GET /teams/{team_id}/repos", "GET /teams/{team_id}/teams", "GET /user/blocks", "GET /user/codespaces", "GET /user/codespaces/secrets", "GET /user/emails", "GET /user/followers", "GET /user/following", "GET /user/gpg_keys", "GET /user/installations", "GET /user/installations/{installation_id}/repositories", "GET /user/issues", "GET /user/keys", "GET /user/marketplace_purchases", "GET /user/marketplace_purchases/stubbed", "GET /user/memberships/orgs", "GET /user/migrations", "GET /user/migrations/{migration_id}/repositories", "GET /user/orgs", "GET /user/packages", "GET /user/packages/{package_type}/{package_name}/versions", "GET /user/public_emails", "GET /user/repos", "GET /user/repository_invitations", "GET /user/starred", "GET /user/subscriptions", "GET /user/teams", "GET /users", "GET /users/{username}/events", "GET /users/{username}/events/orgs/{org}", "GET /users/{username}/events/public", "GET /users/{username}/followers", "GET /users/{username}/following", "GET /users/{username}/gists", "GET /users/{username}/gpg_keys", "GET /users/{username}/keys", "GET /users/{username}/orgs", "GET /users/{username}/packages", "GET /users/{username}/projects", "GET /users/{username}/received_events", "GET /users/{username}/received_events/public", "GET /users/{username}/repos", "GET /users/{username}/starred", "GET /users/{username}/subscriptions"]; +"use strict"; -function isPaginatingEndpoint(arg) { - if (typeof arg === "string") { - return paginatingEndpoints.includes(arg); - } else { - return false; - } -} -/** - * @param octokit Octokit instance - * @param options Options passed to Octokit constructor - */ - -function paginateRest(octokit) { - return { - paginate: Object.assign(paginate.bind(null, octokit), { - iterator: iterator.bind(null, octokit) - }) - }; +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +class Buffer { + constructor(map) { + this._map = null; + this._buf = ""; + this._str = ""; + this._appendCount = 0; + this._last = 0; + this._queue = []; + this._queueCursor = 0; + this._canMarkIdName = true; + this._position = { + line: 1, + column: 0 + }; + this._sourcePosition = { + identifierName: undefined, + identifierNamePos: undefined, + line: undefined, + column: undefined, + filename: undefined + }; + this._map = map; + this._allocQueue(); + } + _allocQueue() { + const queue = this._queue; + for (let i = 0; i < 16; i++) { + queue.push({ + char: 0, + repeat: 1, + line: undefined, + column: undefined, + identifierName: undefined, + identifierNamePos: undefined, + filename: "" + }); + } + } + _pushQueue(char, repeat, line, column, filename) { + const cursor = this._queueCursor; + if (cursor === this._queue.length) { + this._allocQueue(); + } + const item = this._queue[cursor]; + item.char = char; + item.repeat = repeat; + item.line = line; + item.column = column; + item.filename = filename; + this._queueCursor++; + } + _popQueue() { + if (this._queueCursor === 0) { + throw new Error("Cannot pop from empty queue"); + } + return this._queue[--this._queueCursor]; + } + get() { + this._flush(); + const map = this._map; + const result = { + code: (this._buf + this._str).trimRight(), + decodedMap: map == null ? void 0 : map.getDecoded(), + get __mergedMap() { + return this.map; + }, + get map() { + const resultMap = map ? map.get() : null; + result.map = resultMap; + return resultMap; + }, + set map(value) { + Object.defineProperty(result, "map", { + value, + writable: true + }); + }, + get rawMappings() { + const mappings = map == null ? void 0 : map.getRawMappings(); + result.rawMappings = mappings; + return mappings; + }, + set rawMappings(value) { + Object.defineProperty(result, "rawMappings", { + value, + writable: true + }); + } + }; + return result; + } + append(str, maybeNewline) { + this._flush(); + this._append(str, this._sourcePosition, maybeNewline); + } + appendChar(char) { + this._flush(); + this._appendChar(char, 1, this._sourcePosition); + } + queue(char) { + if (char === 10) { + while (this._queueCursor !== 0) { + const char = this._queue[this._queueCursor - 1].char; + if (char !== 32 && char !== 9) { + break; + } + this._queueCursor--; + } + } + const sourcePosition = this._sourcePosition; + this._pushQueue(char, 1, sourcePosition.line, sourcePosition.column, sourcePosition.filename); + } + queueIndentation(char, repeat) { + this._pushQueue(char, repeat, undefined, undefined, undefined); + } + _flush() { + const queueCursor = this._queueCursor; + const queue = this._queue; + for (let i = 0; i < queueCursor; i++) { + const item = queue[i]; + this._appendChar(item.char, item.repeat, item); + } + this._queueCursor = 0; + } + _appendChar(char, repeat, sourcePos) { + this._last = char; + this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char); + if (char !== 10) { + this._mark(sourcePos.line, sourcePos.column, sourcePos.identifierName, sourcePos.identifierNamePos, sourcePos.filename); + this._position.column += repeat; + } else { + this._position.line++; + this._position.column = 0; + } + if (this._canMarkIdName) { + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } + } + _append(str, sourcePos, maybeNewline) { + const len = str.length; + const position = this._position; + this._last = str.charCodeAt(len - 1); + if (++this._appendCount > 4096) { + +this._str; + this._buf += this._str; + this._str = str; + this._appendCount = 0; + } else { + this._str += str; + } + if (!maybeNewline && !this._map) { + position.column += len; + return; + } + const { + column, + identifierName, + identifierNamePos, + filename + } = sourcePos; + let line = sourcePos.line; + if ((identifierName != null || identifierNamePos != null) && this._canMarkIdName) { + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } + let i = str.indexOf("\n"); + let last = 0; + if (i !== 0) { + this._mark(line, column, identifierName, identifierNamePos, filename); + } + while (i !== -1) { + position.line++; + position.column = 0; + last = i + 1; + if (last < len && line !== undefined) { + this._mark(++line, 0, null, null, filename); + } + i = str.indexOf("\n", last); + } + position.column += len - last; + } + _mark(line, column, identifierName, identifierNamePos, filename) { + var _this$_map; + (_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position, line, column, identifierName, identifierNamePos, filename); + } + removeTrailingNewline() { + const queueCursor = this._queueCursor; + if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 10) { + this._queueCursor--; + } + } + removeLastSemicolon() { + const queueCursor = this._queueCursor; + if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 59) { + this._queueCursor--; + } + } + getLastChar() { + const queueCursor = this._queueCursor; + return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last; + } + getNewlineCount() { + const queueCursor = this._queueCursor; + let count = 0; + if (queueCursor === 0) return this._last === 10 ? 1 : 0; + for (let i = queueCursor - 1; i >= 0; i--) { + if (this._queue[i].char !== 10) { + break; + } + count++; + } + return count === queueCursor && this._last === 10 ? count + 1 : count; + } + endsWithCharAndNewline() { + const queue = this._queue; + const queueCursor = this._queueCursor; + if (queueCursor !== 0) { + const lastCp = queue[queueCursor - 1].char; + if (lastCp !== 10) return; + if (queueCursor > 1) { + return queue[queueCursor - 2].char; + } else { + return this._last; + } + } + } + hasContent() { + return this._queueCursor !== 0 || !!this._last; + } + exactSource(loc, cb) { + if (!this._map) { + cb(); + return; + } + this.source("start", loc); + const identifierName = loc.identifierName; + const sourcePos = this._sourcePosition; + if (identifierName) { + this._canMarkIdName = false; + sourcePos.identifierName = identifierName; + } + cb(); + if (identifierName) { + this._canMarkIdName = true; + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } + this.source("end", loc); + } + source(prop, loc) { + if (!this._map) return; + this._normalizePosition(prop, loc, 0); + } + sourceWithOffset(prop, loc, columnOffset) { + if (!this._map) return; + this._normalizePosition(prop, loc, columnOffset); + } + withSource(prop, loc, cb) { + if (this._map) { + this.source(prop, loc); + } + cb(); + } + _normalizePosition(prop, loc, columnOffset) { + const pos = loc[prop]; + const target = this._sourcePosition; + if (pos) { + target.line = pos.line; + target.column = Math.max(pos.column + columnOffset, 0); + target.filename = loc.filename; + } + } + getCurrentColumn() { + const queue = this._queue; + const queueCursor = this._queueCursor; + let lastIndex = -1; + let len = 0; + for (let i = 0; i < queueCursor; i++) { + const item = queue[i]; + if (item.char === 10) { + lastIndex = len; + } + len += item.repeat; + } + return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex; + } + getCurrentLine() { + let count = 0; + const queue = this._queue; + for (let i = 0; i < this._queueCursor; i++) { + if (queue[i].char === 10) { + count++; + } + } + return this._position.line + count; + } } -paginateRest.VERSION = VERSION; +exports.default = Buffer; -exports.composePaginateRest = composePaginateRest; -exports.isPaginatingEndpoint = isPaginatingEndpoint; -exports.paginateRest = paginateRest; -exports.paginatingEndpoints = paginatingEndpoints; -//# sourceMappingURL=index.js.map +//# sourceMappingURL=buffer.js.map /***/ }), -/***/ 3044: +/***/ 8521: /***/ ((__unused_webpack_module, exports) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.BlockStatement = BlockStatement; +exports.Directive = Directive; +exports.DirectiveLiteral = DirectiveLiteral; +exports.File = File; +exports.InterpreterDirective = InterpreterDirective; +exports.Placeholder = Placeholder; +exports.Program = Program; +function File(node) { + if (node.program) { + this.print(node.program.interpreter, node); + } + this.print(node.program, node); +} +function Program(node) { + var _node$directives; + this.noIndentInnerCommentsHere(); + this.printInnerComments(); + const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length; + if (directivesLen) { + var _node$directives$trai; + const newline = node.body.length ? 2 : 1; + this.printSequence(node.directives, node, { + trailingCommentsLineOffset: newline + }); + if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) { + this.newline(newline); + } + } + this.printSequence(node.body, node); +} +function BlockStatement(node) { + var _node$directives2; + this.tokenChar(123); + const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length; + if (directivesLen) { + var _node$directives$trai2; + const newline = node.body.length ? 2 : 1; + this.printSequence(node.directives, node, { + indent: true, + trailingCommentsLineOffset: newline + }); + if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) { + this.newline(newline); + } + } + this.printSequence(node.body, node, { + indent: true + }); + this.rightBrace(node); +} +function Directive(node) { + this.print(node.value, node); + this.semicolon(); +} +const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/; +const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/; +function DirectiveLiteral(node) { + const raw = this.getPossibleRaw(node); + if (!this.format.minified && raw !== undefined) { + this.token(raw); + return; + } + const { + value + } = node; + if (!unescapedDoubleQuoteRE.test(value)) { + this.token(`"${value}"`); + } else if (!unescapedSingleQuoteRE.test(value)) { + this.token(`'${value}'`); + } else { + throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes."); + } +} +function InterpreterDirective(node) { + this.token(`#!${node.value}`); + this.newline(1, true); +} +function Placeholder(node) { + this.token("%%"); + this.print(node.name); + this.token("%%"); + if (node.expectedNode === "Statement") { + this.semicolon(); + } +} -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); +//# sourceMappingURL=base.js.map - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) { - symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - } +/***/ }), - keys.push.apply(keys, symbols); - } +/***/ 7366: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - return keys; -} +"use strict"; -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ClassAccessorProperty = ClassAccessorProperty; +exports.ClassBody = ClassBody; +exports.ClassExpression = exports.ClassDeclaration = ClassDeclaration; +exports.ClassMethod = ClassMethod; +exports.ClassPrivateMethod = ClassPrivateMethod; +exports.ClassPrivateProperty = ClassPrivateProperty; +exports.ClassProperty = ClassProperty; +exports.StaticBlock = StaticBlock; +exports._classMethodHead = _classMethodHead; +var _t = __nccwpck_require__(7012); +const { + isExportDefaultDeclaration, + isExportNamedDeclaration +} = _t; +function ClassDeclaration(node, parent) { + const inExport = isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent); + if (!inExport || !this._shouldPrintDecoratorsBeforeExport(parent)) { + this.printJoin(node.decorators, node); } - - return target; + if (node.declare) { + this.word("declare"); + this.space(); + } + if (node.abstract) { + this.word("abstract"); + this.space(); + } + this.word("class"); + if (node.id) { + this.space(); + this.print(node.id, node); + } + this.print(node.typeParameters, node); + if (node.superClass) { + this.space(); + this.word("extends"); + this.space(); + this.print(node.superClass, node); + this.print(node.superTypeParameters, node); + } + if (node.implements) { + this.space(); + this.word("implements"); + this.space(); + this.printList(node.implements, node); + } + this.space(); + this.print(node.body, node); } - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true +function ClassBody(node) { + this.tokenChar(123); + if (node.body.length === 0) { + this.tokenChar(125); + } else { + this.newline(); + this.printSequence(node.body, node, { + indent: true }); + if (!this.endsWith(10)) this.newline(); + this.rightBrace(node); + } +} +function ClassProperty(node) { + var _node$key$loc; + this.printJoin(node.decorators, node); + const endLine = (_node$key$loc = node.key.loc) == null || (_node$key$loc = _node$key$loc.end) == null ? void 0 : _node$key$loc.line; + if (endLine) this.catchUp(endLine); + this.tsPrintClassMemberModifiers(node); + if (node.computed) { + this.tokenChar(91); + this.print(node.key, node); + this.tokenChar(93); } else { - obj[key] = value; + this._variance(node); + this.print(node.key, node); + } + if (node.optional) { + this.tokenChar(63); + } + if (node.definite) { + this.tokenChar(33); + } + this.print(node.typeAnnotation, node); + if (node.value) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.value, node); + } + this.semicolon(); +} +function ClassAccessorProperty(node) { + var _node$key$loc2; + this.printJoin(node.decorators, node); + const endLine = (_node$key$loc2 = node.key.loc) == null || (_node$key$loc2 = _node$key$loc2.end) == null ? void 0 : _node$key$loc2.line; + if (endLine) this.catchUp(endLine); + this.tsPrintClassMemberModifiers(node); + this.word("accessor", true); + this.space(); + if (node.computed) { + this.tokenChar(91); + this.print(node.key, node); + this.tokenChar(93); + } else { + this._variance(node); + this.print(node.key, node); + } + if (node.optional) { + this.tokenChar(63); + } + if (node.definite) { + this.tokenChar(33); + } + this.print(node.typeAnnotation, node); + if (node.value) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.value, node); + } + this.semicolon(); +} +function ClassPrivateProperty(node) { + this.printJoin(node.decorators, node); + if (node.static) { + this.word("static"); + this.space(); + } + this.print(node.key, node); + this.print(node.typeAnnotation, node); + if (node.value) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.value, node); + } + this.semicolon(); +} +function ClassMethod(node) { + this._classMethodHead(node); + this.space(); + this.print(node.body, node); +} +function ClassPrivateMethod(node) { + this._classMethodHead(node); + this.space(); + this.print(node.body, node); +} +function _classMethodHead(node) { + var _node$key$loc3; + this.printJoin(node.decorators, node); + const endLine = (_node$key$loc3 = node.key.loc) == null || (_node$key$loc3 = _node$key$loc3.end) == null ? void 0 : _node$key$loc3.line; + if (endLine) this.catchUp(endLine); + this.tsPrintClassMemberModifiers(node); + this._methodHead(node); +} +function StaticBlock(node) { + this.word("static"); + this.space(); + this.tokenChar(123); + if (node.body.length === 0) { + this.tokenChar(125); + } else { + this.newline(); + this.printSequence(node.body, node, { + indent: true + }); + this.rightBrace(node); } - - return obj; } -const Endpoints = { - actions: { - addCustomLabelsToSelfHostedRunnerForOrg: ["POST /orgs/{org}/actions/runners/{runner_id}/labels"], - addCustomLabelsToSelfHostedRunnerForRepo: ["POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], - addSelectedRepoToOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], - approveWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve"], - cancelWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"], - createOrUpdateEnvironmentSecret: ["PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], - createOrUpdateOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}"], - createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}"], - createRegistrationTokenForOrg: ["POST /orgs/{org}/actions/runners/registration-token"], - createRegistrationTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/registration-token"], - createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"], - createRemoveTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/remove-token"], - createWorkflowDispatch: ["POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"], - deleteActionsCacheById: ["DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}"], - deleteActionsCacheByKey: ["DELETE /repos/{owner}/{repo}/actions/caches{?key,ref}"], - deleteArtifact: ["DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], - deleteEnvironmentSecret: ["DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], - deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"], - deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}"], - deleteSelfHostedRunnerFromOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}"], - deleteSelfHostedRunnerFromRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"], - deleteWorkflowRun: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}"], - deleteWorkflowRunLogs: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], - disableSelectedRepositoryGithubActionsOrganization: ["DELETE /orgs/{org}/actions/permissions/repositories/{repository_id}"], - disableWorkflow: ["PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable"], - downloadArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"], - downloadJobLogsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"], - downloadWorkflowRunAttemptLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs"], - downloadWorkflowRunLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], - enableSelectedRepositoryGithubActionsOrganization: ["PUT /orgs/{org}/actions/permissions/repositories/{repository_id}"], - enableWorkflow: ["PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable"], - getActionsCacheList: ["GET /repos/{owner}/{repo}/actions/caches"], - getActionsCacheUsage: ["GET /repos/{owner}/{repo}/actions/cache/usage"], - getActionsCacheUsageByRepoForOrg: ["GET /orgs/{org}/actions/cache/usage-by-repository"], - getActionsCacheUsageForEnterprise: ["GET /enterprises/{enterprise}/actions/cache/usage"], - getActionsCacheUsageForOrg: ["GET /orgs/{org}/actions/cache/usage"], - getAllowedActionsOrganization: ["GET /orgs/{org}/actions/permissions/selected-actions"], - getAllowedActionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/selected-actions"], - getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], - getEnvironmentPublicKey: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key"], - getEnvironmentSecret: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], - getGithubActionsDefaultWorkflowPermissionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/workflow"], - getGithubActionsDefaultWorkflowPermissionsOrganization: ["GET /orgs/{org}/actions/permissions/workflow"], - getGithubActionsDefaultWorkflowPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/workflow"], - getGithubActionsPermissionsOrganization: ["GET /orgs/{org}/actions/permissions"], - getGithubActionsPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions"], - getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"], - getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"], - getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"], - getPendingDeploymentsForRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"], - getRepoPermissions: ["GET /repos/{owner}/{repo}/actions/permissions", {}, { - renamed: ["actions", "getGithubActionsPermissionsRepository"] - }], - getRepoPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"], - getRepoSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{secret_name}"], - getReviewsForRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals"], - getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"], - getSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}"], - getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"], - getWorkflowAccessToRepository: ["GET /repos/{owner}/{repo}/actions/permissions/access"], - getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"], - getWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}"], - getWorkflowRunUsage: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"], - getWorkflowUsage: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing"], - listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"], - listEnvironmentSecrets: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets"], - listJobsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"], - listJobsForWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs"], - listLabelsForSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}/labels"], - listLabelsForSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], - listOrgSecrets: ["GET /orgs/{org}/actions/secrets"], - listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"], +//# sourceMappingURL=classes.js.map + + +/***/ }), + +/***/ 463: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.LogicalExpression = exports.BinaryExpression = exports.AssignmentExpression = AssignmentExpression; +exports.AssignmentPattern = AssignmentPattern; +exports.AwaitExpression = AwaitExpression; +exports.BindExpression = BindExpression; +exports.CallExpression = CallExpression; +exports.ConditionalExpression = ConditionalExpression; +exports.Decorator = Decorator; +exports.DoExpression = DoExpression; +exports.EmptyStatement = EmptyStatement; +exports.ExpressionStatement = ExpressionStatement; +exports.Import = Import; +exports.MemberExpression = MemberExpression; +exports.MetaProperty = MetaProperty; +exports.ModuleExpression = ModuleExpression; +exports.NewExpression = NewExpression; +exports.OptionalCallExpression = OptionalCallExpression; +exports.OptionalMemberExpression = OptionalMemberExpression; +exports.ParenthesizedExpression = ParenthesizedExpression; +exports.PrivateName = PrivateName; +exports.SequenceExpression = SequenceExpression; +exports.Super = Super; +exports.ThisExpression = ThisExpression; +exports.UnaryExpression = UnaryExpression; +exports.UpdateExpression = UpdateExpression; +exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier; +exports.YieldExpression = YieldExpression; +exports._shouldPrintDecoratorsBeforeExport = _shouldPrintDecoratorsBeforeExport; +var _t = __nccwpck_require__(7012); +var n = __nccwpck_require__(5051); +const { + isCallExpression, + isLiteral, + isMemberExpression, + isNewExpression +} = _t; +function UnaryExpression(node) { + const { + operator + } = node; + if (operator === "void" || operator === "delete" || operator === "typeof" || operator === "throw") { + this.word(operator); + this.space(); + } else { + this.token(operator); + } + this.print(node.argument, node); +} +function DoExpression(node) { + if (node.async) { + this.word("async", true); + this.space(); + } + this.word("do"); + this.space(); + this.print(node.body, node); +} +function ParenthesizedExpression(node) { + this.tokenChar(40); + this.print(node.expression, node); + this.rightParens(node); +} +function UpdateExpression(node) { + if (node.prefix) { + this.token(node.operator); + this.print(node.argument, node); + } else { + this.printTerminatorless(node.argument, node, true); + this.token(node.operator); + } +} +function ConditionalExpression(node) { + this.print(node.test, node); + this.space(); + this.tokenChar(63); + this.space(); + this.print(node.consequent, node); + this.space(); + this.tokenChar(58); + this.space(); + this.print(node.alternate, node); +} +function NewExpression(node, parent) { + this.word("new"); + this.space(); + this.print(node.callee, node); + if (this.format.minified && node.arguments.length === 0 && !node.optional && !isCallExpression(parent, { + callee: node + }) && !isMemberExpression(parent) && !isNewExpression(parent)) { + return; + } + this.print(node.typeArguments, node); + this.print(node.typeParameters, node); + if (node.optional) { + this.token("?."); + } + this.tokenChar(40); + this.printList(node.arguments, node); + this.rightParens(node); +} +function SequenceExpression(node) { + this.printList(node.expressions, node); +} +function ThisExpression() { + this.word("this"); +} +function Super() { + this.word("super"); +} +function isDecoratorMemberExpression(node) { + switch (node.type) { + case "Identifier": + return true; + case "MemberExpression": + return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object); + default: + return false; + } +} +function shouldParenthesizeDecoratorExpression(node) { + if (node.type === "ParenthesizedExpression") { + return false; + } + return !isDecoratorMemberExpression(node.type === "CallExpression" ? node.callee : node); +} +function _shouldPrintDecoratorsBeforeExport(node) { + if (typeof this.format.decoratorsBeforeExport === "boolean") { + return this.format.decoratorsBeforeExport; + } + return typeof node.start === "number" && node.start === node.declaration.start; +} +function Decorator(node) { + this.tokenChar(64); + const { + expression + } = node; + if (shouldParenthesizeDecoratorExpression(expression)) { + this.tokenChar(40); + this.print(expression, node); + this.tokenChar(41); + } else { + this.print(expression, node); + } + this.newline(); +} +function OptionalMemberExpression(node) { + let { + computed + } = node; + const { + optional, + property + } = node; + this.print(node.object, node); + if (!computed && isMemberExpression(property)) { + throw new TypeError("Got a MemberExpression for MemberExpression property"); + } + if (isLiteral(property) && typeof property.value === "number") { + computed = true; + } + if (optional) { + this.token("?."); + } + if (computed) { + this.tokenChar(91); + this.print(property, node); + this.tokenChar(93); + } else { + if (!optional) { + this.tokenChar(46); + } + this.print(property, node); + } +} +function OptionalCallExpression(node) { + this.print(node.callee, node); + this.print(node.typeParameters, node); + if (node.optional) { + this.token("?."); + } + this.print(node.typeArguments, node); + this.tokenChar(40); + this.printList(node.arguments, node); + this.rightParens(node); +} +function CallExpression(node) { + this.print(node.callee, node); + this.print(node.typeArguments, node); + this.print(node.typeParameters, node); + this.tokenChar(40); + this.printList(node.arguments, node); + this.rightParens(node); +} +function Import() { + this.word("import"); +} +function AwaitExpression(node) { + this.word("await"); + if (node.argument) { + this.space(); + this.printTerminatorless(node.argument, node, false); + } +} +function YieldExpression(node) { + this.word("yield", true); + if (node.delegate) { + this.tokenChar(42); + if (node.argument) { + this.space(); + this.print(node.argument, node); + } + } else { + if (node.argument) { + this.space(); + this.printTerminatorless(node.argument, node, false); + } + } +} +function EmptyStatement() { + this.semicolon(true); +} +function ExpressionStatement(node) { + this.print(node.expression, node); + this.semicolon(); +} +function AssignmentPattern(node) { + this.print(node.left, node); + if (node.left.optional) this.tokenChar(63); + this.print(node.left.typeAnnotation, node); + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.right, node); +} +function AssignmentExpression(node, parent) { + const parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent); + if (parens) { + this.tokenChar(40); + } + this.print(node.left, node); + this.space(); + if (node.operator === "in" || node.operator === "instanceof") { + this.word(node.operator); + } else { + this.token(node.operator); + } + this.space(); + this.print(node.right, node); + if (parens) { + this.tokenChar(41); + } +} +function BindExpression(node) { + this.print(node.object, node); + this.token("::"); + this.print(node.callee, node); +} +function MemberExpression(node) { + this.print(node.object, node); + if (!node.computed && isMemberExpression(node.property)) { + throw new TypeError("Got a MemberExpression for MemberExpression property"); + } + let computed = node.computed; + if (isLiteral(node.property) && typeof node.property.value === "number") { + computed = true; + } + if (computed) { + this.tokenChar(91); + this.print(node.property, node); + this.tokenChar(93); + } else { + this.tokenChar(46); + this.print(node.property, node); + } +} +function MetaProperty(node) { + this.print(node.meta, node); + this.tokenChar(46); + this.print(node.property, node); +} +function PrivateName(node) { + this.tokenChar(35); + this.print(node.id, node); +} +function V8IntrinsicIdentifier(node) { + this.tokenChar(37); + this.word(node.name); +} +function ModuleExpression(node) { + this.word("module", true); + this.space(); + this.tokenChar(123); + this.indent(); + const { + body + } = node; + if (body.body.length || body.directives.length) { + this.newline(); + } + this.print(body, node); + this.dedent(); + this.rightBrace(node); +} + +//# sourceMappingURL=expressions.js.map + + +/***/ }), + +/***/ 1346: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.AnyTypeAnnotation = AnyTypeAnnotation; +exports.ArrayTypeAnnotation = ArrayTypeAnnotation; +exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation; +exports.BooleanTypeAnnotation = BooleanTypeAnnotation; +exports.DeclareClass = DeclareClass; +exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration; +exports.DeclareExportDeclaration = DeclareExportDeclaration; +exports.DeclareFunction = DeclareFunction; +exports.DeclareInterface = DeclareInterface; +exports.DeclareModule = DeclareModule; +exports.DeclareModuleExports = DeclareModuleExports; +exports.DeclareOpaqueType = DeclareOpaqueType; +exports.DeclareTypeAlias = DeclareTypeAlias; +exports.DeclareVariable = DeclareVariable; +exports.DeclaredPredicate = DeclaredPredicate; +exports.EmptyTypeAnnotation = EmptyTypeAnnotation; +exports.EnumBooleanBody = EnumBooleanBody; +exports.EnumBooleanMember = EnumBooleanMember; +exports.EnumDeclaration = EnumDeclaration; +exports.EnumDefaultedMember = EnumDefaultedMember; +exports.EnumNumberBody = EnumNumberBody; +exports.EnumNumberMember = EnumNumberMember; +exports.EnumStringBody = EnumStringBody; +exports.EnumStringMember = EnumStringMember; +exports.EnumSymbolBody = EnumSymbolBody; +exports.ExistsTypeAnnotation = ExistsTypeAnnotation; +exports.FunctionTypeAnnotation = FunctionTypeAnnotation; +exports.FunctionTypeParam = FunctionTypeParam; +exports.IndexedAccessType = IndexedAccessType; +exports.InferredPredicate = InferredPredicate; +exports.InterfaceDeclaration = InterfaceDeclaration; +exports.GenericTypeAnnotation = exports.ClassImplements = exports.InterfaceExtends = InterfaceExtends; +exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation; +exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation; +exports.MixedTypeAnnotation = MixedTypeAnnotation; +exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation; +exports.NullableTypeAnnotation = NullableTypeAnnotation; +Object.defineProperty(exports, "NumberLiteralTypeAnnotation", ({ + enumerable: true, + get: function () { + return _types2.NumericLiteral; + } +})); +exports.NumberTypeAnnotation = NumberTypeAnnotation; +exports.ObjectTypeAnnotation = ObjectTypeAnnotation; +exports.ObjectTypeCallProperty = ObjectTypeCallProperty; +exports.ObjectTypeIndexer = ObjectTypeIndexer; +exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot; +exports.ObjectTypeProperty = ObjectTypeProperty; +exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty; +exports.OpaqueType = OpaqueType; +exports.OptionalIndexedAccessType = OptionalIndexedAccessType; +exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier; +Object.defineProperty(exports, "StringLiteralTypeAnnotation", ({ + enumerable: true, + get: function () { + return _types2.StringLiteral; + } +})); +exports.StringTypeAnnotation = StringTypeAnnotation; +exports.SymbolTypeAnnotation = SymbolTypeAnnotation; +exports.ThisTypeAnnotation = ThisTypeAnnotation; +exports.TupleTypeAnnotation = TupleTypeAnnotation; +exports.TypeAlias = TypeAlias; +exports.TypeAnnotation = TypeAnnotation; +exports.TypeCastExpression = TypeCastExpression; +exports.TypeParameter = TypeParameter; +exports.TypeParameterDeclaration = exports.TypeParameterInstantiation = TypeParameterInstantiation; +exports.TypeofTypeAnnotation = TypeofTypeAnnotation; +exports.UnionTypeAnnotation = UnionTypeAnnotation; +exports.Variance = Variance; +exports.VoidTypeAnnotation = VoidTypeAnnotation; +exports._interfaceish = _interfaceish; +exports._variance = _variance; +var _t = __nccwpck_require__(7012); +var _modules = __nccwpck_require__(8798); +var _types2 = __nccwpck_require__(3400); +const { + isDeclareExportDeclaration, + isStatement +} = _t; +function AnyTypeAnnotation() { + this.word("any"); +} +function ArrayTypeAnnotation(node) { + this.print(node.elementType, node, true); + this.tokenChar(91); + this.tokenChar(93); +} +function BooleanTypeAnnotation() { + this.word("boolean"); +} +function BooleanLiteralTypeAnnotation(node) { + this.word(node.value ? "true" : "false"); +} +function NullLiteralTypeAnnotation() { + this.word("null"); +} +function DeclareClass(node, parent) { + if (!isDeclareExportDeclaration(parent)) { + this.word("declare"); + this.space(); + } + this.word("class"); + this.space(); + this._interfaceish(node); +} +function DeclareFunction(node, parent) { + if (!isDeclareExportDeclaration(parent)) { + this.word("declare"); + this.space(); + } + this.word("function"); + this.space(); + this.print(node.id, node); + this.print(node.id.typeAnnotation.typeAnnotation, node); + if (node.predicate) { + this.space(); + this.print(node.predicate, node); + } + this.semicolon(); +} +function InferredPredicate() { + this.tokenChar(37); + this.word("checks"); +} +function DeclaredPredicate(node) { + this.tokenChar(37); + this.word("checks"); + this.tokenChar(40); + this.print(node.value, node); + this.tokenChar(41); +} +function DeclareInterface(node) { + this.word("declare"); + this.space(); + this.InterfaceDeclaration(node); +} +function DeclareModule(node) { + this.word("declare"); + this.space(); + this.word("module"); + this.space(); + this.print(node.id, node); + this.space(); + this.print(node.body, node); +} +function DeclareModuleExports(node) { + this.word("declare"); + this.space(); + this.word("module"); + this.tokenChar(46); + this.word("exports"); + this.print(node.typeAnnotation, node); +} +function DeclareTypeAlias(node) { + this.word("declare"); + this.space(); + this.TypeAlias(node); +} +function DeclareOpaqueType(node, parent) { + if (!isDeclareExportDeclaration(parent)) { + this.word("declare"); + this.space(); + } + this.OpaqueType(node); +} +function DeclareVariable(node, parent) { + if (!isDeclareExportDeclaration(parent)) { + this.word("declare"); + this.space(); + } + this.word("var"); + this.space(); + this.print(node.id, node); + this.print(node.id.typeAnnotation, node); + this.semicolon(); +} +function DeclareExportDeclaration(node) { + this.word("declare"); + this.space(); + this.word("export"); + this.space(); + if (node.default) { + this.word("default"); + this.space(); + } + FlowExportDeclaration.call(this, node); +} +function DeclareExportAllDeclaration(node) { + this.word("declare"); + this.space(); + _modules.ExportAllDeclaration.call(this, node); +} +function EnumDeclaration(node) { + const { + id, + body + } = node; + this.word("enum"); + this.space(); + this.print(id, node); + this.print(body, node); +} +function enumExplicitType(context, name, hasExplicitType) { + if (hasExplicitType) { + context.space(); + context.word("of"); + context.space(); + context.word(name); + } + context.space(); +} +function enumBody(context, node) { + const { + members + } = node; + context.token("{"); + context.indent(); + context.newline(); + for (const member of members) { + context.print(member, node); + context.newline(); + } + if (node.hasUnknownMembers) { + context.token("..."); + context.newline(); + } + context.dedent(); + context.token("}"); +} +function EnumBooleanBody(node) { + const { + explicitType + } = node; + enumExplicitType(this, "boolean", explicitType); + enumBody(this, node); +} +function EnumNumberBody(node) { + const { + explicitType + } = node; + enumExplicitType(this, "number", explicitType); + enumBody(this, node); +} +function EnumStringBody(node) { + const { + explicitType + } = node; + enumExplicitType(this, "string", explicitType); + enumBody(this, node); +} +function EnumSymbolBody(node) { + enumExplicitType(this, "symbol", true); + enumBody(this, node); +} +function EnumDefaultedMember(node) { + const { + id + } = node; + this.print(id, node); + this.tokenChar(44); +} +function enumInitializedMember(context, node) { + const { + id, + init + } = node; + context.print(id, node); + context.space(); + context.token("="); + context.space(); + context.print(init, node); + context.token(","); +} +function EnumBooleanMember(node) { + enumInitializedMember(this, node); +} +function EnumNumberMember(node) { + enumInitializedMember(this, node); +} +function EnumStringMember(node) { + enumInitializedMember(this, node); +} +function FlowExportDeclaration(node) { + if (node.declaration) { + const declar = node.declaration; + this.print(declar, node); + if (!isStatement(declar)) this.semicolon(); + } else { + this.tokenChar(123); + if (node.specifiers.length) { + this.space(); + this.printList(node.specifiers, node); + this.space(); + } + this.tokenChar(125); + if (node.source) { + this.space(); + this.word("from"); + this.space(); + this.print(node.source, node); + } + this.semicolon(); + } +} +function ExistsTypeAnnotation() { + this.tokenChar(42); +} +function FunctionTypeAnnotation(node, parent) { + this.print(node.typeParameters, node); + this.tokenChar(40); + if (node.this) { + this.word("this"); + this.tokenChar(58); + this.space(); + this.print(node.this.typeAnnotation, node); + if (node.params.length || node.rest) { + this.tokenChar(44); + this.space(); + } + } + this.printList(node.params, node); + if (node.rest) { + if (node.params.length) { + this.tokenChar(44); + this.space(); + } + this.token("..."); + this.print(node.rest, node); + } + this.tokenChar(41); + const type = parent == null ? void 0 : parent.type; + if (type != null && (type === "ObjectTypeCallProperty" || type === "ObjectTypeInternalSlot" || type === "DeclareFunction" || type === "ObjectTypeProperty" && parent.method)) { + this.tokenChar(58); + } else { + this.space(); + this.token("=>"); + } + this.space(); + this.print(node.returnType, node); +} +function FunctionTypeParam(node) { + this.print(node.name, node); + if (node.optional) this.tokenChar(63); + if (node.name) { + this.tokenChar(58); + this.space(); + } + this.print(node.typeAnnotation, node); +} +function InterfaceExtends(node) { + this.print(node.id, node); + this.print(node.typeParameters, node, true); +} +function _interfaceish(node) { + var _node$extends; + this.print(node.id, node); + this.print(node.typeParameters, node); + if ((_node$extends = node.extends) != null && _node$extends.length) { + this.space(); + this.word("extends"); + this.space(); + this.printList(node.extends, node); + } + if (node.type === "DeclareClass") { + var _node$mixins, _node$implements; + if ((_node$mixins = node.mixins) != null && _node$mixins.length) { + this.space(); + this.word("mixins"); + this.space(); + this.printList(node.mixins, node); + } + if ((_node$implements = node.implements) != null && _node$implements.length) { + this.space(); + this.word("implements"); + this.space(); + this.printList(node.implements, node); + } + } + this.space(); + this.print(node.body, node); +} +function _variance(node) { + var _node$variance; + const kind = (_node$variance = node.variance) == null ? void 0 : _node$variance.kind; + if (kind != null) { + if (kind === "plus") { + this.tokenChar(43); + } else if (kind === "minus") { + this.tokenChar(45); + } + } +} +function InterfaceDeclaration(node) { + this.word("interface"); + this.space(); + this._interfaceish(node); +} +function andSeparator() { + this.space(); + this.tokenChar(38); + this.space(); +} +function InterfaceTypeAnnotation(node) { + var _node$extends2; + this.word("interface"); + if ((_node$extends2 = node.extends) != null && _node$extends2.length) { + this.space(); + this.word("extends"); + this.space(); + this.printList(node.extends, node); + } + this.space(); + this.print(node.body, node); +} +function IntersectionTypeAnnotation(node) { + this.printJoin(node.types, node, { + separator: andSeparator + }); +} +function MixedTypeAnnotation() { + this.word("mixed"); +} +function EmptyTypeAnnotation() { + this.word("empty"); +} +function NullableTypeAnnotation(node) { + this.tokenChar(63); + this.print(node.typeAnnotation, node); +} +function NumberTypeAnnotation() { + this.word("number"); +} +function StringTypeAnnotation() { + this.word("string"); +} +function ThisTypeAnnotation() { + this.word("this"); +} +function TupleTypeAnnotation(node) { + this.tokenChar(91); + this.printList(node.types, node); + this.tokenChar(93); +} +function TypeofTypeAnnotation(node) { + this.word("typeof"); + this.space(); + this.print(node.argument, node); +} +function TypeAlias(node) { + this.word("type"); + this.space(); + this.print(node.id, node); + this.print(node.typeParameters, node); + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.right, node); + this.semicolon(); +} +function TypeAnnotation(node) { + this.tokenChar(58); + this.space(); + if (node.optional) this.tokenChar(63); + this.print(node.typeAnnotation, node); +} +function TypeParameterInstantiation(node) { + this.tokenChar(60); + this.printList(node.params, node, {}); + this.tokenChar(62); +} +function TypeParameter(node) { + this._variance(node); + this.word(node.name); + if (node.bound) { + this.print(node.bound, node); + } + if (node.default) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.default, node); + } +} +function OpaqueType(node) { + this.word("opaque"); + this.space(); + this.word("type"); + this.space(); + this.print(node.id, node); + this.print(node.typeParameters, node); + if (node.supertype) { + this.tokenChar(58); + this.space(); + this.print(node.supertype, node); + } + if (node.impltype) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.impltype, node); + } + this.semicolon(); +} +function ObjectTypeAnnotation(node) { + if (node.exact) { + this.token("{|"); + } else { + this.tokenChar(123); + } + const props = [...node.properties, ...(node.callProperties || []), ...(node.indexers || []), ...(node.internalSlots || [])]; + if (props.length) { + this.newline(); + this.space(); + this.printJoin(props, node, { + addNewlines(leading) { + if (leading && !props[0]) return 1; + }, + indent: true, + statement: true, + iterator: () => { + if (props.length !== 1 || node.inexact) { + this.tokenChar(44); + this.space(); + } + } + }); + this.space(); + } + if (node.inexact) { + this.indent(); + this.token("..."); + if (props.length) { + this.newline(); + } + this.dedent(); + } + if (node.exact) { + this.token("|}"); + } else { + this.tokenChar(125); + } +} +function ObjectTypeInternalSlot(node) { + if (node.static) { + this.word("static"); + this.space(); + } + this.tokenChar(91); + this.tokenChar(91); + this.print(node.id, node); + this.tokenChar(93); + this.tokenChar(93); + if (node.optional) this.tokenChar(63); + if (!node.method) { + this.tokenChar(58); + this.space(); + } + this.print(node.value, node); +} +function ObjectTypeCallProperty(node) { + if (node.static) { + this.word("static"); + this.space(); + } + this.print(node.value, node); +} +function ObjectTypeIndexer(node) { + if (node.static) { + this.word("static"); + this.space(); + } + this._variance(node); + this.tokenChar(91); + if (node.id) { + this.print(node.id, node); + this.tokenChar(58); + this.space(); + } + this.print(node.key, node); + this.tokenChar(93); + this.tokenChar(58); + this.space(); + this.print(node.value, node); +} +function ObjectTypeProperty(node) { + if (node.proto) { + this.word("proto"); + this.space(); + } + if (node.static) { + this.word("static"); + this.space(); + } + if (node.kind === "get" || node.kind === "set") { + this.word(node.kind); + this.space(); + } + this._variance(node); + this.print(node.key, node); + if (node.optional) this.tokenChar(63); + if (!node.method) { + this.tokenChar(58); + this.space(); + } + this.print(node.value, node); +} +function ObjectTypeSpreadProperty(node) { + this.token("..."); + this.print(node.argument, node); +} +function QualifiedTypeIdentifier(node) { + this.print(node.qualification, node); + this.tokenChar(46); + this.print(node.id, node); +} +function SymbolTypeAnnotation() { + this.word("symbol"); +} +function orSeparator() { + this.space(); + this.tokenChar(124); + this.space(); +} +function UnionTypeAnnotation(node) { + this.printJoin(node.types, node, { + separator: orSeparator + }); +} +function TypeCastExpression(node) { + this.tokenChar(40); + this.print(node.expression, node); + this.print(node.typeAnnotation, node); + this.tokenChar(41); +} +function Variance(node) { + if (node.kind === "plus") { + this.tokenChar(43); + } else { + this.tokenChar(45); + } +} +function VoidTypeAnnotation() { + this.word("void"); +} +function IndexedAccessType(node) { + this.print(node.objectType, node, true); + this.tokenChar(91); + this.print(node.indexType, node); + this.tokenChar(93); +} +function OptionalIndexedAccessType(node) { + this.print(node.objectType, node); + if (node.optional) { + this.token("?."); + } + this.tokenChar(91); + this.print(node.indexType, node); + this.tokenChar(93); +} + +//# sourceMappingURL=flow.js.map + + +/***/ }), + +/***/ 3633: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +var _templateLiterals = __nccwpck_require__(2332); +Object.keys(_templateLiterals).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _templateLiterals[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _templateLiterals[key]; + } + }); +}); +var _expressions = __nccwpck_require__(463); +Object.keys(_expressions).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _expressions[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _expressions[key]; + } + }); +}); +var _statements = __nccwpck_require__(3189); +Object.keys(_statements).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _statements[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _statements[key]; + } + }); +}); +var _classes = __nccwpck_require__(7366); +Object.keys(_classes).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _classes[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _classes[key]; + } + }); +}); +var _methods = __nccwpck_require__(8309); +Object.keys(_methods).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _methods[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _methods[key]; + } + }); +}); +var _modules = __nccwpck_require__(8798); +Object.keys(_modules).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _modules[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _modules[key]; + } + }); +}); +var _types = __nccwpck_require__(3400); +Object.keys(_types).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _types[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _types[key]; + } + }); +}); +var _flow = __nccwpck_require__(1346); +Object.keys(_flow).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _flow[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _flow[key]; + } + }); +}); +var _base = __nccwpck_require__(8521); +Object.keys(_base).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _base[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _base[key]; + } + }); +}); +var _jsx = __nccwpck_require__(2265); +Object.keys(_jsx).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _jsx[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _jsx[key]; + } + }); +}); +var _typescript = __nccwpck_require__(3778); +Object.keys(_typescript).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (key in exports && exports[key] === _typescript[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _typescript[key]; + } + }); +}); + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 2265: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.JSXAttribute = JSXAttribute; +exports.JSXClosingElement = JSXClosingElement; +exports.JSXClosingFragment = JSXClosingFragment; +exports.JSXElement = JSXElement; +exports.JSXEmptyExpression = JSXEmptyExpression; +exports.JSXExpressionContainer = JSXExpressionContainer; +exports.JSXFragment = JSXFragment; +exports.JSXIdentifier = JSXIdentifier; +exports.JSXMemberExpression = JSXMemberExpression; +exports.JSXNamespacedName = JSXNamespacedName; +exports.JSXOpeningElement = JSXOpeningElement; +exports.JSXOpeningFragment = JSXOpeningFragment; +exports.JSXSpreadAttribute = JSXSpreadAttribute; +exports.JSXSpreadChild = JSXSpreadChild; +exports.JSXText = JSXText; +function JSXAttribute(node) { + this.print(node.name, node); + if (node.value) { + this.tokenChar(61); + this.print(node.value, node); + } +} +function JSXIdentifier(node) { + this.word(node.name); +} +function JSXNamespacedName(node) { + this.print(node.namespace, node); + this.tokenChar(58); + this.print(node.name, node); +} +function JSXMemberExpression(node) { + this.print(node.object, node); + this.tokenChar(46); + this.print(node.property, node); +} +function JSXSpreadAttribute(node) { + this.tokenChar(123); + this.token("..."); + this.print(node.argument, node); + this.tokenChar(125); +} +function JSXExpressionContainer(node) { + this.tokenChar(123); + this.print(node.expression, node); + this.tokenChar(125); +} +function JSXSpreadChild(node) { + this.tokenChar(123); + this.token("..."); + this.print(node.expression, node); + this.tokenChar(125); +} +function JSXText(node) { + const raw = this.getPossibleRaw(node); + if (raw !== undefined) { + this.token(raw, true); + } else { + this.token(node.value, true); + } +} +function JSXElement(node) { + const open = node.openingElement; + this.print(open, node); + if (open.selfClosing) return; + this.indent(); + for (const child of node.children) { + this.print(child, node); + } + this.dedent(); + this.print(node.closingElement, node); +} +function spaceSeparator() { + this.space(); +} +function JSXOpeningElement(node) { + this.tokenChar(60); + this.print(node.name, node); + this.print(node.typeParameters, node); + if (node.attributes.length > 0) { + this.space(); + this.printJoin(node.attributes, node, { + separator: spaceSeparator + }); + } + if (node.selfClosing) { + this.space(); + this.token("/>"); + } else { + this.tokenChar(62); + } +} +function JSXClosingElement(node) { + this.token(" { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ArrowFunctionExpression = ArrowFunctionExpression; +exports.FunctionDeclaration = exports.FunctionExpression = FunctionExpression; +exports._functionHead = _functionHead; +exports._methodHead = _methodHead; +exports._param = _param; +exports._parameters = _parameters; +exports._params = _params; +exports._predicate = _predicate; +var _t = __nccwpck_require__(7012); +const { + isIdentifier +} = _t; +function _params(node, idNode, parentNode) { + this.print(node.typeParameters, node); + const nameInfo = _getFuncIdName.call(this, idNode, parentNode); + if (nameInfo) { + this.sourceIdentifierName(nameInfo.name, nameInfo.pos); + } + this.tokenChar(40); + this._parameters(node.params, node); + this.tokenChar(41); + const noLineTerminator = node.type === "ArrowFunctionExpression"; + this.print(node.returnType, node, noLineTerminator); + this._noLineTerminator = noLineTerminator; +} +function _parameters(parameters, parent) { + const paramLength = parameters.length; + for (let i = 0; i < paramLength; i++) { + this._param(parameters[i], parent); + if (i < parameters.length - 1) { + this.tokenChar(44); + this.space(); + } + } +} +function _param(parameter, parent) { + this.printJoin(parameter.decorators, parameter); + this.print(parameter, parent); + if (parameter.optional) { + this.tokenChar(63); + } + this.print(parameter.typeAnnotation, parameter); +} +function _methodHead(node) { + const kind = node.kind; + const key = node.key; + if (kind === "get" || kind === "set") { + this.word(kind); + this.space(); + } + if (node.async) { + this.word("async", true); + this.space(); + } + if (kind === "method" || kind === "init") { + if (node.generator) { + this.tokenChar(42); + } + } + if (node.computed) { + this.tokenChar(91); + this.print(key, node); + this.tokenChar(93); + } else { + this.print(key, node); + } + if (node.optional) { + this.tokenChar(63); + } + this._params(node, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key, undefined); +} +function _predicate(node, noLineTerminatorAfter) { + if (node.predicate) { + if (!node.returnType) { + this.tokenChar(58); + } + this.space(); + this.print(node.predicate, node, noLineTerminatorAfter); + } +} +function _functionHead(node, parent) { + if (node.async) { + this.word("async"); + this._endsWithInnerRaw = false; + this.space(); + } + this.word("function"); + if (node.generator) { + this._endsWithInnerRaw = false; + this.tokenChar(42); + } + this.space(); + if (node.id) { + this.print(node.id, node); + } + this._params(node, node.id, parent); + if (node.type !== "TSDeclareFunction") { + this._predicate(node); + } +} +function FunctionExpression(node, parent) { + this._functionHead(node, parent); + this.space(); + this.print(node.body, node); +} +function ArrowFunctionExpression(node, parent) { + if (node.async) { + this.word("async", true); + this.space(); + } + let firstParam; + if (!this.format.retainLines && node.params.length === 1 && isIdentifier(firstParam = node.params[0]) && !hasTypesOrComments(node, firstParam)) { + this.print(firstParam, node, true); + } else { + this._params(node, undefined, parent); + } + this._predicate(node, true); + this.space(); + this.printInnerComments(); + this.token("=>"); + this.space(); + this.print(node.body, node); +} +function hasTypesOrComments(node, param) { + var _param$leadingComment, _param$trailingCommen; + return !!(node.typeParameters || node.returnType || node.predicate || param.typeAnnotation || param.optional || (_param$leadingComment = param.leadingComments) != null && _param$leadingComment.length || (_param$trailingCommen = param.trailingComments) != null && _param$trailingCommen.length); +} +function _getFuncIdName(idNode, parent) { + let id = idNode; + if (!id && parent) { + const parentType = parent.type; + if (parentType === "VariableDeclarator") { + id = parent.id; + } else if (parentType === "AssignmentExpression" || parentType === "AssignmentPattern") { + id = parent.left; + } else if (parentType === "ObjectProperty" || parentType === "ClassProperty") { + if (!parent.computed || parent.key.type === "StringLiteral") { + id = parent.key; + } + } else if (parentType === "ClassPrivateProperty" || parentType === "ClassAccessorProperty") { + id = parent.key; + } + } + if (!id) return; + let nameInfo; + if (id.type === "Identifier") { + var _id$loc, _id$loc2; + nameInfo = { + pos: (_id$loc = id.loc) == null ? void 0 : _id$loc.start, + name: ((_id$loc2 = id.loc) == null ? void 0 : _id$loc2.identifierName) || id.name + }; + } else if (id.type === "PrivateName") { + var _id$loc3; + nameInfo = { + pos: (_id$loc3 = id.loc) == null ? void 0 : _id$loc3.start, + name: "#" + id.id.name + }; + } else if (id.type === "StringLiteral") { + var _id$loc4; + nameInfo = { + pos: (_id$loc4 = id.loc) == null ? void 0 : _id$loc4.start, + name: id.value + }; + } + return nameInfo; +} + +//# sourceMappingURL=methods.js.map + + +/***/ }), + +/***/ 8798: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ExportAllDeclaration = ExportAllDeclaration; +exports.ExportDefaultDeclaration = ExportDefaultDeclaration; +exports.ExportDefaultSpecifier = ExportDefaultSpecifier; +exports.ExportNamedDeclaration = ExportNamedDeclaration; +exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier; +exports.ExportSpecifier = ExportSpecifier; +exports.ImportAttribute = ImportAttribute; +exports.ImportDeclaration = ImportDeclaration; +exports.ImportDefaultSpecifier = ImportDefaultSpecifier; +exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; +exports.ImportSpecifier = ImportSpecifier; +exports._printAttributes = _printAttributes; +var _t = __nccwpck_require__(7012); +const { + isClassDeclaration, + isExportDefaultSpecifier, + isExportNamespaceSpecifier, + isImportDefaultSpecifier, + isImportNamespaceSpecifier, + isStatement +} = _t; +function ImportSpecifier(node) { + if (node.importKind === "type" || node.importKind === "typeof") { + this.word(node.importKind); + this.space(); + } + this.print(node.imported, node); + if (node.local && node.local.name !== node.imported.name) { + this.space(); + this.word("as"); + this.space(); + this.print(node.local, node); + } +} +function ImportDefaultSpecifier(node) { + this.print(node.local, node); +} +function ExportDefaultSpecifier(node) { + this.print(node.exported, node); +} +function ExportSpecifier(node) { + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + this.print(node.local, node); + if (node.exported && node.local.name !== node.exported.name) { + this.space(); + this.word("as"); + this.space(); + this.print(node.exported, node); + } +} +function ExportNamespaceSpecifier(node) { + this.tokenChar(42); + this.space(); + this.word("as"); + this.space(); + this.print(node.exported, node); +} +let warningShown = false; +function _printAttributes(node) { + const { + importAttributesKeyword + } = this.format; + const { + attributes, + assertions + } = node; + if (attributes && !importAttributesKeyword && !warningShown) { + warningShown = true; + console.warn(`\ +You are using import attributes, without specifying the desired output syntax. +Please specify the "importAttributesKeyword" generator option, whose value can be one of: + - "with" : \`import { a } from "b" with { type: "json" };\` + - "assert" : \`import { a } from "b" assert { type: "json" };\` + - "with-legacy" : \`import { a } from "b" with type: "json";\` +`); + } + const useAssertKeyword = importAttributesKeyword === "assert" || !importAttributesKeyword && assertions; + this.word(useAssertKeyword ? "assert" : "with"); + this.space(); + if (!useAssertKeyword && importAttributesKeyword !== "with") { + this.printList(attributes || assertions, node); + return; + } + this.tokenChar(123); + this.space(); + this.printList(attributes || assertions, node); + this.space(); + this.tokenChar(125); +} +function ExportAllDeclaration(node) { + var _node$attributes, _node$assertions; + this.word("export"); + this.space(); + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + this.tokenChar(42); + this.space(); + this.word("from"); + this.space(); + if ((_node$attributes = node.attributes) != null && _node$attributes.length || (_node$assertions = node.assertions) != null && _node$assertions.length) { + this.print(node.source, node, true); + this.space(); + this._printAttributes(node); + } else { + this.print(node.source, node); + } + this.semicolon(); +} +function maybePrintDecoratorsBeforeExport(printer, node) { + if (isClassDeclaration(node.declaration) && printer._shouldPrintDecoratorsBeforeExport(node)) { + printer.printJoin(node.declaration.decorators, node); + } +} +function ExportNamedDeclaration(node) { + maybePrintDecoratorsBeforeExport(this, node); + this.word("export"); + this.space(); + if (node.declaration) { + const declar = node.declaration; + this.print(declar, node); + if (!isStatement(declar)) this.semicolon(); + } else { + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + const specifiers = node.specifiers.slice(0); + let hasSpecial = false; + for (;;) { + const first = specifiers[0]; + if (isExportDefaultSpecifier(first) || isExportNamespaceSpecifier(first)) { + hasSpecial = true; + this.print(specifiers.shift(), node); + if (specifiers.length) { + this.tokenChar(44); + this.space(); + } + } else { + break; + } + } + if (specifiers.length || !specifiers.length && !hasSpecial) { + this.tokenChar(123); + if (specifiers.length) { + this.space(); + this.printList(specifiers, node); + this.space(); + } + this.tokenChar(125); + } + if (node.source) { + var _node$attributes2, _node$assertions2; + this.space(); + this.word("from"); + this.space(); + if ((_node$attributes2 = node.attributes) != null && _node$attributes2.length || (_node$assertions2 = node.assertions) != null && _node$assertions2.length) { + this.print(node.source, node, true); + this.space(); + this._printAttributes(node); + } else { + this.print(node.source, node); + } + } + this.semicolon(); + } +} +function ExportDefaultDeclaration(node) { + maybePrintDecoratorsBeforeExport(this, node); + this.word("export"); + this.noIndentInnerCommentsHere(); + this.space(); + this.word("default"); + this.space(); + const declar = node.declaration; + this.print(declar, node); + if (!isStatement(declar)) this.semicolon(); +} +function ImportDeclaration(node) { + var _node$attributes3, _node$assertions3; + this.word("import"); + this.space(); + const isTypeKind = node.importKind === "type" || node.importKind === "typeof"; + if (isTypeKind) { + this.noIndentInnerCommentsHere(); + this.word(node.importKind); + this.space(); + } else if (node.module) { + this.noIndentInnerCommentsHere(); + this.word("module"); + this.space(); + } + const specifiers = node.specifiers.slice(0); + const hasSpecifiers = !!specifiers.length; + while (hasSpecifiers) { + const first = specifiers[0]; + if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) { + this.print(specifiers.shift(), node); + if (specifiers.length) { + this.tokenChar(44); + this.space(); + } + } else { + break; + } + } + if (specifiers.length) { + this.tokenChar(123); + this.space(); + this.printList(specifiers, node); + this.space(); + this.tokenChar(125); + } else if (isTypeKind && !hasSpecifiers) { + this.tokenChar(123); + this.tokenChar(125); + } + if (hasSpecifiers || isTypeKind) { + this.space(); + this.word("from"); + this.space(); + } + if ((_node$attributes3 = node.attributes) != null && _node$attributes3.length || (_node$assertions3 = node.assertions) != null && _node$assertions3.length) { + this.print(node.source, node, true); + this.space(); + this._printAttributes(node); + } else { + this.print(node.source, node); + } + this.semicolon(); +} +function ImportAttribute(node) { + this.print(node.key); + this.tokenChar(58); + this.space(); + this.print(node.value); +} +function ImportNamespaceSpecifier(node) { + this.tokenChar(42); + this.space(); + this.word("as"); + this.space(); + this.print(node.local, node); +} + +//# sourceMappingURL=modules.js.map + + +/***/ }), + +/***/ 3189: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.BreakStatement = BreakStatement; +exports.CatchClause = CatchClause; +exports.ContinueStatement = ContinueStatement; +exports.DebuggerStatement = DebuggerStatement; +exports.DoWhileStatement = DoWhileStatement; +exports.ForOfStatement = exports.ForInStatement = void 0; +exports.ForStatement = ForStatement; +exports.IfStatement = IfStatement; +exports.LabeledStatement = LabeledStatement; +exports.ReturnStatement = ReturnStatement; +exports.SwitchCase = SwitchCase; +exports.SwitchStatement = SwitchStatement; +exports.ThrowStatement = ThrowStatement; +exports.TryStatement = TryStatement; +exports.VariableDeclaration = VariableDeclaration; +exports.VariableDeclarator = VariableDeclarator; +exports.WhileStatement = WhileStatement; +exports.WithStatement = WithStatement; +var _t = __nccwpck_require__(7012); +const { + isFor, + isForStatement, + isIfStatement, + isStatement +} = _t; +function WithStatement(node) { + this.word("with"); + this.space(); + this.tokenChar(40); + this.print(node.object, node); + this.tokenChar(41); + this.printBlock(node); +} +function IfStatement(node) { + this.word("if"); + this.space(); + this.tokenChar(40); + this.print(node.test, node); + this.tokenChar(41); + this.space(); + const needsBlock = node.alternate && isIfStatement(getLastStatement(node.consequent)); + if (needsBlock) { + this.tokenChar(123); + this.newline(); + this.indent(); + } + this.printAndIndentOnComments(node.consequent, node); + if (needsBlock) { + this.dedent(); + this.newline(); + this.tokenChar(125); + } + if (node.alternate) { + if (this.endsWith(125)) this.space(); + this.word("else"); + this.space(); + this.printAndIndentOnComments(node.alternate, node); + } +} +function getLastStatement(statement) { + const { + body + } = statement; + if (isStatement(body) === false) { + return statement; + } + return getLastStatement(body); +} +function ForStatement(node) { + this.word("for"); + this.space(); + this.tokenChar(40); + this.inForStatementInitCounter++; + this.print(node.init, node); + this.inForStatementInitCounter--; + this.tokenChar(59); + if (node.test) { + this.space(); + this.print(node.test, node); + } + this.tokenChar(59); + if (node.update) { + this.space(); + this.print(node.update, node); + } + this.tokenChar(41); + this.printBlock(node); +} +function WhileStatement(node) { + this.word("while"); + this.space(); + this.tokenChar(40); + this.print(node.test, node); + this.tokenChar(41); + this.printBlock(node); +} +function ForXStatement(node) { + this.word("for"); + this.space(); + const isForOf = node.type === "ForOfStatement"; + if (isForOf && node.await) { + this.word("await"); + this.space(); + } + this.noIndentInnerCommentsHere(); + this.tokenChar(40); + this.print(node.left, node); + this.space(); + this.word(isForOf ? "of" : "in"); + this.space(); + this.print(node.right, node); + this.tokenChar(41); + this.printBlock(node); +} +const ForInStatement = ForXStatement; +exports.ForInStatement = ForInStatement; +const ForOfStatement = ForXStatement; +exports.ForOfStatement = ForOfStatement; +function DoWhileStatement(node) { + this.word("do"); + this.space(); + this.print(node.body, node); + this.space(); + this.word("while"); + this.space(); + this.tokenChar(40); + this.print(node.test, node); + this.tokenChar(41); + this.semicolon(); +} +function printStatementAfterKeyword(printer, node, parent, isLabel) { + if (node) { + printer.space(); + printer.printTerminatorless(node, parent, isLabel); + } + printer.semicolon(); +} +function BreakStatement(node) { + this.word("break"); + printStatementAfterKeyword(this, node.label, node, true); +} +function ContinueStatement(node) { + this.word("continue"); + printStatementAfterKeyword(this, node.label, node, true); +} +function ReturnStatement(node) { + this.word("return"); + printStatementAfterKeyword(this, node.argument, node, false); +} +function ThrowStatement(node) { + this.word("throw"); + printStatementAfterKeyword(this, node.argument, node, false); +} +function LabeledStatement(node) { + this.print(node.label, node); + this.tokenChar(58); + this.space(); + this.print(node.body, node); +} +function TryStatement(node) { + this.word("try"); + this.space(); + this.print(node.block, node); + this.space(); + if (node.handlers) { + this.print(node.handlers[0], node); + } else { + this.print(node.handler, node); + } + if (node.finalizer) { + this.space(); + this.word("finally"); + this.space(); + this.print(node.finalizer, node); + } +} +function CatchClause(node) { + this.word("catch"); + this.space(); + if (node.param) { + this.tokenChar(40); + this.print(node.param, node); + this.print(node.param.typeAnnotation, node); + this.tokenChar(41); + this.space(); + } + this.print(node.body, node); +} +function SwitchStatement(node) { + this.word("switch"); + this.space(); + this.tokenChar(40); + this.print(node.discriminant, node); + this.tokenChar(41); + this.space(); + this.tokenChar(123); + this.printSequence(node.cases, node, { + indent: true, + addNewlines(leading, cas) { + if (!leading && node.cases[node.cases.length - 1] === cas) return -1; + } + }); + this.rightBrace(node); +} +function SwitchCase(node) { + if (node.test) { + this.word("case"); + this.space(); + this.print(node.test, node); + this.tokenChar(58); + } else { + this.word("default"); + this.tokenChar(58); + } + if (node.consequent.length) { + this.newline(); + this.printSequence(node.consequent, node, { + indent: true + }); + } +} +function DebuggerStatement() { + this.word("debugger"); + this.semicolon(); +} +function VariableDeclaration(node, parent) { + if (node.declare) { + this.word("declare"); + this.space(); + } + const { + kind + } = node; + this.word(kind, kind === "using" || kind === "await using"); + this.space(); + let hasInits = false; + if (!isFor(parent)) { + for (const declar of node.declarations) { + if (declar.init) { + hasInits = true; + } + } + } + this.printList(node.declarations, node, { + separator: hasInits ? function () { + this.tokenChar(44); + this.newline(); + } : undefined, + indent: node.declarations.length > 1 ? true : false + }); + if (isFor(parent)) { + if (isForStatement(parent)) { + if (parent.init === node) return; + } else { + if (parent.left === node) return; + } + } + this.semicolon(); +} +function VariableDeclarator(node) { + this.print(node.id, node); + if (node.definite) this.tokenChar(33); + this.print(node.id.typeAnnotation, node); + if (node.init) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.init, node); + } +} + +//# sourceMappingURL=statements.js.map + + +/***/ }), + +/***/ 2332: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.TaggedTemplateExpression = TaggedTemplateExpression; +exports.TemplateElement = TemplateElement; +exports.TemplateLiteral = TemplateLiteral; +function TaggedTemplateExpression(node) { + this.print(node.tag, node); + this.print(node.typeParameters, node); + this.print(node.quasi, node); +} +function TemplateElement(node, parent) { + const isFirst = parent.quasis[0] === node; + const isLast = parent.quasis[parent.quasis.length - 1] === node; + const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); + this.token(value, true); +} +function TemplateLiteral(node) { + const quasis = node.quasis; + for (let i = 0; i < quasis.length; i++) { + this.print(quasis[i], node); + if (i + 1 < quasis.length) { + this.print(node.expressions[i], node); + } + } +} + +//# sourceMappingURL=template-literals.js.map + + +/***/ }), + +/***/ 3400: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ArgumentPlaceholder = ArgumentPlaceholder; +exports.ArrayPattern = exports.ArrayExpression = ArrayExpression; +exports.BigIntLiteral = BigIntLiteral; +exports.BooleanLiteral = BooleanLiteral; +exports.DecimalLiteral = DecimalLiteral; +exports.Identifier = Identifier; +exports.NullLiteral = NullLiteral; +exports.NumericLiteral = NumericLiteral; +exports.ObjectPattern = exports.ObjectExpression = ObjectExpression; +exports.ObjectMethod = ObjectMethod; +exports.ObjectProperty = ObjectProperty; +exports.PipelineBareFunction = PipelineBareFunction; +exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference; +exports.PipelineTopicExpression = PipelineTopicExpression; +exports.RecordExpression = RecordExpression; +exports.RegExpLiteral = RegExpLiteral; +exports.SpreadElement = exports.RestElement = RestElement; +exports.StringLiteral = StringLiteral; +exports.TopicReference = TopicReference; +exports.TupleExpression = TupleExpression; +var _t = __nccwpck_require__(7012); +var _jsesc = __nccwpck_require__(5733); +const { + isAssignmentPattern, + isIdentifier +} = _t; +function Identifier(node) { + var _node$loc; + this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name); + this.word(node.name); +} +function ArgumentPlaceholder() { + this.tokenChar(63); +} +function RestElement(node) { + this.token("..."); + this.print(node.argument, node); +} +function ObjectExpression(node) { + const props = node.properties; + this.tokenChar(123); + if (props.length) { + this.space(); + this.printList(props, node, { + indent: true, + statement: true + }); + this.space(); + } + this.sourceWithOffset("end", node.loc, -1); + this.tokenChar(125); +} +function ObjectMethod(node) { + this.printJoin(node.decorators, node); + this._methodHead(node); + this.space(); + this.print(node.body, node); +} +function ObjectProperty(node) { + this.printJoin(node.decorators, node); + if (node.computed) { + this.tokenChar(91); + this.print(node.key, node); + this.tokenChar(93); + } else { + if (isAssignmentPattern(node.value) && isIdentifier(node.key) && node.key.name === node.value.left.name) { + this.print(node.value, node); + return; + } + this.print(node.key, node); + if (node.shorthand && isIdentifier(node.key) && isIdentifier(node.value) && node.key.name === node.value.name) { + return; + } + } + this.tokenChar(58); + this.space(); + this.print(node.value, node); +} +function ArrayExpression(node) { + const elems = node.elements; + const len = elems.length; + this.tokenChar(91); + for (let i = 0; i < elems.length; i++) { + const elem = elems[i]; + if (elem) { + if (i > 0) this.space(); + this.print(elem, node); + if (i < len - 1) this.tokenChar(44); + } else { + this.tokenChar(44); + } + } + this.tokenChar(93); +} +function RecordExpression(node) { + const props = node.properties; + let startToken; + let endToken; + if (this.format.recordAndTupleSyntaxType === "bar") { + startToken = "{|"; + endToken = "|}"; + } else if (this.format.recordAndTupleSyntaxType !== "hash" && this.format.recordAndTupleSyntaxType != null) { + throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`); + } else { + startToken = "#{"; + endToken = "}"; + } + this.token(startToken); + if (props.length) { + this.space(); + this.printList(props, node, { + indent: true, + statement: true + }); + this.space(); + } + this.token(endToken); +} +function TupleExpression(node) { + const elems = node.elements; + const len = elems.length; + let startToken; + let endToken; + if (this.format.recordAndTupleSyntaxType === "bar") { + startToken = "[|"; + endToken = "|]"; + } else if (this.format.recordAndTupleSyntaxType === "hash") { + startToken = "#["; + endToken = "]"; + } else { + throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`); + } + this.token(startToken); + for (let i = 0; i < elems.length; i++) { + const elem = elems[i]; + if (elem) { + if (i > 0) this.space(); + this.print(elem, node); + if (i < len - 1) this.tokenChar(44); + } + } + this.token(endToken); +} +function RegExpLiteral(node) { + this.word(`/${node.pattern}/${node.flags}`); +} +function BooleanLiteral(node) { + this.word(node.value ? "true" : "false"); +} +function NullLiteral() { + this.word("null"); +} +function NumericLiteral(node) { + const raw = this.getPossibleRaw(node); + const opts = this.format.jsescOption; + const value = node.value + ""; + if (opts.numbers) { + this.number(_jsesc(node.value, opts)); + } else if (raw == null) { + this.number(value); + } else if (this.format.minified) { + this.number(raw.length < value.length ? raw : value); + } else { + this.number(raw); + } +} +function StringLiteral(node) { + const raw = this.getPossibleRaw(node); + if (!this.format.minified && raw !== undefined) { + this.token(raw); + return; + } + const val = _jsesc(node.value, this.format.jsescOption); + this.token(val); +} +function BigIntLiteral(node) { + const raw = this.getPossibleRaw(node); + if (!this.format.minified && raw !== undefined) { + this.word(raw); + return; + } + this.word(node.value + "n"); +} +function DecimalLiteral(node) { + const raw = this.getPossibleRaw(node); + if (!this.format.minified && raw !== undefined) { + this.word(raw); + return; + } + this.word(node.value + "m"); +} +const validTopicTokenSet = new Set(["^^", "@@", "^", "%", "#"]); +function TopicReference() { + const { + topicToken + } = this.format; + if (validTopicTokenSet.has(topicToken)) { + this.token(topicToken); + } else { + const givenTopicTokenJSON = JSON.stringify(topicToken); + const validTopics = Array.from(validTopicTokenSet, v => JSON.stringify(v)); + throw new Error(`The "topicToken" generator option must be one of ` + `${validTopics.join(", ")} (${givenTopicTokenJSON} received instead).`); + } +} +function PipelineTopicExpression(node) { + this.print(node.expression, node); +} +function PipelineBareFunction(node) { + this.print(node.callee, node); +} +function PipelinePrimaryTopicReference() { + this.tokenChar(35); +} + +//# sourceMappingURL=types.js.map + + +/***/ }), + +/***/ 3778: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.TSAnyKeyword = TSAnyKeyword; +exports.TSArrayType = TSArrayType; +exports.TSSatisfiesExpression = exports.TSAsExpression = TSTypeExpression; +exports.TSBigIntKeyword = TSBigIntKeyword; +exports.TSBooleanKeyword = TSBooleanKeyword; +exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration; +exports.TSConditionalType = TSConditionalType; +exports.TSConstructSignatureDeclaration = TSConstructSignatureDeclaration; +exports.TSConstructorType = TSConstructorType; +exports.TSDeclareFunction = TSDeclareFunction; +exports.TSDeclareMethod = TSDeclareMethod; +exports.TSEnumDeclaration = TSEnumDeclaration; +exports.TSEnumMember = TSEnumMember; +exports.TSExportAssignment = TSExportAssignment; +exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments; +exports.TSExternalModuleReference = TSExternalModuleReference; +exports.TSFunctionType = TSFunctionType; +exports.TSImportEqualsDeclaration = TSImportEqualsDeclaration; +exports.TSImportType = TSImportType; +exports.TSIndexSignature = TSIndexSignature; +exports.TSIndexedAccessType = TSIndexedAccessType; +exports.TSInferType = TSInferType; +exports.TSInstantiationExpression = TSInstantiationExpression; +exports.TSInterfaceBody = TSInterfaceBody; +exports.TSInterfaceDeclaration = TSInterfaceDeclaration; +exports.TSIntersectionType = TSIntersectionType; +exports.TSIntrinsicKeyword = TSIntrinsicKeyword; +exports.TSLiteralType = TSLiteralType; +exports.TSMappedType = TSMappedType; +exports.TSMethodSignature = TSMethodSignature; +exports.TSModuleBlock = TSModuleBlock; +exports.TSModuleDeclaration = TSModuleDeclaration; +exports.TSNamedTupleMember = TSNamedTupleMember; +exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration; +exports.TSNeverKeyword = TSNeverKeyword; +exports.TSNonNullExpression = TSNonNullExpression; +exports.TSNullKeyword = TSNullKeyword; +exports.TSNumberKeyword = TSNumberKeyword; +exports.TSObjectKeyword = TSObjectKeyword; +exports.TSOptionalType = TSOptionalType; +exports.TSParameterProperty = TSParameterProperty; +exports.TSParenthesizedType = TSParenthesizedType; +exports.TSPropertySignature = TSPropertySignature; +exports.TSQualifiedName = TSQualifiedName; +exports.TSRestType = TSRestType; +exports.TSStringKeyword = TSStringKeyword; +exports.TSSymbolKeyword = TSSymbolKeyword; +exports.TSThisType = TSThisType; +exports.TSTupleType = TSTupleType; +exports.TSTypeAliasDeclaration = TSTypeAliasDeclaration; +exports.TSTypeAnnotation = TSTypeAnnotation; +exports.TSTypeAssertion = TSTypeAssertion; +exports.TSTypeLiteral = TSTypeLiteral; +exports.TSTypeOperator = TSTypeOperator; +exports.TSTypeParameter = TSTypeParameter; +exports.TSTypeParameterDeclaration = exports.TSTypeParameterInstantiation = TSTypeParameterInstantiation; +exports.TSTypePredicate = TSTypePredicate; +exports.TSTypeQuery = TSTypeQuery; +exports.TSTypeReference = TSTypeReference; +exports.TSUndefinedKeyword = TSUndefinedKeyword; +exports.TSUnionType = TSUnionType; +exports.TSUnknownKeyword = TSUnknownKeyword; +exports.TSVoidKeyword = TSVoidKeyword; +exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers; +exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType; +exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName; +exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase; +exports.tsPrintTypeLiteralOrInterfaceBody = tsPrintTypeLiteralOrInterfaceBody; +function TSTypeAnnotation(node) { + this.tokenChar(58); + this.space(); + if (node.optional) this.tokenChar(63); + this.print(node.typeAnnotation, node); +} +function TSTypeParameterInstantiation(node, parent) { + this.tokenChar(60); + this.printList(node.params, node, {}); + if (parent.type === "ArrowFunctionExpression" && node.params.length === 1) { + this.tokenChar(44); + } + this.tokenChar(62); +} +function TSTypeParameter(node) { + if (node.in) { + this.word("in"); + this.space(); + } + if (node.out) { + this.word("out"); + this.space(); + } + this.word(node.name); + if (node.constraint) { + this.space(); + this.word("extends"); + this.space(); + this.print(node.constraint, node); + } + if (node.default) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.default, node); + } +} +function TSParameterProperty(node) { + if (node.accessibility) { + this.word(node.accessibility); + this.space(); + } + if (node.readonly) { + this.word("readonly"); + this.space(); + } + this._param(node.parameter); +} +function TSDeclareFunction(node, parent) { + if (node.declare) { + this.word("declare"); + this.space(); + } + this._functionHead(node, parent); + this.tokenChar(59); +} +function TSDeclareMethod(node) { + this._classMethodHead(node); + this.tokenChar(59); +} +function TSQualifiedName(node) { + this.print(node.left, node); + this.tokenChar(46); + this.print(node.right, node); +} +function TSCallSignatureDeclaration(node) { + this.tsPrintSignatureDeclarationBase(node); + this.tokenChar(59); +} +function TSConstructSignatureDeclaration(node) { + this.word("new"); + this.space(); + this.tsPrintSignatureDeclarationBase(node); + this.tokenChar(59); +} +function TSPropertySignature(node) { + const { + readonly, + initializer + } = node; + if (readonly) { + this.word("readonly"); + this.space(); + } + this.tsPrintPropertyOrMethodName(node); + this.print(node.typeAnnotation, node); + if (initializer) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(initializer, node); + } + this.tokenChar(59); +} +function tsPrintPropertyOrMethodName(node) { + if (node.computed) { + this.tokenChar(91); + } + this.print(node.key, node); + if (node.computed) { + this.tokenChar(93); + } + if (node.optional) { + this.tokenChar(63); + } +} +function TSMethodSignature(node) { + const { + kind + } = node; + if (kind === "set" || kind === "get") { + this.word(kind); + this.space(); + } + this.tsPrintPropertyOrMethodName(node); + this.tsPrintSignatureDeclarationBase(node); + this.tokenChar(59); +} +function TSIndexSignature(node) { + const { + readonly, + static: isStatic + } = node; + if (isStatic) { + this.word("static"); + this.space(); + } + if (readonly) { + this.word("readonly"); + this.space(); + } + this.tokenChar(91); + this._parameters(node.parameters, node); + this.tokenChar(93); + this.print(node.typeAnnotation, node); + this.tokenChar(59); +} +function TSAnyKeyword() { + this.word("any"); +} +function TSBigIntKeyword() { + this.word("bigint"); +} +function TSUnknownKeyword() { + this.word("unknown"); +} +function TSNumberKeyword() { + this.word("number"); +} +function TSObjectKeyword() { + this.word("object"); +} +function TSBooleanKeyword() { + this.word("boolean"); +} +function TSStringKeyword() { + this.word("string"); +} +function TSSymbolKeyword() { + this.word("symbol"); +} +function TSVoidKeyword() { + this.word("void"); +} +function TSUndefinedKeyword() { + this.word("undefined"); +} +function TSNullKeyword() { + this.word("null"); +} +function TSNeverKeyword() { + this.word("never"); +} +function TSIntrinsicKeyword() { + this.word("intrinsic"); +} +function TSThisType() { + this.word("this"); +} +function TSFunctionType(node) { + this.tsPrintFunctionOrConstructorType(node); +} +function TSConstructorType(node) { + if (node.abstract) { + this.word("abstract"); + this.space(); + } + this.word("new"); + this.space(); + this.tsPrintFunctionOrConstructorType(node); +} +function tsPrintFunctionOrConstructorType(node) { + const { + typeParameters + } = node; + const parameters = node.parameters; + this.print(typeParameters, node); + this.tokenChar(40); + this._parameters(parameters, node); + this.tokenChar(41); + this.space(); + this.token("=>"); + this.space(); + const returnType = node.typeAnnotation; + this.print(returnType.typeAnnotation, node); +} +function TSTypeReference(node) { + this.print(node.typeName, node, true); + this.print(node.typeParameters, node, true); +} +function TSTypePredicate(node) { + if (node.asserts) { + this.word("asserts"); + this.space(); + } + this.print(node.parameterName); + if (node.typeAnnotation) { + this.space(); + this.word("is"); + this.space(); + this.print(node.typeAnnotation.typeAnnotation); + } +} +function TSTypeQuery(node) { + this.word("typeof"); + this.space(); + this.print(node.exprName); + if (node.typeParameters) { + this.print(node.typeParameters, node); + } +} +function TSTypeLiteral(node) { + this.tsPrintTypeLiteralOrInterfaceBody(node.members, node); +} +function tsPrintTypeLiteralOrInterfaceBody(members, node) { + tsPrintBraced(this, members, node); +} +function tsPrintBraced(printer, members, node) { + printer.token("{"); + if (members.length) { + printer.indent(); + printer.newline(); + for (const member of members) { + printer.print(member, node); + printer.newline(); + } + printer.dedent(); + } + printer.rightBrace(node); +} +function TSArrayType(node) { + this.print(node.elementType, node, true); + this.token("[]"); +} +function TSTupleType(node) { + this.tokenChar(91); + this.printList(node.elementTypes, node); + this.tokenChar(93); +} +function TSOptionalType(node) { + this.print(node.typeAnnotation, node); + this.tokenChar(63); +} +function TSRestType(node) { + this.token("..."); + this.print(node.typeAnnotation, node); +} +function TSNamedTupleMember(node) { + this.print(node.label, node); + if (node.optional) this.tokenChar(63); + this.tokenChar(58); + this.space(); + this.print(node.elementType, node); +} +function TSUnionType(node) { + tsPrintUnionOrIntersectionType(this, node, "|"); +} +function TSIntersectionType(node) { + tsPrintUnionOrIntersectionType(this, node, "&"); +} +function tsPrintUnionOrIntersectionType(printer, node, sep) { + printer.printJoin(node.types, node, { + separator() { + this.space(); + this.token(sep); + this.space(); + } + }); +} +function TSConditionalType(node) { + this.print(node.checkType); + this.space(); + this.word("extends"); + this.space(); + this.print(node.extendsType); + this.space(); + this.tokenChar(63); + this.space(); + this.print(node.trueType); + this.space(); + this.tokenChar(58); + this.space(); + this.print(node.falseType); +} +function TSInferType(node) { + this.token("infer"); + this.space(); + this.print(node.typeParameter); +} +function TSParenthesizedType(node) { + this.tokenChar(40); + this.print(node.typeAnnotation, node); + this.tokenChar(41); +} +function TSTypeOperator(node) { + this.word(node.operator); + this.space(); + this.print(node.typeAnnotation, node); +} +function TSIndexedAccessType(node) { + this.print(node.objectType, node, true); + this.tokenChar(91); + this.print(node.indexType, node); + this.tokenChar(93); +} +function TSMappedType(node) { + const { + nameType, + optional, + readonly, + typeParameter + } = node; + this.tokenChar(123); + this.space(); + if (readonly) { + tokenIfPlusMinus(this, readonly); + this.word("readonly"); + this.space(); + } + this.tokenChar(91); + this.word(typeParameter.name); + this.space(); + this.word("in"); + this.space(); + this.print(typeParameter.constraint, typeParameter); + if (nameType) { + this.space(); + this.word("as"); + this.space(); + this.print(nameType, node); + } + this.tokenChar(93); + if (optional) { + tokenIfPlusMinus(this, optional); + this.tokenChar(63); + } + this.tokenChar(58); + this.space(); + this.print(node.typeAnnotation, node); + this.space(); + this.tokenChar(125); +} +function tokenIfPlusMinus(self, tok) { + if (tok !== true) { + self.token(tok); + } +} +function TSLiteralType(node) { + this.print(node.literal, node); +} +function TSExpressionWithTypeArguments(node) { + this.print(node.expression, node); + this.print(node.typeParameters, node); +} +function TSInterfaceDeclaration(node) { + const { + declare, + id, + typeParameters, + extends: extendz, + body + } = node; + if (declare) { + this.word("declare"); + this.space(); + } + this.word("interface"); + this.space(); + this.print(id, node); + this.print(typeParameters, node); + if (extendz != null && extendz.length) { + this.space(); + this.word("extends"); + this.space(); + this.printList(extendz, node); + } + this.space(); + this.print(body, node); +} +function TSInterfaceBody(node) { + this.tsPrintTypeLiteralOrInterfaceBody(node.body, node); +} +function TSTypeAliasDeclaration(node) { + const { + declare, + id, + typeParameters, + typeAnnotation + } = node; + if (declare) { + this.word("declare"); + this.space(); + } + this.word("type"); + this.space(); + this.print(id, node); + this.print(typeParameters, node); + this.space(); + this.tokenChar(61); + this.space(); + this.print(typeAnnotation, node); + this.tokenChar(59); +} +function TSTypeExpression(node) { + var _expression$trailingC; + const { + type, + expression, + typeAnnotation + } = node; + const forceParens = !!((_expression$trailingC = expression.trailingComments) != null && _expression$trailingC.length); + this.print(expression, node, true, undefined, forceParens); + this.space(); + this.word(type === "TSAsExpression" ? "as" : "satisfies"); + this.space(); + this.print(typeAnnotation, node); +} +function TSTypeAssertion(node) { + const { + typeAnnotation, + expression + } = node; + this.tokenChar(60); + this.print(typeAnnotation, node); + this.tokenChar(62); + this.space(); + this.print(expression, node); +} +function TSInstantiationExpression(node) { + this.print(node.expression, node); + this.print(node.typeParameters, node); +} +function TSEnumDeclaration(node) { + const { + declare, + const: isConst, + id, + members + } = node; + if (declare) { + this.word("declare"); + this.space(); + } + if (isConst) { + this.word("const"); + this.space(); + } + this.word("enum"); + this.space(); + this.print(id, node); + this.space(); + tsPrintBraced(this, members, node); +} +function TSEnumMember(node) { + const { + id, + initializer + } = node; + this.print(id, node); + if (initializer) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(initializer, node); + } + this.tokenChar(44); +} +function TSModuleDeclaration(node) { + const { + declare, + id + } = node; + if (declare) { + this.word("declare"); + this.space(); + } + if (!node.global) { + this.word(id.type === "Identifier" ? "namespace" : "module"); + this.space(); + } + this.print(id, node); + if (!node.body) { + this.tokenChar(59); + return; + } + let body = node.body; + while (body.type === "TSModuleDeclaration") { + this.tokenChar(46); + this.print(body.id, body); + body = body.body; + } + this.space(); + this.print(body, node); +} +function TSModuleBlock(node) { + tsPrintBraced(this, node.body, node); +} +function TSImportType(node) { + const { + argument, + qualifier, + typeParameters + } = node; + this.word("import"); + this.tokenChar(40); + this.print(argument, node); + this.tokenChar(41); + if (qualifier) { + this.tokenChar(46); + this.print(qualifier, node); + } + if (typeParameters) { + this.print(typeParameters, node); + } +} +function TSImportEqualsDeclaration(node) { + const { + isExport, + id, + moduleReference + } = node; + if (isExport) { + this.word("export"); + this.space(); + } + this.word("import"); + this.space(); + this.print(id, node); + this.space(); + this.tokenChar(61); + this.space(); + this.print(moduleReference, node); + this.tokenChar(59); +} +function TSExternalModuleReference(node) { + this.token("require("); + this.print(node.expression, node); + this.tokenChar(41); +} +function TSNonNullExpression(node) { + this.print(node.expression, node); + this.tokenChar(33); +} +function TSExportAssignment(node) { + this.word("export"); + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.expression, node); + this.tokenChar(59); +} +function TSNamespaceExportDeclaration(node) { + this.word("export"); + this.space(); + this.word("as"); + this.space(); + this.word("namespace"); + this.space(); + this.print(node.id, node); +} +function tsPrintSignatureDeclarationBase(node) { + const { + typeParameters + } = node; + const parameters = node.parameters; + this.print(typeParameters, node); + this.tokenChar(40); + this._parameters(parameters, node); + this.tokenChar(41); + const returnType = node.typeAnnotation; + this.print(returnType, node); +} +function tsPrintClassMemberModifiers(node) { + const isField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty"; + if (isField && node.declare) { + this.word("declare"); + this.space(); + } + if (node.accessibility) { + this.word(node.accessibility); + this.space(); + } + if (node.static) { + this.word("static"); + this.space(); + } + if (node.override) { + this.word("override"); + this.space(); + } + if (node.abstract) { + this.word("abstract"); + this.space(); + } + if (isField && node.readonly) { + this.word("readonly"); + this.space(); + } +} + +//# sourceMappingURL=typescript.js.map + + +/***/ }), + +/***/ 2482: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.CodeGenerator = void 0; +exports.default = generate; +var _sourceMap = __nccwpck_require__(7780); +var _printer = __nccwpck_require__(3027); +class Generator extends _printer.default { + constructor(ast, opts = {}, code) { + const format = normalizeOptions(code, opts); + const map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null; + super(format, map); + this.ast = void 0; + this.ast = ast; + } + generate() { + return super.generate(this.ast); + } +} +function normalizeOptions(code, opts) { + var _opts$recordAndTupleS; + const format = { + auxiliaryCommentBefore: opts.auxiliaryCommentBefore, + auxiliaryCommentAfter: opts.auxiliaryCommentAfter, + shouldPrintComment: opts.shouldPrintComment, + retainLines: opts.retainLines, + retainFunctionParens: opts.retainFunctionParens, + comments: opts.comments == null || opts.comments, + compact: opts.compact, + minified: opts.minified, + concise: opts.concise, + indent: { + adjustMultilineComment: true, + style: " " + }, + jsescOption: Object.assign({ + quotes: "double", + wrap: true, + minimal: false + }, opts.jsescOption), + recordAndTupleSyntaxType: (_opts$recordAndTupleS = opts.recordAndTupleSyntaxType) != null ? _opts$recordAndTupleS : "hash", + topicToken: opts.topicToken, + importAttributesKeyword: opts.importAttributesKeyword + }; + { + format.decoratorsBeforeExport = opts.decoratorsBeforeExport; + format.jsescOption.json = opts.jsonCompatibleStrings; + } + if (format.minified) { + format.compact = true; + format.shouldPrintComment = format.shouldPrintComment || (() => format.comments); + } else { + format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.includes("@license") || value.includes("@preserve")); + } + if (format.compact === "auto") { + format.compact = typeof code === "string" && code.length > 500000; + if (format.compact) { + console.error("[BABEL] Note: The code generator has deoptimised the styling of " + `${opts.filename} as it exceeds the max of ${"500KB"}.`); + } + } + if (format.compact) { + format.indent.adjustMultilineComment = false; + } + const { + auxiliaryCommentBefore, + auxiliaryCommentAfter, + shouldPrintComment + } = format; + if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) { + format.auxiliaryCommentBefore = undefined; + } + if (auxiliaryCommentAfter && !shouldPrintComment(auxiliaryCommentAfter)) { + format.auxiliaryCommentAfter = undefined; + } + return format; +} +class CodeGenerator { + constructor(ast, opts, code) { + this._generator = void 0; + this._generator = new Generator(ast, opts, code); + } + generate() { + return this._generator.generate(); + } +} +exports.CodeGenerator = CodeGenerator; +function generate(ast, opts, code) { + const gen = new Generator(ast, opts, code); + return gen.generate(); +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 5051: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.needsParens = needsParens; +exports.needsWhitespace = needsWhitespace; +exports.needsWhitespaceAfter = needsWhitespaceAfter; +exports.needsWhitespaceBefore = needsWhitespaceBefore; +var whitespace = __nccwpck_require__(9826); +var parens = __nccwpck_require__(1285); +var _t = __nccwpck_require__(7012); +const { + FLIPPED_ALIAS_KEYS, + isCallExpression, + isExpressionStatement, + isMemberExpression, + isNewExpression +} = _t; +function expandAliases(obj) { + const newObj = {}; + function add(type, func) { + const fn = newObj[type]; + newObj[type] = fn ? function (node, parent, stack) { + const result = fn(node, parent, stack); + return result == null ? func(node, parent, stack) : result; + } : func; + } + for (const type of Object.keys(obj)) { + const aliases = FLIPPED_ALIAS_KEYS[type]; + if (aliases) { + for (const alias of aliases) { + add(alias, obj[type]); + } + } else { + add(type, obj[type]); + } + } + return newObj; +} +const expandedParens = expandAliases(parens); +const expandedWhitespaceNodes = expandAliases(whitespace.nodes); +function find(obj, node, parent, printStack) { + const fn = obj[node.type]; + return fn ? fn(node, parent, printStack) : null; +} +function isOrHasCallExpression(node) { + if (isCallExpression(node)) { + return true; + } + return isMemberExpression(node) && isOrHasCallExpression(node.object); +} +function needsWhitespace(node, parent, type) { + if (!node) return false; + if (isExpressionStatement(node)) { + node = node.expression; + } + const flag = find(expandedWhitespaceNodes, node, parent); + if (typeof flag === "number") { + return (flag & type) !== 0; + } + return false; +} +function needsWhitespaceBefore(node, parent) { + return needsWhitespace(node, parent, 1); +} +function needsWhitespaceAfter(node, parent) { + return needsWhitespace(node, parent, 2); +} +function needsParens(node, parent, printStack) { + if (!parent) return false; + if (isNewExpression(parent) && parent.callee === node) { + if (isOrHasCallExpression(node)) return true; + } + return find(expandedParens, node, parent, printStack); +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 1285: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ArrowFunctionExpression = ArrowFunctionExpression; +exports.AssignmentExpression = AssignmentExpression; +exports.Binary = Binary; +exports.BinaryExpression = BinaryExpression; +exports.ClassExpression = ClassExpression; +exports.ConditionalExpression = ConditionalExpression; +exports.DoExpression = DoExpression; +exports.FunctionExpression = FunctionExpression; +exports.FunctionTypeAnnotation = FunctionTypeAnnotation; +exports.Identifier = Identifier; +exports.LogicalExpression = LogicalExpression; +exports.NullableTypeAnnotation = NullableTypeAnnotation; +exports.ObjectExpression = ObjectExpression; +exports.OptionalIndexedAccessType = OptionalIndexedAccessType; +exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression; +exports.SequenceExpression = SequenceExpression; +exports.TSTypeAssertion = exports.TSSatisfiesExpression = exports.TSAsExpression = TSAsExpression; +exports.TSInferType = TSInferType; +exports.TSInstantiationExpression = TSInstantiationExpression; +exports.TSIntersectionType = exports.TSUnionType = TSUnionType; +exports.UnaryLike = UnaryLike; +exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation; +exports.UpdateExpression = UpdateExpression; +exports.AwaitExpression = exports.YieldExpression = YieldExpression; +var _t = __nccwpck_require__(7012); +const { + isArrayTypeAnnotation, + isArrowFunctionExpression, + isAssignmentExpression, + isAwaitExpression, + isBinary, + isBinaryExpression, + isUpdateExpression, + isCallExpression, + isClass, + isClassExpression, + isConditional, + isConditionalExpression, + isExportDeclaration, + isExportDefaultDeclaration, + isExpressionStatement, + isFor, + isForInStatement, + isForOfStatement, + isForStatement, + isFunctionExpression, + isIfStatement, + isIndexedAccessType, + isIntersectionTypeAnnotation, + isLogicalExpression, + isMemberExpression, + isNewExpression, + isNullableTypeAnnotation, + isObjectPattern, + isOptionalCallExpression, + isOptionalMemberExpression, + isReturnStatement, + isSequenceExpression, + isSwitchStatement, + isTSArrayType, + isTSAsExpression, + isTSInstantiationExpression, + isTSIntersectionType, + isTSNonNullExpression, + isTSOptionalType, + isTSRestType, + isTSTypeAssertion, + isTSUnionType, + isTaggedTemplateExpression, + isThrowStatement, + isTypeAnnotation, + isUnaryLike, + isUnionTypeAnnotation, + isVariableDeclarator, + isWhileStatement, + isYieldExpression, + isTSSatisfiesExpression +} = _t; +const PRECEDENCE = { + "||": 0, + "??": 0, + "|>": 0, + "&&": 1, + "|": 2, + "^": 3, + "&": 4, + "==": 5, + "===": 5, + "!=": 5, + "!==": 5, + "<": 6, + ">": 6, + "<=": 6, + ">=": 6, + in: 6, + instanceof: 6, + ">>": 7, + "<<": 7, + ">>>": 7, + "+": 8, + "-": 8, + "*": 9, + "/": 9, + "%": 9, + "**": 10 +}; +function isTSTypeExpression(node) { + return isTSAsExpression(node) || isTSSatisfiesExpression(node) || isTSTypeAssertion(node); +} +const isClassExtendsClause = (node, parent) => isClass(parent, { + superClass: node +}); +const hasPostfixPart = (node, parent) => (isMemberExpression(parent) || isOptionalMemberExpression(parent)) && parent.object === node || (isCallExpression(parent) || isOptionalCallExpression(parent) || isNewExpression(parent)) && parent.callee === node || isTaggedTemplateExpression(parent) && parent.tag === node || isTSNonNullExpression(parent); +function NullableTypeAnnotation(node, parent) { + return isArrayTypeAnnotation(parent); +} +function FunctionTypeAnnotation(node, parent, printStack) { + if (printStack.length < 3) return; + return isUnionTypeAnnotation(parent) || isIntersectionTypeAnnotation(parent) || isArrayTypeAnnotation(parent) || isTypeAnnotation(parent) && isArrowFunctionExpression(printStack[printStack.length - 3]); +} +function UpdateExpression(node, parent) { + return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent); +} +function ObjectExpression(node, parent, printStack) { + return isFirstInContext(printStack, 1 | 2); +} +function DoExpression(node, parent, printStack) { + return !node.async && isFirstInContext(printStack, 1); +} +function Binary(node, parent) { + if (node.operator === "**" && isBinaryExpression(parent, { + operator: "**" + })) { + return parent.left === node; + } + if (isClassExtendsClause(node, parent)) { + return true; + } + if (hasPostfixPart(node, parent) || isUnaryLike(parent) || isAwaitExpression(parent)) { + return true; + } + if (isBinary(parent)) { + const parentOp = parent.operator; + const parentPos = PRECEDENCE[parentOp]; + const nodeOp = node.operator; + const nodePos = PRECEDENCE[nodeOp]; + if (parentPos === nodePos && parent.right === node && !isLogicalExpression(parent) || parentPos > nodePos) { + return true; + } + } +} +function UnionTypeAnnotation(node, parent) { + return isArrayTypeAnnotation(parent) || isNullableTypeAnnotation(parent) || isIntersectionTypeAnnotation(parent) || isUnionTypeAnnotation(parent); +} +function OptionalIndexedAccessType(node, parent) { + return isIndexedAccessType(parent, { + objectType: node + }); +} +function TSAsExpression() { + return true; +} +function TSUnionType(node, parent) { + return isTSArrayType(parent) || isTSOptionalType(parent) || isTSIntersectionType(parent) || isTSUnionType(parent) || isTSRestType(parent); +} +function TSInferType(node, parent) { + return isTSArrayType(parent) || isTSOptionalType(parent); +} +function TSInstantiationExpression(node, parent) { + return (isCallExpression(parent) || isOptionalCallExpression(parent) || isNewExpression(parent) || isTSInstantiationExpression(parent)) && !!parent.typeParameters; +} +function BinaryExpression(node, parent) { + return node.operator === "in" && (isVariableDeclarator(parent) || isFor(parent)); +} +function SequenceExpression(node, parent) { + if (isForStatement(parent) || isThrowStatement(parent) || isReturnStatement(parent) || isIfStatement(parent) && parent.test === node || isWhileStatement(parent) && parent.test === node || isForInStatement(parent) && parent.right === node || isSwitchStatement(parent) && parent.discriminant === node || isExpressionStatement(parent) && parent.expression === node) { + return false; + } + return true; +} +function YieldExpression(node, parent) { + return isBinary(parent) || isUnaryLike(parent) || hasPostfixPart(node, parent) || isAwaitExpression(parent) && isYieldExpression(node) || isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent); +} +function ClassExpression(node, parent, printStack) { + return isFirstInContext(printStack, 1 | 4); +} +function UnaryLike(node, parent) { + return hasPostfixPart(node, parent) || isBinaryExpression(parent, { + operator: "**", + left: node + }) || isClassExtendsClause(node, parent); +} +function FunctionExpression(node, parent, printStack) { + return isFirstInContext(printStack, 1 | 4); +} +function ArrowFunctionExpression(node, parent) { + return isExportDeclaration(parent) || ConditionalExpression(node, parent); +} +function ConditionalExpression(node, parent) { + if (isUnaryLike(parent) || isBinary(parent) || isConditionalExpression(parent, { + test: node + }) || isAwaitExpression(parent) || isTSTypeExpression(parent)) { + return true; + } + return UnaryLike(node, parent); +} +function OptionalMemberExpression(node, parent) { + return isCallExpression(parent, { + callee: node + }) || isMemberExpression(parent, { + object: node + }); +} +function AssignmentExpression(node, parent) { + if (isObjectPattern(node.left)) { + return true; + } else { + return ConditionalExpression(node, parent); + } +} +function LogicalExpression(node, parent) { + if (isTSTypeExpression(parent)) return true; + switch (node.operator) { + case "||": + if (!isLogicalExpression(parent)) return false; + return parent.operator === "??" || parent.operator === "&&"; + case "&&": + return isLogicalExpression(parent, { + operator: "??" + }); + case "??": + return isLogicalExpression(parent) && parent.operator !== "??"; + } +} +function Identifier(node, parent, printStack) { + var _node$extra; + if ((_node$extra = node.extra) != null && _node$extra.parenthesized && isAssignmentExpression(parent, { + left: node + }) && (isFunctionExpression(parent.right) || isClassExpression(parent.right)) && parent.right.id == null) { + return true; + } + if (node.name === "let") { + const isFollowedByBracket = isMemberExpression(parent, { + object: node, + computed: true + }) || isOptionalMemberExpression(parent, { + object: node, + computed: true, + optional: false + }); + return isFirstInContext(printStack, isFollowedByBracket ? 1 | 8 | 16 | 32 : 32); + } + return node.name === "async" && isForOfStatement(parent) && node === parent.left; +} +function isFirstInContext(printStack, checkParam) { + const expressionStatement = checkParam & 1; + const arrowBody = checkParam & 2; + const exportDefault = checkParam & 4; + const forHead = checkParam & 8; + const forInHead = checkParam & 16; + const forOfHead = checkParam & 32; + let i = printStack.length - 1; + if (i <= 0) return; + let node = printStack[i]; + i--; + let parent = printStack[i]; + while (i >= 0) { + if (expressionStatement && isExpressionStatement(parent, { + expression: node + }) || exportDefault && isExportDefaultDeclaration(parent, { + declaration: node + }) || arrowBody && isArrowFunctionExpression(parent, { + body: node + }) || forHead && isForStatement(parent, { + init: node + }) || forInHead && isForInStatement(parent, { + left: node + }) || forOfHead && isForOfStatement(parent, { + left: node + })) { + return true; + } + if (i > 0 && (hasPostfixPart(node, parent) && !isNewExpression(parent) || isSequenceExpression(parent) && parent.expressions[0] === node || isUpdateExpression(parent) && !parent.prefix || isConditional(parent, { + test: node + }) || isBinary(parent, { + left: node + }) || isAssignmentExpression(parent, { + left: node + }))) { + node = parent; + i--; + parent = printStack[i]; + } else { + return false; + } + } + return false; +} + +//# sourceMappingURL=parentheses.js.map + + +/***/ }), + +/***/ 9826: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.nodes = void 0; +var _t = __nccwpck_require__(7012); +const { + FLIPPED_ALIAS_KEYS, + isArrayExpression, + isAssignmentExpression, + isBinary, + isBlockStatement, + isCallExpression, + isFunction, + isIdentifier, + isLiteral, + isMemberExpression, + isObjectExpression, + isOptionalCallExpression, + isOptionalMemberExpression, + isStringLiteral +} = _t; +function crawlInternal(node, state) { + if (!node) return state; + if (isMemberExpression(node) || isOptionalMemberExpression(node)) { + crawlInternal(node.object, state); + if (node.computed) crawlInternal(node.property, state); + } else if (isBinary(node) || isAssignmentExpression(node)) { + crawlInternal(node.left, state); + crawlInternal(node.right, state); + } else if (isCallExpression(node) || isOptionalCallExpression(node)) { + state.hasCall = true; + crawlInternal(node.callee, state); + } else if (isFunction(node)) { + state.hasFunction = true; + } else if (isIdentifier(node)) { + state.hasHelper = state.hasHelper || node.callee && isHelper(node.callee); + } + return state; +} +function crawl(node) { + return crawlInternal(node, { + hasCall: false, + hasFunction: false, + hasHelper: false + }); +} +function isHelper(node) { + if (!node) return false; + if (isMemberExpression(node)) { + return isHelper(node.object) || isHelper(node.property); + } else if (isIdentifier(node)) { + return node.name === "require" || node.name.charCodeAt(0) === 95; + } else if (isCallExpression(node)) { + return isHelper(node.callee); + } else if (isBinary(node) || isAssignmentExpression(node)) { + return isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right); + } else { + return false; + } +} +function isType(node) { + return isLiteral(node) || isObjectExpression(node) || isArrayExpression(node) || isIdentifier(node) || isMemberExpression(node); +} +const nodes = { + AssignmentExpression(node) { + const state = crawl(node.right); + if (state.hasCall && state.hasHelper || state.hasFunction) { + return state.hasFunction ? 1 | 2 : 2; + } + }, + SwitchCase(node, parent) { + return (!!node.consequent.length || parent.cases[0] === node ? 1 : 0) | (!node.consequent.length && parent.cases[parent.cases.length - 1] === node ? 2 : 0); + }, + LogicalExpression(node) { + if (isFunction(node.left) || isFunction(node.right)) { + return 2; + } + }, + Literal(node) { + if (isStringLiteral(node) && node.value === "use strict") { + return 2; + } + }, + CallExpression(node) { + if (isFunction(node.callee) || isHelper(node)) { + return 1 | 2; + } + }, + OptionalCallExpression(node) { + if (isFunction(node.callee)) { + return 1 | 2; + } + }, + VariableDeclaration(node) { + for (let i = 0; i < node.declarations.length; i++) { + const declar = node.declarations[i]; + let enabled = isHelper(declar.id) && !isType(declar.init); + if (!enabled && declar.init) { + const state = crawl(declar.init); + enabled = isHelper(declar.init) && state.hasCall || state.hasFunction; + } + if (enabled) { + return 1 | 2; + } + } + }, + IfStatement(node) { + if (isBlockStatement(node.consequent)) { + return 1 | 2; + } + } +}; +exports.nodes = nodes; +nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node, parent) { + if (parent.properties[0] === node) { + return 1; + } +}; +nodes.ObjectTypeCallProperty = function (node, parent) { + var _parent$properties; + if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) != null && _parent$properties.length)) { + return 1; + } +}; +nodes.ObjectTypeIndexer = function (node, parent) { + var _parent$properties2, _parent$callPropertie; + if (parent.indexers[0] === node && !((_parent$properties2 = parent.properties) != null && _parent$properties2.length) && !((_parent$callPropertie = parent.callProperties) != null && _parent$callPropertie.length)) { + return 1; + } +}; +nodes.ObjectTypeInternalSlot = function (node, parent) { + var _parent$properties3, _parent$callPropertie2, _parent$indexers; + if (parent.internalSlots[0] === node && !((_parent$properties3 = parent.properties) != null && _parent$properties3.length) && !((_parent$callPropertie2 = parent.callProperties) != null && _parent$callPropertie2.length) && !((_parent$indexers = parent.indexers) != null && _parent$indexers.length)) { + return 1; + } +}; +[["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function ([type, amounts]) { + [type].concat(FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { + const ret = amounts ? 1 | 2 : 0; + nodes[type] = () => ret; + }); +}); + +//# sourceMappingURL=whitespace.js.map + + +/***/ }), + +/***/ 3027: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _buffer = __nccwpck_require__(7893); +var n = __nccwpck_require__(5051); +var _t = __nccwpck_require__(7012); +var generatorFunctions = __nccwpck_require__(3633); +const { + isFunction, + isStatement, + isClassBody, + isTSInterfaceBody, + isTSEnumDeclaration +} = _t; +const SCIENTIFIC_NOTATION = /e/i; +const ZERO_DECIMAL_INTEGER = /\.0+$/; +const NON_DECIMAL_LITERAL = /^0[box]/; +const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/; +const HAS_NEWLINE = /[\n\r\u2028\u2029]/; +const HAS_BlOCK_COMMENT_END = /\*\//; +const { + needsParens +} = n; +class Printer { + constructor(format, map) { + this.inForStatementInitCounter = 0; + this._printStack = []; + this._indent = 0; + this._indentChar = 0; + this._indentRepeat = 0; + this._insideAux = false; + this._parenPushNewlineState = null; + this._noLineTerminator = false; + this._printAuxAfterOnNextUserNode = false; + this._printedComments = new Set(); + this._endsWithInteger = false; + this._endsWithWord = false; + this._lastCommentLine = 0; + this._endsWithInnerRaw = false; + this._indentInnerComments = true; + this.format = format; + this._buf = new _buffer.default(map); + this._indentChar = format.indent.style.charCodeAt(0); + this._indentRepeat = format.indent.style.length; + this._inputMap = map == null ? void 0 : map._inputMap; + } + generate(ast) { + this.print(ast); + this._maybeAddAuxComment(); + return this._buf.get(); + } + indent() { + if (this.format.compact || this.format.concise) return; + this._indent++; + } + dedent() { + if (this.format.compact || this.format.concise) return; + this._indent--; + } + semicolon(force = false) { + this._maybeAddAuxComment(); + if (force) { + this._appendChar(59); + } else { + this._queue(59); + } + this._noLineTerminator = false; + } + rightBrace(node) { + if (this.format.minified) { + this._buf.removeLastSemicolon(); + } + this.sourceWithOffset("end", node.loc, -1); + this.tokenChar(125); + } + rightParens(node) { + this.sourceWithOffset("end", node.loc, -1); + this.tokenChar(41); + } + space(force = false) { + if (this.format.compact) return; + if (force) { + this._space(); + } else if (this._buf.hasContent()) { + const lastCp = this.getLastChar(); + if (lastCp !== 32 && lastCp !== 10) { + this._space(); + } + } + } + word(str, noLineTerminatorAfter = false) { + this._maybePrintInnerComments(); + if (this._endsWithWord || str.charCodeAt(0) === 47 && this.endsWith(47)) { + this._space(); + } + this._maybeAddAuxComment(); + this._append(str, false); + this._endsWithWord = true; + this._noLineTerminator = noLineTerminatorAfter; + } + number(str) { + this.word(str); + this._endsWithInteger = Number.isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46; + } + token(str, maybeNewline = false) { + this._maybePrintInnerComments(); + const lastChar = this.getLastChar(); + const strFirst = str.charCodeAt(0); + if (lastChar === 33 && (str === "--" || strFirst === 61) || strFirst === 43 && lastChar === 43 || strFirst === 45 && lastChar === 45 || strFirst === 46 && this._endsWithInteger) { + this._space(); + } + this._maybeAddAuxComment(); + this._append(str, maybeNewline); + this._noLineTerminator = false; + } + tokenChar(char) { + this._maybePrintInnerComments(); + const lastChar = this.getLastChar(); + if (char === 43 && lastChar === 43 || char === 45 && lastChar === 45 || char === 46 && this._endsWithInteger) { + this._space(); + } + this._maybeAddAuxComment(); + this._appendChar(char); + this._noLineTerminator = false; + } + newline(i = 1, force) { + if (i <= 0) return; + if (!force) { + if (this.format.retainLines || this.format.compact) return; + if (this.format.concise) { + this.space(); + return; + } + } + if (i > 2) i = 2; + i -= this._buf.getNewlineCount(); + for (let j = 0; j < i; j++) { + this._newline(); + } + return; + } + endsWith(char) { + return this.getLastChar() === char; + } + getLastChar() { + return this._buf.getLastChar(); + } + endsWithCharAndNewline() { + return this._buf.endsWithCharAndNewline(); + } + removeTrailingNewline() { + this._buf.removeTrailingNewline(); + } + exactSource(loc, cb) { + if (!loc) { + cb(); + return; + } + this._catchUp("start", loc); + this._buf.exactSource(loc, cb); + } + source(prop, loc) { + if (!loc) return; + this._catchUp(prop, loc); + this._buf.source(prop, loc); + } + sourceWithOffset(prop, loc, columnOffset) { + if (!loc) return; + this._catchUp(prop, loc); + this._buf.sourceWithOffset(prop, loc, columnOffset); + } + withSource(prop, loc, cb) { + if (!loc) { + cb(); + return; + } + this._catchUp(prop, loc); + this._buf.withSource(prop, loc, cb); + } + sourceIdentifierName(identifierName, pos) { + if (!this._buf._canMarkIdName) return; + const sourcePosition = this._buf._sourcePosition; + sourcePosition.identifierNamePos = pos; + sourcePosition.identifierName = identifierName; + } + _space() { + this._queue(32); + } + _newline() { + this._queue(10); + } + _append(str, maybeNewline) { + this._maybeAddParen(str); + this._maybeIndent(str.charCodeAt(0)); + this._buf.append(str, maybeNewline); + this._endsWithWord = false; + this._endsWithInteger = false; + } + _appendChar(char) { + this._maybeAddParenChar(char); + this._maybeIndent(char); + this._buf.appendChar(char); + this._endsWithWord = false; + this._endsWithInteger = false; + } + _queue(char) { + this._maybeAddParenChar(char); + this._maybeIndent(char); + this._buf.queue(char); + this._endsWithWord = false; + this._endsWithInteger = false; + } + _maybeIndent(firstChar) { + if (this._indent && firstChar !== 10 && this.endsWith(10)) { + this._buf.queueIndentation(this._indentChar, this._getIndent()); + } + } + _shouldIndent(firstChar) { + if (this._indent && firstChar !== 10 && this.endsWith(10)) { + return true; + } + } + _maybeAddParenChar(char) { + const parenPushNewlineState = this._parenPushNewlineState; + if (!parenPushNewlineState) return; + if (char === 32) { + return; + } + if (char !== 10) { + this._parenPushNewlineState = null; + return; + } + this.tokenChar(40); + this.indent(); + parenPushNewlineState.printed = true; + } + _maybeAddParen(str) { + const parenPushNewlineState = this._parenPushNewlineState; + if (!parenPushNewlineState) return; + const len = str.length; + let i; + for (i = 0; i < len && str.charCodeAt(i) === 32; i++) continue; + if (i === len) { + return; + } + const cha = str.charCodeAt(i); + if (cha !== 10) { + if (cha !== 47 || i + 1 === len) { + this._parenPushNewlineState = null; + return; + } + const chaPost = str.charCodeAt(i + 1); + if (chaPost === 42) { + if (PURE_ANNOTATION_RE.test(str.slice(i + 2, len - 2))) { + return; + } + } else if (chaPost !== 47) { + this._parenPushNewlineState = null; + return; + } + } + this.tokenChar(40); + this.indent(); + parenPushNewlineState.printed = true; + } + catchUp(line) { + if (!this.format.retainLines) return; + const count = line - this._buf.getCurrentLine(); + for (let i = 0; i < count; i++) { + this._newline(); + } + } + _catchUp(prop, loc) { + var _loc$prop; + if (!this.format.retainLines) return; + const line = loc == null || (_loc$prop = loc[prop]) == null ? void 0 : _loc$prop.line; + if (line != null) { + const count = line - this._buf.getCurrentLine(); + for (let i = 0; i < count; i++) { + this._newline(); + } + } + } + _getIndent() { + return this._indentRepeat * this._indent; + } + printTerminatorless(node, parent, isLabel) { + if (isLabel) { + this._noLineTerminator = true; + this.print(node, parent); + } else { + const terminatorState = { + printed: false + }; + this._parenPushNewlineState = terminatorState; + this.print(node, parent); + if (terminatorState.printed) { + this.dedent(); + this.newline(); + this.tokenChar(41); + } + } + } + print(node, parent, noLineTerminatorAfter, trailingCommentsLineOffset, forceParens) { + var _node$extra; + if (!node) return; + this._endsWithInnerRaw = false; + const nodeType = node.type; + const format = this.format; + const oldConcise = format.concise; + if (node._compact) { + format.concise = true; + } + const printMethod = this[nodeType]; + if (printMethod === undefined) { + throw new ReferenceError(`unknown node of type ${JSON.stringify(nodeType)} with constructor ${JSON.stringify(node.constructor.name)}`); + } + this._printStack.push(node); + const oldInAux = this._insideAux; + this._insideAux = node.loc == undefined; + this._maybeAddAuxComment(this._insideAux && !oldInAux); + const shouldPrintParens = forceParens || format.retainFunctionParens && nodeType === "FunctionExpression" && ((_node$extra = node.extra) == null ? void 0 : _node$extra.parenthesized) || needsParens(node, parent, this._printStack); + if (shouldPrintParens) { + this.tokenChar(40); + this._endsWithInnerRaw = false; + } + this._lastCommentLine = 0; + this._printLeadingComments(node, parent); + const loc = nodeType === "Program" || nodeType === "File" ? null : node.loc; + this.exactSource(loc, printMethod.bind(this, node, parent)); + if (shouldPrintParens) { + this._printTrailingComments(node, parent); + this.tokenChar(41); + this._noLineTerminator = noLineTerminatorAfter; + } else if (noLineTerminatorAfter && !this._noLineTerminator) { + this._noLineTerminator = true; + this._printTrailingComments(node, parent); + } else { + this._printTrailingComments(node, parent, trailingCommentsLineOffset); + } + this._printStack.pop(); + format.concise = oldConcise; + this._insideAux = oldInAux; + this._endsWithInnerRaw = false; + } + _maybeAddAuxComment(enteredPositionlessNode) { + if (enteredPositionlessNode) this._printAuxBeforeComment(); + if (!this._insideAux) this._printAuxAfterComment(); + } + _printAuxBeforeComment() { + if (this._printAuxAfterOnNextUserNode) return; + this._printAuxAfterOnNextUserNode = true; + const comment = this.format.auxiliaryCommentBefore; + if (comment) { + this._printComment({ + type: "CommentBlock", + value: comment + }, 0); + } + } + _printAuxAfterComment() { + if (!this._printAuxAfterOnNextUserNode) return; + this._printAuxAfterOnNextUserNode = false; + const comment = this.format.auxiliaryCommentAfter; + if (comment) { + this._printComment({ + type: "CommentBlock", + value: comment + }, 0); + } + } + getPossibleRaw(node) { + const extra = node.extra; + if ((extra == null ? void 0 : extra.raw) != null && extra.rawValue != null && node.value === extra.rawValue) { + return extra.raw; + } + } + printJoin(nodes, parent, opts = {}) { + if (!(nodes != null && nodes.length)) return; + let { + indent + } = opts; + if (indent == null && this.format.retainLines) { + var _nodes$0$loc; + const startLine = (_nodes$0$loc = nodes[0].loc) == null ? void 0 : _nodes$0$loc.start.line; + if (startLine != null && startLine !== this._buf.getCurrentLine()) { + indent = true; + } + } + if (indent) this.indent(); + const newlineOpts = { + addNewlines: opts.addNewlines, + nextNodeStartLine: 0 + }; + const separator = opts.separator ? opts.separator.bind(this) : null; + const len = nodes.length; + for (let i = 0; i < len; i++) { + const node = nodes[i]; + if (!node) continue; + if (opts.statement) this._printNewline(i === 0, newlineOpts); + this.print(node, parent, undefined, opts.trailingCommentsLineOffset || 0); + opts.iterator == null ? void 0 : opts.iterator(node, i); + if (i < len - 1) separator == null ? void 0 : separator(); + if (opts.statement) { + if (i + 1 === len) { + this.newline(1); + } else { + var _nextNode$loc; + const nextNode = nodes[i + 1]; + newlineOpts.nextNodeStartLine = ((_nextNode$loc = nextNode.loc) == null ? void 0 : _nextNode$loc.start.line) || 0; + this._printNewline(true, newlineOpts); + } + } + } + if (indent) this.dedent(); + } + printAndIndentOnComments(node, parent) { + const indent = node.leadingComments && node.leadingComments.length > 0; + if (indent) this.indent(); + this.print(node, parent); + if (indent) this.dedent(); + } + printBlock(parent) { + const node = parent.body; + if (node.type !== "EmptyStatement") { + this.space(); + } + this.print(node, parent); + } + _printTrailingComments(node, parent, lineOffset) { + const { + innerComments, + trailingComments + } = node; + if (innerComments != null && innerComments.length) { + this._printComments(2, innerComments, node, parent, lineOffset); + } + if (trailingComments != null && trailingComments.length) { + this._printComments(2, trailingComments, node, parent, lineOffset); + } + } + _printLeadingComments(node, parent) { + const comments = node.leadingComments; + if (!(comments != null && comments.length)) return; + this._printComments(0, comments, node, parent); + } + _maybePrintInnerComments() { + if (this._endsWithInnerRaw) this.printInnerComments(); + this._endsWithInnerRaw = true; + this._indentInnerComments = true; + } + printInnerComments() { + const node = this._printStack[this._printStack.length - 1]; + const comments = node.innerComments; + if (!(comments != null && comments.length)) return; + const hasSpace = this.endsWith(32); + const indent = this._indentInnerComments; + const printedCommentsCount = this._printedComments.size; + if (indent) this.indent(); + this._printComments(1, comments, node); + if (hasSpace && printedCommentsCount !== this._printedComments.size) { + this.space(); + } + if (indent) this.dedent(); + } + noIndentInnerCommentsHere() { + this._indentInnerComments = false; + } + printSequence(nodes, parent, opts = {}) { + var _opts$indent; + opts.statement = true; + (_opts$indent = opts.indent) != null ? _opts$indent : opts.indent = false; + this.printJoin(nodes, parent, opts); + } + printList(items, parent, opts = {}) { + if (opts.separator == null) { + opts.separator = commaSeparator; + } + this.printJoin(items, parent, opts); + } + _printNewline(newLine, opts) { + const format = this.format; + if (format.retainLines || format.compact) return; + if (format.concise) { + this.space(); + return; + } + if (!newLine) { + return; + } + const startLine = opts.nextNodeStartLine; + const lastCommentLine = this._lastCommentLine; + if (startLine > 0 && lastCommentLine > 0) { + const offset = startLine - lastCommentLine; + if (offset >= 0) { + this.newline(offset || 1); + return; + } + } + if (this._buf.hasContent()) { + this.newline(1); + } + } + _shouldPrintComment(comment) { + if (comment.ignore) return 0; + if (this._printedComments.has(comment)) return 0; + if (this._noLineTerminator && (HAS_NEWLINE.test(comment.value) || HAS_BlOCK_COMMENT_END.test(comment.value))) { + return 2; + } + this._printedComments.add(comment); + if (!this.format.shouldPrintComment(comment.value)) { + return 0; + } + return 1; + } + _printComment(comment, skipNewLines) { + const noLineTerminator = this._noLineTerminator; + const isBlockComment = comment.type === "CommentBlock"; + const printNewLines = isBlockComment && skipNewLines !== 1 && !this._noLineTerminator; + if (printNewLines && this._buf.hasContent() && skipNewLines !== 2) { + this.newline(1); + } + const lastCharCode = this.getLastChar(); + if (lastCharCode !== 91 && lastCharCode !== 123) { + this.space(); + } + let val; + if (isBlockComment) { + val = `/*${comment.value}*/`; + if (this.format.indent.adjustMultilineComment) { + var _comment$loc; + const offset = (_comment$loc = comment.loc) == null ? void 0 : _comment$loc.start.column; + if (offset) { + const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); + val = val.replace(newlineRegex, "\n"); + } + let indentSize = this.format.retainLines ? 0 : this._buf.getCurrentColumn(); + if (this._shouldIndent(47) || this.format.retainLines) { + indentSize += this._getIndent(); + } + val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`); + } + } else if (!noLineTerminator) { + val = `//${comment.value}`; + } else { + val = `/*${comment.value}*/`; + } + if (this.endsWith(47)) this._space(); + this.source("start", comment.loc); + this._append(val, isBlockComment); + if (!isBlockComment && !noLineTerminator) { + this.newline(1, true); + } + if (printNewLines && skipNewLines !== 3) { + this.newline(1); + } + } + _printComments(type, comments, node, parent, lineOffset = 0) { + const nodeLoc = node.loc; + const len = comments.length; + let hasLoc = !!nodeLoc; + const nodeStartLine = hasLoc ? nodeLoc.start.line : 0; + const nodeEndLine = hasLoc ? nodeLoc.end.line : 0; + let lastLine = 0; + let leadingCommentNewline = 0; + const maybeNewline = this._noLineTerminator ? function () {} : this.newline.bind(this); + for (let i = 0; i < len; i++) { + const comment = comments[i]; + const shouldPrint = this._shouldPrintComment(comment); + if (shouldPrint === 2) { + hasLoc = false; + break; + } + if (hasLoc && comment.loc && shouldPrint === 1) { + const commentStartLine = comment.loc.start.line; + const commentEndLine = comment.loc.end.line; + if (type === 0) { + let offset = 0; + if (i === 0) { + if (this._buf.hasContent() && (comment.type === "CommentLine" || commentStartLine != commentEndLine)) { + offset = leadingCommentNewline = 1; + } + } else { + offset = commentStartLine - lastLine; + } + lastLine = commentEndLine; + maybeNewline(offset); + this._printComment(comment, 1); + if (i + 1 === len) { + maybeNewline(Math.max(nodeStartLine - lastLine, leadingCommentNewline)); + lastLine = nodeStartLine; + } + } else if (type === 1) { + const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine); + lastLine = commentEndLine; + maybeNewline(offset); + this._printComment(comment, 1); + if (i + 1 === len) { + maybeNewline(Math.min(1, nodeEndLine - lastLine)); + lastLine = nodeEndLine; + } + } else { + const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine); + lastLine = commentEndLine; + maybeNewline(offset); + this._printComment(comment, 1); + } + } else { + hasLoc = false; + if (shouldPrint !== 1) { + continue; + } + if (len === 1) { + const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value); + const shouldSkipNewline = singleLine && !isStatement(node) && !isClassBody(parent) && !isTSInterfaceBody(parent) && !isTSEnumDeclaration(parent); + if (type === 0) { + this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent, { + body: node + }) ? 1 : 0); + } else if (shouldSkipNewline && type === 2) { + this._printComment(comment, 1); + } else { + this._printComment(comment, 0); + } + } else if (type === 1 && !(node.type === "ObjectExpression" && node.properties.length > 1) && node.type !== "ClassBody" && node.type !== "TSInterfaceBody") { + this._printComment(comment, i === 0 ? 2 : i === len - 1 ? 3 : 0); + } else { + this._printComment(comment, 0); + } + } + } + if (type === 2 && hasLoc && lastLine) { + this._lastCommentLine = lastLine; + } + } +} +Object.assign(Printer.prototype, generatorFunctions); +{ + Printer.prototype.Noop = function Noop() {}; +} +var _default = Printer; +exports.default = _default; +function commaSeparator() { + this.tokenChar(44); + this.space(); +} + +//# sourceMappingURL=printer.js.map + + +/***/ }), + +/***/ 7780: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _genMapping = __nccwpck_require__(5573); +var _traceMapping = __nccwpck_require__(4817); +class SourceMap { + constructor(opts, code) { + var _opts$sourceFileName; + this._map = void 0; + this._rawMappings = void 0; + this._sourceFileName = void 0; + this._lastGenLine = 0; + this._lastSourceLine = 0; + this._lastSourceColumn = 0; + this._inputMap = void 0; + const map = this._map = new _genMapping.GenMapping({ + sourceRoot: opts.sourceRoot + }); + this._sourceFileName = (_opts$sourceFileName = opts.sourceFileName) == null ? void 0 : _opts$sourceFileName.replace(/\\/g, "/"); + this._rawMappings = undefined; + if (opts.inputSourceMap) { + this._inputMap = new _traceMapping.TraceMap(opts.inputSourceMap); + const resolvedSources = this._inputMap.resolvedSources; + if (resolvedSources.length) { + for (let i = 0; i < resolvedSources.length; i++) { + var _this$_inputMap$sourc; + (0, _genMapping.setSourceContent)(map, resolvedSources[i], (_this$_inputMap$sourc = this._inputMap.sourcesContent) == null ? void 0 : _this$_inputMap$sourc[i]); + } + } + } + if (typeof code === "string" && !opts.inputSourceMap) { + (0, _genMapping.setSourceContent)(map, this._sourceFileName, code); + } else if (typeof code === "object") { + for (const sourceFileName of Object.keys(code)) { + (0, _genMapping.setSourceContent)(map, sourceFileName.replace(/\\/g, "/"), code[sourceFileName]); + } + } + } + get() { + return (0, _genMapping.toEncodedMap)(this._map); + } + getDecoded() { + return (0, _genMapping.toDecodedMap)(this._map); + } + getRawMappings() { + return this._rawMappings || (this._rawMappings = (0, _genMapping.allMappings)(this._map)); + } + mark(generated, line, column, identifierName, identifierNamePos, filename) { + var _originalMapping; + this._rawMappings = undefined; + let originalMapping; + if (line != null) { + if (this._inputMap) { + originalMapping = (0, _traceMapping.originalPositionFor)(this._inputMap, { + line, + column + }); + if (!originalMapping.name && identifierNamePos) { + const originalIdentifierMapping = (0, _traceMapping.originalPositionFor)(this._inputMap, identifierNamePos); + if (originalIdentifierMapping.name) { + identifierName = originalIdentifierMapping.name; + } + } + } else { + originalMapping = { + source: (filename == null ? void 0 : filename.replace(/\\/g, "/")) || this._sourceFileName, + line: line, + column: column + }; + } + } + (0, _genMapping.maybeAddMapping)(this._map, { + name: identifierName, + generated, + source: (_originalMapping = originalMapping) == null ? void 0 : _originalMapping.source, + original: originalMapping + }); + } +} +exports.default = SourceMap; + +//# sourceMappingURL=source-map.js.map + + +/***/ }), + +/***/ 5573: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +(function (global, factory) { + true ? factory(exports, __nccwpck_require__(3780), __nccwpck_require__(7225), __nccwpck_require__(4817)) : + 0; +})(this, (function (exports, setArray, sourcemapCodec, traceMapping) { 'use strict'; + + const COLUMN = 0; + const SOURCES_INDEX = 1; + const SOURCE_LINE = 2; + const SOURCE_COLUMN = 3; + const NAMES_INDEX = 4; + + const NO_NAME = -1; + /** + * A low-level API to associate a generated position with an original source position. Line and + * column here are 0-based, unlike `addMapping`. + */ + exports.addSegment = void 0; + /** + * A high-level API to associate a generated position with an original source position. Line is + * 1-based, but column is 0-based, due to legacy behavior in `source-map` library. + */ + exports.addMapping = void 0; + /** + * Same as `addSegment`, but will only add the segment if it generates useful information in the + * resulting map. This only works correctly if segments are added **in order**, meaning you should + * not add a segment with a lower generated line/column than one that came before. + */ + exports.maybeAddSegment = void 0; + /** + * Same as `addMapping`, but will only add the mapping if it generates useful information in the + * resulting map. This only works correctly if mappings are added **in order**, meaning you should + * not add a mapping with a lower generated line/column than one that came before. + */ + exports.maybeAddMapping = void 0; + /** + * Adds/removes the content of the source file to the source map. + */ + exports.setSourceContent = void 0; + /** + * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ + exports.toDecodedMap = void 0; + /** + * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ + exports.toEncodedMap = void 0; + /** + * Constructs a new GenMapping, using the already present mappings of the input. + */ + exports.fromMap = void 0; + /** + * Returns an array of high-level mapping objects for every recorded segment, which could then be + * passed to the `source-map` library. + */ + exports.allMappings = void 0; + // This split declaration is only so that terser can elminiate the static initialization block. + let addSegmentInternal; + /** + * Provides the state to generate a sourcemap. + */ + class GenMapping { + constructor({ file, sourceRoot } = {}) { + this._names = new setArray.SetArray(); + this._sources = new setArray.SetArray(); + this._sourcesContent = []; + this._mappings = []; + this.file = file; + this.sourceRoot = sourceRoot; + } + } + (() => { + exports.addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { + return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); + }; + exports.maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { + return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); + }; + exports.addMapping = (map, mapping) => { + return addMappingInternal(false, map, mapping); + }; + exports.maybeAddMapping = (map, mapping) => { + return addMappingInternal(true, map, mapping); + }; + exports.setSourceContent = (map, source, content) => { + const { _sources: sources, _sourcesContent: sourcesContent } = map; + sourcesContent[setArray.put(sources, source)] = content; + }; + exports.toDecodedMap = (map) => { + const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map; + removeEmptyFinalLines(mappings); + return { + version: 3, + file: file || undefined, + names: names.array, + sourceRoot: sourceRoot || undefined, + sources: sources.array, + sourcesContent, + mappings, + }; + }; + exports.toEncodedMap = (map) => { + const decoded = exports.toDecodedMap(map); + return Object.assign(Object.assign({}, decoded), { mappings: sourcemapCodec.encode(decoded.mappings) }); + }; + exports.allMappings = (map) => { + const out = []; + const { _mappings: mappings, _sources: sources, _names: names } = map; + for (let i = 0; i < mappings.length; i++) { + const line = mappings[i]; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + const generated = { line: i + 1, column: seg[COLUMN] }; + let source = undefined; + let original = undefined; + let name = undefined; + if (seg.length !== 1) { + source = sources.array[seg[SOURCES_INDEX]]; + original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] }; + if (seg.length === 5) + name = names.array[seg[NAMES_INDEX]]; + } + out.push({ generated, source, original, name }); + } + } + return out; + }; + exports.fromMap = (input) => { + const map = new traceMapping.TraceMap(input); + const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot }); + putAll(gen._names, map.names); + putAll(gen._sources, map.sources); + gen._sourcesContent = map.sourcesContent || map.sources.map(() => null); + gen._mappings = traceMapping.decodedMappings(map); + return gen; + }; + // Internal helpers + addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { + const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map; + const line = getLine(mappings, genLine); + const index = getColumnIndex(line, genColumn); + if (!source) { + if (skipable && skipSourceless(line, index)) + return; + return insert(line, index, [genColumn]); + } + const sourcesIndex = setArray.put(sources, source); + const namesIndex = name ? setArray.put(names, name) : NO_NAME; + if (sourcesIndex === sourcesContent.length) + sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null; + if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) { + return; + } + return insert(line, index, name + ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] + : [genColumn, sourcesIndex, sourceLine, sourceColumn]); + }; + })(); + function getLine(mappings, index) { + for (let i = mappings.length; i <= index; i++) { + mappings[i] = []; + } + return mappings[index]; + } + function getColumnIndex(line, genColumn) { + let index = line.length; + for (let i = index - 1; i >= 0; index = i--) { + const current = line[i]; + if (genColumn >= current[COLUMN]) + break; + } + return index; + } + function insert(array, index, value) { + for (let i = array.length; i > index; i--) { + array[i] = array[i - 1]; + } + array[index] = value; + } + function removeEmptyFinalLines(mappings) { + const { length } = mappings; + let len = length; + for (let i = len - 1; i >= 0; len = i, i--) { + if (mappings[i].length > 0) + break; + } + if (len < length) + mappings.length = len; + } + function putAll(strarr, array) { + for (let i = 0; i < array.length; i++) + setArray.put(strarr, array[i]); + } + function skipSourceless(line, index) { + // The start of a line is already sourceless, so adding a sourceless segment to the beginning + // doesn't generate any useful information. + if (index === 0) + return true; + const prev = line[index - 1]; + // If the previous segment is also sourceless, then adding another sourceless segment doesn't + // genrate any new information. Else, this segment will end the source/named segment and point to + // a sourceless position, which is useful. + return prev.length === 1; + } + function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) { + // A source/named segment at the start of a line gives position at that genColumn + if (index === 0) + return false; + const prev = line[index - 1]; + // If the previous segment is sourceless, then we're transitioning to a source. + if (prev.length === 1) + return false; + // If the previous segment maps to the exact same source position, then this segment doesn't + // provide any new position information. + return (sourcesIndex === prev[SOURCES_INDEX] && + sourceLine === prev[SOURCE_LINE] && + sourceColumn === prev[SOURCE_COLUMN] && + namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME)); + } + function addMappingInternal(skipable, map, mapping) { + const { generated, source, original, name, content } = mapping; + if (!source) { + return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null); + } + const s = source; + return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content); + } + + exports.GenMapping = GenMapping; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=gen-mapping.umd.js.map + + +/***/ }), + +/***/ 2056: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +exports.requeueComputedKeyAndDecorators = requeueComputedKeyAndDecorators; +{ + exports.skipAllButComputedKey = function skipAllButComputedKey(path) { + path.skip(); + if (path.node.computed) { + path.context.maybeQueue(path.get("key")); + } + }; +} +function requeueComputedKeyAndDecorators(path) { + const { + context, + node + } = path; + if (node.computed) { + context.maybeQueue(path.get("key")); + } + if (node.decorators) { + for (const decorator of path.get("decorators")) { + context.maybeQueue(decorator); + } + } +} +const visitor = { + FunctionParent(path) { + if (path.isArrowFunctionExpression()) { + return; + } else { + path.skip(); + if (path.isMethod()) { + requeueComputedKeyAndDecorators(path); + } + } + }, + Property(path) { + if (path.isObjectProperty()) { + return; + } + path.skip(); + requeueComputedKeyAndDecorators(path); + } +}; +var _default = visitor; +exports.default = _default; + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 9879: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = _default; +var _template = __nccwpck_require__(6745); +var _t = __nccwpck_require__(7012); +const { + NOT_LOCAL_BINDING, + cloneNode, + identifier, + isAssignmentExpression, + isAssignmentPattern, + isFunction, + isIdentifier, + isLiteral, + isNullLiteral, + isObjectMethod, + isObjectProperty, + isRegExpLiteral, + isRestElement, + isTemplateLiteral, + isVariableDeclarator, + toBindingIdentifierName +} = _t; +function getFunctionArity(node) { + const count = node.params.findIndex(param => isAssignmentPattern(param) || isRestElement(param)); + return count === -1 ? node.params.length : count; +} +const buildPropertyMethodAssignmentWrapper = _template.default.statement(` + (function (FUNCTION_KEY) { + function FUNCTION_ID() { + return FUNCTION_KEY.apply(this, arguments); + } + + FUNCTION_ID.toString = function () { + return FUNCTION_KEY.toString(); + } + + return FUNCTION_ID; + })(FUNCTION) +`); +const buildGeneratorPropertyMethodAssignmentWrapper = _template.default.statement(` + (function (FUNCTION_KEY) { + function* FUNCTION_ID() { + return yield* FUNCTION_KEY.apply(this, arguments); + } + + FUNCTION_ID.toString = function () { + return FUNCTION_KEY.toString(); + }; + + return FUNCTION_ID; + })(FUNCTION) +`); +const visitor = { + "ReferencedIdentifier|BindingIdentifier"(path, state) { + if (path.node.name !== state.name) return; + const localDeclar = path.scope.getBindingIdentifier(state.name); + if (localDeclar !== state.outerDeclar) return; + state.selfReference = true; + path.stop(); + } +}; +function getNameFromLiteralId(id) { + if (isNullLiteral(id)) { + return "null"; + } + if (isRegExpLiteral(id)) { + return `_${id.pattern}_${id.flags}`; + } + if (isTemplateLiteral(id)) { + return id.quasis.map(quasi => quasi.value.raw).join(""); + } + if (id.value !== undefined) { + return id.value + ""; + } + return ""; +} +function wrap(state, method, id, scope) { + if (state.selfReference) { + if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) { + scope.rename(id.name); + } else { + if (!isFunction(method)) return; + let build = buildPropertyMethodAssignmentWrapper; + if (method.generator) { + build = buildGeneratorPropertyMethodAssignmentWrapper; + } + const template = build({ + FUNCTION: method, + FUNCTION_ID: id, + FUNCTION_KEY: scope.generateUidIdentifier(id.name) + }).expression; + const params = template.callee.body.body[0].params; + for (let i = 0, len = getFunctionArity(method); i < len; i++) { + params.push(scope.generateUidIdentifier("x")); + } + return template; + } + } + method.id = id; + scope.getProgramParent().references[id.name] = true; +} +function visit(node, name, scope) { + const state = { + selfAssignment: false, + selfReference: false, + outerDeclar: scope.getBindingIdentifier(name), + name: name + }; + const binding = scope.getOwnBinding(name); + if (binding) { + if (binding.kind === "param") { + state.selfReference = true; + } else {} + } else if (state.outerDeclar || scope.hasGlobal(name)) { + scope.traverse(node, visitor, state); + } + return state; +} +function _default({ + node, + parent, + scope, + id +}, localBinding = false, supportUnicodeId = false) { + if (node.id) return; + if ((isObjectProperty(parent) || isObjectMethod(parent, { + kind: "method" + })) && (!parent.computed || isLiteral(parent.key))) { + id = parent.key; + } else if (isVariableDeclarator(parent)) { + id = parent.id; + if (isIdentifier(id) && !localBinding) { + const binding = scope.parent.getBinding(id.name); + if (binding && binding.constant && scope.getBinding(id.name) === binding) { + node.id = cloneNode(id); + node.id[NOT_LOCAL_BINDING] = true; + return; + } + } + } else if (isAssignmentExpression(parent, { + operator: "=" + })) { + id = parent.left; + } else if (!id) { + return; + } + let name; + if (id && isLiteral(id)) { + name = getNameFromLiteralId(id); + } else if (id && isIdentifier(id)) { + name = id.name; + } + if (name === undefined) { + return; + } + if (!supportUnicodeId && isFunction(node) && /[\uD800-\uDFFF]/.test(name)) { + return; + } + name = toBindingIdentifierName(name); + const newId = identifier(name); + newId[NOT_LOCAL_BINDING] = true; + const state = visit(node, name, scope); + return wrap(state, node, newId, scope) || node; +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 3896: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = hoistVariables; +var _t = __nccwpck_require__(7012); +const { + assignmentExpression, + expressionStatement, + identifier +} = _t; +const visitor = { + Scope(path, state) { + if (state.kind === "let") path.skip(); + }, + FunctionParent(path) { + path.skip(); + }, + VariableDeclaration(path, state) { + if (state.kind && path.node.kind !== state.kind) return; + const nodes = []; + const declarations = path.get("declarations"); + let firstId; + for (const declar of declarations) { + firstId = declar.node.id; + if (declar.node.init) { + nodes.push(expressionStatement(assignmentExpression("=", declar.node.id, declar.node.init))); + } + for (const name of Object.keys(declar.getBindingIdentifiers())) { + state.emit(identifier(name), name, declar.node.init !== null); + } + } + if (path.parentPath.isFor({ + left: path.node + })) { + path.replaceWith(firstId); + } else { + path.replaceWithMultiple(nodes); + } + } +}; +function hoistVariables(path, emit, kind = "var") { + path.traverse(visitor, { + kind, + emit + }); +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 7731: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = splitExportDeclaration; +var _t = __nccwpck_require__(7012); +const { + cloneNode, + exportNamedDeclaration, + exportSpecifier, + identifier, + variableDeclaration, + variableDeclarator +} = _t; +function splitExportDeclaration(exportDeclaration) { + if (!exportDeclaration.isExportDeclaration() || exportDeclaration.isExportAllDeclaration()) { + throw new Error("Only default and named export declarations can be split."); + } + if (exportDeclaration.isExportDefaultDeclaration()) { + const declaration = exportDeclaration.get("declaration"); + const standaloneDeclaration = declaration.isFunctionDeclaration() || declaration.isClassDeclaration(); + const exportExpr = declaration.isFunctionExpression() || declaration.isClassExpression(); + const scope = declaration.isScope() ? declaration.scope.parent : declaration.scope; + let id = declaration.node.id; + let needBindingRegistration = false; + if (!id) { + needBindingRegistration = true; + id = scope.generateUidIdentifier("default"); + if (standaloneDeclaration || exportExpr) { + declaration.node.id = cloneNode(id); + } + } else if (exportExpr && scope.hasBinding(id.name)) { + needBindingRegistration = true; + id = scope.generateUidIdentifier(id.name); + } + const updatedDeclaration = standaloneDeclaration ? declaration.node : variableDeclaration("var", [variableDeclarator(cloneNode(id), declaration.node)]); + const updatedExportDeclaration = exportNamedDeclaration(null, [exportSpecifier(cloneNode(id), identifier("default"))]); + exportDeclaration.insertAfter(updatedExportDeclaration); + exportDeclaration.replaceWith(updatedDeclaration); + if (needBindingRegistration) { + scope.registerDeclaration(exportDeclaration); + } + return exportDeclaration; + } else if (exportDeclaration.get("specifiers").length > 0) { + throw new Error("It doesn't make sense to split exported specifiers."); + } + const declaration = exportDeclaration.get("declaration"); + const bindingIdentifiers = declaration.getOuterBindingIdentifiers(); + const specifiers = Object.keys(bindingIdentifiers).map(name => { + return exportSpecifier(identifier(name), identifier(name)); + }); + const aliasDeclar = exportNamedDeclaration(null, specifiers); + exportDeclaration.insertAfter(aliasDeclar); + exportDeclaration.replaceWith(declaration.node); + return exportDeclaration; +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 1133: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.readCodePoint = readCodePoint; +exports.readInt = readInt; +exports.readStringContents = readStringContents; +var _isDigit = function isDigit(code) { + return code >= 48 && code <= 57; +}; +const forbiddenNumericSeparatorSiblings = { + decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]), + hex: new Set([46, 88, 95, 120]) +}; +const isAllowedNumericSeparatorSibling = { + bin: ch => ch === 48 || ch === 49, + oct: ch => ch >= 48 && ch <= 55, + dec: ch => ch >= 48 && ch <= 57, + hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102 +}; +function readStringContents(type, input, pos, lineStart, curLine, errors) { + const initialPos = pos; + const initialLineStart = lineStart; + const initialCurLine = curLine; + let out = ""; + let firstInvalidLoc = null; + let chunkStart = pos; + const { + length + } = input; + for (;;) { + if (pos >= length) { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + out += input.slice(chunkStart, pos); + break; + } + const ch = input.charCodeAt(pos); + if (isStringEnd(type, ch, input, pos)) { + out += input.slice(chunkStart, pos); + break; + } + if (ch === 92) { + out += input.slice(chunkStart, pos); + const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors); + if (res.ch === null && !firstInvalidLoc) { + firstInvalidLoc = { + pos, + lineStart, + curLine + }; + } else { + out += res.ch; + } + ({ + pos, + lineStart, + curLine + } = res); + chunkStart = pos; + } else if (ch === 8232 || ch === 8233) { + ++pos; + ++curLine; + lineStart = pos; + } else if (ch === 10 || ch === 13) { + if (type === "template") { + out += input.slice(chunkStart, pos) + "\n"; + ++pos; + if (ch === 13 && input.charCodeAt(pos) === 10) { + ++pos; + } + ++curLine; + chunkStart = lineStart = pos; + } else { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + } + } else { + ++pos; + } + } + return { + pos, + str: out, + firstInvalidLoc, + lineStart, + curLine, + containsInvalid: !!firstInvalidLoc + }; +} +function isStringEnd(type, ch, input, pos) { + if (type === "template") { + return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123; + } + return ch === (type === "double" ? 34 : 39); +} +function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) { + const throwOnInvalid = !inTemplate; + pos++; + const res = ch => ({ + pos, + ch, + lineStart, + curLine + }); + const ch = input.charCodeAt(pos++); + switch (ch) { + case 110: + return res("\n"); + case 114: + return res("\r"); + case 120: + { + let code; + ({ + code, + pos + } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors)); + return res(code === null ? null : String.fromCharCode(code)); + } + case 117: + { + let code; + ({ + code, + pos + } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors)); + return res(code === null ? null : String.fromCodePoint(code)); + } + case 116: + return res("\t"); + case 98: + return res("\b"); + case 118: + return res("\u000b"); + case 102: + return res("\f"); + case 13: + if (input.charCodeAt(pos) === 10) { + ++pos; + } + case 10: + lineStart = pos; + ++curLine; + case 8232: + case 8233: + return res(""); + case 56: + case 57: + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(pos - 1, lineStart, curLine); + } + default: + if (ch >= 48 && ch <= 55) { + const startPos = pos - 1; + const match = input.slice(startPos, pos + 2).match(/^[0-7]+/); + let octalStr = match[0]; + let octal = parseInt(octalStr, 8); + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } + pos += octalStr.length - 1; + const next = input.charCodeAt(pos); + if (octalStr !== "0" || next === 56 || next === 57) { + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(startPos, lineStart, curLine); + } + } + return res(String.fromCharCode(octal)); + } + return res(String.fromCharCode(ch)); + } +} +function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) { + const initialPos = pos; + let n; + ({ + n, + pos + } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid)); + if (n === null) { + if (throwOnInvalid) { + errors.invalidEscapeSequence(initialPos, lineStart, curLine); + } else { + pos = initialPos - 1; + } + } + return { + code: n, + pos + }; +} +function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) { + const start = pos; + const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct; + const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin; + let invalid = false; + let total = 0; + for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { + const code = input.charCodeAt(pos); + let val; + if (code === 95 && allowNumSeparator !== "bail") { + const prev = input.charCodeAt(pos - 1); + const next = input.charCodeAt(pos + 1); + if (!allowNumSeparator) { + if (bailOnError) return { + n: null, + pos + }; + errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine); + } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) { + if (bailOnError) return { + n: null, + pos + }; + errors.unexpectedNumericSeparator(pos, lineStart, curLine); + } + ++pos; + continue; + } + if (code >= 97) { + val = code - 97 + 10; + } else if (code >= 65) { + val = code - 65 + 10; + } else if (_isDigit(code)) { + val = code - 48; + } else { + val = Infinity; + } + if (val >= radix) { + if (val <= 9 && bailOnError) { + return { + n: null, + pos + }; + } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) { + val = 0; + } else if (forceLen) { + val = 0; + invalid = true; + } else { + break; + } + } + ++pos; + total = total * radix + val; + } + if (pos === start || len != null && pos - start !== len || invalid) { + return { + n: null, + pos + }; + } + return { + n: total, + pos + }; +} +function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) { + const ch = input.charCodeAt(pos); + let code; + if (ch === 123) { + ++pos; + ({ + code, + pos + } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors)); + ++pos; + if (code !== null && code > 0x10ffff) { + if (throwOnInvalid) { + errors.invalidCodePoint(pos, lineStart, curLine); + } else { + return { + code: null, + pos + }; + } + } + } else { + ({ + code, + pos + } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors)); + } + return { + code, + pos + }; +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 6396: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isIdentifierChar = isIdentifierChar; +exports.isIdentifierName = isIdentifierName; +exports.isIdentifierStart = isIdentifierStart; +let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; +let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65"; +const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); +const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); +nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; +const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191]; +const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; +function isInAstralSet(code, set) { + let pos = 0x10000; + for (let i = 0, length = set.length; i < length; i += 2) { + pos += set[i]; + if (pos > code) return false; + pos += set[i + 1]; + if (pos >= code) return true; + } + return false; +} +function isIdentifierStart(code) { + if (code < 65) return code === 36; + if (code <= 90) return true; + if (code < 97) return code === 95; + if (code <= 122) return true; + if (code <= 0xffff) { + return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); + } + return isInAstralSet(code, astralIdentifierStartCodes); +} +function isIdentifierChar(code) { + if (code < 48) return code === 36; + if (code < 58) return true; + if (code < 65) return false; + if (code <= 90) return true; + if (code < 97) return code === 95; + if (code <= 122) return true; + if (code <= 0xffff) { + return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); + } + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); +} +function isIdentifierName(name) { + let isFirst = true; + for (let i = 0; i < name.length; i++) { + let cp = name.charCodeAt(i); + if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) { + const trail = name.charCodeAt(++i); + if ((trail & 0xfc00) === 0xdc00) { + cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff); + } + } + if (isFirst) { + isFirst = false; + if (!isIdentifierStart(cp)) { + return false; + } + } else if (!isIdentifierChar(cp)) { + return false; + } + } + return !isFirst; +} + +//# sourceMappingURL=identifier.js.map + + +/***/ }), + +/***/ 6607: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "isIdentifierChar", ({ + enumerable: true, + get: function () { + return _identifier.isIdentifierChar; + } +})); +Object.defineProperty(exports, "isIdentifierName", ({ + enumerable: true, + get: function () { + return _identifier.isIdentifierName; + } +})); +Object.defineProperty(exports, "isIdentifierStart", ({ + enumerable: true, + get: function () { + return _identifier.isIdentifierStart; + } +})); +Object.defineProperty(exports, "isKeyword", ({ + enumerable: true, + get: function () { + return _keyword.isKeyword; + } +})); +Object.defineProperty(exports, "isReservedWord", ({ + enumerable: true, + get: function () { + return _keyword.isReservedWord; + } +})); +Object.defineProperty(exports, "isStrictBindOnlyReservedWord", ({ + enumerable: true, + get: function () { + return _keyword.isStrictBindOnlyReservedWord; + } +})); +Object.defineProperty(exports, "isStrictBindReservedWord", ({ + enumerable: true, + get: function () { + return _keyword.isStrictBindReservedWord; + } +})); +Object.defineProperty(exports, "isStrictReservedWord", ({ + enumerable: true, + get: function () { + return _keyword.isStrictReservedWord; + } +})); +var _identifier = __nccwpck_require__(6396); +var _keyword = __nccwpck_require__(7249); + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 7249: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isKeyword = isKeyword; +exports.isReservedWord = isReservedWord; +exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord; +exports.isStrictBindReservedWord = isStrictBindReservedWord; +exports.isStrictReservedWord = isStrictReservedWord; +const reservedWords = { + keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], + strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], + strictBind: ["eval", "arguments"] +}; +const keywords = new Set(reservedWords.keyword); +const reservedWordsStrictSet = new Set(reservedWords.strict); +const reservedWordsStrictBindSet = new Set(reservedWords.strictBind); +function isReservedWord(word, inModule) { + return inModule && word === "await" || word === "enum"; +} +function isStrictReservedWord(word, inModule) { + return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); +} +function isStrictBindOnlyReservedWord(word) { + return reservedWordsStrictBindSet.has(word); +} +function isStrictBindReservedWord(word, inModule) { + return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word); +} +function isKeyword(word) { + return keywords.has(word); +} + +//# sourceMappingURL=keyword.js.map + + +/***/ }), + +/***/ 6860: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = highlight; +exports.shouldHighlight = shouldHighlight; +var _jsTokens = __nccwpck_require__(1531); +var _helperValidatorIdentifier = __nccwpck_require__(6607); +var _chalk = _interopRequireWildcard(__nccwpck_require__(8707), true); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]); +function getDefs(chalk) { + return { + keyword: chalk.cyan, + capitalized: chalk.yellow, + jsxIdentifier: chalk.yellow, + punctuator: chalk.yellow, + number: chalk.magenta, + string: chalk.green, + regex: chalk.magenta, + comment: chalk.grey, + invalid: chalk.white.bgRed.bold + }; +} +const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; +const BRACKET = /^[()[\]{}]$/; +let tokenize; +{ + const JSX_TAG = /^[a-z][\w-]*$/i; + const getTokenType = function (token, offset, text) { + if (token.type === "name") { + if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) { + return "keyword"; + } + if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == " colorize(str)).join("\n"); + } else { + highlighted += value; + } + } + return highlighted; +} +function shouldHighlight(options) { + return _chalk.default.level > 0 || options.forceColor; +} +let chalkWithForcedColor = undefined; +function getChalk(forceColor) { + if (forceColor) { + var _chalkWithForcedColor; + (_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new _chalk.default.constructor({ + enabled: true, + level: 1 + }); + return chalkWithForcedColor; + } + return _chalk.default; +} +{ + exports.getChalk = options => getChalk(options.forceColor); +} +function highlight(code, options = {}) { + if (code !== "" && shouldHighlight(options)) { + const defs = getDefs(getChalk(options.forceColor)); + return highlightTokens(defs, code); + } else { + return code; + } +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 639: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +class Position { + constructor(line, col, index) { + this.line = void 0; + this.column = void 0; + this.index = void 0; + this.line = line; + this.column = col; + this.index = index; + } +} +class SourceLocation { + constructor(start, end) { + this.start = void 0; + this.end = void 0; + this.filename = void 0; + this.identifierName = void 0; + this.start = start; + this.end = end; + } +} +function createPositionWithColumnOffset(position, columnOffset) { + const { + line, + column, + index + } = position; + return new Position(line, column + columnOffset, index + columnOffset); +} +const code = "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"; +var ModuleErrors = { + ImportMetaOutsideModule: { + message: `import.meta may appear only with 'sourceType: "module"'`, + code + }, + ImportOutsideModule: { + message: `'import' and 'export' may appear only with 'sourceType: "module"'`, + code + } +}; +const NodeDescriptions = { + ArrayPattern: "array destructuring pattern", + AssignmentExpression: "assignment expression", + AssignmentPattern: "assignment expression", + ArrowFunctionExpression: "arrow function expression", + ConditionalExpression: "conditional expression", + CatchClause: "catch clause", + ForOfStatement: "for-of statement", + ForInStatement: "for-in statement", + ForStatement: "for-loop", + FormalParameters: "function parameter list", + Identifier: "identifier", + ImportSpecifier: "import specifier", + ImportDefaultSpecifier: "import default specifier", + ImportNamespaceSpecifier: "import namespace specifier", + ObjectPattern: "object destructuring pattern", + ParenthesizedExpression: "parenthesized expression", + RestElement: "rest element", + UpdateExpression: { + true: "prefix operation", + false: "postfix operation" + }, + VariableDeclarator: "variable declaration", + YieldExpression: "yield expression" +}; +const toNodeDescription = ({ + type, + prefix +}) => type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix)] : NodeDescriptions[type]; +var StandardErrors = { + AccessorIsGenerator: ({ + kind + }) => `A ${kind}ter cannot be a generator.`, + ArgumentsInClass: "'arguments' is only allowed in functions and class methods.", + AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.", + AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.", + AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.", + AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.", + AwaitUsingNotInAsyncContext: "'await using' is only allowed within async functions and at the top levels of modules.", + AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.", + AwaitNotInAsyncFunction: "'await' is only allowed within async functions.", + BadGetterArity: "A 'get' accessor must not have any formal parameters.", + BadSetterArity: "A 'set' accessor must have exactly one formal parameter.", + BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.", + ConstructorClassField: "Classes may not have a field named 'constructor'.", + ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.", + ConstructorIsAccessor: "Class constructor may not be an accessor.", + ConstructorIsAsync: "Constructor can't be an async function.", + ConstructorIsGenerator: "Constructor can't be a generator.", + DeclarationMissingInitializer: ({ + kind + }) => `Missing initializer in ${kind} declaration.`, + DecoratorArgumentsOutsideParentheses: "Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.", + DecoratorBeforeExport: "Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.", + DecoratorsBeforeAfterExport: "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.", + DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?", + DecoratorExportClass: "Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.", + DecoratorSemicolon: "Decorators must not be followed by a semicolon.", + DecoratorStaticBlock: "Decorators can't be used with a static block.", + DeletePrivateField: "Deleting a private field is not allowed.", + DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.", + DuplicateConstructor: "Duplicate constructor in the same class.", + DuplicateDefaultExport: "Only one default export allowed per module.", + DuplicateExport: ({ + exportName + }) => `\`${exportName}\` has already been exported. Exported identifiers must be unique.`, + DuplicateProto: "Redefinition of __proto__ property.", + DuplicateRegExpFlags: "Duplicate regular expression flag.", + ElementAfterRest: "Rest element must be last element.", + EscapedCharNotAnIdentifier: "Invalid Unicode escape.", + ExportBindingIsString: ({ + localName, + exportName + }) => `A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${localName}' as '${exportName}' } from 'some-module'\`?`, + ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.", + ForInOfLoopInitializer: ({ + type + }) => `'${type === "ForInStatement" ? "for-in" : "for-of"}' loop variable declaration may not have an initializer.`, + ForInUsing: "For-in loop may not start with 'using' declaration.", + ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.", + ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.", + GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block.", + IllegalBreakContinue: ({ + type + }) => `Unsyntactic ${type === "BreakStatement" ? "break" : "continue"}.`, + IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.", + IllegalReturn: "'return' outside of function.", + ImportAttributesUseAssert: "The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedAssertSyntax: true` option in the import attributes plugin to suppress this error.", + ImportBindingIsString: ({ + importName + }) => `A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${importName}" as foo }\`?`, + ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments.", + ImportCallArity: ({ + maxArgumentCount + }) => `\`import()\` requires exactly ${maxArgumentCount === 1 ? "one argument" : "one or two arguments"}.`, + ImportCallNotNewExpression: "Cannot use new with import(...).", + ImportCallSpreadArgument: "`...` is not allowed in `import()`.", + ImportJSONBindingNotDefault: "A JSON module can only be imported with `default`.", + ImportReflectionHasAssertion: "`import module x` cannot have assertions.", + ImportReflectionNotBinding: 'Only `import module x from "./module"` is valid.', + IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.", + InvalidBigIntLiteral: "Invalid BigIntLiteral.", + InvalidCodePoint: "Code point out of bounds.", + InvalidCoverInitializedName: "Invalid shorthand property initializer.", + InvalidDecimal: "Invalid decimal.", + InvalidDigit: ({ + radix + }) => `Expected number in radix ${radix}.`, + InvalidEscapeSequence: "Bad character escape sequence.", + InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.", + InvalidEscapedReservedWord: ({ + reservedWord + }) => `Escape sequence in keyword ${reservedWord}.`, + InvalidIdentifier: ({ + identifierName + }) => `Invalid identifier ${identifierName}.`, + InvalidLhs: ({ + ancestor + }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`, + InvalidLhsBinding: ({ + ancestor + }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`, + InvalidNumber: "Invalid number.", + InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.", + InvalidOrUnexpectedToken: ({ + unexpected + }) => `Unexpected character '${unexpected}'.`, + InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.", + InvalidPrivateFieldResolution: ({ + identifierName + }) => `Private name #${identifierName} is not defined.`, + InvalidPropertyBindingPattern: "Binding member expression.", + InvalidRecordProperty: "Only properties and spread elements are allowed in record definitions.", + InvalidRestAssignmentPattern: "Invalid rest operator's argument.", + LabelRedeclaration: ({ + labelName + }) => `Label '${labelName}' is already declared.`, + LetInLexicalBinding: "'let' is disallowed as a lexically bound name.", + LineTerminatorBeforeArrow: "No line break is allowed before '=>'.", + MalformedRegExpFlags: "Invalid regular expression flag.", + MissingClassName: "A class name is required.", + MissingEqInAssignment: "Only '=' operator can be used for specifying default value.", + MissingSemicolon: "Missing semicolon.", + MissingPlugin: ({ + missingPlugin + }) => `This experimental syntax requires enabling the parser plugin: ${missingPlugin.map(name => JSON.stringify(name)).join(", ")}.`, + MissingOneOfPlugins: ({ + missingPlugin + }) => `This experimental syntax requires enabling one of the following parser plugin(s): ${missingPlugin.map(name => JSON.stringify(name)).join(", ")}.`, + MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX.", + MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators.", + ModuleAttributeDifferentFromType: "The only accepted module attribute is `type`.", + ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values.", + ModuleAttributesWithDuplicateKeys: ({ + key + }) => `Duplicate key "${key}" is not allowed in module attributes.`, + ModuleExportNameHasLoneSurrogate: ({ + surrogateCharCode + }) => `An export name cannot include a lone surrogate, found '\\u${surrogateCharCode.toString(16)}'.`, + ModuleExportUndefined: ({ + localName + }) => `Export '${localName}' is not defined.`, + MultipleDefaultsInSwitch: "Multiple default clauses.", + NewlineAfterThrow: "Illegal newline after throw.", + NoCatchOrFinally: "Missing catch or finally clause.", + NumberIdentifier: "Identifier directly after number.", + NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.", + ObsoleteAwaitStar: "'await*' has been removed from the async functions proposal. Use Promise.all() instead.", + OptionalChainingNoNew: "Constructors in/after an Optional Chain are not allowed.", + OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain.", + OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.", + ParamDupe: "Argument name clash.", + PatternHasAccessor: "Object pattern can't contain getter or setter.", + PatternHasMethod: "Object pattern can't contain methods.", + PrivateInExpectedIn: ({ + identifierName + }) => `Private names are only allowed in property accesses (\`obj.#${identifierName}\`) or in \`in\` expressions (\`#${identifierName} in obj\`).`, + PrivateNameRedeclaration: ({ + identifierName + }) => `Duplicate private name #${identifierName}.`, + RecordExpressionBarIncorrectEndSyntaxType: "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.", + RecordExpressionBarIncorrectStartSyntaxType: "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.", + RecordExpressionHashIncorrectStartSyntaxType: "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.", + RecordNoProto: "'__proto__' is not allowed in Record expressions.", + RestTrailingComma: "Unexpected trailing comma after rest element.", + SloppyFunction: "In non-strict mode code, functions can only be declared at top level or inside a block.", + SloppyFunctionAnnexB: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.", + StaticPrototype: "Classes may not have static property named prototype.", + SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?", + SuperPrivateField: "Private fields can't be accessed on super.", + TrailingDecorator: "Decorators must be attached to a class element.", + TupleExpressionBarIncorrectEndSyntaxType: "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.", + TupleExpressionBarIncorrectStartSyntaxType: "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.", + TupleExpressionHashIncorrectStartSyntaxType: "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.", + UnexpectedArgumentPlaceholder: "Unexpected argument placeholder.", + UnexpectedAwaitAfterPipelineBody: 'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.', + UnexpectedDigitAfterHash: "Unexpected digit after hash token.", + UnexpectedImportExport: "'import' and 'export' may only appear at the top level.", + UnexpectedKeyword: ({ + keyword + }) => `Unexpected keyword '${keyword}'.`, + UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.", + UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.", + UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.", + UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.", + UnexpectedPrivateField: "Unexpected private name.", + UnexpectedReservedWord: ({ + reservedWord + }) => `Unexpected reserved word '${reservedWord}'.`, + UnexpectedSuper: "'super' is only allowed in object methods and classes.", + UnexpectedToken: ({ + expected, + unexpected + }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`, + UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.", + UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script`.", + UnsupportedBind: "Binding should be performed on object property.", + UnsupportedDecoratorExport: "A decorated export must export a class declaration.", + UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.", + UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.", + UnsupportedMetaProperty: ({ + target, + onlyValidPropertyName + }) => `The only valid meta property for ${target} is ${target}.${onlyValidPropertyName}.`, + UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters.", + UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties.", + UnsupportedSuper: "'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).", + UnterminatedComment: "Unterminated comment.", + UnterminatedRegExp: "Unterminated regular expression.", + UnterminatedString: "Unterminated string constant.", + UnterminatedTemplate: "Unterminated template.", + UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.", + VarRedeclaration: ({ + identifierName + }) => `Identifier '${identifierName}' has already been declared.`, + YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.", + YieldInParameter: "Yield expression is not allowed in formal parameters.", + ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0." +}; +var StrictModeErrors = { + StrictDelete: "Deleting local variable in strict mode.", + StrictEvalArguments: ({ + referenceName + }) => `Assigning to '${referenceName}' in strict mode.`, + StrictEvalArgumentsBinding: ({ + bindingName + }) => `Binding '${bindingName}' in strict mode.`, + StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block.", + StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.", + StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.", + StrictWith: "'with' in strict mode." +}; +const UnparenthesizedPipeBodyDescriptions = new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]); +var PipelineOperatorErrors = { + PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.", + PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.', + PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.", + PipeTopicUnconfiguredToken: ({ + token + }) => `Invalid topic token ${token}. In order to use ${token} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${token}" }.`, + PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.", + PipeUnparenthesizedBody: ({ + type + }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({ + type + })}; please wrap it in parentheses.`, + PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.', + PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression.", + PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression.", + PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference.", + PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.", + PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.' +}; +const _excluded$1 = ["toMessage"], + _excluded2$1 = ["message"]; +function defineHidden(obj, key, value) { + Object.defineProperty(obj, key, { + enumerable: false, + configurable: true, + value + }); +} +function toParseErrorConstructor(_ref) { + let { + toMessage + } = _ref, + properties = _objectWithoutPropertiesLoose(_ref, _excluded$1); + return function constructor({ + loc, + details + }) { + const error = new SyntaxError(); + Object.assign(error, properties, { + loc, + pos: loc.index + }); + if ("missingPlugin" in details) { + Object.assign(error, { + missingPlugin: details.missingPlugin + }); + } + defineHidden(error, "clone", function clone(overrides = {}) { + var _overrides$loc; + const { + line, + column, + index + } = (_overrides$loc = overrides.loc) != null ? _overrides$loc : loc; + return constructor({ + loc: new Position(line, column, index), + details: Object.assign({}, details, overrides.details) + }); + }); + defineHidden(error, "details", details); + Object.defineProperty(error, "message", { + configurable: true, + get() { + const message = `${toMessage(details)} (${loc.line}:${loc.column})`; + this.message = message; + return message; + }, + set(value) { + Object.defineProperty(this, "message", { + value, + writable: true + }); + } + }); + return error; + }; +} +function ParseErrorEnum(argument, syntaxPlugin) { + if (Array.isArray(argument)) { + return parseErrorTemplates => ParseErrorEnum(parseErrorTemplates, argument[0]); + } + const ParseErrorConstructors = {}; + for (const reasonCode of Object.keys(argument)) { + const template = argument[reasonCode]; + const _ref2 = typeof template === "string" ? { + message: () => template + } : typeof template === "function" ? { + message: template + } : template, + { + message + } = _ref2, + rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1); + const toMessage = typeof message === "string" ? () => message : message; + ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({ + code: "BABEL_PARSER_SYNTAX_ERROR", + reasonCode, + toMessage + }, syntaxPlugin ? { + syntaxPlugin + } : {}, rest)); + } + return ParseErrorConstructors; +} +const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors)); +const { + defineProperty +} = Object; +const toUnenumerable = (object, key) => defineProperty(object, key, { + enumerable: false, + value: object[key] +}); +function toESTreeLocation(node) { + node.loc.start && toUnenumerable(node.loc.start, "index"); + node.loc.end && toUnenumerable(node.loc.end, "index"); + return node; +} +var estree = superClass => class ESTreeParserMixin extends superClass { + parse() { + const file = toESTreeLocation(super.parse()); + if (this.options.tokens) { + file.tokens = file.tokens.map(toESTreeLocation); + } + return file; + } + parseRegExpLiteral({ + pattern, + flags + }) { + let regex = null; + try { + regex = new RegExp(pattern, flags); + } catch (e) {} + const node = this.estreeParseLiteral(regex); + node.regex = { + pattern, + flags + }; + return node; + } + parseBigIntLiteral(value) { + let bigInt; + try { + bigInt = BigInt(value); + } catch (_unused) { + bigInt = null; + } + const node = this.estreeParseLiteral(bigInt); + node.bigint = String(node.value || value); + return node; + } + parseDecimalLiteral(value) { + const decimal = null; + const node = this.estreeParseLiteral(decimal); + node.decimal = String(node.value || value); + return node; + } + estreeParseLiteral(value) { + return this.parseLiteral(value, "Literal"); + } + parseStringLiteral(value) { + return this.estreeParseLiteral(value); + } + parseNumericLiteral(value) { + return this.estreeParseLiteral(value); + } + parseNullLiteral() { + return this.estreeParseLiteral(null); + } + parseBooleanLiteral(value) { + return this.estreeParseLiteral(value); + } + directiveToStmt(directive) { + const expression = directive.value; + delete directive.value; + expression.type = "Literal"; + expression.raw = expression.extra.raw; + expression.value = expression.extra.expressionValue; + const stmt = directive; + stmt.type = "ExpressionStatement"; + stmt.expression = expression; + stmt.directive = expression.extra.rawValue; + delete expression.extra; + return stmt; + } + initFunction(node, isAsync) { + super.initFunction(node, isAsync); + node.expression = false; + } + checkDeclaration(node) { + if (node != null && this.isObjectProperty(node)) { + this.checkDeclaration(node.value); + } else { + super.checkDeclaration(node); + } + } + getObjectOrClassMethodParams(method) { + return method.value.params; + } + isValidDirective(stmt) { + var _stmt$expression$extr; + return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !((_stmt$expression$extr = stmt.expression.extra) != null && _stmt$expression$extr.parenthesized); + } + parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) { + super.parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse); + const directiveStatements = node.directives.map(d => this.directiveToStmt(d)); + node.body = directiveStatements.concat(node.body); + delete node.directives; + } + pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) { + this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true); + if (method.typeParameters) { + method.value.typeParameters = method.typeParameters; + delete method.typeParameters; + } + classBody.body.push(method); + } + parsePrivateName() { + const node = super.parsePrivateName(); + { + if (!this.getPluginOption("estree", "classFeatures")) { + return node; + } + } + return this.convertPrivateNameToPrivateIdentifier(node); + } + convertPrivateNameToPrivateIdentifier(node) { + const name = super.getPrivateNameSV(node); + node = node; + delete node.id; + node.name = name; + node.type = "PrivateIdentifier"; + return node; + } + isPrivateName(node) { + { + if (!this.getPluginOption("estree", "classFeatures")) { + return super.isPrivateName(node); + } + } + return node.type === "PrivateIdentifier"; + } + getPrivateNameSV(node) { + { + if (!this.getPluginOption("estree", "classFeatures")) { + return super.getPrivateNameSV(node); + } + } + return node.name; + } + parseLiteral(value, type) { + const node = super.parseLiteral(value, type); + node.raw = node.extra.raw; + delete node.extra; + return node; + } + parseFunctionBody(node, allowExpression, isMethod = false) { + super.parseFunctionBody(node, allowExpression, isMethod); + node.expression = node.body.type !== "BlockStatement"; + } + parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) { + let funcNode = this.startNode(); + funcNode.kind = node.kind; + funcNode = super.parseMethod(funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope); + funcNode.type = "FunctionExpression"; + delete funcNode.kind; + node.value = funcNode; + if (type === "ClassPrivateMethod") { + node.computed = false; + } + return this.finishNode(node, "MethodDefinition"); + } + parseClassProperty(...args) { + const propertyNode = super.parseClassProperty(...args); + { + if (!this.getPluginOption("estree", "classFeatures")) { + return propertyNode; + } + } + propertyNode.type = "PropertyDefinition"; + return propertyNode; + } + parseClassPrivateProperty(...args) { + const propertyNode = super.parseClassPrivateProperty(...args); + { + if (!this.getPluginOption("estree", "classFeatures")) { + return propertyNode; + } + } + propertyNode.type = "PropertyDefinition"; + propertyNode.computed = false; + return propertyNode; + } + parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) { + const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor); + if (node) { + node.type = "Property"; + if (node.kind === "method") { + node.kind = "init"; + } + node.shorthand = false; + } + return node; + } + parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) { + const node = super.parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors); + if (node) { + node.kind = "init"; + node.type = "Property"; + } + return node; + } + isValidLVal(type, isUnparenthesizedInAssign, binding) { + return type === "Property" ? "value" : super.isValidLVal(type, isUnparenthesizedInAssign, binding); + } + isAssignable(node, isBinding) { + if (node != null && this.isObjectProperty(node)) { + return this.isAssignable(node.value, isBinding); + } + return super.isAssignable(node, isBinding); + } + toAssignable(node, isLHS = false) { + if (node != null && this.isObjectProperty(node)) { + const { + key, + value + } = node; + if (this.isPrivateName(key)) { + this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start); + } + this.toAssignable(value, isLHS); + } else { + super.toAssignable(node, isLHS); + } + } + toAssignableObjectExpressionProp(prop, isLast, isLHS) { + if (prop.kind === "get" || prop.kind === "set") { + this.raise(Errors.PatternHasAccessor, { + at: prop.key + }); + } else if (prop.method) { + this.raise(Errors.PatternHasMethod, { + at: prop.key + }); + } else { + super.toAssignableObjectExpressionProp(prop, isLast, isLHS); + } + } + finishCallExpression(unfinished, optional) { + const node = super.finishCallExpression(unfinished, optional); + if (node.callee.type === "Import") { + node.type = "ImportExpression"; + node.source = node.arguments[0]; + if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) { + var _node$arguments$; + node.attributes = (_node$arguments$ = node.arguments[1]) != null ? _node$arguments$ : null; + } + delete node.arguments; + delete node.callee; + } + return node; + } + toReferencedArguments(node) { + if (node.type === "ImportExpression") { + return; + } + super.toReferencedArguments(node); + } + parseExport(unfinished, decorators) { + const exportStartLoc = this.state.lastTokStartLoc; + const node = super.parseExport(unfinished, decorators); + switch (node.type) { + case "ExportAllDeclaration": + node.exported = null; + break; + case "ExportNamedDeclaration": + if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier") { + node.type = "ExportAllDeclaration"; + node.exported = node.specifiers[0].exported; + delete node.specifiers; + } + case "ExportDefaultDeclaration": + { + var _declaration$decorato; + const { + declaration + } = node; + if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0 && declaration.start === node.start) { + this.resetStartLocation(node, exportStartLoc); + } + } + break; + } + return node; + } + parseSubscript(base, startLoc, noCalls, state) { + const node = super.parseSubscript(base, startLoc, noCalls, state); + if (state.optionalChainMember) { + if (node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression") { + node.type = node.type.substring(8); + } + if (state.stop) { + const chain = this.startNodeAtNode(node); + chain.expression = node; + return this.finishNode(chain, "ChainExpression"); + } + } else if (node.type === "MemberExpression" || node.type === "CallExpression") { + node.optional = false; + } + return node; + } + hasPropertyAsPrivateName(node) { + if (node.type === "ChainExpression") { + node = node.expression; + } + return super.hasPropertyAsPrivateName(node); + } + isObjectProperty(node) { + return node.type === "Property" && node.kind === "init" && !node.method; + } + isObjectMethod(node) { + return node.method || node.kind === "get" || node.kind === "set"; + } + finishNodeAt(node, type, endLoc) { + return toESTreeLocation(super.finishNodeAt(node, type, endLoc)); + } + resetStartLocation(node, startLoc) { + super.resetStartLocation(node, startLoc); + toESTreeLocation(node); + } + resetEndLocation(node, endLoc = this.state.lastTokEndLoc) { + super.resetEndLocation(node, endLoc); + toESTreeLocation(node); + } +}; +class TokContext { + constructor(token, preserveSpace) { + this.token = void 0; + this.preserveSpace = void 0; + this.token = token; + this.preserveSpace = !!preserveSpace; + } +} +const types = { + brace: new TokContext("{"), + j_oTag: new TokContext("...", true) +}; +{ + types.template = new TokContext("`", true); +} +const beforeExpr = true; +const startsExpr = true; +const isLoop = true; +const isAssign = true; +const prefix = true; +const postfix = true; +class ExportedTokenType { + constructor(label, conf = {}) { + this.label = void 0; + this.keyword = void 0; + this.beforeExpr = void 0; + this.startsExpr = void 0; + this.rightAssociative = void 0; + this.isLoop = void 0; + this.isAssign = void 0; + this.prefix = void 0; + this.postfix = void 0; + this.binop = void 0; + this.label = label; + this.keyword = conf.keyword; + this.beforeExpr = !!conf.beforeExpr; + this.startsExpr = !!conf.startsExpr; + this.rightAssociative = !!conf.rightAssociative; + this.isLoop = !!conf.isLoop; + this.isAssign = !!conf.isAssign; + this.prefix = !!conf.prefix; + this.postfix = !!conf.postfix; + this.binop = conf.binop != null ? conf.binop : null; + { + this.updateContext = null; + } + } +} +const keywords$1 = new Map(); +function createKeyword(name, options = {}) { + options.keyword = name; + const token = createToken(name, options); + keywords$1.set(name, token); + return token; +} +function createBinop(name, binop) { + return createToken(name, { + beforeExpr, + binop + }); +} +let tokenTypeCounter = -1; +const tokenTypes = []; +const tokenLabels = []; +const tokenBinops = []; +const tokenBeforeExprs = []; +const tokenStartsExprs = []; +const tokenPrefixes = []; +function createToken(name, options = {}) { + var _options$binop, _options$beforeExpr, _options$startsExpr, _options$prefix; + ++tokenTypeCounter; + tokenLabels.push(name); + tokenBinops.push((_options$binop = options.binop) != null ? _options$binop : -1); + tokenBeforeExprs.push((_options$beforeExpr = options.beforeExpr) != null ? _options$beforeExpr : false); + tokenStartsExprs.push((_options$startsExpr = options.startsExpr) != null ? _options$startsExpr : false); + tokenPrefixes.push((_options$prefix = options.prefix) != null ? _options$prefix : false); + tokenTypes.push(new ExportedTokenType(name, options)); + return tokenTypeCounter; +} +function createKeywordLike(name, options = {}) { + var _options$binop2, _options$beforeExpr2, _options$startsExpr2, _options$prefix2; + ++tokenTypeCounter; + keywords$1.set(name, tokenTypeCounter); + tokenLabels.push(name); + tokenBinops.push((_options$binop2 = options.binop) != null ? _options$binop2 : -1); + tokenBeforeExprs.push((_options$beforeExpr2 = options.beforeExpr) != null ? _options$beforeExpr2 : false); + tokenStartsExprs.push((_options$startsExpr2 = options.startsExpr) != null ? _options$startsExpr2 : false); + tokenPrefixes.push((_options$prefix2 = options.prefix) != null ? _options$prefix2 : false); + tokenTypes.push(new ExportedTokenType("name", options)); + return tokenTypeCounter; +} +const tt = { + bracketL: createToken("[", { + beforeExpr, + startsExpr + }), + bracketHashL: createToken("#[", { + beforeExpr, + startsExpr + }), + bracketBarL: createToken("[|", { + beforeExpr, + startsExpr + }), + bracketR: createToken("]"), + bracketBarR: createToken("|]"), + braceL: createToken("{", { + beforeExpr, + startsExpr + }), + braceBarL: createToken("{|", { + beforeExpr, + startsExpr + }), + braceHashL: createToken("#{", { + beforeExpr, + startsExpr + }), + braceR: createToken("}"), + braceBarR: createToken("|}"), + parenL: createToken("(", { + beforeExpr, + startsExpr + }), + parenR: createToken(")"), + comma: createToken(",", { + beforeExpr + }), + semi: createToken(";", { + beforeExpr + }), + colon: createToken(":", { + beforeExpr + }), + doubleColon: createToken("::", { + beforeExpr + }), + dot: createToken("."), + question: createToken("?", { + beforeExpr + }), + questionDot: createToken("?."), + arrow: createToken("=>", { + beforeExpr + }), + template: createToken("template"), + ellipsis: createToken("...", { + beforeExpr + }), + backQuote: createToken("`", { + startsExpr + }), + dollarBraceL: createToken("${", { + beforeExpr, + startsExpr + }), + templateTail: createToken("...`", { + startsExpr + }), + templateNonTail: createToken("...${", { + beforeExpr, + startsExpr + }), + at: createToken("@"), + hash: createToken("#", { + startsExpr + }), + interpreterDirective: createToken("#!..."), + eq: createToken("=", { + beforeExpr, + isAssign + }), + assign: createToken("_=", { + beforeExpr, + isAssign + }), + slashAssign: createToken("_=", { + beforeExpr, + isAssign + }), + xorAssign: createToken("_=", { + beforeExpr, + isAssign + }), + moduloAssign: createToken("_=", { + beforeExpr, + isAssign + }), + incDec: createToken("++/--", { + prefix, + postfix, + startsExpr + }), + bang: createToken("!", { + beforeExpr, + prefix, + startsExpr + }), + tilde: createToken("~", { + beforeExpr, + prefix, + startsExpr + }), + doubleCaret: createToken("^^", { + startsExpr + }), + doubleAt: createToken("@@", { + startsExpr + }), + pipeline: createBinop("|>", 0), + nullishCoalescing: createBinop("??", 1), + logicalOR: createBinop("||", 1), + logicalAND: createBinop("&&", 2), + bitwiseOR: createBinop("|", 3), + bitwiseXOR: createBinop("^", 4), + bitwiseAND: createBinop("&", 5), + equality: createBinop("==/!=/===/!==", 6), + lt: createBinop("/<=/>=", 7), + gt: createBinop("/<=/>=", 7), + relational: createBinop("/<=/>=", 7), + bitShift: createBinop("<>/>>>", 8), + bitShiftL: createBinop("<>/>>>", 8), + bitShiftR: createBinop("<>/>>>", 8), + plusMin: createToken("+/-", { + beforeExpr, + binop: 9, + prefix, + startsExpr + }), + modulo: createToken("%", { + binop: 10, + startsExpr + }), + star: createToken("*", { + binop: 10 + }), + slash: createBinop("/", 10), + exponent: createToken("**", { + beforeExpr, + binop: 11, + rightAssociative: true + }), + _in: createKeyword("in", { + beforeExpr, + binop: 7 + }), + _instanceof: createKeyword("instanceof", { + beforeExpr, + binop: 7 + }), + _break: createKeyword("break"), + _case: createKeyword("case", { + beforeExpr + }), + _catch: createKeyword("catch"), + _continue: createKeyword("continue"), + _debugger: createKeyword("debugger"), + _default: createKeyword("default", { + beforeExpr + }), + _else: createKeyword("else", { + beforeExpr + }), + _finally: createKeyword("finally"), + _function: createKeyword("function", { + startsExpr + }), + _if: createKeyword("if"), + _return: createKeyword("return", { + beforeExpr + }), + _switch: createKeyword("switch"), + _throw: createKeyword("throw", { + beforeExpr, + prefix, + startsExpr + }), + _try: createKeyword("try"), + _var: createKeyword("var"), + _const: createKeyword("const"), + _with: createKeyword("with"), + _new: createKeyword("new", { + beforeExpr, + startsExpr + }), + _this: createKeyword("this", { + startsExpr + }), + _super: createKeyword("super", { + startsExpr + }), + _class: createKeyword("class", { + startsExpr + }), + _extends: createKeyword("extends", { + beforeExpr + }), + _export: createKeyword("export"), + _import: createKeyword("import", { + startsExpr + }), + _null: createKeyword("null", { + startsExpr + }), + _true: createKeyword("true", { + startsExpr + }), + _false: createKeyword("false", { + startsExpr + }), + _typeof: createKeyword("typeof", { + beforeExpr, + prefix, + startsExpr + }), + _void: createKeyword("void", { + beforeExpr, + prefix, + startsExpr + }), + _delete: createKeyword("delete", { + beforeExpr, + prefix, + startsExpr + }), + _do: createKeyword("do", { + isLoop, + beforeExpr + }), + _for: createKeyword("for", { + isLoop + }), + _while: createKeyword("while", { + isLoop + }), + _as: createKeywordLike("as", { + startsExpr + }), + _assert: createKeywordLike("assert", { + startsExpr + }), + _async: createKeywordLike("async", { + startsExpr + }), + _await: createKeywordLike("await", { + startsExpr + }), + _from: createKeywordLike("from", { + startsExpr + }), + _get: createKeywordLike("get", { + startsExpr + }), + _let: createKeywordLike("let", { + startsExpr + }), + _meta: createKeywordLike("meta", { + startsExpr + }), + _of: createKeywordLike("of", { + startsExpr + }), + _sent: createKeywordLike("sent", { + startsExpr + }), + _set: createKeywordLike("set", { + startsExpr + }), + _static: createKeywordLike("static", { + startsExpr + }), + _using: createKeywordLike("using", { + startsExpr + }), + _yield: createKeywordLike("yield", { + startsExpr + }), + _asserts: createKeywordLike("asserts", { + startsExpr + }), + _checks: createKeywordLike("checks", { + startsExpr + }), + _exports: createKeywordLike("exports", { + startsExpr + }), + _global: createKeywordLike("global", { + startsExpr + }), + _implements: createKeywordLike("implements", { + startsExpr + }), + _intrinsic: createKeywordLike("intrinsic", { + startsExpr + }), + _infer: createKeywordLike("infer", { + startsExpr + }), + _is: createKeywordLike("is", { + startsExpr + }), + _mixins: createKeywordLike("mixins", { + startsExpr + }), + _proto: createKeywordLike("proto", { + startsExpr + }), + _require: createKeywordLike("require", { + startsExpr + }), + _satisfies: createKeywordLike("satisfies", { + startsExpr + }), + _keyof: createKeywordLike("keyof", { + startsExpr + }), + _readonly: createKeywordLike("readonly", { + startsExpr + }), + _unique: createKeywordLike("unique", { + startsExpr + }), + _abstract: createKeywordLike("abstract", { + startsExpr + }), + _declare: createKeywordLike("declare", { + startsExpr + }), + _enum: createKeywordLike("enum", { + startsExpr + }), + _module: createKeywordLike("module", { + startsExpr + }), + _namespace: createKeywordLike("namespace", { + startsExpr + }), + _interface: createKeywordLike("interface", { + startsExpr + }), + _type: createKeywordLike("type", { + startsExpr + }), + _opaque: createKeywordLike("opaque", { + startsExpr + }), + name: createToken("name", { + startsExpr + }), + string: createToken("string", { + startsExpr + }), + num: createToken("num", { + startsExpr + }), + bigint: createToken("bigint", { + startsExpr + }), + decimal: createToken("decimal", { + startsExpr + }), + regexp: createToken("regexp", { + startsExpr + }), + privateName: createToken("#name", { + startsExpr + }), + eof: createToken("eof"), + jsxName: createToken("jsxName"), + jsxText: createToken("jsxText", { + beforeExpr: true + }), + jsxTagStart: createToken("jsxTagStart", { + startsExpr: true + }), + jsxTagEnd: createToken("jsxTagEnd"), + placeholder: createToken("%%", { + startsExpr: true + }) +}; +function tokenIsIdentifier(token) { + return token >= 93 && token <= 130; +} +function tokenKeywordOrIdentifierIsKeyword(token) { + return token <= 92; +} +function tokenIsKeywordOrIdentifier(token) { + return token >= 58 && token <= 130; +} +function tokenIsLiteralPropertyName(token) { + return token >= 58 && token <= 134; +} +function tokenComesBeforeExpression(token) { + return tokenBeforeExprs[token]; +} +function tokenCanStartExpression(token) { + return tokenStartsExprs[token]; +} +function tokenIsAssignment(token) { + return token >= 29 && token <= 33; +} +function tokenIsFlowInterfaceOrTypeOrOpaque(token) { + return token >= 127 && token <= 129; +} +function tokenIsLoop(token) { + return token >= 90 && token <= 92; +} +function tokenIsKeyword(token) { + return token >= 58 && token <= 92; +} +function tokenIsOperator(token) { + return token >= 39 && token <= 59; +} +function tokenIsPostfix(token) { + return token === 34; +} +function tokenIsPrefix(token) { + return tokenPrefixes[token]; +} +function tokenIsTSTypeOperator(token) { + return token >= 119 && token <= 121; +} +function tokenIsTSDeclarationStart(token) { + return token >= 122 && token <= 128; +} +function tokenLabelName(token) { + return tokenLabels[token]; +} +function tokenOperatorPrecedence(token) { + return tokenBinops[token]; +} +function tokenIsRightAssociative(token) { + return token === 57; +} +function tokenIsTemplate(token) { + return token >= 24 && token <= 25; +} +function getExportedToken(token) { + return tokenTypes[token]; +} +{ + tokenTypes[8].updateContext = context => { + context.pop(); + }; + tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = context => { + context.push(types.brace); + }; + tokenTypes[22].updateContext = context => { + if (context[context.length - 1] === types.template) { + context.pop(); + } else { + context.push(types.template); + } + }; + tokenTypes[140].updateContext = context => { + context.push(types.j_expr, types.j_oTag); + }; +} +let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; +let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; +const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); +const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); +nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; +const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191]; +const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; +function isInAstralSet(code, set) { + let pos = 0x10000; + for (let i = 0, length = set.length; i < length; i += 2) { + pos += set[i]; + if (pos > code) return false; + pos += set[i + 1]; + if (pos >= code) return true; + } + return false; +} +function isIdentifierStart(code) { + if (code < 65) return code === 36; + if (code <= 90) return true; + if (code < 97) return code === 95; + if (code <= 122) return true; + if (code <= 0xffff) { + return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); + } + return isInAstralSet(code, astralIdentifierStartCodes); +} +function isIdentifierChar(code) { + if (code < 48) return code === 36; + if (code < 58) return true; + if (code < 65) return false; + if (code <= 90) return true; + if (code < 97) return code === 95; + if (code <= 122) return true; + if (code <= 0xffff) { + return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); + } + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); +} +const reservedWords = { + keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], + strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], + strictBind: ["eval", "arguments"] +}; +const keywords = new Set(reservedWords.keyword); +const reservedWordsStrictSet = new Set(reservedWords.strict); +const reservedWordsStrictBindSet = new Set(reservedWords.strictBind); +function isReservedWord(word, inModule) { + return inModule && word === "await" || word === "enum"; +} +function isStrictReservedWord(word, inModule) { + return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); +} +function isStrictBindOnlyReservedWord(word) { + return reservedWordsStrictBindSet.has(word); +} +function isStrictBindReservedWord(word, inModule) { + return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word); +} +function isKeyword(word) { + return keywords.has(word); +} +function isIteratorStart(current, next, next2) { + return current === 64 && next === 64 && isIdentifierStart(next2); +} +const reservedWordLikeSet = new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]); +function canBeReservedWord(word) { + return reservedWordLikeSet.has(word); +} +class Scope { + constructor(flags) { + this.var = new Set(); + this.lexical = new Set(); + this.functions = new Set(); + this.flags = flags; + } +} +class ScopeHandler { + constructor(parser, inModule) { + this.parser = void 0; + this.scopeStack = []; + this.inModule = void 0; + this.undefinedExports = new Map(); + this.parser = parser; + this.inModule = inModule; + } + get inTopLevel() { + return (this.currentScope().flags & 1) > 0; + } + get inFunction() { + return (this.currentVarScopeFlags() & 2) > 0; + } + get allowSuper() { + return (this.currentThisScopeFlags() & 16) > 0; + } + get allowDirectSuper() { + return (this.currentThisScopeFlags() & 32) > 0; + } + get inClass() { + return (this.currentThisScopeFlags() & 64) > 0; + } + get inClassAndNotInNonArrowFunction() { + const flags = this.currentThisScopeFlags(); + return (flags & 64) > 0 && (flags & 2) === 0; + } + get inStaticBlock() { + for (let i = this.scopeStack.length - 1;; i--) { + const { + flags + } = this.scopeStack[i]; + if (flags & 128) { + return true; + } + if (flags & (387 | 64)) { + return false; + } + } + } + get inNonArrowFunction() { + return (this.currentThisScopeFlags() & 2) > 0; + } + get treatFunctionsAsVar() { + return this.treatFunctionsAsVarInScope(this.currentScope()); + } + createScope(flags) { + return new Scope(flags); + } + enter(flags) { + this.scopeStack.push(this.createScope(flags)); + } + exit() { + const scope = this.scopeStack.pop(); + return scope.flags; + } + treatFunctionsAsVarInScope(scope) { + return !!(scope.flags & (2 | 128) || !this.parser.inModule && scope.flags & 1); + } + declareName(name, bindingType, loc) { + let scope = this.currentScope(); + if (bindingType & 8 || bindingType & 16) { + this.checkRedeclarationInScope(scope, name, bindingType, loc); + if (bindingType & 16) { + scope.functions.add(name); + } else { + scope.lexical.add(name); + } + if (bindingType & 8) { + this.maybeExportDefined(scope, name); + } + } else if (bindingType & 4) { + for (let i = this.scopeStack.length - 1; i >= 0; --i) { + scope = this.scopeStack[i]; + this.checkRedeclarationInScope(scope, name, bindingType, loc); + scope.var.add(name); + this.maybeExportDefined(scope, name); + if (scope.flags & 387) break; + } + } + if (this.parser.inModule && scope.flags & 1) { + this.undefinedExports.delete(name); + } + } + maybeExportDefined(scope, name) { + if (this.parser.inModule && scope.flags & 1) { + this.undefinedExports.delete(name); + } + } + checkRedeclarationInScope(scope, name, bindingType, loc) { + if (this.isRedeclaredInScope(scope, name, bindingType)) { + this.parser.raise(Errors.VarRedeclaration, { + at: loc, + identifierName: name + }); + } + } + isRedeclaredInScope(scope, name, bindingType) { + if (!(bindingType & 1)) return false; + if (bindingType & 8) { + return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name); + } + if (bindingType & 16) { + return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name); + } + return scope.lexical.has(name) && !(scope.flags & 8 && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name); + } + checkLocalExport(id) { + const { + name + } = id; + const topLevelScope = this.scopeStack[0]; + if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) { + this.undefinedExports.set(name, id.loc.start); + } + } + currentScope() { + return this.scopeStack[this.scopeStack.length - 1]; + } + currentVarScopeFlags() { + for (let i = this.scopeStack.length - 1;; i--) { + const { + flags + } = this.scopeStack[i]; + if (flags & 387) { + return flags; + } + } + } + currentThisScopeFlags() { + for (let i = this.scopeStack.length - 1;; i--) { + const { + flags + } = this.scopeStack[i]; + if (flags & (387 | 64) && !(flags & 4)) { + return flags; + } + } + } +} +class FlowScope extends Scope { + constructor(...args) { + super(...args); + this.declareFunctions = new Set(); + } +} +class FlowScopeHandler extends ScopeHandler { + createScope(flags) { + return new FlowScope(flags); + } + declareName(name, bindingType, loc) { + const scope = this.currentScope(); + if (bindingType & 2048) { + this.checkRedeclarationInScope(scope, name, bindingType, loc); + this.maybeExportDefined(scope, name); + scope.declareFunctions.add(name); + return; + } + super.declareName(name, bindingType, loc); + } + isRedeclaredInScope(scope, name, bindingType) { + if (super.isRedeclaredInScope(scope, name, bindingType)) return true; + if (bindingType & 2048) { + return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name)); + } + return false; + } + checkLocalExport(id) { + if (!this.scopeStack[0].declareFunctions.has(id.name)) { + super.checkLocalExport(id); + } + } +} +class BaseParser { + constructor() { + this.sawUnambiguousESM = false; + this.ambiguousScriptDifferentAst = false; + } + hasPlugin(pluginConfig) { + if (typeof pluginConfig === "string") { + return this.plugins.has(pluginConfig); + } else { + const [pluginName, pluginOptions] = pluginConfig; + if (!this.hasPlugin(pluginName)) { + return false; + } + const actualOptions = this.plugins.get(pluginName); + for (const key of Object.keys(pluginOptions)) { + if ((actualOptions == null ? void 0 : actualOptions[key]) !== pluginOptions[key]) { + return false; + } + } + return true; + } + } + getPluginOption(plugin, name) { + var _this$plugins$get; + return (_this$plugins$get = this.plugins.get(plugin)) == null ? void 0 : _this$plugins$get[name]; + } +} +function setTrailingComments(node, comments) { + if (node.trailingComments === undefined) { + node.trailingComments = comments; + } else { + node.trailingComments.unshift(...comments); + } +} +function setLeadingComments(node, comments) { + if (node.leadingComments === undefined) { + node.leadingComments = comments; + } else { + node.leadingComments.unshift(...comments); + } +} +function setInnerComments(node, comments) { + if (node.innerComments === undefined) { + node.innerComments = comments; + } else { + node.innerComments.unshift(...comments); + } +} +function adjustInnerComments(node, elements, commentWS) { + let lastElement = null; + let i = elements.length; + while (lastElement === null && i > 0) { + lastElement = elements[--i]; + } + if (lastElement === null || lastElement.start > commentWS.start) { + setInnerComments(node, commentWS.comments); + } else { + setTrailingComments(lastElement, commentWS.comments); + } +} +class CommentsParser extends BaseParser { + addComment(comment) { + if (this.filename) comment.loc.filename = this.filename; + this.state.comments.push(comment); + } + processComment(node) { + const { + commentStack + } = this.state; + const commentStackLength = commentStack.length; + if (commentStackLength === 0) return; + let i = commentStackLength - 1; + const lastCommentWS = commentStack[i]; + if (lastCommentWS.start === node.end) { + lastCommentWS.leadingNode = node; + i--; + } + const { + start: nodeStart + } = node; + for (; i >= 0; i--) { + const commentWS = commentStack[i]; + const commentEnd = commentWS.end; + if (commentEnd > nodeStart) { + commentWS.containingNode = node; + this.finalizeComment(commentWS); + commentStack.splice(i, 1); + } else { + if (commentEnd === nodeStart) { + commentWS.trailingNode = node; + } + break; + } + } + } + finalizeComment(commentWS) { + const { + comments + } = commentWS; + if (commentWS.leadingNode !== null || commentWS.trailingNode !== null) { + if (commentWS.leadingNode !== null) { + setTrailingComments(commentWS.leadingNode, comments); + } + if (commentWS.trailingNode !== null) { + setLeadingComments(commentWS.trailingNode, comments); + } + } else { + const { + containingNode: node, + start: commentStart + } = commentWS; + if (this.input.charCodeAt(commentStart - 1) === 44) { + switch (node.type) { + case "ObjectExpression": + case "ObjectPattern": + case "RecordExpression": + adjustInnerComments(node, node.properties, commentWS); + break; + case "CallExpression": + case "OptionalCallExpression": + adjustInnerComments(node, node.arguments, commentWS); + break; + case "FunctionDeclaration": + case "FunctionExpression": + case "ArrowFunctionExpression": + case "ObjectMethod": + case "ClassMethod": + case "ClassPrivateMethod": + adjustInnerComments(node, node.params, commentWS); + break; + case "ArrayExpression": + case "ArrayPattern": + case "TupleExpression": + adjustInnerComments(node, node.elements, commentWS); + break; + case "ExportNamedDeclaration": + case "ImportDeclaration": + adjustInnerComments(node, node.specifiers, commentWS); + break; + default: + { + setInnerComments(node, comments); + } + } + } else { + setInnerComments(node, comments); + } + } + } + finalizeRemainingComments() { + const { + commentStack + } = this.state; + for (let i = commentStack.length - 1; i >= 0; i--) { + this.finalizeComment(commentStack[i]); + } + this.state.commentStack = []; + } + resetPreviousNodeTrailingComments(node) { + const { + commentStack + } = this.state; + const { + length + } = commentStack; + if (length === 0) return; + const commentWS = commentStack[length - 1]; + if (commentWS.leadingNode === node) { + commentWS.leadingNode = null; + } + } + resetPreviousIdentifierLeadingComments(node) { + const { + commentStack + } = this.state; + const { + length + } = commentStack; + if (length === 0) return; + if (commentStack[length - 1].trailingNode === node) { + commentStack[length - 1].trailingNode = null; + } else if (length >= 2 && commentStack[length - 2].trailingNode === node) { + commentStack[length - 2].trailingNode = null; + } + } + takeSurroundingComments(node, start, end) { + const { + commentStack + } = this.state; + const commentStackLength = commentStack.length; + if (commentStackLength === 0) return; + let i = commentStackLength - 1; + for (; i >= 0; i--) { + const commentWS = commentStack[i]; + const commentEnd = commentWS.end; + const commentStart = commentWS.start; + if (commentStart === end) { + commentWS.leadingNode = node; + } else if (commentEnd === start) { + commentWS.trailingNode = node; + } else if (commentEnd < start) { + break; + } + } + } +} +const lineBreak = /\r\n?|[\n\u2028\u2029]/; +const lineBreakG = new RegExp(lineBreak.source, "g"); +function isNewLine(code) { + switch (code) { + case 10: + case 13: + case 8232: + case 8233: + return true; + default: + return false; + } +} +const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; +const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g; +const skipWhiteSpaceToLineBreak = new RegExp("(?=(" + skipWhiteSpaceInLine.source + "))\\1" + /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y"); +function isWhitespace(code) { + switch (code) { + case 0x0009: + case 0x000b: + case 0x000c: + case 32: + case 160: + case 5760: + case 0x2000: + case 0x2001: + case 0x2002: + case 0x2003: + case 0x2004: + case 0x2005: + case 0x2006: + case 0x2007: + case 0x2008: + case 0x2009: + case 0x200a: + case 0x202f: + case 0x205f: + case 0x3000: + case 0xfeff: + return true; + default: + return false; + } +} +class State { + constructor() { + this.strict = void 0; + this.curLine = void 0; + this.lineStart = void 0; + this.startLoc = void 0; + this.endLoc = void 0; + this.errors = []; + this.potentialArrowAt = -1; + this.noArrowAt = []; + this.noArrowParamsConversionAt = []; + this.maybeInArrowParameters = false; + this.inType = false; + this.noAnonFunctionType = false; + this.hasFlowComment = false; + this.isAmbientContext = false; + this.inAbstractClass = false; + this.inDisallowConditionalTypesContext = false; + this.topicContext = { + maxNumOfResolvableTopics: 0, + maxTopicIndex: null + }; + this.soloAwait = false; + this.inFSharpPipelineDirectBody = false; + this.labels = []; + this.comments = []; + this.commentStack = []; + this.pos = 0; + this.type = 137; + this.value = null; + this.start = 0; + this.end = 0; + this.lastTokEndLoc = null; + this.lastTokStartLoc = null; + this.lastTokStart = 0; + this.context = [types.brace]; + this.canStartJSXElement = true; + this.containsEsc = false; + this.firstInvalidTemplateEscapePos = null; + this.strictErrors = new Map(); + this.tokensLength = 0; + } + init({ + strictMode, + sourceType, + startLine, + startColumn + }) { + this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module"; + this.curLine = startLine; + this.lineStart = -startColumn; + this.startLoc = this.endLoc = new Position(startLine, startColumn, 0); + } + curPosition() { + return new Position(this.curLine, this.pos - this.lineStart, this.pos); + } + clone(skipArrays) { + const state = new State(); + const keys = Object.keys(this); + for (let i = 0, length = keys.length; i < length; i++) { + const key = keys[i]; + let val = this[key]; + if (!skipArrays && Array.isArray(val)) { + val = val.slice(); + } + state[key] = val; + } + return state; + } +} +var _isDigit = function isDigit(code) { + return code >= 48 && code <= 57; +}; +const forbiddenNumericSeparatorSiblings = { + decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]), + hex: new Set([46, 88, 95, 120]) +}; +const isAllowedNumericSeparatorSibling = { + bin: ch => ch === 48 || ch === 49, + oct: ch => ch >= 48 && ch <= 55, + dec: ch => ch >= 48 && ch <= 57, + hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102 +}; +function readStringContents(type, input, pos, lineStart, curLine, errors) { + const initialPos = pos; + const initialLineStart = lineStart; + const initialCurLine = curLine; + let out = ""; + let firstInvalidLoc = null; + let chunkStart = pos; + const { + length + } = input; + for (;;) { + if (pos >= length) { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + out += input.slice(chunkStart, pos); + break; + } + const ch = input.charCodeAt(pos); + if (isStringEnd(type, ch, input, pos)) { + out += input.slice(chunkStart, pos); + break; + } + if (ch === 92) { + out += input.slice(chunkStart, pos); + const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors); + if (res.ch === null && !firstInvalidLoc) { + firstInvalidLoc = { + pos, + lineStart, + curLine + }; + } else { + out += res.ch; + } + ({ + pos, + lineStart, + curLine + } = res); + chunkStart = pos; + } else if (ch === 8232 || ch === 8233) { + ++pos; + ++curLine; + lineStart = pos; + } else if (ch === 10 || ch === 13) { + if (type === "template") { + out += input.slice(chunkStart, pos) + "\n"; + ++pos; + if (ch === 13 && input.charCodeAt(pos) === 10) { + ++pos; + } + ++curLine; + chunkStart = lineStart = pos; + } else { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + } + } else { + ++pos; + } + } + return { + pos, + str: out, + firstInvalidLoc, + lineStart, + curLine, + containsInvalid: !!firstInvalidLoc + }; +} +function isStringEnd(type, ch, input, pos) { + if (type === "template") { + return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123; + } + return ch === (type === "double" ? 34 : 39); +} +function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) { + const throwOnInvalid = !inTemplate; + pos++; + const res = ch => ({ + pos, + ch, + lineStart, + curLine + }); + const ch = input.charCodeAt(pos++); + switch (ch) { + case 110: + return res("\n"); + case 114: + return res("\r"); + case 120: + { + let code; + ({ + code, + pos + } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors)); + return res(code === null ? null : String.fromCharCode(code)); + } + case 117: + { + let code; + ({ + code, + pos + } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors)); + return res(code === null ? null : String.fromCodePoint(code)); + } + case 116: + return res("\t"); + case 98: + return res("\b"); + case 118: + return res("\u000b"); + case 102: + return res("\f"); + case 13: + if (input.charCodeAt(pos) === 10) { + ++pos; + } + case 10: + lineStart = pos; + ++curLine; + case 8232: + case 8233: + return res(""); + case 56: + case 57: + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(pos - 1, lineStart, curLine); + } + default: + if (ch >= 48 && ch <= 55) { + const startPos = pos - 1; + const match = input.slice(startPos, pos + 2).match(/^[0-7]+/); + let octalStr = match[0]; + let octal = parseInt(octalStr, 8); + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } + pos += octalStr.length - 1; + const next = input.charCodeAt(pos); + if (octalStr !== "0" || next === 56 || next === 57) { + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(startPos, lineStart, curLine); + } + } + return res(String.fromCharCode(octal)); + } + return res(String.fromCharCode(ch)); + } +} +function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) { + const initialPos = pos; + let n; + ({ + n, + pos + } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid)); + if (n === null) { + if (throwOnInvalid) { + errors.invalidEscapeSequence(initialPos, lineStart, curLine); + } else { + pos = initialPos - 1; + } + } + return { + code: n, + pos + }; +} +function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) { + const start = pos; + const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct; + const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin; + let invalid = false; + let total = 0; + for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { + const code = input.charCodeAt(pos); + let val; + if (code === 95 && allowNumSeparator !== "bail") { + const prev = input.charCodeAt(pos - 1); + const next = input.charCodeAt(pos + 1); + if (!allowNumSeparator) { + if (bailOnError) return { + n: null, + pos + }; + errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine); + } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) { + if (bailOnError) return { + n: null, + pos + }; + errors.unexpectedNumericSeparator(pos, lineStart, curLine); + } + ++pos; + continue; + } + if (code >= 97) { + val = code - 97 + 10; + } else if (code >= 65) { + val = code - 65 + 10; + } else if (_isDigit(code)) { + val = code - 48; + } else { + val = Infinity; + } + if (val >= radix) { + if (val <= 9 && bailOnError) { + return { + n: null, + pos + }; + } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) { + val = 0; + } else if (forceLen) { + val = 0; + invalid = true; + } else { + break; + } + } + ++pos; + total = total * radix + val; + } + if (pos === start || len != null && pos - start !== len || invalid) { + return { + n: null, + pos + }; + } + return { + n: total, + pos + }; +} +function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) { + const ch = input.charCodeAt(pos); + let code; + if (ch === 123) { + ++pos; + ({ + code, + pos + } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors)); + ++pos; + if (code !== null && code > 0x10ffff) { + if (throwOnInvalid) { + errors.invalidCodePoint(pos, lineStart, curLine); + } else { + return { + code: null, + pos + }; + } + } + } else { + ({ + code, + pos + } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors)); + } + return { + code, + pos + }; +} +const _excluded = ["at"], + _excluded2 = ["at"]; +function buildPosition(pos, lineStart, curLine) { + return new Position(curLine, pos - lineStart, pos); +} +const VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]); +class Token { + constructor(state) { + this.type = state.type; + this.value = state.value; + this.start = state.start; + this.end = state.end; + this.loc = new SourceLocation(state.startLoc, state.endLoc); + } +} +class Tokenizer extends CommentsParser { + constructor(options, input) { + super(); + this.isLookahead = void 0; + this.tokens = []; + this.errorHandlers_readInt = { + invalidDigit: (pos, lineStart, curLine, radix) => { + if (!this.options.errorRecovery) return false; + this.raise(Errors.InvalidDigit, { + at: buildPosition(pos, lineStart, curLine), + radix + }); + return true; + }, + numericSeparatorInEscapeSequence: this.errorBuilder(Errors.NumericSeparatorInEscapeSequence), + unexpectedNumericSeparator: this.errorBuilder(Errors.UnexpectedNumericSeparator) + }; + this.errorHandlers_readCodePoint = Object.assign({}, this.errorHandlers_readInt, { + invalidEscapeSequence: this.errorBuilder(Errors.InvalidEscapeSequence), + invalidCodePoint: this.errorBuilder(Errors.InvalidCodePoint) + }); + this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, { + strictNumericEscape: (pos, lineStart, curLine) => { + this.recordStrictModeErrors(Errors.StrictNumericEscape, { + at: buildPosition(pos, lineStart, curLine) + }); + }, + unterminated: (pos, lineStart, curLine) => { + throw this.raise(Errors.UnterminatedString, { + at: buildPosition(pos - 1, lineStart, curLine) + }); + } + }); + this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, { + strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape), + unterminated: (pos, lineStart, curLine) => { + throw this.raise(Errors.UnterminatedTemplate, { + at: buildPosition(pos, lineStart, curLine) + }); + } + }); + this.state = new State(); + this.state.init(options); + this.input = input; + this.length = input.length; + this.isLookahead = false; + } + pushToken(token) { + this.tokens.length = this.state.tokensLength; + this.tokens.push(token); + ++this.state.tokensLength; + } + next() { + this.checkKeywordEscapes(); + if (this.options.tokens) { + this.pushToken(new Token(this.state)); + } + this.state.lastTokStart = this.state.start; + this.state.lastTokEndLoc = this.state.endLoc; + this.state.lastTokStartLoc = this.state.startLoc; + this.nextToken(); + } + eat(type) { + if (this.match(type)) { + this.next(); + return true; + } else { + return false; + } + } + match(type) { + return this.state.type === type; + } + createLookaheadState(state) { + return { + pos: state.pos, + value: null, + type: state.type, + start: state.start, + end: state.end, + context: [this.curContext()], + inType: state.inType, + startLoc: state.startLoc, + lastTokEndLoc: state.lastTokEndLoc, + curLine: state.curLine, + lineStart: state.lineStart, + curPosition: state.curPosition + }; + } + lookahead() { + const old = this.state; + this.state = this.createLookaheadState(old); + this.isLookahead = true; + this.nextToken(); + this.isLookahead = false; + const curr = this.state; + this.state = old; + return curr; + } + nextTokenStart() { + return this.nextTokenStartSince(this.state.pos); + } + nextTokenStartSince(pos) { + skipWhiteSpace.lastIndex = pos; + return skipWhiteSpace.test(this.input) ? skipWhiteSpace.lastIndex : pos; + } + lookaheadCharCode() { + return this.input.charCodeAt(this.nextTokenStart()); + } + nextTokenInLineStart() { + return this.nextTokenInLineStartSince(this.state.pos); + } + nextTokenInLineStartSince(pos) { + skipWhiteSpaceInLine.lastIndex = pos; + return skipWhiteSpaceInLine.test(this.input) ? skipWhiteSpaceInLine.lastIndex : pos; + } + lookaheadInLineCharCode() { + return this.input.charCodeAt(this.nextTokenInLineStart()); + } + codePointAtPos(pos) { + let cp = this.input.charCodeAt(pos); + if ((cp & 0xfc00) === 0xd800 && ++pos < this.input.length) { + const trail = this.input.charCodeAt(pos); + if ((trail & 0xfc00) === 0xdc00) { + cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff); + } + } + return cp; + } + setStrict(strict) { + this.state.strict = strict; + if (strict) { + this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, { + at + })); + this.state.strictErrors.clear(); + } + } + curContext() { + return this.state.context[this.state.context.length - 1]; + } + nextToken() { + this.skipSpace(); + this.state.start = this.state.pos; + if (!this.isLookahead) this.state.startLoc = this.state.curPosition(); + if (this.state.pos >= this.length) { + this.finishToken(137); + return; + } + this.getTokenFromCode(this.codePointAtPos(this.state.pos)); + } + skipBlockComment(commentEnd) { + let startLoc; + if (!this.isLookahead) startLoc = this.state.curPosition(); + const start = this.state.pos; + const end = this.input.indexOf(commentEnd, start + 2); + if (end === -1) { + throw this.raise(Errors.UnterminatedComment, { + at: this.state.curPosition() + }); + } + this.state.pos = end + commentEnd.length; + lineBreakG.lastIndex = start + 2; + while (lineBreakG.test(this.input) && lineBreakG.lastIndex <= end) { + ++this.state.curLine; + this.state.lineStart = lineBreakG.lastIndex; + } + if (this.isLookahead) return; + const comment = { + type: "CommentBlock", + value: this.input.slice(start + 2, end), + start, + end: end + commentEnd.length, + loc: new SourceLocation(startLoc, this.state.curPosition()) + }; + if (this.options.tokens) this.pushToken(comment); + return comment; + } + skipLineComment(startSkip) { + const start = this.state.pos; + let startLoc; + if (!this.isLookahead) startLoc = this.state.curPosition(); + let ch = this.input.charCodeAt(this.state.pos += startSkip); + if (this.state.pos < this.length) { + while (!isNewLine(ch) && ++this.state.pos < this.length) { + ch = this.input.charCodeAt(this.state.pos); + } + } + if (this.isLookahead) return; + const end = this.state.pos; + const value = this.input.slice(start + startSkip, end); + const comment = { + type: "CommentLine", + value, + start, + end, + loc: new SourceLocation(startLoc, this.state.curPosition()) + }; + if (this.options.tokens) this.pushToken(comment); + return comment; + } + skipSpace() { + const spaceStart = this.state.pos; + const comments = []; + loop: while (this.state.pos < this.length) { + const ch = this.input.charCodeAt(this.state.pos); + switch (ch) { + case 32: + case 160: + case 9: + ++this.state.pos; + break; + case 13: + if (this.input.charCodeAt(this.state.pos + 1) === 10) { + ++this.state.pos; + } + case 10: + case 8232: + case 8233: + ++this.state.pos; + ++this.state.curLine; + this.state.lineStart = this.state.pos; + break; + case 47: + switch (this.input.charCodeAt(this.state.pos + 1)) { + case 42: + { + const comment = this.skipBlockComment("*/"); + if (comment !== undefined) { + this.addComment(comment); + if (this.options.attachComment) comments.push(comment); + } + break; + } + case 47: + { + const comment = this.skipLineComment(2); + if (comment !== undefined) { + this.addComment(comment); + if (this.options.attachComment) comments.push(comment); + } + break; + } + default: + break loop; + } + break; + default: + if (isWhitespace(ch)) { + ++this.state.pos; + } else if (ch === 45 && !this.inModule && this.options.annexB) { + const pos = this.state.pos; + if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) { + const comment = this.skipLineComment(3); + if (comment !== undefined) { + this.addComment(comment); + if (this.options.attachComment) comments.push(comment); + } + } else { + break loop; + } + } else if (ch === 60 && !this.inModule && this.options.annexB) { + const pos = this.state.pos; + if (this.input.charCodeAt(pos + 1) === 33 && this.input.charCodeAt(pos + 2) === 45 && this.input.charCodeAt(pos + 3) === 45) { + const comment = this.skipLineComment(4); + if (comment !== undefined) { + this.addComment(comment); + if (this.options.attachComment) comments.push(comment); + } + } else { + break loop; + } + } else { + break loop; + } + } + } + if (comments.length > 0) { + const end = this.state.pos; + const commentWhitespace = { + start: spaceStart, + end, + comments, + leadingNode: null, + trailingNode: null, + containingNode: null + }; + this.state.commentStack.push(commentWhitespace); + } + } + finishToken(type, val) { + this.state.end = this.state.pos; + this.state.endLoc = this.state.curPosition(); + const prevType = this.state.type; + this.state.type = type; + this.state.value = val; + if (!this.isLookahead) { + this.updateContext(prevType); + } + } + replaceToken(type) { + this.state.type = type; + this.updateContext(); + } + readToken_numberSign() { + if (this.state.pos === 0 && this.readToken_interpreter()) { + return; + } + const nextPos = this.state.pos + 1; + const next = this.codePointAtPos(nextPos); + if (next >= 48 && next <= 57) { + throw this.raise(Errors.UnexpectedDigitAfterHash, { + at: this.state.curPosition() + }); + } + if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) { + this.expectPlugin("recordAndTuple"); + if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") { + throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, { + at: this.state.curPosition() + }); + } + this.state.pos += 2; + if (next === 123) { + this.finishToken(7); + } else { + this.finishToken(1); + } + } else if (isIdentifierStart(next)) { + ++this.state.pos; + this.finishToken(136, this.readWord1(next)); + } else if (next === 92) { + ++this.state.pos; + this.finishToken(136, this.readWord1()); + } else { + this.finishOp(27, 1); + } + } + readToken_dot() { + const next = this.input.charCodeAt(this.state.pos + 1); + if (next >= 48 && next <= 57) { + this.readNumber(true); + return; + } + if (next === 46 && this.input.charCodeAt(this.state.pos + 2) === 46) { + this.state.pos += 3; + this.finishToken(21); + } else { + ++this.state.pos; + this.finishToken(16); + } + } + readToken_slash() { + const next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61) { + this.finishOp(31, 2); + } else { + this.finishOp(56, 1); + } + } + readToken_interpreter() { + if (this.state.pos !== 0 || this.length < 2) return false; + let ch = this.input.charCodeAt(this.state.pos + 1); + if (ch !== 33) return false; + const start = this.state.pos; + this.state.pos += 1; + while (!isNewLine(ch) && ++this.state.pos < this.length) { + ch = this.input.charCodeAt(this.state.pos); + } + const value = this.input.slice(start + 2, this.state.pos); + this.finishToken(28, value); + return true; + } + readToken_mult_modulo(code) { + let type = code === 42 ? 55 : 54; + let width = 1; + let next = this.input.charCodeAt(this.state.pos + 1); + if (code === 42 && next === 42) { + width++; + next = this.input.charCodeAt(this.state.pos + 2); + type = 57; + } + if (next === 61 && !this.state.inType) { + width++; + type = code === 37 ? 33 : 30; + } + this.finishOp(type, width); + } + readToken_pipe_amp(code) { + const next = this.input.charCodeAt(this.state.pos + 1); + if (next === code) { + if (this.input.charCodeAt(this.state.pos + 2) === 61) { + this.finishOp(30, 3); + } else { + this.finishOp(code === 124 ? 41 : 42, 2); + } + return; + } + if (code === 124) { + if (next === 62) { + this.finishOp(39, 2); + return; + } + if (this.hasPlugin("recordAndTuple") && next === 125) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, { + at: this.state.curPosition() + }); + } + this.state.pos += 2; + this.finishToken(9); + return; + } + if (this.hasPlugin("recordAndTuple") && next === 93) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, { + at: this.state.curPosition() + }); + } + this.state.pos += 2; + this.finishToken(4); + return; + } + } + if (next === 61) { + this.finishOp(30, 2); + return; + } + this.finishOp(code === 124 ? 43 : 45, 1); + } + readToken_caret() { + const next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61 && !this.state.inType) { + this.finishOp(32, 2); + } else if (next === 94 && this.hasPlugin(["pipelineOperator", { + proposal: "hack", + topicToken: "^^" + }])) { + this.finishOp(37, 2); + const lookaheadCh = this.input.codePointAt(this.state.pos); + if (lookaheadCh === 94) { + this.unexpected(); + } + } else { + this.finishOp(44, 1); + } + } + readToken_atSign() { + const next = this.input.charCodeAt(this.state.pos + 1); + if (next === 64 && this.hasPlugin(["pipelineOperator", { + proposal: "hack", + topicToken: "@@" + }])) { + this.finishOp(38, 2); + } else { + this.finishOp(26, 1); + } + } + readToken_plus_min(code) { + const next = this.input.charCodeAt(this.state.pos + 1); + if (next === code) { + this.finishOp(34, 2); + return; + } + if (next === 61) { + this.finishOp(30, 2); + } else { + this.finishOp(53, 1); + } + } + readToken_lt() { + const { + pos + } = this.state; + const next = this.input.charCodeAt(pos + 1); + if (next === 60) { + if (this.input.charCodeAt(pos + 2) === 61) { + this.finishOp(30, 3); + return; + } + this.finishOp(51, 2); + return; + } + if (next === 61) { + this.finishOp(49, 2); + return; + } + this.finishOp(47, 1); + } + readToken_gt() { + const { + pos + } = this.state; + const next = this.input.charCodeAt(pos + 1); + if (next === 62) { + const size = this.input.charCodeAt(pos + 2) === 62 ? 3 : 2; + if (this.input.charCodeAt(pos + size) === 61) { + this.finishOp(30, size + 1); + return; + } + this.finishOp(52, size); + return; + } + if (next === 61) { + this.finishOp(49, 2); + return; + } + this.finishOp(48, 1); + } + readToken_eq_excl(code) { + const next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61) { + this.finishOp(46, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2); + return; + } + if (code === 61 && next === 62) { + this.state.pos += 2; + this.finishToken(19); + return; + } + this.finishOp(code === 61 ? 29 : 35, 1); + } + readToken_question() { + const next = this.input.charCodeAt(this.state.pos + 1); + const next2 = this.input.charCodeAt(this.state.pos + 2); + if (next === 63) { + if (next2 === 61) { + this.finishOp(30, 3); + } else { + this.finishOp(40, 2); + } + } else if (next === 46 && !(next2 >= 48 && next2 <= 57)) { + this.state.pos += 2; + this.finishToken(18); + } else { + ++this.state.pos; + this.finishToken(17); + } + } + getTokenFromCode(code) { + switch (code) { + case 46: + this.readToken_dot(); + return; + case 40: + ++this.state.pos; + this.finishToken(10); + return; + case 41: + ++this.state.pos; + this.finishToken(11); + return; + case 59: + ++this.state.pos; + this.finishToken(13); + return; + case 44: + ++this.state.pos; + this.finishToken(12); + return; + case 91: + if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, { + at: this.state.curPosition() + }); + } + this.state.pos += 2; + this.finishToken(2); + } else { + ++this.state.pos; + this.finishToken(0); + } + return; + case 93: + ++this.state.pos; + this.finishToken(3); + return; + case 123: + if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, { + at: this.state.curPosition() + }); + } + this.state.pos += 2; + this.finishToken(6); + } else { + ++this.state.pos; + this.finishToken(5); + } + return; + case 125: + ++this.state.pos; + this.finishToken(8); + return; + case 58: + if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) { + this.finishOp(15, 2); + } else { + ++this.state.pos; + this.finishToken(14); + } + return; + case 63: + this.readToken_question(); + return; + case 96: + this.readTemplateToken(); + return; + case 48: + { + const next = this.input.charCodeAt(this.state.pos + 1); + if (next === 120 || next === 88) { + this.readRadixNumber(16); + return; + } + if (next === 111 || next === 79) { + this.readRadixNumber(8); + return; + } + if (next === 98 || next === 66) { + this.readRadixNumber(2); + return; + } + } + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + this.readNumber(false); + return; + case 34: + case 39: + this.readString(code); + return; + case 47: + this.readToken_slash(); + return; + case 37: + case 42: + this.readToken_mult_modulo(code); + return; + case 124: + case 38: + this.readToken_pipe_amp(code); + return; + case 94: + this.readToken_caret(); + return; + case 43: + case 45: + this.readToken_plus_min(code); + return; + case 60: + this.readToken_lt(); + return; + case 62: + this.readToken_gt(); + return; + case 61: + case 33: + this.readToken_eq_excl(code); + return; + case 126: + this.finishOp(36, 1); + return; + case 64: + this.readToken_atSign(); + return; + case 35: + this.readToken_numberSign(); + return; + case 92: + this.readWord(); + return; + default: + if (isIdentifierStart(code)) { + this.readWord(code); + return; + } + } + throw this.raise(Errors.InvalidOrUnexpectedToken, { + at: this.state.curPosition(), + unexpected: String.fromCodePoint(code) + }); + } + finishOp(type, size) { + const str = this.input.slice(this.state.pos, this.state.pos + size); + this.state.pos += size; + this.finishToken(type, str); + } + readRegexp() { + const startLoc = this.state.startLoc; + const start = this.state.start + 1; + let escaped, inClass; + let { + pos + } = this.state; + for (;; ++pos) { + if (pos >= this.length) { + throw this.raise(Errors.UnterminatedRegExp, { + at: createPositionWithColumnOffset(startLoc, 1) + }); + } + const ch = this.input.charCodeAt(pos); + if (isNewLine(ch)) { + throw this.raise(Errors.UnterminatedRegExp, { + at: createPositionWithColumnOffset(startLoc, 1) + }); + } + if (escaped) { + escaped = false; + } else { + if (ch === 91) { + inClass = true; + } else if (ch === 93 && inClass) { + inClass = false; + } else if (ch === 47 && !inClass) { + break; + } + escaped = ch === 92; + } + } + const content = this.input.slice(start, pos); + ++pos; + let mods = ""; + const nextPos = () => createPositionWithColumnOffset(startLoc, pos + 2 - start); + while (pos < this.length) { + const cp = this.codePointAtPos(pos); + const char = String.fromCharCode(cp); + if (VALID_REGEX_FLAGS.has(cp)) { + if (cp === 118) { + if (mods.includes("u")) { + this.raise(Errors.IncompatibleRegExpUVFlags, { + at: nextPos() + }); + } + } else if (cp === 117) { + if (mods.includes("v")) { + this.raise(Errors.IncompatibleRegExpUVFlags, { + at: nextPos() + }); + } + } + if (mods.includes(char)) { + this.raise(Errors.DuplicateRegExpFlags, { + at: nextPos() + }); + } + } else if (isIdentifierChar(cp) || cp === 92) { + this.raise(Errors.MalformedRegExpFlags, { + at: nextPos() + }); + } else { + break; + } + ++pos; + mods += char; + } + this.state.pos = pos; + this.finishToken(135, { + pattern: content, + flags: mods + }); + } + readInt(radix, len, forceLen = false, allowNumSeparator = true) { + const { + n, + pos + } = readInt(this.input, this.state.pos, this.state.lineStart, this.state.curLine, radix, len, forceLen, allowNumSeparator, this.errorHandlers_readInt, false); + this.state.pos = pos; + return n; + } + readRadixNumber(radix) { + const startLoc = this.state.curPosition(); + let isBigInt = false; + this.state.pos += 2; + const val = this.readInt(radix); + if (val == null) { + this.raise(Errors.InvalidDigit, { + at: createPositionWithColumnOffset(startLoc, 2), + radix + }); + } + const next = this.input.charCodeAt(this.state.pos); + if (next === 110) { + ++this.state.pos; + isBigInt = true; + } else if (next === 109) { + throw this.raise(Errors.InvalidDecimal, { + at: startLoc + }); + } + if (isIdentifierStart(this.codePointAtPos(this.state.pos))) { + throw this.raise(Errors.NumberIdentifier, { + at: this.state.curPosition() + }); + } + if (isBigInt) { + const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, ""); + this.finishToken(133, str); + return; + } + this.finishToken(132, val); + } + readNumber(startsWithDot) { + const start = this.state.pos; + const startLoc = this.state.curPosition(); + let isFloat = false; + let isBigInt = false; + let isDecimal = false; + let hasExponent = false; + let isOctal = false; + if (!startsWithDot && this.readInt(10) === null) { + this.raise(Errors.InvalidNumber, { + at: this.state.curPosition() + }); + } + const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48; + if (hasLeadingZero) { + const integer = this.input.slice(start, this.state.pos); + this.recordStrictModeErrors(Errors.StrictOctalLiteral, { + at: startLoc + }); + if (!this.state.strict) { + const underscorePos = integer.indexOf("_"); + if (underscorePos > 0) { + this.raise(Errors.ZeroDigitNumericSeparator, { + at: createPositionWithColumnOffset(startLoc, underscorePos) + }); + } + } + isOctal = hasLeadingZero && !/[89]/.test(integer); + } + let next = this.input.charCodeAt(this.state.pos); + if (next === 46 && !isOctal) { + ++this.state.pos; + this.readInt(10); + isFloat = true; + next = this.input.charCodeAt(this.state.pos); + } + if ((next === 69 || next === 101) && !isOctal) { + next = this.input.charCodeAt(++this.state.pos); + if (next === 43 || next === 45) { + ++this.state.pos; + } + if (this.readInt(10) === null) { + this.raise(Errors.InvalidOrMissingExponent, { + at: startLoc + }); + } + isFloat = true; + hasExponent = true; + next = this.input.charCodeAt(this.state.pos); + } + if (next === 110) { + if (isFloat || hasLeadingZero) { + this.raise(Errors.InvalidBigIntLiteral, { + at: startLoc + }); + } + ++this.state.pos; + isBigInt = true; + } + if (next === 109) { + this.expectPlugin("decimal", this.state.curPosition()); + if (hasExponent || hasLeadingZero) { + this.raise(Errors.InvalidDecimal, { + at: startLoc + }); + } + ++this.state.pos; + isDecimal = true; + } + if (isIdentifierStart(this.codePointAtPos(this.state.pos))) { + throw this.raise(Errors.NumberIdentifier, { + at: this.state.curPosition() + }); + } + const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, ""); + if (isBigInt) { + this.finishToken(133, str); + return; + } + if (isDecimal) { + this.finishToken(134, str); + return; + } + const val = isOctal ? parseInt(str, 8) : parseFloat(str); + this.finishToken(132, val); + } + readCodePoint(throwOnInvalid) { + const { + code, + pos + } = readCodePoint(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint); + this.state.pos = pos; + return code; + } + readString(quote) { + const { + str, + pos, + curLine, + lineStart + } = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string); + this.state.pos = pos + 1; + this.state.lineStart = lineStart; + this.state.curLine = curLine; + this.finishToken(131, str); + } + readTemplateContinuation() { + if (!this.match(8)) { + this.unexpected(null, 8); + } + this.state.pos--; + this.readTemplateToken(); + } + readTemplateToken() { + const opening = this.input[this.state.pos]; + const { + str, + firstInvalidLoc, + pos, + curLine, + lineStart + } = readStringContents("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template); + this.state.pos = pos + 1; + this.state.lineStart = lineStart; + this.state.curLine = curLine; + if (firstInvalidLoc) { + this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, firstInvalidLoc.pos); + } + if (this.input.codePointAt(pos) === 96) { + this.finishToken(24, firstInvalidLoc ? null : opening + str + "`"); + } else { + this.state.pos++; + this.finishToken(25, firstInvalidLoc ? null : opening + str + "${"); + } + } + recordStrictModeErrors(toParseError, { + at + }) { + const index = at.index; + if (this.state.strict && !this.state.strictErrors.has(index)) { + this.raise(toParseError, { + at + }); + } else { + this.state.strictErrors.set(index, [toParseError, at]); + } + } + readWord1(firstCode) { + this.state.containsEsc = false; + let word = ""; + const start = this.state.pos; + let chunkStart = this.state.pos; + if (firstCode !== undefined) { + this.state.pos += firstCode <= 0xffff ? 1 : 2; + } + while (this.state.pos < this.length) { + const ch = this.codePointAtPos(this.state.pos); + if (isIdentifierChar(ch)) { + this.state.pos += ch <= 0xffff ? 1 : 2; + } else if (ch === 92) { + this.state.containsEsc = true; + word += this.input.slice(chunkStart, this.state.pos); + const escStart = this.state.curPosition(); + const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar; + if (this.input.charCodeAt(++this.state.pos) !== 117) { + this.raise(Errors.MissingUnicodeEscape, { + at: this.state.curPosition() + }); + chunkStart = this.state.pos - 1; + continue; + } + ++this.state.pos; + const esc = this.readCodePoint(true); + if (esc !== null) { + if (!identifierCheck(esc)) { + this.raise(Errors.EscapedCharNotAnIdentifier, { + at: escStart + }); + } + word += String.fromCodePoint(esc); + } + chunkStart = this.state.pos; + } else { + break; + } + } + return word + this.input.slice(chunkStart, this.state.pos); + } + readWord(firstCode) { + const word = this.readWord1(firstCode); + const type = keywords$1.get(word); + if (type !== undefined) { + this.finishToken(type, tokenLabelName(type)); + } else { + this.finishToken(130, word); + } + } + checkKeywordEscapes() { + const { + type + } = this.state; + if (tokenIsKeyword(type) && this.state.containsEsc) { + this.raise(Errors.InvalidEscapedReservedWord, { + at: this.state.startLoc, + reservedWord: tokenLabelName(type) + }); + } + } + raise(toParseError, raiseProperties) { + const { + at + } = raiseProperties, + details = _objectWithoutPropertiesLoose(raiseProperties, _excluded); + const loc = at instanceof Position ? at : at.loc.start; + const error = toParseError({ + loc, + details + }); + if (!this.options.errorRecovery) throw error; + if (!this.isLookahead) this.state.errors.push(error); + return error; + } + raiseOverwrite(toParseError, raiseProperties) { + const { + at + } = raiseProperties, + details = _objectWithoutPropertiesLoose(raiseProperties, _excluded2); + const loc = at instanceof Position ? at : at.loc.start; + const pos = loc.index; + const errors = this.state.errors; + for (let i = errors.length - 1; i >= 0; i--) { + const error = errors[i]; + if (error.loc.index === pos) { + return errors[i] = toParseError({ + loc, + details + }); + } + if (error.loc.index < pos) break; + } + return this.raise(toParseError, raiseProperties); + } + updateContext(prevType) {} + unexpected(loc, type) { + throw this.raise(Errors.UnexpectedToken, { + expected: type ? tokenLabelName(type) : null, + at: loc != null ? loc : this.state.startLoc + }); + } + expectPlugin(pluginName, loc) { + if (this.hasPlugin(pluginName)) { + return true; + } + throw this.raise(Errors.MissingPlugin, { + at: loc != null ? loc : this.state.startLoc, + missingPlugin: [pluginName] + }); + } + expectOnePlugin(pluginNames) { + if (!pluginNames.some(name => this.hasPlugin(name))) { + throw this.raise(Errors.MissingOneOfPlugins, { + at: this.state.startLoc, + missingPlugin: pluginNames + }); + } + } + errorBuilder(error) { + return (pos, lineStart, curLine) => { + this.raise(error, { + at: buildPosition(pos, lineStart, curLine) + }); + }; + } +} +class ClassScope { + constructor() { + this.privateNames = new Set(); + this.loneAccessors = new Map(); + this.undefinedPrivateNames = new Map(); + } +} +class ClassScopeHandler { + constructor(parser) { + this.parser = void 0; + this.stack = []; + this.undefinedPrivateNames = new Map(); + this.parser = parser; + } + current() { + return this.stack[this.stack.length - 1]; + } + enter() { + this.stack.push(new ClassScope()); + } + exit() { + const oldClassScope = this.stack.pop(); + const current = this.current(); + for (const [name, loc] of Array.from(oldClassScope.undefinedPrivateNames)) { + if (current) { + if (!current.undefinedPrivateNames.has(name)) { + current.undefinedPrivateNames.set(name, loc); + } + } else { + this.parser.raise(Errors.InvalidPrivateFieldResolution, { + at: loc, + identifierName: name + }); + } + } + } + declarePrivateName(name, elementType, loc) { + const { + privateNames, + loneAccessors, + undefinedPrivateNames + } = this.current(); + let redefined = privateNames.has(name); + if (elementType & 3) { + const accessor = redefined && loneAccessors.get(name); + if (accessor) { + const oldStatic = accessor & 4; + const newStatic = elementType & 4; + const oldKind = accessor & 3; + const newKind = elementType & 3; + redefined = oldKind === newKind || oldStatic !== newStatic; + if (!redefined) loneAccessors.delete(name); + } else if (!redefined) { + loneAccessors.set(name, elementType); + } + } + if (redefined) { + this.parser.raise(Errors.PrivateNameRedeclaration, { + at: loc, + identifierName: name + }); + } + privateNames.add(name); + undefinedPrivateNames.delete(name); + } + usePrivateName(name, loc) { + let classScope; + for (classScope of this.stack) { + if (classScope.privateNames.has(name)) return; + } + if (classScope) { + classScope.undefinedPrivateNames.set(name, loc); + } else { + this.parser.raise(Errors.InvalidPrivateFieldResolution, { + at: loc, + identifierName: name + }); + } + } +} +class ExpressionScope { + constructor(type = 0) { + this.type = type; + } + canBeArrowParameterDeclaration() { + return this.type === 2 || this.type === 1; + } + isCertainlyParameterDeclaration() { + return this.type === 3; + } +} +class ArrowHeadParsingScope extends ExpressionScope { + constructor(type) { + super(type); + this.declarationErrors = new Map(); + } + recordDeclarationError(ParsingErrorClass, { + at + }) { + const index = at.index; + this.declarationErrors.set(index, [ParsingErrorClass, at]); + } + clearDeclarationError(index) { + this.declarationErrors.delete(index); + } + iterateErrors(iterator) { + this.declarationErrors.forEach(iterator); + } +} +class ExpressionScopeHandler { + constructor(parser) { + this.parser = void 0; + this.stack = [new ExpressionScope()]; + this.parser = parser; + } + enter(scope) { + this.stack.push(scope); + } + exit() { + this.stack.pop(); + } + recordParameterInitializerError(toParseError, { + at: node + }) { + const origin = { + at: node.loc.start + }; + const { + stack + } = this; + let i = stack.length - 1; + let scope = stack[i]; + while (!scope.isCertainlyParameterDeclaration()) { + if (scope.canBeArrowParameterDeclaration()) { + scope.recordDeclarationError(toParseError, origin); + } else { + return; + } + scope = stack[--i]; + } + this.parser.raise(toParseError, origin); + } + recordArrowParameterBindingError(error, { + at: node + }) { + const { + stack + } = this; + const scope = stack[stack.length - 1]; + const origin = { + at: node.loc.start + }; + if (scope.isCertainlyParameterDeclaration()) { + this.parser.raise(error, origin); + } else if (scope.canBeArrowParameterDeclaration()) { + scope.recordDeclarationError(error, origin); + } else { + return; + } + } + recordAsyncArrowParametersError({ + at + }) { + const { + stack + } = this; + let i = stack.length - 1; + let scope = stack[i]; + while (scope.canBeArrowParameterDeclaration()) { + if (scope.type === 2) { + scope.recordDeclarationError(Errors.AwaitBindingIdentifier, { + at + }); + } + scope = stack[--i]; + } + } + validateAsPattern() { + const { + stack + } = this; + const currentScope = stack[stack.length - 1]; + if (!currentScope.canBeArrowParameterDeclaration()) return; + currentScope.iterateErrors(([toParseError, loc]) => { + this.parser.raise(toParseError, { + at: loc + }); + let i = stack.length - 2; + let scope = stack[i]; + while (scope.canBeArrowParameterDeclaration()) { + scope.clearDeclarationError(loc.index); + scope = stack[--i]; + } + }); + } +} +function newParameterDeclarationScope() { + return new ExpressionScope(3); +} +function newArrowHeadScope() { + return new ArrowHeadParsingScope(1); +} +function newAsyncArrowScope() { + return new ArrowHeadParsingScope(2); +} +function newExpressionScope() { + return new ExpressionScope(); +} +const PARAM = 0b0000, + PARAM_YIELD = 0b0001, + PARAM_AWAIT = 0b0010, + PARAM_RETURN = 0b0100, + PARAM_IN = 0b1000; +class ProductionParameterHandler { + constructor() { + this.stacks = []; + } + enter(flags) { + this.stacks.push(flags); + } + exit() { + this.stacks.pop(); + } + currentFlags() { + return this.stacks[this.stacks.length - 1]; + } + get hasAwait() { + return (this.currentFlags() & PARAM_AWAIT) > 0; + } + get hasYield() { + return (this.currentFlags() & PARAM_YIELD) > 0; + } + get hasReturn() { + return (this.currentFlags() & PARAM_RETURN) > 0; + } + get hasIn() { + return (this.currentFlags() & PARAM_IN) > 0; + } +} +function functionFlags(isAsync, isGenerator) { + return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0); +} +class UtilParser extends Tokenizer { + addExtra(node, key, value, enumerable = true) { + if (!node) return; + const extra = node.extra = node.extra || {}; + if (enumerable) { + extra[key] = value; + } else { + Object.defineProperty(extra, key, { + enumerable, + value + }); + } + } + isContextual(token) { + return this.state.type === token && !this.state.containsEsc; + } + isUnparsedContextual(nameStart, name) { + const nameEnd = nameStart + name.length; + if (this.input.slice(nameStart, nameEnd) === name) { + const nextCh = this.input.charCodeAt(nameEnd); + return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800); + } + return false; + } + isLookaheadContextual(name) { + const next = this.nextTokenStart(); + return this.isUnparsedContextual(next, name); + } + eatContextual(token) { + if (this.isContextual(token)) { + this.next(); + return true; + } + return false; + } + expectContextual(token, toParseError) { + if (!this.eatContextual(token)) { + if (toParseError != null) { + throw this.raise(toParseError, { + at: this.state.startLoc + }); + } + this.unexpected(null, token); + } + } + canInsertSemicolon() { + return this.match(137) || this.match(8) || this.hasPrecedingLineBreak(); + } + hasPrecedingLineBreak() { + return lineBreak.test(this.input.slice(this.state.lastTokEndLoc.index, this.state.start)); + } + hasFollowingLineBreak() { + skipWhiteSpaceToLineBreak.lastIndex = this.state.end; + return skipWhiteSpaceToLineBreak.test(this.input); + } + isLineTerminator() { + return this.eat(13) || this.canInsertSemicolon(); + } + semicolon(allowAsi = true) { + if (allowAsi ? this.isLineTerminator() : this.eat(13)) return; + this.raise(Errors.MissingSemicolon, { + at: this.state.lastTokEndLoc + }); + } + expect(type, loc) { + this.eat(type) || this.unexpected(loc, type); + } + tryParse(fn, oldState = this.state.clone()) { + const abortSignal = { + node: null + }; + try { + const node = fn((node = null) => { + abortSignal.node = node; + throw abortSignal; + }); + if (this.state.errors.length > oldState.errors.length) { + const failState = this.state; + this.state = oldState; + this.state.tokensLength = failState.tokensLength; + return { + node, + error: failState.errors[oldState.errors.length], + thrown: false, + aborted: false, + failState + }; + } + return { + node, + error: null, + thrown: false, + aborted: false, + failState: null + }; + } catch (error) { + const failState = this.state; + this.state = oldState; + if (error instanceof SyntaxError) { + return { + node: null, + error, + thrown: true, + aborted: false, + failState + }; + } + if (error === abortSignal) { + return { + node: abortSignal.node, + error: null, + thrown: false, + aborted: true, + failState + }; + } + throw error; + } + } + checkExpressionErrors(refExpressionErrors, andThrow) { + if (!refExpressionErrors) return false; + const { + shorthandAssignLoc, + doubleProtoLoc, + privateKeyLoc, + optionalParametersLoc + } = refExpressionErrors; + const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc; + if (!andThrow) { + return hasErrors; + } + if (shorthandAssignLoc != null) { + this.raise(Errors.InvalidCoverInitializedName, { + at: shorthandAssignLoc + }); + } + if (doubleProtoLoc != null) { + this.raise(Errors.DuplicateProto, { + at: doubleProtoLoc + }); + } + if (privateKeyLoc != null) { + this.raise(Errors.UnexpectedPrivateField, { + at: privateKeyLoc + }); + } + if (optionalParametersLoc != null) { + this.unexpected(optionalParametersLoc); + } + } + isLiteralPropertyName() { + return tokenIsLiteralPropertyName(this.state.type); + } + isPrivateName(node) { + return node.type === "PrivateName"; + } + getPrivateNameSV(node) { + return node.id.name; + } + hasPropertyAsPrivateName(node) { + return (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") && this.isPrivateName(node.property); + } + isObjectProperty(node) { + return node.type === "ObjectProperty"; + } + isObjectMethod(node) { + return node.type === "ObjectMethod"; + } + initializeScopes(inModule = this.options.sourceType === "module") { + const oldLabels = this.state.labels; + this.state.labels = []; + const oldExportedIdentifiers = this.exportedIdentifiers; + this.exportedIdentifiers = new Set(); + const oldInModule = this.inModule; + this.inModule = inModule; + const oldScope = this.scope; + const ScopeHandler = this.getScopeHandler(); + this.scope = new ScopeHandler(this, inModule); + const oldProdParam = this.prodParam; + this.prodParam = new ProductionParameterHandler(); + const oldClassScope = this.classScope; + this.classScope = new ClassScopeHandler(this); + const oldExpressionScope = this.expressionScope; + this.expressionScope = new ExpressionScopeHandler(this); + return () => { + this.state.labels = oldLabels; + this.exportedIdentifiers = oldExportedIdentifiers; + this.inModule = oldInModule; + this.scope = oldScope; + this.prodParam = oldProdParam; + this.classScope = oldClassScope; + this.expressionScope = oldExpressionScope; + }; + } + enterInitialScopes() { + let paramFlags = PARAM; + if (this.inModule) { + paramFlags |= PARAM_AWAIT; + } + this.scope.enter(1); + this.prodParam.enter(paramFlags); + } + checkDestructuringPrivate(refExpressionErrors) { + const { + privateKeyLoc + } = refExpressionErrors; + if (privateKeyLoc !== null) { + this.expectPlugin("destructuringPrivate", privateKeyLoc); + } + } +} +class ExpressionErrors { + constructor() { + this.shorthandAssignLoc = null; + this.doubleProtoLoc = null; + this.privateKeyLoc = null; + this.optionalParametersLoc = null; + } +} +class Node { + constructor(parser, pos, loc) { + this.type = ""; + this.start = pos; + this.end = 0; + this.loc = new SourceLocation(loc); + if (parser != null && parser.options.ranges) this.range = [pos, 0]; + if (parser != null && parser.filename) this.loc.filename = parser.filename; + } +} +const NodePrototype = Node.prototype; +{ + NodePrototype.__clone = function () { + const newNode = new Node(undefined, this.start, this.loc.start); + const keys = Object.keys(this); + for (let i = 0, length = keys.length; i < length; i++) { + const key = keys[i]; + if (key !== "leadingComments" && key !== "trailingComments" && key !== "innerComments") { + newNode[key] = this[key]; + } + } + return newNode; + }; +} +function clonePlaceholder(node) { + return cloneIdentifier(node); +} +function cloneIdentifier(node) { + const { + type, + start, + end, + loc, + range, + extra, + name + } = node; + const cloned = Object.create(NodePrototype); + cloned.type = type; + cloned.start = start; + cloned.end = end; + cloned.loc = loc; + cloned.range = range; + cloned.extra = extra; + cloned.name = name; + if (type === "Placeholder") { + cloned.expectedNode = node.expectedNode; + } + return cloned; +} +function cloneStringLiteral(node) { + const { + type, + start, + end, + loc, + range, + extra + } = node; + if (type === "Placeholder") { + return clonePlaceholder(node); + } + const cloned = Object.create(NodePrototype); + cloned.type = type; + cloned.start = start; + cloned.end = end; + cloned.loc = loc; + cloned.range = range; + if (node.raw !== undefined) { + cloned.raw = node.raw; + } else { + cloned.extra = extra; + } + cloned.value = node.value; + return cloned; +} +class NodeUtils extends UtilParser { + startNode() { + return new Node(this, this.state.start, this.state.startLoc); + } + startNodeAt(loc) { + return new Node(this, loc.index, loc); + } + startNodeAtNode(type) { + return this.startNodeAt(type.loc.start); + } + finishNode(node, type) { + return this.finishNodeAt(node, type, this.state.lastTokEndLoc); + } + finishNodeAt(node, type, endLoc) { + node.type = type; + node.end = endLoc.index; + node.loc.end = endLoc; + if (this.options.ranges) node.range[1] = endLoc.index; + if (this.options.attachComment) this.processComment(node); + return node; + } + resetStartLocation(node, startLoc) { + node.start = startLoc.index; + node.loc.start = startLoc; + if (this.options.ranges) node.range[0] = startLoc.index; + } + resetEndLocation(node, endLoc = this.state.lastTokEndLoc) { + node.end = endLoc.index; + node.loc.end = endLoc; + if (this.options.ranges) node.range[1] = endLoc.index; + } + resetStartLocationFromNode(node, locationNode) { + this.resetStartLocation(node, locationNode.loc.start); + } +} +const reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]); +const FlowErrors = ParseErrorEnum`flow`({ + AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.", + AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.", + AssignReservedType: ({ + reservedType + }) => `Cannot overwrite reserved type ${reservedType}.`, + DeclareClassElement: "The `declare` modifier can only appear on class fields.", + DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.", + DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.", + EnumBooleanMemberNotInitialized: ({ + memberName, + enumName + }) => `Boolean enum members need to be initialized. Use either \`${memberName} = true,\` or \`${memberName} = false,\` in enum \`${enumName}\`.`, + EnumDuplicateMemberName: ({ + memberName, + enumName + }) => `Enum member names need to be unique, but the name \`${memberName}\` has already been used before in enum \`${enumName}\`.`, + EnumInconsistentMemberValues: ({ + enumName + }) => `Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`, + EnumInvalidExplicitType: ({ + invalidEnumType, + enumName + }) => `Enum type \`${invalidEnumType}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`, + EnumInvalidExplicitTypeUnknownSupplied: ({ + enumName + }) => `Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`, + EnumInvalidMemberInitializerPrimaryType: ({ + enumName, + memberName, + explicitType + }) => `Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of \`${memberName}\` needs to be a ${explicitType} literal.`, + EnumInvalidMemberInitializerSymbolType: ({ + enumName, + memberName + }) => `Symbol enum members cannot be initialized. Use \`${memberName},\` in enum \`${enumName}\`.`, + EnumInvalidMemberInitializerUnknownType: ({ + enumName, + memberName + }) => `The enum member initializer for \`${memberName}\` needs to be a literal (either a boolean, number, or string) in enum \`${enumName}\`.`, + EnumInvalidMemberName: ({ + enumName, + memberName, + suggestion + }) => `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`, + EnumNumberMemberNotInitialized: ({ + enumName, + memberName + }) => `Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`, + EnumStringMemberInconsistentlyInitialized: ({ + enumName + }) => `String enum members need to consistently either all use initializers, or use no initializers, in enum \`${enumName}\`.`, + GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.", + ImportReflectionHasImportType: "An `import module` declaration can not use `type` or `typeof` keyword.", + ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.", + InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.", + InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.", + InexactVariance: "Explicit inexact syntax cannot have variance.", + InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.", + MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.", + NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.", + NestedFlowComment: "Cannot have a flow comment inside another flow comment.", + PatternIsOptional: Object.assign({ + message: "A binding pattern parameter cannot be optional in an implementation signature." + }, { + reasonCode: "OptionalBindingPattern" + }), + SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.", + SpreadVariance: "Spread properties cannot have variance.", + ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.", + ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.", + ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.", + ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.", + ThisParamNoDefault: "The `this` parameter may not have a default value.", + TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.", + TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.", + UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.", + UnexpectedReservedType: ({ + reservedType + }) => `Unexpected reserved type ${reservedType}.`, + UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.", + UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.", + UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.", + UnexpectedSubtractionOperand: 'Unexpected token, expected "number" or "bigint".', + UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.", + UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of ` async () => {}`, use `async () => {}`.", + UnsupportedDeclareExportKind: ({ + unsupportedExportKind, + suggestion + }) => `\`declare export ${unsupportedExportKind}\` is not supported. Use \`${suggestion}\` instead.`, + UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.", + UnterminatedFlowComment: "Unterminated flow-comment." +}); +function isEsModuleType(bodyElement) { + return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration"); +} +function hasTypeImportKind(node) { + return node.importKind === "type" || node.importKind === "typeof"; +} +const exportSuggestions = { + const: "declare export var", + let: "declare export var", + type: "export type", + interface: "export interface" +}; +function partition(list, test) { + const list1 = []; + const list2 = []; + for (let i = 0; i < list.length; i++) { + (test(list[i], i, list) ? list1 : list2).push(list[i]); + } + return [list1, list2]; +} +const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/; +var flow = superClass => class FlowParserMixin extends superClass { + constructor(...args) { + super(...args); + this.flowPragma = undefined; + } + getScopeHandler() { + return FlowScopeHandler; + } + shouldParseTypes() { + return this.getPluginOption("flow", "all") || this.flowPragma === "flow"; + } + shouldParseEnums() { + return !!this.getPluginOption("flow", "enums"); + } + finishToken(type, val) { + if (type !== 131 && type !== 13 && type !== 28) { + if (this.flowPragma === undefined) { + this.flowPragma = null; + } + } + super.finishToken(type, val); + } + addComment(comment) { + if (this.flowPragma === undefined) { + const matches = FLOW_PRAGMA_REGEX.exec(comment.value); + if (!matches) ;else if (matches[1] === "flow") { + this.flowPragma = "flow"; + } else if (matches[1] === "noflow") { + this.flowPragma = "noflow"; + } else { + throw new Error("Unexpected flow pragma"); + } + } + super.addComment(comment); + } + flowParseTypeInitialiser(tok) { + const oldInType = this.state.inType; + this.state.inType = true; + this.expect(tok || 14); + const type = this.flowParseType(); + this.state.inType = oldInType; + return type; + } + flowParsePredicate() { + const node = this.startNode(); + const moduloLoc = this.state.startLoc; + this.next(); + this.expectContextual(108); + if (this.state.lastTokStart > moduloLoc.index + 1) { + this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, { + at: moduloLoc + }); + } + if (this.eat(10)) { + node.value = super.parseExpression(); + this.expect(11); + return this.finishNode(node, "DeclaredPredicate"); + } else { + return this.finishNode(node, "InferredPredicate"); + } + } + flowParseTypeAndPredicateInitialiser() { + const oldInType = this.state.inType; + this.state.inType = true; + this.expect(14); + let type = null; + let predicate = null; + if (this.match(54)) { + this.state.inType = oldInType; + predicate = this.flowParsePredicate(); + } else { + type = this.flowParseType(); + this.state.inType = oldInType; + if (this.match(54)) { + predicate = this.flowParsePredicate(); + } + } + return [type, predicate]; + } + flowParseDeclareClass(node) { + this.next(); + this.flowParseInterfaceish(node, true); + return this.finishNode(node, "DeclareClass"); + } + flowParseDeclareFunction(node) { + this.next(); + const id = node.id = this.parseIdentifier(); + const typeNode = this.startNode(); + const typeContainer = this.startNode(); + if (this.match(47)) { + typeNode.typeParameters = this.flowParseTypeParameterDeclaration(); + } else { + typeNode.typeParameters = null; + } + this.expect(10); + const tmp = this.flowParseFunctionTypeParams(); + typeNode.params = tmp.params; + typeNode.rest = tmp.rest; + typeNode.this = tmp._this; + this.expect(11); + [typeNode.returnType, node.predicate] = this.flowParseTypeAndPredicateInitialiser(); + typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation"); + id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation"); + this.resetEndLocation(id); + this.semicolon(); + this.scope.declareName(node.id.name, 2048, node.id.loc.start); + return this.finishNode(node, "DeclareFunction"); + } + flowParseDeclare(node, insideModule) { + if (this.match(80)) { + return this.flowParseDeclareClass(node); + } else if (this.match(68)) { + return this.flowParseDeclareFunction(node); + } else if (this.match(74)) { + return this.flowParseDeclareVariable(node); + } else if (this.eatContextual(125)) { + if (this.match(16)) { + return this.flowParseDeclareModuleExports(node); + } else { + if (insideModule) { + this.raise(FlowErrors.NestedDeclareModule, { + at: this.state.lastTokStartLoc + }); + } + return this.flowParseDeclareModule(node); + } + } else if (this.isContextual(128)) { + return this.flowParseDeclareTypeAlias(node); + } else if (this.isContextual(129)) { + return this.flowParseDeclareOpaqueType(node); + } else if (this.isContextual(127)) { + return this.flowParseDeclareInterface(node); + } else if (this.match(82)) { + return this.flowParseDeclareExportDeclaration(node, insideModule); + } else { + this.unexpected(); + } + } + flowParseDeclareVariable(node) { + this.next(); + node.id = this.flowParseTypeAnnotatableIdentifier(true); + this.scope.declareName(node.id.name, 5, node.id.loc.start); + this.semicolon(); + return this.finishNode(node, "DeclareVariable"); + } + flowParseDeclareModule(node) { + this.scope.enter(0); + if (this.match(131)) { + node.id = super.parseExprAtom(); + } else { + node.id = this.parseIdentifier(); + } + const bodyNode = node.body = this.startNode(); + const body = bodyNode.body = []; + this.expect(5); + while (!this.match(8)) { + let bodyNode = this.startNode(); + if (this.match(83)) { + this.next(); + if (!this.isContextual(128) && !this.match(87)) { + this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, { + at: this.state.lastTokStartLoc + }); + } + super.parseImport(bodyNode); + } else { + this.expectContextual(123, FlowErrors.UnsupportedStatementInDeclareModule); + bodyNode = this.flowParseDeclare(bodyNode, true); + } + body.push(bodyNode); + } + this.scope.exit(); + this.expect(8); + this.finishNode(bodyNode, "BlockStatement"); + let kind = null; + let hasModuleExport = false; + body.forEach(bodyElement => { + if (isEsModuleType(bodyElement)) { + if (kind === "CommonJS") { + this.raise(FlowErrors.AmbiguousDeclareModuleKind, { + at: bodyElement + }); + } + kind = "ES"; + } else if (bodyElement.type === "DeclareModuleExports") { + if (hasModuleExport) { + this.raise(FlowErrors.DuplicateDeclareModuleExports, { + at: bodyElement + }); + } + if (kind === "ES") { + this.raise(FlowErrors.AmbiguousDeclareModuleKind, { + at: bodyElement + }); + } + kind = "CommonJS"; + hasModuleExport = true; + } + }); + node.kind = kind || "CommonJS"; + return this.finishNode(node, "DeclareModule"); + } + flowParseDeclareExportDeclaration(node, insideModule) { + this.expect(82); + if (this.eat(65)) { + if (this.match(68) || this.match(80)) { + node.declaration = this.flowParseDeclare(this.startNode()); + } else { + node.declaration = this.flowParseType(); + this.semicolon(); + } + node.default = true; + return this.finishNode(node, "DeclareExportDeclaration"); + } else { + if (this.match(75) || this.isLet() || (this.isContextual(128) || this.isContextual(127)) && !insideModule) { + const label = this.state.value; + throw this.raise(FlowErrors.UnsupportedDeclareExportKind, { + at: this.state.startLoc, + unsupportedExportKind: label, + suggestion: exportSuggestions[label] + }); + } + if (this.match(74) || this.match(68) || this.match(80) || this.isContextual(129)) { + node.declaration = this.flowParseDeclare(this.startNode()); + node.default = false; + return this.finishNode(node, "DeclareExportDeclaration"); + } else if (this.match(55) || this.match(5) || this.isContextual(127) || this.isContextual(128) || this.isContextual(129)) { + node = this.parseExport(node, null); + if (node.type === "ExportNamedDeclaration") { + node.type = "ExportDeclaration"; + node.default = false; + delete node.exportKind; + } + node.type = "Declare" + node.type; + return node; + } + } + this.unexpected(); + } + flowParseDeclareModuleExports(node) { + this.next(); + this.expectContextual(109); + node.typeAnnotation = this.flowParseTypeAnnotation(); + this.semicolon(); + return this.finishNode(node, "DeclareModuleExports"); + } + flowParseDeclareTypeAlias(node) { + this.next(); + const finished = this.flowParseTypeAlias(node); + finished.type = "DeclareTypeAlias"; + return finished; + } + flowParseDeclareOpaqueType(node) { + this.next(); + const finished = this.flowParseOpaqueType(node, true); + finished.type = "DeclareOpaqueType"; + return finished; + } + flowParseDeclareInterface(node) { + this.next(); + this.flowParseInterfaceish(node, false); + return this.finishNode(node, "DeclareInterface"); + } + flowParseInterfaceish(node, isClass) { + node.id = this.flowParseRestrictedIdentifier(!isClass, true); + this.scope.declareName(node.id.name, isClass ? 17 : 8201, node.id.loc.start); + if (this.match(47)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } else { + node.typeParameters = null; + } + node.extends = []; + if (this.eat(81)) { + do { + node.extends.push(this.flowParseInterfaceExtends()); + } while (!isClass && this.eat(12)); + } + if (isClass) { + node.implements = []; + node.mixins = []; + if (this.eatContextual(115)) { + do { + node.mixins.push(this.flowParseInterfaceExtends()); + } while (this.eat(12)); + } + if (this.eatContextual(111)) { + do { + node.implements.push(this.flowParseInterfaceExtends()); + } while (this.eat(12)); + } + } + node.body = this.flowParseObjectType({ + allowStatic: isClass, + allowExact: false, + allowSpread: false, + allowProto: isClass, + allowInexact: false + }); + } + flowParseInterfaceExtends() { + const node = this.startNode(); + node.id = this.flowParseQualifiedTypeIdentifier(); + if (this.match(47)) { + node.typeParameters = this.flowParseTypeParameterInstantiation(); + } else { + node.typeParameters = null; + } + return this.finishNode(node, "InterfaceExtends"); + } + flowParseInterface(node) { + this.flowParseInterfaceish(node, false); + return this.finishNode(node, "InterfaceDeclaration"); + } + checkNotUnderscore(word) { + if (word === "_") { + this.raise(FlowErrors.UnexpectedReservedUnderscore, { + at: this.state.startLoc + }); + } + } + checkReservedType(word, startLoc, declaration) { + if (!reservedTypes.has(word)) return; + this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, { + at: startLoc, + reservedType: word + }); + } + flowParseRestrictedIdentifier(liberal, declaration) { + this.checkReservedType(this.state.value, this.state.startLoc, declaration); + return this.parseIdentifier(liberal); + } + flowParseTypeAlias(node) { + node.id = this.flowParseRestrictedIdentifier(false, true); + this.scope.declareName(node.id.name, 8201, node.id.loc.start); + if (this.match(47)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } else { + node.typeParameters = null; + } + node.right = this.flowParseTypeInitialiser(29); + this.semicolon(); + return this.finishNode(node, "TypeAlias"); + } + flowParseOpaqueType(node, declare) { + this.expectContextual(128); + node.id = this.flowParseRestrictedIdentifier(true, true); + this.scope.declareName(node.id.name, 8201, node.id.loc.start); + if (this.match(47)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } else { + node.typeParameters = null; + } + node.supertype = null; + if (this.match(14)) { + node.supertype = this.flowParseTypeInitialiser(14); + } + node.impltype = null; + if (!declare) { + node.impltype = this.flowParseTypeInitialiser(29); + } + this.semicolon(); + return this.finishNode(node, "OpaqueType"); + } + flowParseTypeParameter(requireDefault = false) { + const nodeStartLoc = this.state.startLoc; + const node = this.startNode(); + const variance = this.flowParseVariance(); + const ident = this.flowParseTypeAnnotatableIdentifier(); + node.name = ident.name; + node.variance = variance; + node.bound = ident.typeAnnotation; + if (this.match(29)) { + this.eat(29); + node.default = this.flowParseType(); + } else { + if (requireDefault) { + this.raise(FlowErrors.MissingTypeParamDefault, { + at: nodeStartLoc + }); + } + } + return this.finishNode(node, "TypeParameter"); + } + flowParseTypeParameterDeclaration() { + const oldInType = this.state.inType; + const node = this.startNode(); + node.params = []; + this.state.inType = true; + if (this.match(47) || this.match(140)) { + this.next(); + } else { + this.unexpected(); + } + let defaultRequired = false; + do { + const typeParameter = this.flowParseTypeParameter(defaultRequired); + node.params.push(typeParameter); + if (typeParameter.default) { + defaultRequired = true; + } + if (!this.match(48)) { + this.expect(12); + } + } while (!this.match(48)); + this.expect(48); + this.state.inType = oldInType; + return this.finishNode(node, "TypeParameterDeclaration"); + } + flowParseTypeParameterInstantiation() { + const node = this.startNode(); + const oldInType = this.state.inType; + node.params = []; + this.state.inType = true; + this.expect(47); + const oldNoAnonFunctionType = this.state.noAnonFunctionType; + this.state.noAnonFunctionType = false; + while (!this.match(48)) { + node.params.push(this.flowParseType()); + if (!this.match(48)) { + this.expect(12); + } + } + this.state.noAnonFunctionType = oldNoAnonFunctionType; + this.expect(48); + this.state.inType = oldInType; + return this.finishNode(node, "TypeParameterInstantiation"); + } + flowParseTypeParameterInstantiationCallOrNew() { + const node = this.startNode(); + const oldInType = this.state.inType; + node.params = []; + this.state.inType = true; + this.expect(47); + while (!this.match(48)) { + node.params.push(this.flowParseTypeOrImplicitInstantiation()); + if (!this.match(48)) { + this.expect(12); + } + } + this.expect(48); + this.state.inType = oldInType; + return this.finishNode(node, "TypeParameterInstantiation"); + } + flowParseInterfaceType() { + const node = this.startNode(); + this.expectContextual(127); + node.extends = []; + if (this.eat(81)) { + do { + node.extends.push(this.flowParseInterfaceExtends()); + } while (this.eat(12)); + } + node.body = this.flowParseObjectType({ + allowStatic: false, + allowExact: false, + allowSpread: false, + allowProto: false, + allowInexact: false + }); + return this.finishNode(node, "InterfaceTypeAnnotation"); + } + flowParseObjectPropertyKey() { + return this.match(132) || this.match(131) ? super.parseExprAtom() : this.parseIdentifier(true); + } + flowParseObjectTypeIndexer(node, isStatic, variance) { + node.static = isStatic; + if (this.lookahead().type === 14) { + node.id = this.flowParseObjectPropertyKey(); + node.key = this.flowParseTypeInitialiser(); + } else { + node.id = null; + node.key = this.flowParseType(); + } + this.expect(3); + node.value = this.flowParseTypeInitialiser(); + node.variance = variance; + return this.finishNode(node, "ObjectTypeIndexer"); + } + flowParseObjectTypeInternalSlot(node, isStatic) { + node.static = isStatic; + node.id = this.flowParseObjectPropertyKey(); + this.expect(3); + this.expect(3); + if (this.match(47) || this.match(10)) { + node.method = true; + node.optional = false; + node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.loc.start)); + } else { + node.method = false; + if (this.eat(17)) { + node.optional = true; + } + node.value = this.flowParseTypeInitialiser(); + } + return this.finishNode(node, "ObjectTypeInternalSlot"); + } + flowParseObjectTypeMethodish(node) { + node.params = []; + node.rest = null; + node.typeParameters = null; + node.this = null; + if (this.match(47)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } + this.expect(10); + if (this.match(78)) { + node.this = this.flowParseFunctionTypeParam(true); + node.this.name = null; + if (!this.match(11)) { + this.expect(12); + } + } + while (!this.match(11) && !this.match(21)) { + node.params.push(this.flowParseFunctionTypeParam(false)); + if (!this.match(11)) { + this.expect(12); + } + } + if (this.eat(21)) { + node.rest = this.flowParseFunctionTypeParam(false); + } + this.expect(11); + node.returnType = this.flowParseTypeInitialiser(); + return this.finishNode(node, "FunctionTypeAnnotation"); + } + flowParseObjectTypeCallProperty(node, isStatic) { + const valueNode = this.startNode(); + node.static = isStatic; + node.value = this.flowParseObjectTypeMethodish(valueNode); + return this.finishNode(node, "ObjectTypeCallProperty"); + } + flowParseObjectType({ + allowStatic, + allowExact, + allowSpread, + allowProto, + allowInexact + }) { + const oldInType = this.state.inType; + this.state.inType = true; + const nodeStart = this.startNode(); + nodeStart.callProperties = []; + nodeStart.properties = []; + nodeStart.indexers = []; + nodeStart.internalSlots = []; + let endDelim; + let exact; + let inexact = false; + if (allowExact && this.match(6)) { + this.expect(6); + endDelim = 9; + exact = true; + } else { + this.expect(5); + endDelim = 8; + exact = false; + } + nodeStart.exact = exact; + while (!this.match(endDelim)) { + let isStatic = false; + let protoStartLoc = null; + let inexactStartLoc = null; + const node = this.startNode(); + if (allowProto && this.isContextual(116)) { + const lookahead = this.lookahead(); + if (lookahead.type !== 14 && lookahead.type !== 17) { + this.next(); + protoStartLoc = this.state.startLoc; + allowStatic = false; + } + } + if (allowStatic && this.isContextual(104)) { + const lookahead = this.lookahead(); + if (lookahead.type !== 14 && lookahead.type !== 17) { + this.next(); + isStatic = true; + } + } + const variance = this.flowParseVariance(); + if (this.eat(0)) { + if (protoStartLoc != null) { + this.unexpected(protoStartLoc); + } + if (this.eat(0)) { + if (variance) { + this.unexpected(variance.loc.start); + } + nodeStart.internalSlots.push(this.flowParseObjectTypeInternalSlot(node, isStatic)); + } else { + nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance)); + } + } else if (this.match(10) || this.match(47)) { + if (protoStartLoc != null) { + this.unexpected(protoStartLoc); + } + if (variance) { + this.unexpected(variance.loc.start); + } + nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic)); + } else { + let kind = "init"; + if (this.isContextual(98) || this.isContextual(103)) { + const lookahead = this.lookahead(); + if (tokenIsLiteralPropertyName(lookahead.type)) { + kind = this.state.value; + this.next(); + } + } + const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic, protoStartLoc, variance, kind, allowSpread, allowInexact != null ? allowInexact : !exact); + if (propOrInexact === null) { + inexact = true; + inexactStartLoc = this.state.lastTokStartLoc; + } else { + nodeStart.properties.push(propOrInexact); + } + } + this.flowObjectTypeSemicolon(); + if (inexactStartLoc && !this.match(8) && !this.match(9)) { + this.raise(FlowErrors.UnexpectedExplicitInexactInObject, { + at: inexactStartLoc + }); + } + } + this.expect(endDelim); + if (allowSpread) { + nodeStart.inexact = inexact; + } + const out = this.finishNode(nodeStart, "ObjectTypeAnnotation"); + this.state.inType = oldInType; + return out; + } + flowParseObjectTypeProperty(node, isStatic, protoStartLoc, variance, kind, allowSpread, allowInexact) { + if (this.eat(21)) { + const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9); + if (isInexactToken) { + if (!allowSpread) { + this.raise(FlowErrors.InexactInsideNonObject, { + at: this.state.lastTokStartLoc + }); + } else if (!allowInexact) { + this.raise(FlowErrors.InexactInsideExact, { + at: this.state.lastTokStartLoc + }); + } + if (variance) { + this.raise(FlowErrors.InexactVariance, { + at: variance + }); + } + return null; + } + if (!allowSpread) { + this.raise(FlowErrors.UnexpectedSpreadType, { + at: this.state.lastTokStartLoc + }); + } + if (protoStartLoc != null) { + this.unexpected(protoStartLoc); + } + if (variance) { + this.raise(FlowErrors.SpreadVariance, { + at: variance + }); + } + node.argument = this.flowParseType(); + return this.finishNode(node, "ObjectTypeSpreadProperty"); + } else { + node.key = this.flowParseObjectPropertyKey(); + node.static = isStatic; + node.proto = protoStartLoc != null; + node.kind = kind; + let optional = false; + if (this.match(47) || this.match(10)) { + node.method = true; + if (protoStartLoc != null) { + this.unexpected(protoStartLoc); + } + if (variance) { + this.unexpected(variance.loc.start); + } + node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.loc.start)); + if (kind === "get" || kind === "set") { + this.flowCheckGetterSetterParams(node); + } + if (!allowSpread && node.key.name === "constructor" && node.value.this) { + this.raise(FlowErrors.ThisParamBannedInConstructor, { + at: node.value.this + }); + } + } else { + if (kind !== "init") this.unexpected(); + node.method = false; + if (this.eat(17)) { + optional = true; + } + node.value = this.flowParseTypeInitialiser(); + node.variance = variance; + } + node.optional = optional; + return this.finishNode(node, "ObjectTypeProperty"); + } + } + flowCheckGetterSetterParams(property) { + const paramCount = property.kind === "get" ? 0 : 1; + const length = property.value.params.length + (property.value.rest ? 1 : 0); + if (property.value.this) { + this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, { + at: property.value.this + }); + } + if (length !== paramCount) { + this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, { + at: property + }); + } + if (property.kind === "set" && property.value.rest) { + this.raise(Errors.BadSetterRestParameter, { + at: property + }); + } + } + flowObjectTypeSemicolon() { + if (!this.eat(13) && !this.eat(12) && !this.match(8) && !this.match(9)) { + this.unexpected(); + } + } + flowParseQualifiedTypeIdentifier(startLoc, id) { + var _startLoc; + (_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc; + let node = id || this.flowParseRestrictedIdentifier(true); + while (this.eat(16)) { + const node2 = this.startNodeAt(startLoc); + node2.qualification = node; + node2.id = this.flowParseRestrictedIdentifier(true); + node = this.finishNode(node2, "QualifiedTypeIdentifier"); + } + return node; + } + flowParseGenericType(startLoc, id) { + const node = this.startNodeAt(startLoc); + node.typeParameters = null; + node.id = this.flowParseQualifiedTypeIdentifier(startLoc, id); + if (this.match(47)) { + node.typeParameters = this.flowParseTypeParameterInstantiation(); + } + return this.finishNode(node, "GenericTypeAnnotation"); + } + flowParseTypeofType() { + const node = this.startNode(); + this.expect(87); + node.argument = this.flowParsePrimaryType(); + return this.finishNode(node, "TypeofTypeAnnotation"); + } + flowParseTupleType() { + const node = this.startNode(); + node.types = []; + this.expect(0); + while (this.state.pos < this.length && !this.match(3)) { + node.types.push(this.flowParseType()); + if (this.match(3)) break; + this.expect(12); + } + this.expect(3); + return this.finishNode(node, "TupleTypeAnnotation"); + } + flowParseFunctionTypeParam(first) { + let name = null; + let optional = false; + let typeAnnotation = null; + const node = this.startNode(); + const lh = this.lookahead(); + const isThis = this.state.type === 78; + if (lh.type === 14 || lh.type === 17) { + if (isThis && !first) { + this.raise(FlowErrors.ThisParamMustBeFirst, { + at: node + }); + } + name = this.parseIdentifier(isThis); + if (this.eat(17)) { + optional = true; + if (isThis) { + this.raise(FlowErrors.ThisParamMayNotBeOptional, { + at: node + }); + } + } + typeAnnotation = this.flowParseTypeInitialiser(); + } else { + typeAnnotation = this.flowParseType(); + } + node.name = name; + node.optional = optional; + node.typeAnnotation = typeAnnotation; + return this.finishNode(node, "FunctionTypeParam"); + } + reinterpretTypeAsFunctionTypeParam(type) { + const node = this.startNodeAt(type.loc.start); + node.name = null; + node.optional = false; + node.typeAnnotation = type; + return this.finishNode(node, "FunctionTypeParam"); + } + flowParseFunctionTypeParams(params = []) { + let rest = null; + let _this = null; + if (this.match(78)) { + _this = this.flowParseFunctionTypeParam(true); + _this.name = null; + if (!this.match(11)) { + this.expect(12); + } + } + while (!this.match(11) && !this.match(21)) { + params.push(this.flowParseFunctionTypeParam(false)); + if (!this.match(11)) { + this.expect(12); + } + } + if (this.eat(21)) { + rest = this.flowParseFunctionTypeParam(false); + } + return { + params, + rest, + _this + }; + } + flowIdentToTypeAnnotation(startLoc, node, id) { + switch (id.name) { + case "any": + return this.finishNode(node, "AnyTypeAnnotation"); + case "bool": + case "boolean": + return this.finishNode(node, "BooleanTypeAnnotation"); + case "mixed": + return this.finishNode(node, "MixedTypeAnnotation"); + case "empty": + return this.finishNode(node, "EmptyTypeAnnotation"); + case "number": + return this.finishNode(node, "NumberTypeAnnotation"); + case "string": + return this.finishNode(node, "StringTypeAnnotation"); + case "symbol": + return this.finishNode(node, "SymbolTypeAnnotation"); + default: + this.checkNotUnderscore(id.name); + return this.flowParseGenericType(startLoc, id); + } + } + flowParsePrimaryType() { + const startLoc = this.state.startLoc; + const node = this.startNode(); + let tmp; + let type; + let isGroupedType = false; + const oldNoAnonFunctionType = this.state.noAnonFunctionType; + switch (this.state.type) { + case 5: + return this.flowParseObjectType({ + allowStatic: false, + allowExact: false, + allowSpread: true, + allowProto: false, + allowInexact: true + }); + case 6: + return this.flowParseObjectType({ + allowStatic: false, + allowExact: true, + allowSpread: true, + allowProto: false, + allowInexact: false + }); + case 0: + this.state.noAnonFunctionType = false; + type = this.flowParseTupleType(); + this.state.noAnonFunctionType = oldNoAnonFunctionType; + return type; + case 47: + node.typeParameters = this.flowParseTypeParameterDeclaration(); + this.expect(10); + tmp = this.flowParseFunctionTypeParams(); + node.params = tmp.params; + node.rest = tmp.rest; + node.this = tmp._this; + this.expect(11); + this.expect(19); + node.returnType = this.flowParseType(); + return this.finishNode(node, "FunctionTypeAnnotation"); + case 10: + this.next(); + if (!this.match(11) && !this.match(21)) { + if (tokenIsIdentifier(this.state.type) || this.match(78)) { + const token = this.lookahead().type; + isGroupedType = token !== 17 && token !== 14; + } else { + isGroupedType = true; + } + } + if (isGroupedType) { + this.state.noAnonFunctionType = false; + type = this.flowParseType(); + this.state.noAnonFunctionType = oldNoAnonFunctionType; + if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) { + this.expect(11); + return type; + } else { + this.eat(12); + } + } + if (type) { + tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]); + } else { + tmp = this.flowParseFunctionTypeParams(); + } + node.params = tmp.params; + node.rest = tmp.rest; + node.this = tmp._this; + this.expect(11); + this.expect(19); + node.returnType = this.flowParseType(); + node.typeParameters = null; + return this.finishNode(node, "FunctionTypeAnnotation"); + case 131: + return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation"); + case 85: + case 86: + node.value = this.match(85); + this.next(); + return this.finishNode(node, "BooleanLiteralTypeAnnotation"); + case 53: + if (this.state.value === "-") { + this.next(); + if (this.match(132)) { + return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node); + } + if (this.match(133)) { + return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node); + } + throw this.raise(FlowErrors.UnexpectedSubtractionOperand, { + at: this.state.startLoc + }); + } + this.unexpected(); + return; + case 132: + return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation"); + case 133: + return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation"); + case 88: + this.next(); + return this.finishNode(node, "VoidTypeAnnotation"); + case 84: + this.next(); + return this.finishNode(node, "NullLiteralTypeAnnotation"); + case 78: + this.next(); + return this.finishNode(node, "ThisTypeAnnotation"); + case 55: + this.next(); + return this.finishNode(node, "ExistsTypeAnnotation"); + case 87: + return this.flowParseTypeofType(); + default: + if (tokenIsKeyword(this.state.type)) { + const label = tokenLabelName(this.state.type); + this.next(); + return super.createIdentifier(node, label); + } else if (tokenIsIdentifier(this.state.type)) { + if (this.isContextual(127)) { + return this.flowParseInterfaceType(); + } + return this.flowIdentToTypeAnnotation(startLoc, node, this.parseIdentifier()); + } + } + this.unexpected(); + } + flowParsePostfixType() { + const startLoc = this.state.startLoc; + let type = this.flowParsePrimaryType(); + let seenOptionalIndexedAccess = false; + while ((this.match(0) || this.match(18)) && !this.canInsertSemicolon()) { + const node = this.startNodeAt(startLoc); + const optional = this.eat(18); + seenOptionalIndexedAccess = seenOptionalIndexedAccess || optional; + this.expect(0); + if (!optional && this.match(3)) { + node.elementType = type; + this.next(); + type = this.finishNode(node, "ArrayTypeAnnotation"); + } else { + node.objectType = type; + node.indexType = this.flowParseType(); + this.expect(3); + if (seenOptionalIndexedAccess) { + node.optional = optional; + type = this.finishNode(node, "OptionalIndexedAccessType"); + } else { + type = this.finishNode(node, "IndexedAccessType"); + } + } + } + return type; + } + flowParsePrefixType() { + const node = this.startNode(); + if (this.eat(17)) { + node.typeAnnotation = this.flowParsePrefixType(); + return this.finishNode(node, "NullableTypeAnnotation"); + } else { + return this.flowParsePostfixType(); + } + } + flowParseAnonFunctionWithoutParens() { + const param = this.flowParsePrefixType(); + if (!this.state.noAnonFunctionType && this.eat(19)) { + const node = this.startNodeAt(param.loc.start); + node.params = [this.reinterpretTypeAsFunctionTypeParam(param)]; + node.rest = null; + node.this = null; + node.returnType = this.flowParseType(); + node.typeParameters = null; + return this.finishNode(node, "FunctionTypeAnnotation"); + } + return param; + } + flowParseIntersectionType() { + const node = this.startNode(); + this.eat(45); + const type = this.flowParseAnonFunctionWithoutParens(); + node.types = [type]; + while (this.eat(45)) { + node.types.push(this.flowParseAnonFunctionWithoutParens()); + } + return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation"); + } + flowParseUnionType() { + const node = this.startNode(); + this.eat(43); + const type = this.flowParseIntersectionType(); + node.types = [type]; + while (this.eat(43)) { + node.types.push(this.flowParseIntersectionType()); + } + return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation"); + } + flowParseType() { + const oldInType = this.state.inType; + this.state.inType = true; + const type = this.flowParseUnionType(); + this.state.inType = oldInType; + return type; + } + flowParseTypeOrImplicitInstantiation() { + if (this.state.type === 130 && this.state.value === "_") { + const startLoc = this.state.startLoc; + const node = this.parseIdentifier(); + return this.flowParseGenericType(startLoc, node); + } else { + return this.flowParseType(); + } + } + flowParseTypeAnnotation() { + const node = this.startNode(); + node.typeAnnotation = this.flowParseTypeInitialiser(); + return this.finishNode(node, "TypeAnnotation"); + } + flowParseTypeAnnotatableIdentifier(allowPrimitiveOverride) { + const ident = allowPrimitiveOverride ? this.parseIdentifier() : this.flowParseRestrictedIdentifier(); + if (this.match(14)) { + ident.typeAnnotation = this.flowParseTypeAnnotation(); + this.resetEndLocation(ident); + } + return ident; + } + typeCastToParameter(node) { + node.expression.typeAnnotation = node.typeAnnotation; + this.resetEndLocation(node.expression, node.typeAnnotation.loc.end); + return node.expression; + } + flowParseVariance() { + let variance = null; + if (this.match(53)) { + variance = this.startNode(); + if (this.state.value === "+") { + variance.kind = "plus"; + } else { + variance.kind = "minus"; + } + this.next(); + return this.finishNode(variance, "Variance"); + } + return variance; + } + parseFunctionBody(node, allowExpressionBody, isMethod = false) { + if (allowExpressionBody) { + this.forwardNoArrowParamsConversionAt(node, () => super.parseFunctionBody(node, true, isMethod)); + return; + } + super.parseFunctionBody(node, false, isMethod); + } + parseFunctionBodyAndFinish(node, type, isMethod = false) { + if (this.match(14)) { + const typeNode = this.startNode(); + [typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser(); + node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null; + } + return super.parseFunctionBodyAndFinish(node, type, isMethod); + } + parseStatementLike(flags) { + if (this.state.strict && this.isContextual(127)) { + const lookahead = this.lookahead(); + if (tokenIsKeywordOrIdentifier(lookahead.type)) { + const node = this.startNode(); + this.next(); + return this.flowParseInterface(node); + } + } else if (this.shouldParseEnums() && this.isContextual(124)) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); + } + const stmt = super.parseStatementLike(flags); + if (this.flowPragma === undefined && !this.isValidDirective(stmt)) { + this.flowPragma = null; + } + return stmt; + } + parseExpressionStatement(node, expr, decorators) { + if (expr.type === "Identifier") { + if (expr.name === "declare") { + if (this.match(80) || tokenIsIdentifier(this.state.type) || this.match(68) || this.match(74) || this.match(82)) { + return this.flowParseDeclare(node); + } + } else if (tokenIsIdentifier(this.state.type)) { + if (expr.name === "interface") { + return this.flowParseInterface(node); + } else if (expr.name === "type") { + return this.flowParseTypeAlias(node); + } else if (expr.name === "opaque") { + return this.flowParseOpaqueType(node, false); + } + } + } + return super.parseExpressionStatement(node, expr, decorators); + } + shouldParseExportDeclaration() { + const { + type + } = this.state; + if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 124) { + return !this.state.containsEsc; + } + return super.shouldParseExportDeclaration(); + } + isExportDefaultSpecifier() { + const { + type + } = this.state; + if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 124) { + return this.state.containsEsc; + } + return super.isExportDefaultSpecifier(); + } + parseExportDefaultExpression() { + if (this.shouldParseEnums() && this.isContextual(124)) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); + } + return super.parseExportDefaultExpression(); + } + parseConditional(expr, startLoc, refExpressionErrors) { + if (!this.match(17)) return expr; + if (this.state.maybeInArrowParameters) { + const nextCh = this.lookaheadCharCode(); + if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) { + this.setOptionalParametersError(refExpressionErrors); + return expr; + } + } + this.expect(17); + const state = this.state.clone(); + const originalNoArrowAt = this.state.noArrowAt; + const node = this.startNodeAt(startLoc); + let { + consequent, + failed + } = this.tryParseConditionalConsequent(); + let [valid, invalid] = this.getArrowLikeExpressions(consequent); + if (failed || invalid.length > 0) { + const noArrowAt = [...originalNoArrowAt]; + if (invalid.length > 0) { + this.state = state; + this.state.noArrowAt = noArrowAt; + for (let i = 0; i < invalid.length; i++) { + noArrowAt.push(invalid[i].start); + } + ({ + consequent, + failed + } = this.tryParseConditionalConsequent()); + [valid, invalid] = this.getArrowLikeExpressions(consequent); + } + if (failed && valid.length > 1) { + this.raise(FlowErrors.AmbiguousConditionalArrow, { + at: state.startLoc + }); + } + if (failed && valid.length === 1) { + this.state = state; + noArrowAt.push(valid[0].start); + this.state.noArrowAt = noArrowAt; + ({ + consequent, + failed + } = this.tryParseConditionalConsequent()); + } + } + this.getArrowLikeExpressions(consequent, true); + this.state.noArrowAt = originalNoArrowAt; + this.expect(14); + node.test = expr; + node.consequent = consequent; + node.alternate = this.forwardNoArrowParamsConversionAt(node, () => this.parseMaybeAssign(undefined, undefined)); + return this.finishNode(node, "ConditionalExpression"); + } + tryParseConditionalConsequent() { + this.state.noArrowParamsConversionAt.push(this.state.start); + const consequent = this.parseMaybeAssignAllowIn(); + const failed = !this.match(14); + this.state.noArrowParamsConversionAt.pop(); + return { + consequent, + failed + }; + } + getArrowLikeExpressions(node, disallowInvalid) { + const stack = [node]; + const arrows = []; + while (stack.length !== 0) { + const node = stack.pop(); + if (node.type === "ArrowFunctionExpression") { + if (node.typeParameters || !node.returnType) { + this.finishArrowValidation(node); + } else { + arrows.push(node); + } + stack.push(node.body); + } else if (node.type === "ConditionalExpression") { + stack.push(node.consequent); + stack.push(node.alternate); + } + } + if (disallowInvalid) { + arrows.forEach(node => this.finishArrowValidation(node)); + return [arrows, []]; + } + return partition(arrows, node => node.params.every(param => this.isAssignable(param, true))); + } + finishArrowValidation(node) { + var _node$extra; + this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false); + this.scope.enter(2 | 4); + super.checkParams(node, false, true); + this.scope.exit(); + } + forwardNoArrowParamsConversionAt(node, parse) { + let result; + if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) { + this.state.noArrowParamsConversionAt.push(this.state.start); + result = parse(); + this.state.noArrowParamsConversionAt.pop(); + } else { + result = parse(); + } + return result; + } + parseParenItem(node, startLoc) { + node = super.parseParenItem(node, startLoc); + if (this.eat(17)) { + node.optional = true; + this.resetEndLocation(node); + } + if (this.match(14)) { + const typeCastNode = this.startNodeAt(startLoc); + typeCastNode.expression = node; + typeCastNode.typeAnnotation = this.flowParseTypeAnnotation(); + return this.finishNode(typeCastNode, "TypeCastExpression"); + } + return node; + } + assertModuleNodeAllowed(node) { + if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") { + return; + } + super.assertModuleNodeAllowed(node); + } + parseExportDeclaration(node) { + if (this.isContextual(128)) { + node.exportKind = "type"; + const declarationNode = this.startNode(); + this.next(); + if (this.match(5)) { + node.specifiers = this.parseExportSpecifiers(true); + super.parseExportFrom(node); + return null; + } else { + return this.flowParseTypeAlias(declarationNode); + } + } else if (this.isContextual(129)) { + node.exportKind = "type"; + const declarationNode = this.startNode(); + this.next(); + return this.flowParseOpaqueType(declarationNode, false); + } else if (this.isContextual(127)) { + node.exportKind = "type"; + const declarationNode = this.startNode(); + this.next(); + return this.flowParseInterface(declarationNode); + } else if (this.shouldParseEnums() && this.isContextual(124)) { + node.exportKind = "value"; + const declarationNode = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(declarationNode); + } else { + return super.parseExportDeclaration(node); + } + } + eatExportStar(node) { + if (super.eatExportStar(node)) return true; + if (this.isContextual(128) && this.lookahead().type === 55) { + node.exportKind = "type"; + this.next(); + this.next(); + return true; + } + return false; + } + maybeParseExportNamespaceSpecifier(node) { + const { + startLoc + } = this.state; + const hasNamespace = super.maybeParseExportNamespaceSpecifier(node); + if (hasNamespace && node.exportKind === "type") { + this.unexpected(startLoc); + } + return hasNamespace; + } + parseClassId(node, isStatement, optionalId) { + super.parseClassId(node, isStatement, optionalId); + if (this.match(47)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } + } + parseClassMember(classBody, member, state) { + const { + startLoc + } = this.state; + if (this.isContextual(123)) { + if (super.parseClassMemberFromModifier(classBody, member)) { + return; + } + member.declare = true; + } + super.parseClassMember(classBody, member, state); + if (member.declare) { + if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") { + this.raise(FlowErrors.DeclareClassElement, { + at: startLoc + }); + } else if (member.value) { + this.raise(FlowErrors.DeclareClassFieldInitializer, { + at: member.value + }); + } + } + } + isIterator(word) { + return word === "iterator" || word === "asyncIterator"; + } + readIterator() { + const word = super.readWord1(); + const fullWord = "@@" + word; + if (!this.isIterator(word) || !this.state.inType) { + this.raise(Errors.InvalidIdentifier, { + at: this.state.curPosition(), + identifierName: fullWord + }); + } + this.finishToken(130, fullWord); + } + getTokenFromCode(code) { + const next = this.input.charCodeAt(this.state.pos + 1); + if (code === 123 && next === 124) { + this.finishOp(6, 2); + } else if (this.state.inType && (code === 62 || code === 60)) { + this.finishOp(code === 62 ? 48 : 47, 1); + } else if (this.state.inType && code === 63) { + if (next === 46) { + this.finishOp(18, 2); + } else { + this.finishOp(17, 1); + } + } else if (isIteratorStart(code, next, this.input.charCodeAt(this.state.pos + 2))) { + this.state.pos += 2; + this.readIterator(); + } else { + super.getTokenFromCode(code); + } + } + isAssignable(node, isBinding) { + if (node.type === "TypeCastExpression") { + return this.isAssignable(node.expression, isBinding); + } else { + return super.isAssignable(node, isBinding); + } + } + toAssignable(node, isLHS = false) { + if (!isLHS && node.type === "AssignmentExpression" && node.left.type === "TypeCastExpression") { + node.left = this.typeCastToParameter(node.left); + } + super.toAssignable(node, isLHS); + } + toAssignableList(exprList, trailingCommaLoc, isLHS) { + for (let i = 0; i < exprList.length; i++) { + const expr = exprList[i]; + if ((expr == null ? void 0 : expr.type) === "TypeCastExpression") { + exprList[i] = this.typeCastToParameter(expr); + } + } + super.toAssignableList(exprList, trailingCommaLoc, isLHS); + } + toReferencedList(exprList, isParenthesizedExpr) { + for (let i = 0; i < exprList.length; i++) { + var _expr$extra; + const expr = exprList[i]; + if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) { + this.raise(FlowErrors.TypeCastInPattern, { + at: expr.typeAnnotation + }); + } + } + return exprList; + } + parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) { + const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors); + if (canBePattern && !this.state.maybeInArrowParameters) { + this.toReferencedList(node.elements); + } + return node; + } + isValidLVal(type, isParenthesized, binding) { + return type === "TypeCastExpression" || super.isValidLVal(type, isParenthesized, binding); + } + parseClassProperty(node) { + if (this.match(14)) { + node.typeAnnotation = this.flowParseTypeAnnotation(); + } + return super.parseClassProperty(node); + } + parseClassPrivateProperty(node) { + if (this.match(14)) { + node.typeAnnotation = this.flowParseTypeAnnotation(); + } + return super.parseClassPrivateProperty(node); + } + isClassMethod() { + return this.match(47) || super.isClassMethod(); + } + isClassProperty() { + return this.match(14) || super.isClassProperty(); + } + isNonstaticConstructor(method) { + return !this.match(14) && super.isNonstaticConstructor(method); + } + pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) { + if (method.variance) { + this.unexpected(method.variance.loc.start); + } + delete method.variance; + if (this.match(47)) { + method.typeParameters = this.flowParseTypeParameterDeclaration(); + } + super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper); + if (method.params && isConstructor) { + const params = method.params; + if (params.length > 0 && this.isThisParam(params[0])) { + this.raise(FlowErrors.ThisParamBannedInConstructor, { + at: method + }); + } + } else if (method.type === "MethodDefinition" && isConstructor && method.value.params) { + const params = method.value.params; + if (params.length > 0 && this.isThisParam(params[0])) { + this.raise(FlowErrors.ThisParamBannedInConstructor, { + at: method + }); + } + } + } + pushClassPrivateMethod(classBody, method, isGenerator, isAsync) { + if (method.variance) { + this.unexpected(method.variance.loc.start); + } + delete method.variance; + if (this.match(47)) { + method.typeParameters = this.flowParseTypeParameterDeclaration(); + } + super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync); + } + parseClassSuper(node) { + super.parseClassSuper(node); + if (node.superClass && this.match(47)) { + node.superTypeParameters = this.flowParseTypeParameterInstantiation(); + } + if (this.isContextual(111)) { + this.next(); + const implemented = node.implements = []; + do { + const node = this.startNode(); + node.id = this.flowParseRestrictedIdentifier(true); + if (this.match(47)) { + node.typeParameters = this.flowParseTypeParameterInstantiation(); + } else { + node.typeParameters = null; + } + implemented.push(this.finishNode(node, "ClassImplements")); + } while (this.eat(12)); + } + } + checkGetterSetterParams(method) { + super.checkGetterSetterParams(method); + const params = this.getObjectOrClassMethodParams(method); + if (params.length > 0) { + const param = params[0]; + if (this.isThisParam(param) && method.kind === "get") { + this.raise(FlowErrors.GetterMayNotHaveThisParam, { + at: param + }); + } else if (this.isThisParam(param)) { + this.raise(FlowErrors.SetterMayNotHaveThisParam, { + at: param + }); + } + } + } + parsePropertyNamePrefixOperator(node) { + node.variance = this.flowParseVariance(); + } + parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) { + if (prop.variance) { + this.unexpected(prop.variance.loc.start); + } + delete prop.variance; + let typeParameters; + if (this.match(47) && !isAccessor) { + typeParameters = this.flowParseTypeParameterDeclaration(); + if (!this.match(10)) this.unexpected(); + } + const result = super.parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors); + if (typeParameters) { + (result.value || result).typeParameters = typeParameters; + } + return result; + } + parseAssignableListItemTypes(param) { + if (this.eat(17)) { + if (param.type !== "Identifier") { + this.raise(FlowErrors.PatternIsOptional, { + at: param + }); + } + if (this.isThisParam(param)) { + this.raise(FlowErrors.ThisParamMayNotBeOptional, { + at: param + }); + } + param.optional = true; + } + if (this.match(14)) { + param.typeAnnotation = this.flowParseTypeAnnotation(); + } else if (this.isThisParam(param)) { + this.raise(FlowErrors.ThisParamAnnotationRequired, { + at: param + }); + } + if (this.match(29) && this.isThisParam(param)) { + this.raise(FlowErrors.ThisParamNoDefault, { + at: param + }); + } + this.resetEndLocation(param); + return param; + } + parseMaybeDefault(startLoc, left) { + const node = super.parseMaybeDefault(startLoc, left); + if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) { + this.raise(FlowErrors.TypeBeforeInitializer, { + at: node.typeAnnotation + }); + } + return node; + } + checkImportReflection(node) { + super.checkImportReflection(node); + if (node.module && node.importKind !== "value") { + this.raise(FlowErrors.ImportReflectionHasImportType, { + at: node.specifiers[0].loc.start + }); + } + } + parseImportSpecifierLocal(node, specifier, type) { + specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier(true, true) : this.parseIdentifier(); + node.specifiers.push(this.finishImportSpecifier(specifier, type)); + } + isPotentialImportPhase(isExport) { + if (super.isPotentialImportPhase(isExport)) return true; + if (this.isContextual(128)) { + if (!isExport) return true; + const ch = this.lookaheadCharCode(); + return ch === 123 || ch === 42; + } + return !isExport && this.isContextual(87); + } + applyImportPhase(node, isExport, phase, loc) { + super.applyImportPhase(node, isExport, phase, loc); + if (isExport) { + if (!phase && this.match(65)) { + return; + } + node.exportKind = phase === "type" ? phase : "value"; + } else { + if (phase === "type" && this.match(55)) this.unexpected(); + node.importKind = phase === "type" || phase === "typeof" ? phase : "value"; + } + } + parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) { + const firstIdent = specifier.imported; + let specifierTypeKind = null; + if (firstIdent.type === "Identifier") { + if (firstIdent.name === "type") { + specifierTypeKind = "type"; + } else if (firstIdent.name === "typeof") { + specifierTypeKind = "typeof"; + } + } + let isBinding = false; + if (this.isContextual(93) && !this.isLookaheadContextual("as")) { + const as_ident = this.parseIdentifier(true); + if (specifierTypeKind !== null && !tokenIsKeywordOrIdentifier(this.state.type)) { + specifier.imported = as_ident; + specifier.importKind = specifierTypeKind; + specifier.local = cloneIdentifier(as_ident); + } else { + specifier.imported = firstIdent; + specifier.importKind = null; + specifier.local = this.parseIdentifier(); + } + } else { + if (specifierTypeKind !== null && tokenIsKeywordOrIdentifier(this.state.type)) { + specifier.imported = this.parseIdentifier(true); + specifier.importKind = specifierTypeKind; + } else { + if (importedIsString) { + throw this.raise(Errors.ImportBindingIsString, { + at: specifier, + importName: firstIdent.value + }); + } + specifier.imported = firstIdent; + specifier.importKind = null; + } + if (this.eatContextual(93)) { + specifier.local = this.parseIdentifier(); + } else { + isBinding = true; + specifier.local = cloneIdentifier(specifier.imported); + } + } + const specifierIsTypeImport = hasTypeImportKind(specifier); + if (isInTypeOnlyImport && specifierIsTypeImport) { + this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, { + at: specifier + }); + } + if (isInTypeOnlyImport || specifierIsTypeImport) { + this.checkReservedType(specifier.local.name, specifier.local.loc.start, true); + } + if (isBinding && !isInTypeOnlyImport && !specifierIsTypeImport) { + this.checkReservedWord(specifier.local.name, specifier.loc.start, true, true); + } + return this.finishImportSpecifier(specifier, "ImportSpecifier"); + } + parseBindingAtom() { + switch (this.state.type) { + case 78: + return this.parseIdentifier(true); + default: + return super.parseBindingAtom(); + } + } + parseFunctionParams(node, isConstructor) { + const kind = node.kind; + if (kind !== "get" && kind !== "set" && this.match(47)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } + super.parseFunctionParams(node, isConstructor); + } + parseVarId(decl, kind) { + super.parseVarId(decl, kind); + if (this.match(14)) { + decl.id.typeAnnotation = this.flowParseTypeAnnotation(); + this.resetEndLocation(decl.id); + } + } + parseAsyncArrowFromCallExpression(node, call) { + if (this.match(14)) { + const oldNoAnonFunctionType = this.state.noAnonFunctionType; + this.state.noAnonFunctionType = true; + node.returnType = this.flowParseTypeAnnotation(); + this.state.noAnonFunctionType = oldNoAnonFunctionType; + } + return super.parseAsyncArrowFromCallExpression(node, call); + } + shouldParseAsyncArrow() { + return this.match(14) || super.shouldParseAsyncArrow(); + } + parseMaybeAssign(refExpressionErrors, afterLeftParse) { + var _jsx; + let state = null; + let jsx; + if (this.hasPlugin("jsx") && (this.match(140) || this.match(47))) { + state = this.state.clone(); + jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state); + if (!jsx.error) return jsx.node; + const { + context + } = this.state; + const currentContext = context[context.length - 1]; + if (currentContext === types.j_oTag || currentContext === types.j_expr) { + context.pop(); + } + } + if ((_jsx = jsx) != null && _jsx.error || this.match(47)) { + var _jsx2, _jsx3; + state = state || this.state.clone(); + let typeParameters; + const arrow = this.tryParse(abort => { + var _arrowExpression$extr; + typeParameters = this.flowParseTypeParameterDeclaration(); + const arrowExpression = this.forwardNoArrowParamsConversionAt(typeParameters, () => { + const result = super.parseMaybeAssign(refExpressionErrors, afterLeftParse); + this.resetStartLocationFromNode(result, typeParameters); + return result; + }); + if ((_arrowExpression$extr = arrowExpression.extra) != null && _arrowExpression$extr.parenthesized) abort(); + const expr = this.maybeUnwrapTypeCastExpression(arrowExpression); + if (expr.type !== "ArrowFunctionExpression") abort(); + expr.typeParameters = typeParameters; + this.resetStartLocationFromNode(expr, typeParameters); + return arrowExpression; + }, state); + let arrowExpression = null; + if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") { + if (!arrow.error && !arrow.aborted) { + if (arrow.node.async) { + this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, { + at: typeParameters + }); + } + return arrow.node; + } + arrowExpression = arrow.node; + } + if ((_jsx2 = jsx) != null && _jsx2.node) { + this.state = jsx.failState; + return jsx.node; + } + if (arrowExpression) { + this.state = arrow.failState; + return arrowExpression; + } + if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error; + if (arrow.thrown) throw arrow.error; + throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, { + at: typeParameters + }); + } + return super.parseMaybeAssign(refExpressionErrors, afterLeftParse); + } + parseArrow(node) { + if (this.match(14)) { + const result = this.tryParse(() => { + const oldNoAnonFunctionType = this.state.noAnonFunctionType; + this.state.noAnonFunctionType = true; + const typeNode = this.startNode(); + [typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser(); + this.state.noAnonFunctionType = oldNoAnonFunctionType; + if (this.canInsertSemicolon()) this.unexpected(); + if (!this.match(19)) this.unexpected(); + return typeNode; + }); + if (result.thrown) return null; + if (result.error) this.state = result.failState; + node.returnType = result.node.typeAnnotation ? this.finishNode(result.node, "TypeAnnotation") : null; + } + return super.parseArrow(node); + } + shouldParseArrow(params) { + return this.match(14) || super.shouldParseArrow(params); + } + setArrowFunctionParameters(node, params) { + if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) { + node.params = params; + } else { + super.setArrowFunctionParameters(node, params); + } + } + checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) { + if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) { + return; + } + for (let i = 0; i < node.params.length; i++) { + if (this.isThisParam(node.params[i]) && i > 0) { + this.raise(FlowErrors.ThisParamMustBeFirst, { + at: node.params[i] + }); + } + } + super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged); + } + parseParenAndDistinguishExpression(canBeArrow) { + return super.parseParenAndDistinguishExpression(canBeArrow && this.state.noArrowAt.indexOf(this.state.start) === -1); + } + parseSubscripts(base, startLoc, noCalls) { + if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.indexOf(startLoc.index) !== -1) { + this.next(); + const node = this.startNodeAt(startLoc); + node.callee = base; + node.arguments = super.parseCallExpressionArguments(11, false); + base = this.finishNode(node, "CallExpression"); + } else if (base.type === "Identifier" && base.name === "async" && this.match(47)) { + const state = this.state.clone(); + const arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startLoc) || abort(), state); + if (!arrow.error && !arrow.aborted) return arrow.node; + const result = this.tryParse(() => super.parseSubscripts(base, startLoc, noCalls), state); + if (result.node && !result.error) return result.node; + if (arrow.node) { + this.state = arrow.failState; + return arrow.node; + } + if (result.node) { + this.state = result.failState; + return result.node; + } + throw arrow.error || result.error; + } + return super.parseSubscripts(base, startLoc, noCalls); + } + parseSubscript(base, startLoc, noCalls, subscriptState) { + if (this.match(18) && this.isLookaheadToken_lt()) { + subscriptState.optionalChainMember = true; + if (noCalls) { + subscriptState.stop = true; + return base; + } + this.next(); + const node = this.startNodeAt(startLoc); + node.callee = base; + node.typeArguments = this.flowParseTypeParameterInstantiation(); + this.expect(10); + node.arguments = this.parseCallExpressionArguments(11, false); + node.optional = true; + return this.finishCallExpression(node, true); + } else if (!noCalls && this.shouldParseTypes() && this.match(47)) { + const node = this.startNodeAt(startLoc); + node.callee = base; + const result = this.tryParse(() => { + node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew(); + this.expect(10); + node.arguments = super.parseCallExpressionArguments(11, false); + if (subscriptState.optionalChainMember) { + node.optional = false; + } + return this.finishCallExpression(node, subscriptState.optionalChainMember); + }); + if (result.node) { + if (result.error) this.state = result.failState; + return result.node; + } + } + return super.parseSubscript(base, startLoc, noCalls, subscriptState); + } + parseNewCallee(node) { + super.parseNewCallee(node); + let targs = null; + if (this.shouldParseTypes() && this.match(47)) { + targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node; + } + node.typeArguments = targs; + } + parseAsyncArrowWithTypeParameters(startLoc) { + const node = this.startNodeAt(startLoc); + this.parseFunctionParams(node, false); + if (!this.parseArrow(node)) return; + return super.parseArrowExpression(node, undefined, true); + } + readToken_mult_modulo(code) { + const next = this.input.charCodeAt(this.state.pos + 1); + if (code === 42 && next === 47 && this.state.hasFlowComment) { + this.state.hasFlowComment = false; + this.state.pos += 2; + this.nextToken(); + return; + } + super.readToken_mult_modulo(code); + } + readToken_pipe_amp(code) { + const next = this.input.charCodeAt(this.state.pos + 1); + if (code === 124 && next === 125) { + this.finishOp(9, 2); + return; + } + super.readToken_pipe_amp(code); + } + parseTopLevel(file, program) { + const fileNode = super.parseTopLevel(file, program); + if (this.state.hasFlowComment) { + this.raise(FlowErrors.UnterminatedFlowComment, { + at: this.state.curPosition() + }); + } + return fileNode; + } + skipBlockComment() { + if (this.hasPlugin("flowComments") && this.skipFlowComment()) { + if (this.state.hasFlowComment) { + throw this.raise(FlowErrors.NestedFlowComment, { + at: this.state.startLoc + }); + } + this.hasFlowCommentCompletion(); + const commentSkip = this.skipFlowComment(); + if (commentSkip) { + this.state.pos += commentSkip; + this.state.hasFlowComment = true; + } + return; + } + return super.skipBlockComment(this.state.hasFlowComment ? "*-/" : "*/"); + } + skipFlowComment() { + const { + pos + } = this.state; + let shiftToFirstNonWhiteSpace = 2; + while ([32, 9].includes(this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace))) { + shiftToFirstNonWhiteSpace++; + } + const ch2 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos); + const ch3 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos + 1); + if (ch2 === 58 && ch3 === 58) { + return shiftToFirstNonWhiteSpace + 2; + } + if (this.input.slice(shiftToFirstNonWhiteSpace + pos, shiftToFirstNonWhiteSpace + pos + 12) === "flow-include") { + return shiftToFirstNonWhiteSpace + 12; + } + if (ch2 === 58 && ch3 !== 58) { + return shiftToFirstNonWhiteSpace; + } + return false; + } + hasFlowCommentCompletion() { + const end = this.input.indexOf("*/", this.state.pos); + if (end === -1) { + throw this.raise(Errors.UnterminatedComment, { + at: this.state.curPosition() + }); + } + } + flowEnumErrorBooleanMemberNotInitialized(loc, { + enumName, + memberName + }) { + this.raise(FlowErrors.EnumBooleanMemberNotInitialized, { + at: loc, + memberName, + enumName + }); + } + flowEnumErrorInvalidMemberInitializer(loc, enumContext) { + return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, Object.assign({ + at: loc + }, enumContext)); + } + flowEnumErrorNumberMemberNotInitialized(loc, { + enumName, + memberName + }) { + this.raise(FlowErrors.EnumNumberMemberNotInitialized, { + at: loc, + enumName, + memberName + }); + } + flowEnumErrorStringMemberInconsistentlyInitialized(node, { + enumName + }) { + this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, { + at: node, + enumName + }); + } + flowEnumMemberInit() { + const startLoc = this.state.startLoc; + const endOfInit = () => this.match(12) || this.match(8); + switch (this.state.type) { + case 132: + { + const literal = this.parseNumericLiteral(this.state.value); + if (endOfInit()) { + return { + type: "number", + loc: literal.loc.start, + value: literal + }; + } + return { + type: "invalid", + loc: startLoc + }; + } + case 131: + { + const literal = this.parseStringLiteral(this.state.value); + if (endOfInit()) { + return { + type: "string", + loc: literal.loc.start, + value: literal + }; + } + return { + type: "invalid", + loc: startLoc + }; + } + case 85: + case 86: + { + const literal = this.parseBooleanLiteral(this.match(85)); + if (endOfInit()) { + return { + type: "boolean", + loc: literal.loc.start, + value: literal + }; + } + return { + type: "invalid", + loc: startLoc + }; + } + default: + return { + type: "invalid", + loc: startLoc + }; + } + } + flowEnumMemberRaw() { + const loc = this.state.startLoc; + const id = this.parseIdentifier(true); + const init = this.eat(29) ? this.flowEnumMemberInit() : { + type: "none", + loc + }; + return { + id, + init + }; + } + flowEnumCheckExplicitTypeMismatch(loc, context, expectedType) { + const { + explicitType + } = context; + if (explicitType === null) { + return; + } + if (explicitType !== expectedType) { + this.flowEnumErrorInvalidMemberInitializer(loc, context); + } + } + flowEnumMembers({ + enumName, + explicitType + }) { + const seenNames = new Set(); + const members = { + booleanMembers: [], + numberMembers: [], + stringMembers: [], + defaultedMembers: [] + }; + let hasUnknownMembers = false; + while (!this.match(8)) { + if (this.eat(21)) { + hasUnknownMembers = true; + break; + } + const memberNode = this.startNode(); + const { + id, + init + } = this.flowEnumMemberRaw(); + const memberName = id.name; + if (memberName === "") { + continue; + } + if (/^[a-z]/.test(memberName)) { + this.raise(FlowErrors.EnumInvalidMemberName, { + at: id, + memberName, + suggestion: memberName[0].toUpperCase() + memberName.slice(1), + enumName + }); + } + if (seenNames.has(memberName)) { + this.raise(FlowErrors.EnumDuplicateMemberName, { + at: id, + memberName, + enumName + }); + } + seenNames.add(memberName); + const context = { + enumName, + explicitType, + memberName + }; + memberNode.id = id; + switch (init.type) { + case "boolean": + { + this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "boolean"); + memberNode.init = init.value; + members.booleanMembers.push(this.finishNode(memberNode, "EnumBooleanMember")); + break; + } + case "number": + { + this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "number"); + memberNode.init = init.value; + members.numberMembers.push(this.finishNode(memberNode, "EnumNumberMember")); + break; + } + case "string": + { + this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "string"); + memberNode.init = init.value; + members.stringMembers.push(this.finishNode(memberNode, "EnumStringMember")); + break; + } + case "invalid": + { + throw this.flowEnumErrorInvalidMemberInitializer(init.loc, context); + } + case "none": + { + switch (explicitType) { + case "boolean": + this.flowEnumErrorBooleanMemberNotInitialized(init.loc, context); + break; + case "number": + this.flowEnumErrorNumberMemberNotInitialized(init.loc, context); + break; + default: + members.defaultedMembers.push(this.finishNode(memberNode, "EnumDefaultedMember")); + } + } + } + if (!this.match(8)) { + this.expect(12); + } + } + return { + members, + hasUnknownMembers + }; + } + flowEnumStringMembers(initializedMembers, defaultedMembers, { + enumName + }) { + if (initializedMembers.length === 0) { + return defaultedMembers; + } else if (defaultedMembers.length === 0) { + return initializedMembers; + } else if (defaultedMembers.length > initializedMembers.length) { + for (const member of initializedMembers) { + this.flowEnumErrorStringMemberInconsistentlyInitialized(member, { + enumName + }); + } + return defaultedMembers; + } else { + for (const member of defaultedMembers) { + this.flowEnumErrorStringMemberInconsistentlyInitialized(member, { + enumName + }); + } + return initializedMembers; + } + } + flowEnumParseExplicitType({ + enumName + }) { + if (!this.eatContextual(101)) return null; + if (!tokenIsIdentifier(this.state.type)) { + throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, { + at: this.state.startLoc, + enumName + }); + } + const { + value + } = this.state; + this.next(); + if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") { + this.raise(FlowErrors.EnumInvalidExplicitType, { + at: this.state.startLoc, + enumName, + invalidEnumType: value + }); + } + return value; + } + flowEnumBody(node, id) { + const enumName = id.name; + const nameLoc = id.loc.start; + const explicitType = this.flowEnumParseExplicitType({ + enumName + }); + this.expect(5); + const { + members, + hasUnknownMembers + } = this.flowEnumMembers({ + enumName, + explicitType + }); + node.hasUnknownMembers = hasUnknownMembers; + switch (explicitType) { + case "boolean": + node.explicitType = true; + node.members = members.booleanMembers; + this.expect(8); + return this.finishNode(node, "EnumBooleanBody"); + case "number": + node.explicitType = true; + node.members = members.numberMembers; + this.expect(8); + return this.finishNode(node, "EnumNumberBody"); + case "string": + node.explicitType = true; + node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, { + enumName + }); + this.expect(8); + return this.finishNode(node, "EnumStringBody"); + case "symbol": + node.members = members.defaultedMembers; + this.expect(8); + return this.finishNode(node, "EnumSymbolBody"); + default: + { + const empty = () => { + node.members = []; + this.expect(8); + return this.finishNode(node, "EnumStringBody"); + }; + node.explicitType = false; + const boolsLen = members.booleanMembers.length; + const numsLen = members.numberMembers.length; + const strsLen = members.stringMembers.length; + const defaultedLen = members.defaultedMembers.length; + if (!boolsLen && !numsLen && !strsLen && !defaultedLen) { + return empty(); + } else if (!boolsLen && !numsLen) { + node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, { + enumName + }); + this.expect(8); + return this.finishNode(node, "EnumStringBody"); + } else if (!numsLen && !strsLen && boolsLen >= defaultedLen) { + for (const member of members.defaultedMembers) { + this.flowEnumErrorBooleanMemberNotInitialized(member.loc.start, { + enumName, + memberName: member.id.name + }); + } + node.members = members.booleanMembers; + this.expect(8); + return this.finishNode(node, "EnumBooleanBody"); + } else if (!boolsLen && !strsLen && numsLen >= defaultedLen) { + for (const member of members.defaultedMembers) { + this.flowEnumErrorNumberMemberNotInitialized(member.loc.start, { + enumName, + memberName: member.id.name + }); + } + node.members = members.numberMembers; + this.expect(8); + return this.finishNode(node, "EnumNumberBody"); + } else { + this.raise(FlowErrors.EnumInconsistentMemberValues, { + at: nameLoc, + enumName + }); + return empty(); + } + } + } + } + flowParseEnumDeclaration(node) { + const id = this.parseIdentifier(); + node.id = id; + node.body = this.flowEnumBody(this.startNode(), id); + return this.finishNode(node, "EnumDeclaration"); + } + isLookaheadToken_lt() { + const next = this.nextTokenStart(); + if (this.input.charCodeAt(next) === 60) { + const afterNext = this.input.charCodeAt(next + 1); + return afterNext !== 60 && afterNext !== 61; + } + return false; + } + maybeUnwrapTypeCastExpression(node) { + return node.type === "TypeCastExpression" ? node.expression : node; + } +}; +const entities = { + __proto__: null, + quot: "\u0022", + amp: "&", + apos: "\u0027", + lt: "<", + gt: ">", + nbsp: "\u00A0", + iexcl: "\u00A1", + cent: "\u00A2", + pound: "\u00A3", + curren: "\u00A4", + yen: "\u00A5", + brvbar: "\u00A6", + sect: "\u00A7", + uml: "\u00A8", + copy: "\u00A9", + ordf: "\u00AA", + laquo: "\u00AB", + not: "\u00AC", + shy: "\u00AD", + reg: "\u00AE", + macr: "\u00AF", + deg: "\u00B0", + plusmn: "\u00B1", + sup2: "\u00B2", + sup3: "\u00B3", + acute: "\u00B4", + micro: "\u00B5", + para: "\u00B6", + middot: "\u00B7", + cedil: "\u00B8", + sup1: "\u00B9", + ordm: "\u00BA", + raquo: "\u00BB", + frac14: "\u00BC", + frac12: "\u00BD", + frac34: "\u00BE", + iquest: "\u00BF", + Agrave: "\u00C0", + Aacute: "\u00C1", + Acirc: "\u00C2", + Atilde: "\u00C3", + Auml: "\u00C4", + Aring: "\u00C5", + AElig: "\u00C6", + Ccedil: "\u00C7", + Egrave: "\u00C8", + Eacute: "\u00C9", + Ecirc: "\u00CA", + Euml: "\u00CB", + Igrave: "\u00CC", + Iacute: "\u00CD", + Icirc: "\u00CE", + Iuml: "\u00CF", + ETH: "\u00D0", + Ntilde: "\u00D1", + Ograve: "\u00D2", + Oacute: "\u00D3", + Ocirc: "\u00D4", + Otilde: "\u00D5", + Ouml: "\u00D6", + times: "\u00D7", + Oslash: "\u00D8", + Ugrave: "\u00D9", + Uacute: "\u00DA", + Ucirc: "\u00DB", + Uuml: "\u00DC", + Yacute: "\u00DD", + THORN: "\u00DE", + szlig: "\u00DF", + agrave: "\u00E0", + aacute: "\u00E1", + acirc: "\u00E2", + atilde: "\u00E3", + auml: "\u00E4", + aring: "\u00E5", + aelig: "\u00E6", + ccedil: "\u00E7", + egrave: "\u00E8", + eacute: "\u00E9", + ecirc: "\u00EA", + euml: "\u00EB", + igrave: "\u00EC", + iacute: "\u00ED", + icirc: "\u00EE", + iuml: "\u00EF", + eth: "\u00F0", + ntilde: "\u00F1", + ograve: "\u00F2", + oacute: "\u00F3", + ocirc: "\u00F4", + otilde: "\u00F5", + ouml: "\u00F6", + divide: "\u00F7", + oslash: "\u00F8", + ugrave: "\u00F9", + uacute: "\u00FA", + ucirc: "\u00FB", + uuml: "\u00FC", + yacute: "\u00FD", + thorn: "\u00FE", + yuml: "\u00FF", + OElig: "\u0152", + oelig: "\u0153", + Scaron: "\u0160", + scaron: "\u0161", + Yuml: "\u0178", + fnof: "\u0192", + circ: "\u02C6", + tilde: "\u02DC", + Alpha: "\u0391", + Beta: "\u0392", + Gamma: "\u0393", + Delta: "\u0394", + Epsilon: "\u0395", + Zeta: "\u0396", + Eta: "\u0397", + Theta: "\u0398", + Iota: "\u0399", + Kappa: "\u039A", + Lambda: "\u039B", + Mu: "\u039C", + Nu: "\u039D", + Xi: "\u039E", + Omicron: "\u039F", + Pi: "\u03A0", + Rho: "\u03A1", + Sigma: "\u03A3", + Tau: "\u03A4", + Upsilon: "\u03A5", + Phi: "\u03A6", + Chi: "\u03A7", + Psi: "\u03A8", + Omega: "\u03A9", + alpha: "\u03B1", + beta: "\u03B2", + gamma: "\u03B3", + delta: "\u03B4", + epsilon: "\u03B5", + zeta: "\u03B6", + eta: "\u03B7", + theta: "\u03B8", + iota: "\u03B9", + kappa: "\u03BA", + lambda: "\u03BB", + mu: "\u03BC", + nu: "\u03BD", + xi: "\u03BE", + omicron: "\u03BF", + pi: "\u03C0", + rho: "\u03C1", + sigmaf: "\u03C2", + sigma: "\u03C3", + tau: "\u03C4", + upsilon: "\u03C5", + phi: "\u03C6", + chi: "\u03C7", + psi: "\u03C8", + omega: "\u03C9", + thetasym: "\u03D1", + upsih: "\u03D2", + piv: "\u03D6", + ensp: "\u2002", + emsp: "\u2003", + thinsp: "\u2009", + zwnj: "\u200C", + zwj: "\u200D", + lrm: "\u200E", + rlm: "\u200F", + ndash: "\u2013", + mdash: "\u2014", + lsquo: "\u2018", + rsquo: "\u2019", + sbquo: "\u201A", + ldquo: "\u201C", + rdquo: "\u201D", + bdquo: "\u201E", + dagger: "\u2020", + Dagger: "\u2021", + bull: "\u2022", + hellip: "\u2026", + permil: "\u2030", + prime: "\u2032", + Prime: "\u2033", + lsaquo: "\u2039", + rsaquo: "\u203A", + oline: "\u203E", + frasl: "\u2044", + euro: "\u20AC", + image: "\u2111", + weierp: "\u2118", + real: "\u211C", + trade: "\u2122", + alefsym: "\u2135", + larr: "\u2190", + uarr: "\u2191", + rarr: "\u2192", + darr: "\u2193", + harr: "\u2194", + crarr: "\u21B5", + lArr: "\u21D0", + uArr: "\u21D1", + rArr: "\u21D2", + dArr: "\u21D3", + hArr: "\u21D4", + forall: "\u2200", + part: "\u2202", + exist: "\u2203", + empty: "\u2205", + nabla: "\u2207", + isin: "\u2208", + notin: "\u2209", + ni: "\u220B", + prod: "\u220F", + sum: "\u2211", + minus: "\u2212", + lowast: "\u2217", + radic: "\u221A", + prop: "\u221D", + infin: "\u221E", + ang: "\u2220", + and: "\u2227", + or: "\u2228", + cap: "\u2229", + cup: "\u222A", + int: "\u222B", + there4: "\u2234", + sim: "\u223C", + cong: "\u2245", + asymp: "\u2248", + ne: "\u2260", + equiv: "\u2261", + le: "\u2264", + ge: "\u2265", + sub: "\u2282", + sup: "\u2283", + nsub: "\u2284", + sube: "\u2286", + supe: "\u2287", + oplus: "\u2295", + otimes: "\u2297", + perp: "\u22A5", + sdot: "\u22C5", + lceil: "\u2308", + rceil: "\u2309", + lfloor: "\u230A", + rfloor: "\u230B", + lang: "\u2329", + rang: "\u232A", + loz: "\u25CA", + spades: "\u2660", + clubs: "\u2663", + hearts: "\u2665", + diams: "\u2666" +}; +const JsxErrors = ParseErrorEnum`jsx`({ + AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.", + MissingClosingTagElement: ({ + openingTagName + }) => `Expected corresponding JSX closing tag for <${openingTagName}>.`, + MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.", + UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?", + UnexpectedToken: ({ + unexpected, + HTMLEntity + }) => `Unexpected token \`${unexpected}\`. Did you mean \`${HTMLEntity}\` or \`{'${unexpected}'}\`?`, + UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.", + UnterminatedJsxContent: "Unterminated JSX contents.", + UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...?" +}); +function isFragment(object) { + return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false; +} +function getQualifiedJSXName(object) { + if (object.type === "JSXIdentifier") { + return object.name; + } + if (object.type === "JSXNamespacedName") { + return object.namespace.name + ":" + object.name.name; + } + if (object.type === "JSXMemberExpression") { + return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property); + } + throw new Error("Node had unexpected type: " + object.type); +} +var jsx = superClass => class JSXParserMixin extends superClass { + jsxReadToken() { + let out = ""; + let chunkStart = this.state.pos; + for (;;) { + if (this.state.pos >= this.length) { + throw this.raise(JsxErrors.UnterminatedJsxContent, { + at: this.state.startLoc + }); + } + const ch = this.input.charCodeAt(this.state.pos); + switch (ch) { + case 60: + case 123: + if (this.state.pos === this.state.start) { + if (ch === 60 && this.state.canStartJSXElement) { + ++this.state.pos; + this.finishToken(140); + } else { + super.getTokenFromCode(ch); + } + return; + } + out += this.input.slice(chunkStart, this.state.pos); + this.finishToken(139, out); + return; + case 38: + out += this.input.slice(chunkStart, this.state.pos); + out += this.jsxReadEntity(); + chunkStart = this.state.pos; + break; + case 62: + case 125: + default: + if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.state.pos); + out += this.jsxReadNewLine(true); + chunkStart = this.state.pos; + } else { + ++this.state.pos; + } + } + } + } + jsxReadNewLine(normalizeCRLF) { + const ch = this.input.charCodeAt(this.state.pos); + let out; + ++this.state.pos; + if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) { + ++this.state.pos; + out = normalizeCRLF ? "\n" : "\r\n"; + } else { + out = String.fromCharCode(ch); + } + ++this.state.curLine; + this.state.lineStart = this.state.pos; + return out; + } + jsxReadString(quote) { + let out = ""; + let chunkStart = ++this.state.pos; + for (;;) { + if (this.state.pos >= this.length) { + throw this.raise(Errors.UnterminatedString, { + at: this.state.startLoc + }); + } + const ch = this.input.charCodeAt(this.state.pos); + if (ch === quote) break; + if (ch === 38) { + out += this.input.slice(chunkStart, this.state.pos); + out += this.jsxReadEntity(); + chunkStart = this.state.pos; + } else if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.state.pos); + out += this.jsxReadNewLine(false); + chunkStart = this.state.pos; + } else { + ++this.state.pos; + } + } + out += this.input.slice(chunkStart, this.state.pos++); + this.finishToken(131, out); + } + jsxReadEntity() { + const startPos = ++this.state.pos; + if (this.codePointAtPos(this.state.pos) === 35) { + ++this.state.pos; + let radix = 10; + if (this.codePointAtPos(this.state.pos) === 120) { + radix = 16; + ++this.state.pos; + } + const codePoint = this.readInt(radix, undefined, false, "bail"); + if (codePoint !== null && this.codePointAtPos(this.state.pos) === 59) { + ++this.state.pos; + return String.fromCodePoint(codePoint); + } + } else { + let count = 0; + let semi = false; + while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) == 59)) { + ++this.state.pos; + } + if (semi) { + const desc = this.input.slice(startPos, this.state.pos); + const entity = entities[desc]; + ++this.state.pos; + if (entity) { + return entity; + } + } + } + this.state.pos = startPos; + return "&"; + } + jsxReadWord() { + let ch; + const start = this.state.pos; + do { + ch = this.input.charCodeAt(++this.state.pos); + } while (isIdentifierChar(ch) || ch === 45); + this.finishToken(138, this.input.slice(start, this.state.pos)); + } + jsxParseIdentifier() { + const node = this.startNode(); + if (this.match(138)) { + node.name = this.state.value; + } else if (tokenIsKeyword(this.state.type)) { + node.name = tokenLabelName(this.state.type); + } else { + this.unexpected(); + } + this.next(); + return this.finishNode(node, "JSXIdentifier"); + } + jsxParseNamespacedName() { + const startLoc = this.state.startLoc; + const name = this.jsxParseIdentifier(); + if (!this.eat(14)) return name; + const node = this.startNodeAt(startLoc); + node.namespace = name; + node.name = this.jsxParseIdentifier(); + return this.finishNode(node, "JSXNamespacedName"); + } + jsxParseElementName() { + const startLoc = this.state.startLoc; + let node = this.jsxParseNamespacedName(); + if (node.type === "JSXNamespacedName") { + return node; + } + while (this.eat(16)) { + const newNode = this.startNodeAt(startLoc); + newNode.object = node; + newNode.property = this.jsxParseIdentifier(); + node = this.finishNode(newNode, "JSXMemberExpression"); + } + return node; + } + jsxParseAttributeValue() { + let node; + switch (this.state.type) { + case 5: + node = this.startNode(); + this.setContext(types.brace); + this.next(); + node = this.jsxParseExpressionContainer(node, types.j_oTag); + if (node.expression.type === "JSXEmptyExpression") { + this.raise(JsxErrors.AttributeIsEmpty, { + at: node + }); + } + return node; + case 140: + case 131: + return this.parseExprAtom(); + default: + throw this.raise(JsxErrors.UnsupportedJsxValue, { + at: this.state.startLoc + }); + } + } + jsxParseEmptyExpression() { + const node = this.startNodeAt(this.state.lastTokEndLoc); + return this.finishNodeAt(node, "JSXEmptyExpression", this.state.startLoc); + } + jsxParseSpreadChild(node) { + this.next(); + node.expression = this.parseExpression(); + this.setContext(types.j_expr); + this.state.canStartJSXElement = true; + this.expect(8); + return this.finishNode(node, "JSXSpreadChild"); + } + jsxParseExpressionContainer(node, previousContext) { + if (this.match(8)) { + node.expression = this.jsxParseEmptyExpression(); + } else { + const expression = this.parseExpression(); + node.expression = expression; + } + this.setContext(previousContext); + this.state.canStartJSXElement = true; + this.expect(8); + return this.finishNode(node, "JSXExpressionContainer"); + } + jsxParseAttribute() { + const node = this.startNode(); + if (this.match(5)) { + this.setContext(types.brace); + this.next(); + this.expect(21); + node.argument = this.parseMaybeAssignAllowIn(); + this.setContext(types.j_oTag); + this.state.canStartJSXElement = true; + this.expect(8); + return this.finishNode(node, "JSXSpreadAttribute"); + } + node.name = this.jsxParseNamespacedName(); + node.value = this.eat(29) ? this.jsxParseAttributeValue() : null; + return this.finishNode(node, "JSXAttribute"); + } + jsxParseOpeningElementAt(startLoc) { + const node = this.startNodeAt(startLoc); + if (this.eat(141)) { + return this.finishNode(node, "JSXOpeningFragment"); + } + node.name = this.jsxParseElementName(); + return this.jsxParseOpeningElementAfterName(node); + } + jsxParseOpeningElementAfterName(node) { + const attributes = []; + while (!this.match(56) && !this.match(141)) { + attributes.push(this.jsxParseAttribute()); + } + node.attributes = attributes; + node.selfClosing = this.eat(56); + this.expect(141); + return this.finishNode(node, "JSXOpeningElement"); + } + jsxParseClosingElementAt(startLoc) { + const node = this.startNodeAt(startLoc); + if (this.eat(141)) { + return this.finishNode(node, "JSXClosingFragment"); + } + node.name = this.jsxParseElementName(); + this.expect(141); + return this.finishNode(node, "JSXClosingElement"); + } + jsxParseElementAt(startLoc) { + const node = this.startNodeAt(startLoc); + const children = []; + const openingElement = this.jsxParseOpeningElementAt(startLoc); + let closingElement = null; + if (!openingElement.selfClosing) { + contents: for (;;) { + switch (this.state.type) { + case 140: + startLoc = this.state.startLoc; + this.next(); + if (this.eat(56)) { + closingElement = this.jsxParseClosingElementAt(startLoc); + break contents; + } + children.push(this.jsxParseElementAt(startLoc)); + break; + case 139: + children.push(this.parseExprAtom()); + break; + case 5: + { + const node = this.startNode(); + this.setContext(types.brace); + this.next(); + if (this.match(21)) { + children.push(this.jsxParseSpreadChild(node)); + } else { + children.push(this.jsxParseExpressionContainer(node, types.j_expr)); + } + break; + } + default: + this.unexpected(); + } + } + if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) { + this.raise(JsxErrors.MissingClosingTagFragment, { + at: closingElement + }); + } else if (!isFragment(openingElement) && isFragment(closingElement)) { + this.raise(JsxErrors.MissingClosingTagElement, { + at: closingElement, + openingTagName: getQualifiedJSXName(openingElement.name) + }); + } else if (!isFragment(openingElement) && !isFragment(closingElement)) { + if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) { + this.raise(JsxErrors.MissingClosingTagElement, { + at: closingElement, + openingTagName: getQualifiedJSXName(openingElement.name) + }); + } + } + } + if (isFragment(openingElement)) { + node.openingFragment = openingElement; + node.closingFragment = closingElement; + } else { + node.openingElement = openingElement; + node.closingElement = closingElement; + } + node.children = children; + if (this.match(47)) { + throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, { + at: this.state.startLoc + }); + } + return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement"); + } + jsxParseElement() { + const startLoc = this.state.startLoc; + this.next(); + return this.jsxParseElementAt(startLoc); + } + setContext(newContext) { + const { + context + } = this.state; + context[context.length - 1] = newContext; + } + parseExprAtom(refExpressionErrors) { + if (this.match(139)) { + return this.parseLiteral(this.state.value, "JSXText"); + } else if (this.match(140)) { + return this.jsxParseElement(); + } else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) { + this.replaceToken(140); + return this.jsxParseElement(); + } else { + return super.parseExprAtom(refExpressionErrors); + } + } + skipSpace() { + const curContext = this.curContext(); + if (!curContext.preserveSpace) super.skipSpace(); + } + getTokenFromCode(code) { + const context = this.curContext(); + if (context === types.j_expr) { + this.jsxReadToken(); + return; + } + if (context === types.j_oTag || context === types.j_cTag) { + if (isIdentifierStart(code)) { + this.jsxReadWord(); + return; + } + if (code === 62) { + ++this.state.pos; + this.finishToken(141); + return; + } + if ((code === 34 || code === 39) && context === types.j_oTag) { + this.jsxReadString(code); + return; + } + } + if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) { + ++this.state.pos; + this.finishToken(140); + return; + } + super.getTokenFromCode(code); + } + updateContext(prevType) { + const { + context, + type + } = this.state; + if (type === 56 && prevType === 140) { + context.splice(-2, 2, types.j_cTag); + this.state.canStartJSXElement = false; + } else if (type === 140) { + context.push(types.j_oTag); + } else if (type === 141) { + const out = context[context.length - 1]; + if (out === types.j_oTag && prevType === 56 || out === types.j_cTag) { + context.pop(); + this.state.canStartJSXElement = context[context.length - 1] === types.j_expr; + } else { + this.setContext(types.j_expr); + this.state.canStartJSXElement = true; + } + } else { + this.state.canStartJSXElement = tokenComesBeforeExpression(type); + } + } +}; +class TypeScriptScope extends Scope { + constructor(...args) { + super(...args); + this.types = new Set(); + this.enums = new Set(); + this.constEnums = new Set(); + this.classes = new Set(); + this.exportOnlyBindings = new Set(); + } +} +class TypeScriptScopeHandler extends ScopeHandler { + constructor(...args) { + super(...args); + this.importsStack = []; + } + createScope(flags) { + this.importsStack.push(new Set()); + return new TypeScriptScope(flags); + } + enter(flags) { + if (flags == 256) { + this.importsStack.push(new Set()); + } + super.enter(flags); + } + exit() { + const flags = super.exit(); + if (flags == 256) { + this.importsStack.pop(); + } + return flags; + } + hasImport(name, allowShadow) { + const len = this.importsStack.length; + if (this.importsStack[len - 1].has(name)) { + return true; + } + if (!allowShadow && len > 1) { + for (let i = 0; i < len - 1; i++) { + if (this.importsStack[i].has(name)) return true; + } + } + return false; + } + declareName(name, bindingType, loc) { + if (bindingType & 4096) { + if (this.hasImport(name, true)) { + this.parser.raise(Errors.VarRedeclaration, { + at: loc, + identifierName: name + }); + } + this.importsStack[this.importsStack.length - 1].add(name); + return; + } + const scope = this.currentScope(); + if (bindingType & 1024) { + this.maybeExportDefined(scope, name); + scope.exportOnlyBindings.add(name); + return; + } + super.declareName(name, bindingType, loc); + if (bindingType & 2) { + if (!(bindingType & 1)) { + this.checkRedeclarationInScope(scope, name, bindingType, loc); + this.maybeExportDefined(scope, name); + } + scope.types.add(name); + } + if (bindingType & 256) scope.enums.add(name); + if (bindingType & 512) { + scope.constEnums.add(name); + } + if (bindingType & 128) scope.classes.add(name); + } + isRedeclaredInScope(scope, name, bindingType) { + if (scope.enums.has(name)) { + if (bindingType & 256) { + const isConst = !!(bindingType & 512); + const wasConst = scope.constEnums.has(name); + return isConst !== wasConst; + } + return true; + } + if (bindingType & 128 && scope.classes.has(name)) { + if (scope.lexical.has(name)) { + return !!(bindingType & 1); + } else { + return false; + } + } + if (bindingType & 2 && scope.types.has(name)) { + return true; + } + return super.isRedeclaredInScope(scope, name, bindingType); + } + checkLocalExport(id) { + const { + name + } = id; + if (this.hasImport(name)) return; + const len = this.scopeStack.length; + for (let i = len - 1; i >= 0; i--) { + const scope = this.scopeStack[i]; + if (scope.types.has(name) || scope.exportOnlyBindings.has(name)) return; + } + super.checkLocalExport(id); + } +} +const getOwn$1 = (object, key) => Object.hasOwnProperty.call(object, key) && object[key]; +const unwrapParenthesizedExpression = node => { + return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node; +}; +class LValParser extends NodeUtils { + toAssignable(node, isLHS = false) { + var _node$extra, _node$extra3; + let parenthesized = undefined; + if (node.type === "ParenthesizedExpression" || (_node$extra = node.extra) != null && _node$extra.parenthesized) { + parenthesized = unwrapParenthesizedExpression(node); + if (isLHS) { + if (parenthesized.type === "Identifier") { + this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, { + at: node + }); + } else if (parenthesized.type !== "MemberExpression") { + this.raise(Errors.InvalidParenthesizedAssignment, { + at: node + }); + } + } else { + this.raise(Errors.InvalidParenthesizedAssignment, { + at: node + }); + } + } + switch (node.type) { + case "Identifier": + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + case "RestElement": + break; + case "ObjectExpression": + node.type = "ObjectPattern"; + for (let i = 0, length = node.properties.length, last = length - 1; i < length; i++) { + var _node$extra2; + const prop = node.properties[i]; + const isLast = i === last; + this.toAssignableObjectExpressionProp(prop, isLast, isLHS); + if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) { + this.raise(Errors.RestTrailingComma, { + at: node.extra.trailingCommaLoc + }); + } + } + break; + case "ObjectProperty": + { + const { + key, + value + } = node; + if (this.isPrivateName(key)) { + this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start); + } + this.toAssignable(value, isLHS); + break; + } + case "SpreadElement": + { + throw new Error("Internal @babel/parser error (this is a bug, please report it)." + " SpreadElement should be converted by .toAssignable's caller."); + } + case "ArrayExpression": + node.type = "ArrayPattern"; + this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingCommaLoc, isLHS); + break; + case "AssignmentExpression": + if (node.operator !== "=") { + this.raise(Errors.MissingEqInAssignment, { + at: node.left.loc.end + }); + } + node.type = "AssignmentPattern"; + delete node.operator; + this.toAssignable(node.left, isLHS); + break; + case "ParenthesizedExpression": + this.toAssignable(parenthesized, isLHS); + break; + } + } + toAssignableObjectExpressionProp(prop, isLast, isLHS) { + if (prop.type === "ObjectMethod") { + this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, { + at: prop.key + }); + } else if (prop.type === "SpreadElement") { + prop.type = "RestElement"; + const arg = prop.argument; + this.checkToRestConversion(arg, false); + this.toAssignable(arg, isLHS); + if (!isLast) { + this.raise(Errors.RestTrailingComma, { + at: prop + }); + } + } else { + this.toAssignable(prop, isLHS); + } + } + toAssignableList(exprList, trailingCommaLoc, isLHS) { + const end = exprList.length - 1; + for (let i = 0; i <= end; i++) { + const elt = exprList[i]; + if (!elt) continue; + if (elt.type === "SpreadElement") { + elt.type = "RestElement"; + const arg = elt.argument; + this.checkToRestConversion(arg, true); + this.toAssignable(arg, isLHS); + } else { + this.toAssignable(elt, isLHS); + } + if (elt.type === "RestElement") { + if (i < end) { + this.raise(Errors.RestTrailingComma, { + at: elt + }); + } else if (trailingCommaLoc) { + this.raise(Errors.RestTrailingComma, { + at: trailingCommaLoc + }); + } + } + } + } + isAssignable(node, isBinding) { + switch (node.type) { + case "Identifier": + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + case "RestElement": + return true; + case "ObjectExpression": + { + const last = node.properties.length - 1; + return node.properties.every((prop, i) => { + return prop.type !== "ObjectMethod" && (i === last || prop.type !== "SpreadElement") && this.isAssignable(prop); + }); + } + case "ObjectProperty": + return this.isAssignable(node.value); + case "SpreadElement": + return this.isAssignable(node.argument); + case "ArrayExpression": + return node.elements.every(element => element === null || this.isAssignable(element)); + case "AssignmentExpression": + return node.operator === "="; + case "ParenthesizedExpression": + return this.isAssignable(node.expression); + case "MemberExpression": + case "OptionalMemberExpression": + return !isBinding; + default: + return false; + } + } + toReferencedList(exprList, isParenthesizedExpr) { + return exprList; + } + toReferencedListDeep(exprList, isParenthesizedExpr) { + this.toReferencedList(exprList, isParenthesizedExpr); + for (const expr of exprList) { + if ((expr == null ? void 0 : expr.type) === "ArrayExpression") { + this.toReferencedListDeep(expr.elements); + } + } + } + parseSpread(refExpressionErrors) { + const node = this.startNode(); + this.next(); + node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined); + return this.finishNode(node, "SpreadElement"); + } + parseRestBinding() { + const node = this.startNode(); + this.next(); + node.argument = this.parseBindingAtom(); + return this.finishNode(node, "RestElement"); + } + parseBindingAtom() { + switch (this.state.type) { + case 0: + { + const node = this.startNode(); + this.next(); + node.elements = this.parseBindingList(3, 93, 1); + return this.finishNode(node, "ArrayPattern"); + } + case 5: + return this.parseObjectLike(8, true); + } + return this.parseIdentifier(); + } + parseBindingList(close, closeCharCode, flags) { + const allowEmpty = flags & 1; + const elts = []; + let first = true; + while (!this.eat(close)) { + if (first) { + first = false; + } else { + this.expect(12); + } + if (allowEmpty && this.match(12)) { + elts.push(null); + } else if (this.eat(close)) { + break; + } else if (this.match(21)) { + elts.push(this.parseAssignableListItemTypes(this.parseRestBinding(), flags)); + if (!this.checkCommaAfterRest(closeCharCode)) { + this.expect(close); + break; + } + } else { + const decorators = []; + if (this.match(26) && this.hasPlugin("decorators")) { + this.raise(Errors.UnsupportedParameterDecorator, { + at: this.state.startLoc + }); + } + while (this.match(26)) { + decorators.push(this.parseDecorator()); + } + elts.push(this.parseAssignableListItem(flags, decorators)); + } + } + return elts; + } + parseBindingRestProperty(prop) { + this.next(); + prop.argument = this.parseIdentifier(); + this.checkCommaAfterRest(125); + return this.finishNode(prop, "RestElement"); + } + parseBindingProperty() { + const prop = this.startNode(); + const { + type, + startLoc + } = this.state; + if (type === 21) { + return this.parseBindingRestProperty(prop); + } else if (type === 136) { + this.expectPlugin("destructuringPrivate", startLoc); + this.classScope.usePrivateName(this.state.value, startLoc); + prop.key = this.parsePrivateName(); + } else { + this.parsePropertyName(prop); + } + prop.method = false; + return this.parseObjPropValue(prop, startLoc, false, false, true, false); + } + parseAssignableListItem(flags, decorators) { + const left = this.parseMaybeDefault(); + this.parseAssignableListItemTypes(left, flags); + const elt = this.parseMaybeDefault(left.loc.start, left); + if (decorators.length) { + left.decorators = decorators; + } + return elt; + } + parseAssignableListItemTypes(param, flags) { + return param; + } + parseMaybeDefault(startLoc, left) { + var _startLoc, _left; + (_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc; + left = (_left = left) != null ? _left : this.parseBindingAtom(); + if (!this.eat(29)) return left; + const node = this.startNodeAt(startLoc); + node.left = left; + node.right = this.parseMaybeAssignAllowIn(); + return this.finishNode(node, "AssignmentPattern"); + } + isValidLVal(type, isUnparenthesizedInAssign, binding) { + return getOwn$1({ + AssignmentPattern: "left", + RestElement: "argument", + ObjectProperty: "value", + ParenthesizedExpression: "expression", + ArrayPattern: "elements", + ObjectPattern: "properties" + }, type); + } + checkLVal(expression, { + in: ancestor, + binding = 64, + checkClashes = false, + strictModeChanged = false, + hasParenthesizedAncestor = false + }) { + var _expression$extra; + const type = expression.type; + if (this.isObjectMethod(expression)) return; + if (type === "MemberExpression") { + if (binding !== 64) { + this.raise(Errors.InvalidPropertyBindingPattern, { + at: expression + }); + } + return; + } + if (type === "Identifier") { + this.checkIdentifier(expression, binding, strictModeChanged); + const { + name + } = expression; + if (checkClashes) { + if (checkClashes.has(name)) { + this.raise(Errors.ParamDupe, { + at: expression + }); + } else { + checkClashes.add(name); + } + } + return; + } + const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding); + if (validity === true) return; + if (validity === false) { + const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding; + this.raise(ParseErrorClass, { + at: expression, + ancestor + }); + return; + } + const [key, isParenthesizedExpression] = Array.isArray(validity) ? validity : [validity, type === "ParenthesizedExpression"]; + const nextAncestor = type === "ArrayPattern" || type === "ObjectPattern" || type === "ParenthesizedExpression" ? { + type + } : ancestor; + for (const child of [].concat(expression[key])) { + if (child) { + this.checkLVal(child, { + in: nextAncestor, + binding, + checkClashes, + strictModeChanged, + hasParenthesizedAncestor: isParenthesizedExpression + }); + } + } + } + checkIdentifier(at, bindingType, strictModeChanged = false) { + if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) { + if (bindingType === 64) { + this.raise(Errors.StrictEvalArguments, { + at, + referenceName: at.name + }); + } else { + this.raise(Errors.StrictEvalArgumentsBinding, { + at, + bindingName: at.name + }); + } + } + if (bindingType & 8192 && at.name === "let") { + this.raise(Errors.LetInLexicalBinding, { + at + }); + } + if (!(bindingType & 64)) { + this.declareNameFromIdentifier(at, bindingType); + } + } + declareNameFromIdentifier(identifier, binding) { + this.scope.declareName(identifier.name, binding, identifier.loc.start); + } + checkToRestConversion(node, allowPattern) { + switch (node.type) { + case "ParenthesizedExpression": + this.checkToRestConversion(node.expression, allowPattern); + break; + case "Identifier": + case "MemberExpression": + break; + case "ArrayExpression": + case "ObjectExpression": + if (allowPattern) break; + default: + this.raise(Errors.InvalidRestAssignmentPattern, { + at: node + }); + } + } + checkCommaAfterRest(close) { + if (!this.match(12)) { + return false; + } + this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, { + at: this.state.startLoc + }); + return true; + } +} +const getOwn = (object, key) => Object.hasOwnProperty.call(object, key) && object[key]; +function nonNull(x) { + if (x == null) { + throw new Error(`Unexpected ${x} value.`); + } + return x; +} +function assert(x) { + if (!x) { + throw new Error("Assert fail"); + } +} +const TSErrors = ParseErrorEnum`typescript`({ + AbstractMethodHasImplementation: ({ + methodName + }) => `Method '${methodName}' cannot have an implementation because it is marked abstract.`, + AbstractPropertyHasInitializer: ({ + propertyName + }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`, + AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.", + AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.", + AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.", + ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.", + ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.", + ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.", + ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.", + DeclareAccessor: ({ + kind + }) => `'declare' is not allowed in ${kind}ters.`, + DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.", + DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.", + DuplicateAccessibilityModifier: ({ + modifier + }) => `Accessibility modifier already seen.`, + DuplicateModifier: ({ + modifier + }) => `Duplicate modifier: '${modifier}'.`, + EmptyHeritageClauseType: ({ + token + }) => `'${token}' list cannot be empty.`, + EmptyTypeArguments: "Type argument list cannot be empty.", + EmptyTypeParameters: "Type parameter list cannot be empty.", + ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.", + ImportAliasHasImportType: "An import alias can not use 'import type'.", + ImportReflectionHasImportType: "An `import module` declaration can not use `type` modifier", + IncompatibleModifiers: ({ + modifiers + }) => `'${modifiers[0]}' modifier cannot be used with '${modifiers[1]}' modifier.`, + IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.", + IndexSignatureHasAccessibility: ({ + modifier + }) => `Index signatures cannot have an accessibility modifier ('${modifier}').`, + IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.", + IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.", + IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.", + InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.", + InvalidModifierOnTypeMember: ({ + modifier + }) => `'${modifier}' modifier cannot appear on a type member.`, + InvalidModifierOnTypeParameter: ({ + modifier + }) => `'${modifier}' modifier cannot appear on a type parameter.`, + InvalidModifierOnTypeParameterPositions: ({ + modifier + }) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`, + InvalidModifiersOrder: ({ + orderedModifiers + }) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`, + InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. " + "You can either wrap the instantiation expression in parentheses, or delete the type arguments.", + InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.", + MissingInterfaceName: "'interface' declarations must be followed by an identifier.", + MixedLabeledAndUnlabeledElements: "Tuple members must all have names or all not have names.", + NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.", + NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.", + OptionalTypeBeforeRequired: "A required element cannot follow an optional element.", + OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.", + PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.", + PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.", + PrivateElementHasAccessibility: ({ + modifier + }) => `Private elements cannot have an accessibility modifier ('${modifier}').`, + ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.", + ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `() => ...`.", + ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.", + SetAccesorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.", + SetAccesorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.", + SetAccesorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.", + SingleTypeParameterWithoutTrailingComma: ({ + typeParameterName + }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`, + StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.", + TupleOptionalAfterType: "A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).", + TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.", + TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.", + TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.", + TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.", + UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.", + UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.", + UnexpectedTypeAnnotation: "Did not expect a type annotation here.", + UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.", + UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.", + UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.", + UnsupportedSignatureParameterKind: ({ + type + }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.` +}); +function keywordTypeFromName(value) { + switch (value) { + case "any": + return "TSAnyKeyword"; + case "boolean": + return "TSBooleanKeyword"; + case "bigint": + return "TSBigIntKeyword"; + case "never": + return "TSNeverKeyword"; + case "number": + return "TSNumberKeyword"; + case "object": + return "TSObjectKeyword"; + case "string": + return "TSStringKeyword"; + case "symbol": + return "TSSymbolKeyword"; + case "undefined": + return "TSUndefinedKeyword"; + case "unknown": + return "TSUnknownKeyword"; + default: + return undefined; + } +} +function tsIsAccessModifier(modifier) { + return modifier === "private" || modifier === "public" || modifier === "protected"; +} +function tsIsVarianceAnnotations(modifier) { + return modifier === "in" || modifier === "out"; +} +var typescript = superClass => class TypeScriptParserMixin extends superClass { + constructor(...args) { + super(...args); + this.tsParseInOutModifiers = this.tsParseModifiers.bind(this, { + allowedModifiers: ["in", "out"], + disallowedModifiers: ["const", "public", "private", "protected", "readonly", "declare", "abstract", "override"], + errorTemplate: TSErrors.InvalidModifierOnTypeParameter + }); + this.tsParseConstModifier = this.tsParseModifiers.bind(this, { + allowedModifiers: ["const"], + disallowedModifiers: ["in", "out"], + errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions + }); + this.tsParseInOutConstModifiers = this.tsParseModifiers.bind(this, { + allowedModifiers: ["in", "out", "const"], + disallowedModifiers: ["public", "private", "protected", "readonly", "declare", "abstract", "override"], + errorTemplate: TSErrors.InvalidModifierOnTypeParameter + }); + } + getScopeHandler() { + return TypeScriptScopeHandler; + } + tsIsIdentifier() { + return tokenIsIdentifier(this.state.type); + } + tsTokenCanFollowModifier() { + return (this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(136) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak(); + } + tsNextTokenCanFollowModifier() { + this.next(); + return this.tsTokenCanFollowModifier(); + } + tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) { + if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58 && this.state.type !== 75) { + return undefined; + } + const modifier = this.state.value; + if (allowedModifiers.indexOf(modifier) !== -1) { + if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) { + return undefined; + } + if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) { + return modifier; + } + } + return undefined; + } + tsParseModifiers({ + allowedModifiers, + disallowedModifiers, + stopOnStartOfClassStaticBlock, + errorTemplate = TSErrors.InvalidModifierOnTypeMember + }, modified) { + const enforceOrder = (loc, modifier, before, after) => { + if (modifier === before && modified[after]) { + this.raise(TSErrors.InvalidModifiersOrder, { + at: loc, + orderedModifiers: [before, after] + }); + } + }; + const incompatible = (loc, modifier, mod1, mod2) => { + if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) { + this.raise(TSErrors.IncompatibleModifiers, { + at: loc, + modifiers: [mod1, mod2] + }); + } + }; + for (;;) { + const { + startLoc + } = this.state; + const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock); + if (!modifier) break; + if (tsIsAccessModifier(modifier)) { + if (modified.accessibility) { + this.raise(TSErrors.DuplicateAccessibilityModifier, { + at: startLoc, + modifier + }); + } else { + enforceOrder(startLoc, modifier, modifier, "override"); + enforceOrder(startLoc, modifier, modifier, "static"); + enforceOrder(startLoc, modifier, modifier, "readonly"); + modified.accessibility = modifier; + } + } else if (tsIsVarianceAnnotations(modifier)) { + if (modified[modifier]) { + this.raise(TSErrors.DuplicateModifier, { + at: startLoc, + modifier + }); + } + modified[modifier] = true; + enforceOrder(startLoc, modifier, "in", "out"); + } else { + if (Object.hasOwnProperty.call(modified, modifier)) { + this.raise(TSErrors.DuplicateModifier, { + at: startLoc, + modifier + }); + } else { + enforceOrder(startLoc, modifier, "static", "readonly"); + enforceOrder(startLoc, modifier, "static", "override"); + enforceOrder(startLoc, modifier, "override", "readonly"); + enforceOrder(startLoc, modifier, "abstract", "override"); + incompatible(startLoc, modifier, "declare", "override"); + incompatible(startLoc, modifier, "static", "abstract"); + } + modified[modifier] = true; + } + if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) { + this.raise(errorTemplate, { + at: startLoc, + modifier + }); + } + } + } + tsIsListTerminator(kind) { + switch (kind) { + case "EnumMembers": + case "TypeMembers": + return this.match(8); + case "HeritageClauseElement": + return this.match(5); + case "TupleElementTypes": + return this.match(3); + case "TypeParametersOrArguments": + return this.match(48); + } + } + tsParseList(kind, parseElement) { + const result = []; + while (!this.tsIsListTerminator(kind)) { + result.push(parseElement()); + } + return result; + } + tsParseDelimitedList(kind, parseElement, refTrailingCommaPos) { + return nonNull(this.tsParseDelimitedListWorker(kind, parseElement, true, refTrailingCommaPos)); + } + tsParseDelimitedListWorker(kind, parseElement, expectSuccess, refTrailingCommaPos) { + const result = []; + let trailingCommaPos = -1; + for (;;) { + if (this.tsIsListTerminator(kind)) { + break; + } + trailingCommaPos = -1; + const element = parseElement(); + if (element == null) { + return undefined; + } + result.push(element); + if (this.eat(12)) { + trailingCommaPos = this.state.lastTokStart; + continue; + } + if (this.tsIsListTerminator(kind)) { + break; + } + if (expectSuccess) { + this.expect(12); + } + return undefined; + } + if (refTrailingCommaPos) { + refTrailingCommaPos.value = trailingCommaPos; + } + return result; + } + tsParseBracketedList(kind, parseElement, bracket, skipFirstToken, refTrailingCommaPos) { + if (!skipFirstToken) { + if (bracket) { + this.expect(0); + } else { + this.expect(47); + } + } + const result = this.tsParseDelimitedList(kind, parseElement, refTrailingCommaPos); + if (bracket) { + this.expect(3); + } else { + this.expect(48); + } + return result; + } + tsParseImportType() { + const node = this.startNode(); + this.expect(83); + this.expect(10); + if (!this.match(131)) { + this.raise(TSErrors.UnsupportedImportTypeArgument, { + at: this.state.startLoc + }); + } + node.argument = super.parseExprAtom(); + this.expect(11); + if (this.eat(16)) { + node.qualifier = this.tsParseEntityName(); + } + if (this.match(47)) { + node.typeParameters = this.tsParseTypeArguments(); + } + return this.finishNode(node, "TSImportType"); + } + tsParseEntityName(allowReservedWords = true) { + let entity = this.parseIdentifier(allowReservedWords); + while (this.eat(16)) { + const node = this.startNodeAtNode(entity); + node.left = entity; + node.right = this.parseIdentifier(allowReservedWords); + entity = this.finishNode(node, "TSQualifiedName"); + } + return entity; + } + tsParseTypeReference() { + const node = this.startNode(); + node.typeName = this.tsParseEntityName(); + if (!this.hasPrecedingLineBreak() && this.match(47)) { + node.typeParameters = this.tsParseTypeArguments(); + } + return this.finishNode(node, "TSTypeReference"); + } + tsParseThisTypePredicate(lhs) { + this.next(); + const node = this.startNodeAtNode(lhs); + node.parameterName = lhs; + node.typeAnnotation = this.tsParseTypeAnnotation(false); + node.asserts = false; + return this.finishNode(node, "TSTypePredicate"); + } + tsParseThisTypeNode() { + const node = this.startNode(); + this.next(); + return this.finishNode(node, "TSThisType"); + } + tsParseTypeQuery() { + const node = this.startNode(); + this.expect(87); + if (this.match(83)) { + node.exprName = this.tsParseImportType(); + } else { + node.exprName = this.tsParseEntityName(); + } + if (!this.hasPrecedingLineBreak() && this.match(47)) { + node.typeParameters = this.tsParseTypeArguments(); + } + return this.finishNode(node, "TSTypeQuery"); + } + tsParseTypeParameter(parseModifiers) { + const node = this.startNode(); + parseModifiers(node); + node.name = this.tsParseTypeParameterName(); + node.constraint = this.tsEatThenParseType(81); + node.default = this.tsEatThenParseType(29); + return this.finishNode(node, "TSTypeParameter"); + } + tsTryParseTypeParameters(parseModifiers) { + if (this.match(47)) { + return this.tsParseTypeParameters(parseModifiers); + } + } + tsParseTypeParameters(parseModifiers) { + const node = this.startNode(); + if (this.match(47) || this.match(140)) { + this.next(); + } else { + this.unexpected(); + } + const refTrailingCommaPos = { + value: -1 + }; + node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos); + if (node.params.length === 0) { + this.raise(TSErrors.EmptyTypeParameters, { + at: node + }); + } + if (refTrailingCommaPos.value !== -1) { + this.addExtra(node, "trailingComma", refTrailingCommaPos.value); + } + return this.finishNode(node, "TSTypeParameterDeclaration"); + } + tsFillSignature(returnToken, signature) { + const returnTokenRequired = returnToken === 19; + const paramsKey = "parameters"; + const returnTypeKey = "typeAnnotation"; + signature.typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier); + this.expect(10); + signature[paramsKey] = this.tsParseBindingListForSignature(); + if (returnTokenRequired) { + signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken); + } else if (this.match(returnToken)) { + signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken); + } + } + tsParseBindingListForSignature() { + const list = super.parseBindingList(11, 41, 2); + for (const pattern of list) { + const { + type + } = pattern; + if (type === "AssignmentPattern" || type === "TSParameterProperty") { + this.raise(TSErrors.UnsupportedSignatureParameterKind, { + at: pattern, + type + }); + } + } + return list; + } + tsParseTypeMemberSemicolon() { + if (!this.eat(12) && !this.isLineTerminator()) { + this.expect(13); + } + } + tsParseSignatureMember(kind, node) { + this.tsFillSignature(14, node); + this.tsParseTypeMemberSemicolon(); + return this.finishNode(node, kind); + } + tsIsUnambiguouslyIndexSignature() { + this.next(); + if (tokenIsIdentifier(this.state.type)) { + this.next(); + return this.match(14); + } + return false; + } + tsTryParseIndexSignature(node) { + if (!(this.match(0) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) { + return; + } + this.expect(0); + const id = this.parseIdentifier(); + id.typeAnnotation = this.tsParseTypeAnnotation(); + this.resetEndLocation(id); + this.expect(3); + node.parameters = [id]; + const type = this.tsTryParseTypeAnnotation(); + if (type) node.typeAnnotation = type; + this.tsParseTypeMemberSemicolon(); + return this.finishNode(node, "TSIndexSignature"); + } + tsParsePropertyOrMethodSignature(node, readonly) { + if (this.eat(17)) node.optional = true; + const nodeAny = node; + if (this.match(10) || this.match(47)) { + if (readonly) { + this.raise(TSErrors.ReadonlyForMethodSignature, { + at: node + }); + } + const method = nodeAny; + if (method.kind && this.match(47)) { + this.raise(TSErrors.AccesorCannotHaveTypeParameters, { + at: this.state.curPosition() + }); + } + this.tsFillSignature(14, method); + this.tsParseTypeMemberSemicolon(); + const paramsKey = "parameters"; + const returnTypeKey = "typeAnnotation"; + if (method.kind === "get") { + if (method[paramsKey].length > 0) { + this.raise(Errors.BadGetterArity, { + at: this.state.curPosition() + }); + if (this.isThisParam(method[paramsKey][0])) { + this.raise(TSErrors.AccesorCannotDeclareThisParameter, { + at: this.state.curPosition() + }); + } + } + } else if (method.kind === "set") { + if (method[paramsKey].length !== 1) { + this.raise(Errors.BadSetterArity, { + at: this.state.curPosition() + }); + } else { + const firstParameter = method[paramsKey][0]; + if (this.isThisParam(firstParameter)) { + this.raise(TSErrors.AccesorCannotDeclareThisParameter, { + at: this.state.curPosition() + }); + } + if (firstParameter.type === "Identifier" && firstParameter.optional) { + this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, { + at: this.state.curPosition() + }); + } + if (firstParameter.type === "RestElement") { + this.raise(TSErrors.SetAccesorCannotHaveRestParameter, { + at: this.state.curPosition() + }); + } + } + if (method[returnTypeKey]) { + this.raise(TSErrors.SetAccesorCannotHaveReturnType, { + at: method[returnTypeKey] + }); + } + } else { + method.kind = "method"; + } + return this.finishNode(method, "TSMethodSignature"); + } else { + const property = nodeAny; + if (readonly) property.readonly = true; + const type = this.tsTryParseTypeAnnotation(); + if (type) property.typeAnnotation = type; + this.tsParseTypeMemberSemicolon(); + return this.finishNode(property, "TSPropertySignature"); + } + } + tsParseTypeMember() { + const node = this.startNode(); + if (this.match(10) || this.match(47)) { + return this.tsParseSignatureMember("TSCallSignatureDeclaration", node); + } + if (this.match(77)) { + const id = this.startNode(); + this.next(); + if (this.match(10) || this.match(47)) { + return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node); + } else { + node.key = this.createIdentifier(id, "new"); + return this.tsParsePropertyOrMethodSignature(node, false); + } + } + this.tsParseModifiers({ + allowedModifiers: ["readonly"], + disallowedModifiers: ["declare", "abstract", "private", "protected", "public", "static", "override"] + }, node); + const idx = this.tsTryParseIndexSignature(node); + if (idx) { + return idx; + } + super.parsePropertyName(node); + if (!node.computed && node.key.type === "Identifier" && (node.key.name === "get" || node.key.name === "set") && this.tsTokenCanFollowModifier()) { + node.kind = node.key.name; + super.parsePropertyName(node); + } + return this.tsParsePropertyOrMethodSignature(node, !!node.readonly); + } + tsParseTypeLiteral() { + const node = this.startNode(); + node.members = this.tsParseObjectTypeMembers(); + return this.finishNode(node, "TSTypeLiteral"); + } + tsParseObjectTypeMembers() { + this.expect(5); + const members = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this)); + this.expect(8); + return members; + } + tsIsStartOfMappedType() { + this.next(); + if (this.eat(53)) { + return this.isContextual(120); + } + if (this.isContextual(120)) { + this.next(); + } + if (!this.match(0)) { + return false; + } + this.next(); + if (!this.tsIsIdentifier()) { + return false; + } + this.next(); + return this.match(58); + } + tsParseMappedTypeParameter() { + const node = this.startNode(); + node.name = this.tsParseTypeParameterName(); + node.constraint = this.tsExpectThenParseType(58); + return this.finishNode(node, "TSTypeParameter"); + } + tsParseMappedType() { + const node = this.startNode(); + this.expect(5); + if (this.match(53)) { + node.readonly = this.state.value; + this.next(); + this.expectContextual(120); + } else if (this.eatContextual(120)) { + node.readonly = true; + } + this.expect(0); + node.typeParameter = this.tsParseMappedTypeParameter(); + node.nameType = this.eatContextual(93) ? this.tsParseType() : null; + this.expect(3); + if (this.match(53)) { + node.optional = this.state.value; + this.next(); + this.expect(17); + } else if (this.eat(17)) { + node.optional = true; + } + node.typeAnnotation = this.tsTryParseType(); + this.semicolon(); + this.expect(8); + return this.finishNode(node, "TSMappedType"); + } + tsParseTupleType() { + const node = this.startNode(); + node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false); + let seenOptionalElement = false; + let labeledElements = null; + node.elementTypes.forEach(elementNode => { + var _labeledElements; + const { + type + } = elementNode; + if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) { + this.raise(TSErrors.OptionalTypeBeforeRequired, { + at: elementNode + }); + } + seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType"); + let checkType = type; + if (type === "TSRestType") { + elementNode = elementNode.typeAnnotation; + checkType = elementNode.type; + } + const isLabeled = checkType === "TSNamedTupleMember"; + (_labeledElements = labeledElements) != null ? _labeledElements : labeledElements = isLabeled; + if (labeledElements !== isLabeled) { + this.raise(TSErrors.MixedLabeledAndUnlabeledElements, { + at: elementNode + }); + } + }); + return this.finishNode(node, "TSTupleType"); + } + tsParseTupleElementType() { + const { + startLoc + } = this.state; + const rest = this.eat(21); + let labeled; + let label; + let optional; + let type; + const isWord = tokenIsKeywordOrIdentifier(this.state.type); + const chAfterWord = isWord ? this.lookaheadCharCode() : null; + if (chAfterWord === 58) { + labeled = true; + optional = false; + label = this.parseIdentifier(true); + this.expect(14); + type = this.tsParseType(); + } else if (chAfterWord === 63) { + optional = true; + const startLoc = this.state.startLoc; + const wordName = this.state.value; + const typeOrLabel = this.tsParseNonArrayType(); + if (this.lookaheadCharCode() === 58) { + labeled = true; + label = this.createIdentifier(this.startNodeAt(startLoc), wordName); + this.expect(17); + this.expect(14); + type = this.tsParseType(); + } else { + labeled = false; + type = typeOrLabel; + this.expect(17); + } + } else { + type = this.tsParseType(); + optional = this.eat(17); + labeled = this.eat(14); + } + if (labeled) { + let labeledNode; + if (label) { + labeledNode = this.startNodeAtNode(label); + labeledNode.optional = optional; + labeledNode.label = label; + labeledNode.elementType = type; + if (this.eat(17)) { + labeledNode.optional = true; + this.raise(TSErrors.TupleOptionalAfterType, { + at: this.state.lastTokStartLoc + }); + } + } else { + labeledNode = this.startNodeAtNode(type); + labeledNode.optional = optional; + this.raise(TSErrors.InvalidTupleMemberLabel, { + at: type + }); + labeledNode.label = type; + labeledNode.elementType = this.tsParseType(); + } + type = this.finishNode(labeledNode, "TSNamedTupleMember"); + } else if (optional) { + const optionalTypeNode = this.startNodeAtNode(type); + optionalTypeNode.typeAnnotation = type; + type = this.finishNode(optionalTypeNode, "TSOptionalType"); + } + if (rest) { + const restNode = this.startNodeAt(startLoc); + restNode.typeAnnotation = type; + type = this.finishNode(restNode, "TSRestType"); + } + return type; + } + tsParseParenthesizedType() { + const node = this.startNode(); + this.expect(10); + node.typeAnnotation = this.tsParseType(); + this.expect(11); + return this.finishNode(node, "TSParenthesizedType"); + } + tsParseFunctionOrConstructorType(type, abstract) { + const node = this.startNode(); + if (type === "TSConstructorType") { + node.abstract = !!abstract; + if (abstract) this.next(); + this.next(); + } + this.tsInAllowConditionalTypesContext(() => this.tsFillSignature(19, node)); + return this.finishNode(node, type); + } + tsParseLiteralTypeNode() { + const node = this.startNode(); + switch (this.state.type) { + case 132: + case 133: + case 131: + case 85: + case 86: + node.literal = super.parseExprAtom(); + break; + default: + this.unexpected(); + } + return this.finishNode(node, "TSLiteralType"); + } + tsParseTemplateLiteralType() { + const node = this.startNode(); + node.literal = super.parseTemplate(false); + return this.finishNode(node, "TSLiteralType"); + } + parseTemplateSubstitution() { + if (this.state.inType) return this.tsParseType(); + return super.parseTemplateSubstitution(); + } + tsParseThisTypeOrThisTypePredicate() { + const thisKeyword = this.tsParseThisTypeNode(); + if (this.isContextual(114) && !this.hasPrecedingLineBreak()) { + return this.tsParseThisTypePredicate(thisKeyword); + } else { + return thisKeyword; + } + } + tsParseNonArrayType() { + switch (this.state.type) { + case 131: + case 132: + case 133: + case 85: + case 86: + return this.tsParseLiteralTypeNode(); + case 53: + if (this.state.value === "-") { + const node = this.startNode(); + const nextToken = this.lookahead(); + if (nextToken.type !== 132 && nextToken.type !== 133) { + this.unexpected(); + } + node.literal = this.parseMaybeUnary(); + return this.finishNode(node, "TSLiteralType"); + } + break; + case 78: + return this.tsParseThisTypeOrThisTypePredicate(); + case 87: + return this.tsParseTypeQuery(); + case 83: + return this.tsParseImportType(); + case 5: + return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral(); + case 0: + return this.tsParseTupleType(); + case 10: + return this.tsParseParenthesizedType(); + case 25: + case 24: + return this.tsParseTemplateLiteralType(); + default: + { + const { + type + } = this.state; + if (tokenIsIdentifier(type) || type === 88 || type === 84) { + const nodeType = type === 88 ? "TSVoidKeyword" : type === 84 ? "TSNullKeyword" : keywordTypeFromName(this.state.value); + if (nodeType !== undefined && this.lookaheadCharCode() !== 46) { + const node = this.startNode(); + this.next(); + return this.finishNode(node, nodeType); + } + return this.tsParseTypeReference(); + } + } + } + this.unexpected(); + } + tsParseArrayTypeOrHigher() { + let type = this.tsParseNonArrayType(); + while (!this.hasPrecedingLineBreak() && this.eat(0)) { + if (this.match(3)) { + const node = this.startNodeAtNode(type); + node.elementType = type; + this.expect(3); + type = this.finishNode(node, "TSArrayType"); + } else { + const node = this.startNodeAtNode(type); + node.objectType = type; + node.indexType = this.tsParseType(); + this.expect(3); + type = this.finishNode(node, "TSIndexedAccessType"); + } + } + return type; + } + tsParseTypeOperator() { + const node = this.startNode(); + const operator = this.state.value; + this.next(); + node.operator = operator; + node.typeAnnotation = this.tsParseTypeOperatorOrHigher(); + if (operator === "readonly") { + this.tsCheckTypeAnnotationForReadOnly(node); + } + return this.finishNode(node, "TSTypeOperator"); + } + tsCheckTypeAnnotationForReadOnly(node) { + switch (node.typeAnnotation.type) { + case "TSTupleType": + case "TSArrayType": + return; + default: + this.raise(TSErrors.UnexpectedReadonly, { + at: node + }); + } + } + tsParseInferType() { + const node = this.startNode(); + this.expectContextual(113); + const typeParameter = this.startNode(); + typeParameter.name = this.tsParseTypeParameterName(); + typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType()); + node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter"); + return this.finishNode(node, "TSInferType"); + } + tsParseConstraintForInferType() { + if (this.eat(81)) { + const constraint = this.tsInDisallowConditionalTypesContext(() => this.tsParseType()); + if (this.state.inDisallowConditionalTypesContext || !this.match(17)) { + return constraint; + } + } + } + tsParseTypeOperatorOrHigher() { + const isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc; + return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(113) ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher()); + } + tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) { + const node = this.startNode(); + const hasLeadingOperator = this.eat(operator); + const types = []; + do { + types.push(parseConstituentType()); + } while (this.eat(operator)); + if (types.length === 1 && !hasLeadingOperator) { + return types[0]; + } + node.types = types; + return this.finishNode(node, kind); + } + tsParseIntersectionTypeOrHigher() { + return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 45); + } + tsParseUnionTypeOrHigher() { + return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 43); + } + tsIsStartOfFunctionType() { + if (this.match(47)) { + return true; + } + return this.match(10) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this)); + } + tsSkipParameterStart() { + if (tokenIsIdentifier(this.state.type) || this.match(78)) { + this.next(); + return true; + } + if (this.match(5)) { + const { + errors + } = this.state; + const previousErrorCount = errors.length; + try { + this.parseObjectLike(8, true); + return errors.length === previousErrorCount; + } catch (_unused) { + return false; + } + } + if (this.match(0)) { + this.next(); + const { + errors + } = this.state; + const previousErrorCount = errors.length; + try { + super.parseBindingList(3, 93, 1); + return errors.length === previousErrorCount; + } catch (_unused2) { + return false; + } + } + return false; + } + tsIsUnambiguouslyStartOfFunctionType() { + this.next(); + if (this.match(11) || this.match(21)) { + return true; + } + if (this.tsSkipParameterStart()) { + if (this.match(14) || this.match(12) || this.match(17) || this.match(29)) { + return true; + } + if (this.match(11)) { + this.next(); + if (this.match(19)) { + return true; + } + } + } + return false; + } + tsParseTypeOrTypePredicateAnnotation(returnToken) { + return this.tsInType(() => { + const t = this.startNode(); + this.expect(returnToken); + const node = this.startNode(); + const asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this)); + if (asserts && this.match(78)) { + let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate(); + if (thisTypePredicate.type === "TSThisType") { + node.parameterName = thisTypePredicate; + node.asserts = true; + node.typeAnnotation = null; + thisTypePredicate = this.finishNode(node, "TSTypePredicate"); + } else { + this.resetStartLocationFromNode(thisTypePredicate, node); + thisTypePredicate.asserts = true; + } + t.typeAnnotation = thisTypePredicate; + return this.finishNode(t, "TSTypeAnnotation"); + } + const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this)); + if (!typePredicateVariable) { + if (!asserts) { + return this.tsParseTypeAnnotation(false, t); + } + node.parameterName = this.parseIdentifier(); + node.asserts = asserts; + node.typeAnnotation = null; + t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); + return this.finishNode(t, "TSTypeAnnotation"); + } + const type = this.tsParseTypeAnnotation(false); + node.parameterName = typePredicateVariable; + node.typeAnnotation = type; + node.asserts = asserts; + t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); + return this.finishNode(t, "TSTypeAnnotation"); + }); + } + tsTryParseTypeOrTypePredicateAnnotation() { + if (this.match(14)) { + return this.tsParseTypeOrTypePredicateAnnotation(14); + } + } + tsTryParseTypeAnnotation() { + if (this.match(14)) { + return this.tsParseTypeAnnotation(); + } + } + tsTryParseType() { + return this.tsEatThenParseType(14); + } + tsParseTypePredicatePrefix() { + const id = this.parseIdentifier(); + if (this.isContextual(114) && !this.hasPrecedingLineBreak()) { + this.next(); + return id; + } + } + tsParseTypePredicateAsserts() { + if (this.state.type !== 107) { + return false; + } + const containsEsc = this.state.containsEsc; + this.next(); + if (!tokenIsIdentifier(this.state.type) && !this.match(78)) { + return false; + } + if (containsEsc) { + this.raise(Errors.InvalidEscapedReservedWord, { + at: this.state.lastTokStartLoc, + reservedWord: "asserts" + }); + } + return true; + } + tsParseTypeAnnotation(eatColon = true, t = this.startNode()) { + this.tsInType(() => { + if (eatColon) this.expect(14); + t.typeAnnotation = this.tsParseType(); + }); + return this.finishNode(t, "TSTypeAnnotation"); + } + tsParseType() { + assert(this.state.inType); + const type = this.tsParseNonConditionalType(); + if (this.state.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(81)) { + return type; + } + const node = this.startNodeAtNode(type); + node.checkType = type; + node.extendsType = this.tsInDisallowConditionalTypesContext(() => this.tsParseNonConditionalType()); + this.expect(17); + node.trueType = this.tsInAllowConditionalTypesContext(() => this.tsParseType()); + this.expect(14); + node.falseType = this.tsInAllowConditionalTypesContext(() => this.tsParseType()); + return this.finishNode(node, "TSConditionalType"); + } + isAbstractConstructorSignature() { + return this.isContextual(122) && this.lookahead().type === 77; + } + tsParseNonConditionalType() { + if (this.tsIsStartOfFunctionType()) { + return this.tsParseFunctionOrConstructorType("TSFunctionType"); + } + if (this.match(77)) { + return this.tsParseFunctionOrConstructorType("TSConstructorType"); + } else if (this.isAbstractConstructorSignature()) { + return this.tsParseFunctionOrConstructorType("TSConstructorType", true); + } + return this.tsParseUnionTypeOrHigher(); + } + tsParseTypeAssertion() { + if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) { + this.raise(TSErrors.ReservedTypeAssertion, { + at: this.state.startLoc + }); + } + const node = this.startNode(); + node.typeAnnotation = this.tsInType(() => { + this.next(); + return this.match(75) ? this.tsParseTypeReference() : this.tsParseType(); + }); + this.expect(48); + node.expression = this.parseMaybeUnary(); + return this.finishNode(node, "TSTypeAssertion"); + } + tsParseHeritageClause(token) { + const originalStartLoc = this.state.startLoc; + const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => { + const node = this.startNode(); + node.expression = this.tsParseEntityName(); + if (this.match(47)) { + node.typeParameters = this.tsParseTypeArguments(); + } + return this.finishNode(node, "TSExpressionWithTypeArguments"); + }); + if (!delimitedList.length) { + this.raise(TSErrors.EmptyHeritageClauseType, { + at: originalStartLoc, + token + }); + } + return delimitedList; + } + tsParseInterfaceDeclaration(node, properties = {}) { + if (this.hasFollowingLineBreak()) return null; + this.expectContextual(127); + if (properties.declare) node.declare = true; + if (tokenIsIdentifier(this.state.type)) { + node.id = this.parseIdentifier(); + this.checkIdentifier(node.id, 130); + } else { + node.id = null; + this.raise(TSErrors.MissingInterfaceName, { + at: this.state.startLoc + }); + } + node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers); + if (this.eat(81)) { + node.extends = this.tsParseHeritageClause("extends"); + } + const body = this.startNode(); + body.body = this.tsInType(this.tsParseObjectTypeMembers.bind(this)); + node.body = this.finishNode(body, "TSInterfaceBody"); + return this.finishNode(node, "TSInterfaceDeclaration"); + } + tsParseTypeAliasDeclaration(node) { + node.id = this.parseIdentifier(); + this.checkIdentifier(node.id, 2); + node.typeAnnotation = this.tsInType(() => { + node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers); + this.expect(29); + if (this.isContextual(112) && this.lookahead().type !== 16) { + const node = this.startNode(); + this.next(); + return this.finishNode(node, "TSIntrinsicKeyword"); + } + return this.tsParseType(); + }); + this.semicolon(); + return this.finishNode(node, "TSTypeAliasDeclaration"); + } + tsInNoContext(cb) { + const oldContext = this.state.context; + this.state.context = [oldContext[0]]; + try { + return cb(); + } finally { + this.state.context = oldContext; + } + } + tsInType(cb) { + const oldInType = this.state.inType; + this.state.inType = true; + try { + return cb(); + } finally { + this.state.inType = oldInType; + } + } + tsInDisallowConditionalTypesContext(cb) { + const oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext; + this.state.inDisallowConditionalTypesContext = true; + try { + return cb(); + } finally { + this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; + } + } + tsInAllowConditionalTypesContext(cb) { + const oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext; + this.state.inDisallowConditionalTypesContext = false; + try { + return cb(); + } finally { + this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; + } + } + tsEatThenParseType(token) { + if (this.match(token)) { + return this.tsNextThenParseType(); + } + } + tsExpectThenParseType(token) { + return this.tsInType(() => { + this.expect(token); + return this.tsParseType(); + }); + } + tsNextThenParseType() { + return this.tsInType(() => { + this.next(); + return this.tsParseType(); + }); + } + tsParseEnumMember() { + const node = this.startNode(); + node.id = this.match(131) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true); + if (this.eat(29)) { + node.initializer = super.parseMaybeAssignAllowIn(); + } + return this.finishNode(node, "TSEnumMember"); + } + tsParseEnumDeclaration(node, properties = {}) { + if (properties.const) node.const = true; + if (properties.declare) node.declare = true; + this.expectContextual(124); + node.id = this.parseIdentifier(); + this.checkIdentifier(node.id, node.const ? 8971 : 8459); + this.expect(5); + node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this)); + this.expect(8); + return this.finishNode(node, "TSEnumDeclaration"); + } + tsParseModuleBlock() { + const node = this.startNode(); + this.scope.enter(0); + this.expect(5); + super.parseBlockOrModuleBlockBody(node.body = [], undefined, true, 8); + this.scope.exit(); + return this.finishNode(node, "TSModuleBlock"); + } + tsParseModuleOrNamespaceDeclaration(node, nested = false) { + node.id = this.parseIdentifier(); + if (!nested) { + this.checkIdentifier(node.id, 1024); + } + if (this.eat(16)) { + const inner = this.startNode(); + this.tsParseModuleOrNamespaceDeclaration(inner, true); + node.body = inner; + } else { + this.scope.enter(256); + this.prodParam.enter(PARAM); + node.body = this.tsParseModuleBlock(); + this.prodParam.exit(); + this.scope.exit(); + } + return this.finishNode(node, "TSModuleDeclaration"); + } + tsParseAmbientExternalModuleDeclaration(node) { + if (this.isContextual(110)) { + node.global = true; + node.id = this.parseIdentifier(); + } else if (this.match(131)) { + node.id = super.parseStringLiteral(this.state.value); + } else { + this.unexpected(); + } + if (this.match(5)) { + this.scope.enter(256); + this.prodParam.enter(PARAM); + node.body = this.tsParseModuleBlock(); + this.prodParam.exit(); + this.scope.exit(); + } else { + this.semicolon(); + } + return this.finishNode(node, "TSModuleDeclaration"); + } + tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, isExport) { + node.isExport = isExport || false; + node.id = maybeDefaultIdentifier || this.parseIdentifier(); + this.checkIdentifier(node.id, 4096); + this.expect(29); + const moduleReference = this.tsParseModuleReference(); + if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") { + this.raise(TSErrors.ImportAliasHasImportType, { + at: moduleReference + }); + } + node.moduleReference = moduleReference; + this.semicolon(); + return this.finishNode(node, "TSImportEqualsDeclaration"); + } + tsIsExternalModuleReference() { + return this.isContextual(117) && this.lookaheadCharCode() === 40; + } + tsParseModuleReference() { + return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(false); + } + tsParseExternalModuleReference() { + const node = this.startNode(); + this.expectContextual(117); + this.expect(10); + if (!this.match(131)) { + this.unexpected(); + } + node.expression = super.parseExprAtom(); + this.expect(11); + this.sawUnambiguousESM = true; + return this.finishNode(node, "TSExternalModuleReference"); + } + tsLookAhead(f) { + const state = this.state.clone(); + const res = f(); + this.state = state; + return res; + } + tsTryParseAndCatch(f) { + const result = this.tryParse(abort => f() || abort()); + if (result.aborted || !result.node) return; + if (result.error) this.state = result.failState; + return result.node; + } + tsTryParse(f) { + const state = this.state.clone(); + const result = f(); + if (result !== undefined && result !== false) { + return result; + } + this.state = state; + } + tsTryParseDeclare(nany) { + if (this.isLineTerminator()) { + return; + } + let startType = this.state.type; + let kind; + if (this.isContextual(99)) { + startType = 74; + kind = "let"; + } + return this.tsInAmbientContext(() => { + switch (startType) { + case 68: + nany.declare = true; + return super.parseFunctionStatement(nany, false, false); + case 80: + nany.declare = true; + return this.parseClass(nany, true, false); + case 124: + return this.tsParseEnumDeclaration(nany, { + declare: true + }); + case 110: + return this.tsParseAmbientExternalModuleDeclaration(nany); + case 75: + case 74: + if (!this.match(75) || !this.isLookaheadContextual("enum")) { + nany.declare = true; + return this.parseVarStatement(nany, kind || this.state.value, true); + } + this.expect(75); + return this.tsParseEnumDeclaration(nany, { + const: true, + declare: true + }); + case 127: + { + const result = this.tsParseInterfaceDeclaration(nany, { + declare: true + }); + if (result) return result; + } + default: + if (tokenIsIdentifier(startType)) { + return this.tsParseDeclaration(nany, this.state.value, true, null); + } + } + }); + } + tsTryParseExportDeclaration() { + return this.tsParseDeclaration(this.startNode(), this.state.value, true, null); + } + tsParseExpressionStatement(node, expr, decorators) { + switch (expr.name) { + case "declare": + { + const declaration = this.tsTryParseDeclare(node); + if (declaration) { + declaration.declare = true; + } + return declaration; + } + case "global": + if (this.match(5)) { + this.scope.enter(256); + this.prodParam.enter(PARAM); + const mod = node; + mod.global = true; + mod.id = expr; + mod.body = this.tsParseModuleBlock(); + this.scope.exit(); + this.prodParam.exit(); + return this.finishNode(mod, "TSModuleDeclaration"); + } + break; + default: + return this.tsParseDeclaration(node, expr.name, false, decorators); + } + } + tsParseDeclaration(node, value, next, decorators) { + switch (value) { + case "abstract": + if (this.tsCheckLineTerminator(next) && (this.match(80) || tokenIsIdentifier(this.state.type))) { + return this.tsParseAbstractDeclaration(node, decorators); + } + break; + case "module": + if (this.tsCheckLineTerminator(next)) { + if (this.match(131)) { + return this.tsParseAmbientExternalModuleDeclaration(node); + } else if (tokenIsIdentifier(this.state.type)) { + return this.tsParseModuleOrNamespaceDeclaration(node); + } + } + break; + case "namespace": + if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) { + return this.tsParseModuleOrNamespaceDeclaration(node); + } + break; + case "type": + if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) { + return this.tsParseTypeAliasDeclaration(node); + } + break; + } + } + tsCheckLineTerminator(next) { + if (next) { + if (this.hasFollowingLineBreak()) return false; + this.next(); + return true; + } + return !this.isLineTerminator(); + } + tsTryParseGenericAsyncArrowFunction(startLoc) { + if (!this.match(47)) return; + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + this.state.maybeInArrowParameters = true; + const res = this.tsTryParseAndCatch(() => { + const node = this.startNodeAt(startLoc); + node.typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier); + super.parseFunctionParams(node); + node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation(); + this.expect(19); + return node; + }); + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + if (!res) return; + return super.parseArrowExpression(res, null, true); + } + tsParseTypeArgumentsInExpression() { + if (this.reScan_lt() !== 47) return; + return this.tsParseTypeArguments(); + } + tsParseTypeArguments() { + const node = this.startNode(); + node.params = this.tsInType(() => this.tsInNoContext(() => { + this.expect(47); + return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this)); + })); + if (node.params.length === 0) { + this.raise(TSErrors.EmptyTypeArguments, { + at: node + }); + } else if (!this.state.inType && this.curContext() === types.brace) { + this.reScan_lt_gt(); + } + this.expect(48); + return this.finishNode(node, "TSTypeParameterInstantiation"); + } + tsIsDeclarationStart() { + return tokenIsTSDeclarationStart(this.state.type); + } + isExportDefaultSpecifier() { + if (this.tsIsDeclarationStart()) return false; + return super.isExportDefaultSpecifier(); + } + parseAssignableListItem(flags, decorators) { + const startLoc = this.state.startLoc; + const modified = {}; + this.tsParseModifiers({ + allowedModifiers: ["public", "private", "protected", "override", "readonly"] + }, modified); + const accessibility = modified.accessibility; + const override = modified.override; + const readonly = modified.readonly; + if (!(flags & 4) && (accessibility || readonly || override)) { + this.raise(TSErrors.UnexpectedParameterModifier, { + at: startLoc + }); + } + const left = this.parseMaybeDefault(); + this.parseAssignableListItemTypes(left, flags); + const elt = this.parseMaybeDefault(left.loc.start, left); + if (accessibility || readonly || override) { + const pp = this.startNodeAt(startLoc); + if (decorators.length) { + pp.decorators = decorators; + } + if (accessibility) pp.accessibility = accessibility; + if (readonly) pp.readonly = readonly; + if (override) pp.override = override; + if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") { + this.raise(TSErrors.UnsupportedParameterPropertyKind, { + at: pp + }); + } + pp.parameter = elt; + return this.finishNode(pp, "TSParameterProperty"); + } + if (decorators.length) { + left.decorators = decorators; + } + return elt; + } + isSimpleParameter(node) { + return node.type === "TSParameterProperty" && super.isSimpleParameter(node.parameter) || super.isSimpleParameter(node); + } + tsDisallowOptionalPattern(node) { + for (const param of node.params) { + if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) { + this.raise(TSErrors.PatternIsOptional, { + at: param + }); + } + } + } + setArrowFunctionParameters(node, params, trailingCommaLoc) { + super.setArrowFunctionParameters(node, params, trailingCommaLoc); + this.tsDisallowOptionalPattern(node); + } + parseFunctionBodyAndFinish(node, type, isMethod = false) { + if (this.match(14)) { + node.returnType = this.tsParseTypeOrTypePredicateAnnotation(14); + } + const bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" || type === "ClassPrivateMethod" ? "TSDeclareMethod" : undefined; + if (bodilessType && !this.match(5) && this.isLineTerminator()) { + return this.finishNode(node, bodilessType); + } + if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) { + this.raise(TSErrors.DeclareFunctionHasImplementation, { + at: node + }); + if (node.declare) { + return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod); + } + } + this.tsDisallowOptionalPattern(node); + return super.parseFunctionBodyAndFinish(node, type, isMethod); + } + registerFunctionStatementId(node) { + if (!node.body && node.id) { + this.checkIdentifier(node.id, 1024); + } else { + super.registerFunctionStatementId(node); + } + } + tsCheckForInvalidTypeCasts(items) { + items.forEach(node => { + if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") { + this.raise(TSErrors.UnexpectedTypeAnnotation, { + at: node.typeAnnotation + }); + } + }); + } + toReferencedList(exprList, isInParens) { + this.tsCheckForInvalidTypeCasts(exprList); + return exprList; + } + parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) { + const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors); + if (node.type === "ArrayExpression") { + this.tsCheckForInvalidTypeCasts(node.elements); + } + return node; + } + parseSubscript(base, startLoc, noCalls, state) { + if (!this.hasPrecedingLineBreak() && this.match(35)) { + this.state.canStartJSXElement = false; + this.next(); + const nonNullExpression = this.startNodeAt(startLoc); + nonNullExpression.expression = base; + return this.finishNode(nonNullExpression, "TSNonNullExpression"); + } + let isOptionalCall = false; + if (this.match(18) && this.lookaheadCharCode() === 60) { + if (noCalls) { + state.stop = true; + return base; + } + state.optionalChainMember = isOptionalCall = true; + this.next(); + } + if (this.match(47) || this.match(51)) { + let missingParenErrorLoc; + const result = this.tsTryParseAndCatch(() => { + if (!noCalls && this.atPossibleAsyncArrow(base)) { + const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startLoc); + if (asyncArrowFn) { + return asyncArrowFn; + } + } + const typeArguments = this.tsParseTypeArgumentsInExpression(); + if (!typeArguments) return; + if (isOptionalCall && !this.match(10)) { + missingParenErrorLoc = this.state.curPosition(); + return; + } + if (tokenIsTemplate(this.state.type)) { + const result = super.parseTaggedTemplateExpression(base, startLoc, state); + result.typeParameters = typeArguments; + return result; + } + if (!noCalls && this.eat(10)) { + const node = this.startNodeAt(startLoc); + node.callee = base; + node.arguments = this.parseCallExpressionArguments(11, false); + this.tsCheckForInvalidTypeCasts(node.arguments); + node.typeParameters = typeArguments; + if (state.optionalChainMember) { + node.optional = isOptionalCall; + } + return this.finishCallExpression(node, state.optionalChainMember); + } + const tokenType = this.state.type; + if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) { + return; + } + const node = this.startNodeAt(startLoc); + node.expression = base; + node.typeParameters = typeArguments; + return this.finishNode(node, "TSInstantiationExpression"); + }); + if (missingParenErrorLoc) { + this.unexpected(missingParenErrorLoc, 10); + } + if (result) { + if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) { + this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, { + at: this.state.startLoc + }); + } + return result; + } + } + return super.parseSubscript(base, startLoc, noCalls, state); + } + parseNewCallee(node) { + var _callee$extra; + super.parseNewCallee(node); + const { + callee + } = node; + if (callee.type === "TSInstantiationExpression" && !((_callee$extra = callee.extra) != null && _callee$extra.parenthesized)) { + node.typeParameters = callee.typeParameters; + node.callee = callee.expression; + } + } + parseExprOp(left, leftStartLoc, minPrec) { + let isSatisfies; + if (tokenOperatorPrecedence(58) > minPrec && !this.hasPrecedingLineBreak() && (this.isContextual(93) || (isSatisfies = this.isContextual(118)))) { + const node = this.startNodeAt(leftStartLoc); + node.expression = left; + node.typeAnnotation = this.tsInType(() => { + this.next(); + if (this.match(75)) { + if (isSatisfies) { + this.raise(Errors.UnexpectedKeyword, { + at: this.state.startLoc, + keyword: "const" + }); + } + return this.tsParseTypeReference(); + } + return this.tsParseType(); + }); + this.finishNode(node, isSatisfies ? "TSSatisfiesExpression" : "TSAsExpression"); + this.reScan_lt_gt(); + return this.parseExprOp(node, leftStartLoc, minPrec); + } + return super.parseExprOp(left, leftStartLoc, minPrec); + } + checkReservedWord(word, startLoc, checkKeywords, isBinding) { + if (!this.state.isAmbientContext) { + super.checkReservedWord(word, startLoc, checkKeywords, isBinding); + } + } + checkImportReflection(node) { + super.checkImportReflection(node); + if (node.module && node.importKind !== "value") { + this.raise(TSErrors.ImportReflectionHasImportType, { + at: node.specifiers[0].loc.start + }); + } + } + checkDuplicateExports() {} + isPotentialImportPhase(isExport) { + if (super.isPotentialImportPhase(isExport)) return true; + if (this.isContextual(128)) { + const ch = this.lookaheadCharCode(); + return isExport ? ch === 123 || ch === 42 : ch !== 61; + } + return !isExport && this.isContextual(87); + } + applyImportPhase(node, isExport, phase, loc) { + super.applyImportPhase(node, isExport, phase, loc); + if (isExport) { + node.exportKind = phase === "type" ? "type" : "value"; + } else { + node.importKind = phase === "type" || phase === "typeof" ? phase : "value"; + } + } + parseImport(node) { + if (this.match(131)) { + node.importKind = "value"; + return super.parseImport(node); + } + let importNode; + if (tokenIsIdentifier(this.state.type) && this.lookaheadCharCode() === 61) { + node.importKind = "value"; + return this.tsParseImportEqualsDeclaration(node); + } else if (this.isContextual(128)) { + const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false); + if (this.lookaheadCharCode() === 61) { + return this.tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier); + } else { + importNode = super.parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier); + } + } else { + importNode = super.parseImport(node); + } + if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") { + this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, { + at: importNode + }); + } + return importNode; + } + parseExport(node, decorators) { + if (this.match(83)) { + this.next(); + let maybeDefaultIdentifier = null; + if (this.isContextual(128) && this.isPotentialImportPhase(false)) { + maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false); + } else { + node.importKind = "value"; + } + return this.tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, true); + } else if (this.eat(29)) { + const assign = node; + assign.expression = super.parseExpression(); + this.semicolon(); + this.sawUnambiguousESM = true; + return this.finishNode(assign, "TSExportAssignment"); + } else if (this.eatContextual(93)) { + const decl = node; + this.expectContextual(126); + decl.id = this.parseIdentifier(); + this.semicolon(); + return this.finishNode(decl, "TSNamespaceExportDeclaration"); + } else { + return super.parseExport(node, decorators); + } + } + isAbstractClass() { + return this.isContextual(122) && this.lookahead().type === 80; + } + parseExportDefaultExpression() { + if (this.isAbstractClass()) { + const cls = this.startNode(); + this.next(); + cls.abstract = true; + return this.parseClass(cls, true, true); + } + if (this.match(127)) { + const result = this.tsParseInterfaceDeclaration(this.startNode()); + if (result) return result; + } + return super.parseExportDefaultExpression(); + } + parseVarStatement(node, kind, allowMissingInitializer = false) { + const { + isAmbientContext + } = this.state; + const declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext); + if (!isAmbientContext) return declaration; + for (const { + id, + init + } of declaration.declarations) { + if (!init) continue; + if (kind !== "const" || !!id.typeAnnotation) { + this.raise(TSErrors.InitializerNotAllowedInAmbientContext, { + at: init + }); + } else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) { + this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, { + at: init + }); + } + } + return declaration; + } + parseStatementContent(flags, decorators) { + if (this.match(75) && this.isLookaheadContextual("enum")) { + const node = this.startNode(); + this.expect(75); + return this.tsParseEnumDeclaration(node, { + const: true + }); + } + if (this.isContextual(124)) { + return this.tsParseEnumDeclaration(this.startNode()); + } + if (this.isContextual(127)) { + const result = this.tsParseInterfaceDeclaration(this.startNode()); + if (result) return result; + } + return super.parseStatementContent(flags, decorators); + } + parseAccessModifier() { + return this.tsParseModifier(["public", "protected", "private"]); + } + tsHasSomeModifiers(member, modifiers) { + return modifiers.some(modifier => { + if (tsIsAccessModifier(modifier)) { + return member.accessibility === modifier; + } + return !!member[modifier]; + }); + } + tsIsStartOfStaticBlocks() { + return this.isContextual(104) && this.lookaheadCharCode() === 123; + } + parseClassMember(classBody, member, state) { + const modifiers = ["declare", "private", "public", "protected", "override", "abstract", "readonly", "static"]; + this.tsParseModifiers({ + allowedModifiers: modifiers, + disallowedModifiers: ["in", "out"], + stopOnStartOfClassStaticBlock: true, + errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions + }, member); + const callParseClassMemberWithIsStatic = () => { + if (this.tsIsStartOfStaticBlocks()) { + this.next(); + this.next(); + if (this.tsHasSomeModifiers(member, modifiers)) { + this.raise(TSErrors.StaticBlockCannotHaveModifier, { + at: this.state.curPosition() + }); + } + super.parseClassStaticBlock(classBody, member); + } else { + this.parseClassMemberWithIsStatic(classBody, member, state, !!member.static); + } + }; + if (member.declare) { + this.tsInAmbientContext(callParseClassMemberWithIsStatic); + } else { + callParseClassMemberWithIsStatic(); + } + } + parseClassMemberWithIsStatic(classBody, member, state, isStatic) { + const idx = this.tsTryParseIndexSignature(member); + if (idx) { + classBody.body.push(idx); + if (member.abstract) { + this.raise(TSErrors.IndexSignatureHasAbstract, { + at: member + }); + } + if (member.accessibility) { + this.raise(TSErrors.IndexSignatureHasAccessibility, { + at: member, + modifier: member.accessibility + }); + } + if (member.declare) { + this.raise(TSErrors.IndexSignatureHasDeclare, { + at: member + }); + } + if (member.override) { + this.raise(TSErrors.IndexSignatureHasOverride, { + at: member + }); + } + return; + } + if (!this.state.inAbstractClass && member.abstract) { + this.raise(TSErrors.NonAbstractClassHasAbstractMethod, { + at: member + }); + } + if (member.override) { + if (!state.hadSuperClass) { + this.raise(TSErrors.OverrideNotInSubClass, { + at: member + }); + } + } + super.parseClassMemberWithIsStatic(classBody, member, state, isStatic); + } + parsePostMemberNameModifiers(methodOrProp) { + const optional = this.eat(17); + if (optional) methodOrProp.optional = true; + if (methodOrProp.readonly && this.match(10)) { + this.raise(TSErrors.ClassMethodHasReadonly, { + at: methodOrProp + }); + } + if (methodOrProp.declare && this.match(10)) { + this.raise(TSErrors.ClassMethodHasDeclare, { + at: methodOrProp + }); + } + } + parseExpressionStatement(node, expr, decorators) { + const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr, decorators) : undefined; + return decl || super.parseExpressionStatement(node, expr, decorators); + } + shouldParseExportDeclaration() { + if (this.tsIsDeclarationStart()) return true; + return super.shouldParseExportDeclaration(); + } + parseConditional(expr, startLoc, refExpressionErrors) { + if (!this.state.maybeInArrowParameters || !this.match(17)) { + return super.parseConditional(expr, startLoc, refExpressionErrors); + } + const result = this.tryParse(() => super.parseConditional(expr, startLoc)); + if (!result.node) { + if (result.error) { + super.setOptionalParametersError(refExpressionErrors, result.error); + } + return expr; + } + if (result.error) this.state = result.failState; + return result.node; + } + parseParenItem(node, startLoc) { + node = super.parseParenItem(node, startLoc); + if (this.eat(17)) { + node.optional = true; + this.resetEndLocation(node); + } + if (this.match(14)) { + const typeCastNode = this.startNodeAt(startLoc); + typeCastNode.expression = node; + typeCastNode.typeAnnotation = this.tsParseTypeAnnotation(); + return this.finishNode(typeCastNode, "TSTypeCastExpression"); + } + return node; + } + parseExportDeclaration(node) { + if (!this.state.isAmbientContext && this.isContextual(123)) { + return this.tsInAmbientContext(() => this.parseExportDeclaration(node)); + } + const startLoc = this.state.startLoc; + const isDeclare = this.eatContextual(123); + if (isDeclare && (this.isContextual(123) || !this.shouldParseExportDeclaration())) { + throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, { + at: this.state.startLoc + }); + } + const isIdentifier = tokenIsIdentifier(this.state.type); + const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node); + if (!declaration) return null; + if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) { + node.exportKind = "type"; + } + if (isDeclare) { + this.resetStartLocation(declaration, startLoc); + declaration.declare = true; + } + return declaration; + } + parseClassId(node, isStatement, optionalId, bindingType) { + if ((!isStatement || optionalId) && this.isContextual(111)) { + return; + } + super.parseClassId(node, isStatement, optionalId, node.declare ? 1024 : 8331); + const typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers); + if (typeParameters) node.typeParameters = typeParameters; + } + parseClassPropertyAnnotation(node) { + if (!node.optional) { + if (this.eat(35)) { + node.definite = true; + } else if (this.eat(17)) { + node.optional = true; + } + } + const type = this.tsTryParseTypeAnnotation(); + if (type) node.typeAnnotation = type; + } + parseClassProperty(node) { + this.parseClassPropertyAnnotation(node); + if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) { + this.raise(TSErrors.DeclareClassFieldHasInitializer, { + at: this.state.startLoc + }); + } + if (node.abstract && this.match(29)) { + const { + key + } = node; + this.raise(TSErrors.AbstractPropertyHasInitializer, { + at: this.state.startLoc, + propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]` + }); + } + return super.parseClassProperty(node); + } + parseClassPrivateProperty(node) { + if (node.abstract) { + this.raise(TSErrors.PrivateElementHasAbstract, { + at: node + }); + } + if (node.accessibility) { + this.raise(TSErrors.PrivateElementHasAccessibility, { + at: node, + modifier: node.accessibility + }); + } + this.parseClassPropertyAnnotation(node); + return super.parseClassPrivateProperty(node); + } + parseClassAccessorProperty(node) { + this.parseClassPropertyAnnotation(node); + if (node.optional) { + this.raise(TSErrors.AccessorCannotBeOptional, { + at: node + }); + } + return super.parseClassAccessorProperty(node); + } + pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) { + const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier); + if (typeParameters && isConstructor) { + this.raise(TSErrors.ConstructorHasTypeParameters, { + at: typeParameters + }); + } + const { + declare = false, + kind + } = method; + if (declare && (kind === "get" || kind === "set")) { + this.raise(TSErrors.DeclareAccessor, { + at: method, + kind + }); + } + if (typeParameters) method.typeParameters = typeParameters; + super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper); + } + pushClassPrivateMethod(classBody, method, isGenerator, isAsync) { + const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier); + if (typeParameters) method.typeParameters = typeParameters; + super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync); + } + declareClassPrivateMethodInScope(node, kind) { + if (node.type === "TSDeclareMethod") return; + if (node.type === "MethodDefinition" && !node.value.body) return; + super.declareClassPrivateMethodInScope(node, kind); + } + parseClassSuper(node) { + super.parseClassSuper(node); + if (node.superClass && (this.match(47) || this.match(51))) { + node.superTypeParameters = this.tsParseTypeArgumentsInExpression(); + } + if (this.eatContextual(111)) { + node.implements = this.tsParseHeritageClause("implements"); + } + } + parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) { + const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier); + if (typeParameters) prop.typeParameters = typeParameters; + return super.parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors); + } + parseFunctionParams(node, isConstructor) { + const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier); + if (typeParameters) node.typeParameters = typeParameters; + super.parseFunctionParams(node, isConstructor); + } + parseVarId(decl, kind) { + super.parseVarId(decl, kind); + if (decl.id.type === "Identifier" && !this.hasPrecedingLineBreak() && this.eat(35)) { + decl.definite = true; + } + const type = this.tsTryParseTypeAnnotation(); + if (type) { + decl.id.typeAnnotation = type; + this.resetEndLocation(decl.id); + } + } + parseAsyncArrowFromCallExpression(node, call) { + if (this.match(14)) { + node.returnType = this.tsParseTypeAnnotation(); + } + return super.parseAsyncArrowFromCallExpression(node, call); + } + parseMaybeAssign(refExpressionErrors, afterLeftParse) { + var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2; + let state; + let jsx; + let typeCast; + if (this.hasPlugin("jsx") && (this.match(140) || this.match(47))) { + state = this.state.clone(); + jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state); + if (!jsx.error) return jsx.node; + const { + context + } = this.state; + const currentContext = context[context.length - 1]; + if (currentContext === types.j_oTag || currentContext === types.j_expr) { + context.pop(); + } + } + if (!((_jsx = jsx) != null && _jsx.error) && !this.match(47)) { + return super.parseMaybeAssign(refExpressionErrors, afterLeftParse); + } + if (!state || state === this.state) state = this.state.clone(); + let typeParameters; + const arrow = this.tryParse(abort => { + var _expr$extra, _typeParameters; + typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier); + const expr = super.parseMaybeAssign(refExpressionErrors, afterLeftParse); + if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) { + abort(); + } + if (((_typeParameters = typeParameters) == null ? void 0 : _typeParameters.params.length) !== 0) { + this.resetStartLocationFromNode(expr, typeParameters); + } + expr.typeParameters = typeParameters; + return expr; + }, state); + if (!arrow.error && !arrow.aborted) { + if (typeParameters) this.reportReservedArrowTypeParam(typeParameters); + return arrow.node; + } + if (!jsx) { + assert(!this.hasPlugin("jsx")); + typeCast = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state); + if (!typeCast.error) return typeCast.node; + } + if ((_jsx2 = jsx) != null && _jsx2.node) { + this.state = jsx.failState; + return jsx.node; + } + if (arrow.node) { + this.state = arrow.failState; + if (typeParameters) this.reportReservedArrowTypeParam(typeParameters); + return arrow.node; + } + if ((_typeCast = typeCast) != null && _typeCast.node) { + this.state = typeCast.failState; + return typeCast.node; + } + throw ((_jsx3 = jsx) == null ? void 0 : _jsx3.error) || arrow.error || ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.error); + } + reportReservedArrowTypeParam(node) { + var _node$extra; + if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) { + this.raise(TSErrors.ReservedArrowTypeParam, { + at: node + }); + } + } + parseMaybeUnary(refExpressionErrors, sawUnary) { + if (!this.hasPlugin("jsx") && this.match(47)) { + return this.tsParseTypeAssertion(); + } + return super.parseMaybeUnary(refExpressionErrors, sawUnary); + } + parseArrow(node) { + if (this.match(14)) { + const result = this.tryParse(abort => { + const returnType = this.tsParseTypeOrTypePredicateAnnotation(14); + if (this.canInsertSemicolon() || !this.match(19)) abort(); + return returnType; + }); + if (result.aborted) return; + if (!result.thrown) { + if (result.error) this.state = result.failState; + node.returnType = result.node; + } + } + return super.parseArrow(node); + } + parseAssignableListItemTypes(param, flags) { + if (!(flags & 2)) return param; + if (this.eat(17)) { + param.optional = true; + } + const type = this.tsTryParseTypeAnnotation(); + if (type) param.typeAnnotation = type; + this.resetEndLocation(param); + return param; + } + isAssignable(node, isBinding) { + switch (node.type) { + case "TSTypeCastExpression": + return this.isAssignable(node.expression, isBinding); + case "TSParameterProperty": + return true; + default: + return super.isAssignable(node, isBinding); + } + } + toAssignable(node, isLHS = false) { + switch (node.type) { + case "ParenthesizedExpression": + this.toAssignableParenthesizedExpression(node, isLHS); + break; + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSNonNullExpression": + case "TSTypeAssertion": + if (isLHS) { + this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, { + at: node + }); + } else { + this.raise(TSErrors.UnexpectedTypeCastInParameter, { + at: node + }); + } + this.toAssignable(node.expression, isLHS); + break; + case "AssignmentExpression": + if (!isLHS && node.left.type === "TSTypeCastExpression") { + node.left = this.typeCastToParameter(node.left); + } + default: + super.toAssignable(node, isLHS); + } + } + toAssignableParenthesizedExpression(node, isLHS) { + switch (node.expression.type) { + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSNonNullExpression": + case "TSTypeAssertion": + case "ParenthesizedExpression": + this.toAssignable(node.expression, isLHS); + break; + default: + super.toAssignable(node, isLHS); + } + } + checkToRestConversion(node, allowPattern) { + switch (node.type) { + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSNonNullExpression": + this.checkToRestConversion(node.expression, false); + break; + default: + super.checkToRestConversion(node, allowPattern); + } + } + isValidLVal(type, isUnparenthesizedInAssign, binding) { + return getOwn({ + TSTypeCastExpression: true, + TSParameterProperty: "parameter", + TSNonNullExpression: "expression", + TSAsExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true], + TSSatisfiesExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true], + TSTypeAssertion: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true] + }, type) || super.isValidLVal(type, isUnparenthesizedInAssign, binding); + } + parseBindingAtom() { + if (this.state.type === 78) { + return this.parseIdentifier(true); + } + return super.parseBindingAtom(); + } + parseMaybeDecoratorArguments(expr) { + if (this.match(47) || this.match(51)) { + const typeArguments = this.tsParseTypeArgumentsInExpression(); + if (this.match(10)) { + const call = super.parseMaybeDecoratorArguments(expr); + call.typeParameters = typeArguments; + return call; + } + this.unexpected(null, 10); + } + return super.parseMaybeDecoratorArguments(expr); + } + checkCommaAfterRest(close) { + if (this.state.isAmbientContext && this.match(12) && this.lookaheadCharCode() === close) { + this.next(); + return false; + } + return super.checkCommaAfterRest(close); + } + isClassMethod() { + return this.match(47) || super.isClassMethod(); + } + isClassProperty() { + return this.match(35) || this.match(14) || super.isClassProperty(); + } + parseMaybeDefault(startLoc, left) { + const node = super.parseMaybeDefault(startLoc, left); + if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) { + this.raise(TSErrors.TypeAnnotationAfterAssign, { + at: node.typeAnnotation + }); + } + return node; + } + getTokenFromCode(code) { + if (this.state.inType) { + if (code === 62) { + this.finishOp(48, 1); + return; + } + if (code === 60) { + this.finishOp(47, 1); + return; + } + } + super.getTokenFromCode(code); + } + reScan_lt_gt() { + const { + type + } = this.state; + if (type === 47) { + this.state.pos -= 1; + this.readToken_lt(); + } else if (type === 48) { + this.state.pos -= 1; + this.readToken_gt(); + } + } + reScan_lt() { + const { + type + } = this.state; + if (type === 51) { + this.state.pos -= 2; + this.finishOp(47, 1); + return 47; + } + return type; + } + toAssignableList(exprList, trailingCommaLoc, isLHS) { + for (let i = 0; i < exprList.length; i++) { + const expr = exprList[i]; + if ((expr == null ? void 0 : expr.type) === "TSTypeCastExpression") { + exprList[i] = this.typeCastToParameter(expr); + } + } + super.toAssignableList(exprList, trailingCommaLoc, isLHS); + } + typeCastToParameter(node) { + node.expression.typeAnnotation = node.typeAnnotation; + this.resetEndLocation(node.expression, node.typeAnnotation.loc.end); + return node.expression; + } + shouldParseArrow(params) { + if (this.match(14)) { + return params.every(expr => this.isAssignable(expr, true)); + } + return super.shouldParseArrow(params); + } + shouldParseAsyncArrow() { + return this.match(14) || super.shouldParseAsyncArrow(); + } + canHaveLeadingDecorator() { + return super.canHaveLeadingDecorator() || this.isAbstractClass(); + } + jsxParseOpeningElementAfterName(node) { + if (this.match(47) || this.match(51)) { + const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression()); + if (typeArguments) node.typeParameters = typeArguments; + } + return super.jsxParseOpeningElementAfterName(node); + } + getGetterSetterExpectedParamCount(method) { + const baseCount = super.getGetterSetterExpectedParamCount(method); + const params = this.getObjectOrClassMethodParams(method); + const firstParam = params[0]; + const hasContextParam = firstParam && this.isThisParam(firstParam); + return hasContextParam ? baseCount + 1 : baseCount; + } + parseCatchClauseParam() { + const param = super.parseCatchClauseParam(); + const type = this.tsTryParseTypeAnnotation(); + if (type) { + param.typeAnnotation = type; + this.resetEndLocation(param); + } + return param; + } + tsInAmbientContext(cb) { + const oldIsAmbientContext = this.state.isAmbientContext; + this.state.isAmbientContext = true; + try { + return cb(); + } finally { + this.state.isAmbientContext = oldIsAmbientContext; + } + } + parseClass(node, isStatement, optionalId) { + const oldInAbstractClass = this.state.inAbstractClass; + this.state.inAbstractClass = !!node.abstract; + try { + return super.parseClass(node, isStatement, optionalId); + } finally { + this.state.inAbstractClass = oldInAbstractClass; + } + } + tsParseAbstractDeclaration(node, decorators) { + if (this.match(80)) { + node.abstract = true; + return this.maybeTakeDecorators(decorators, this.parseClass(node, true, false)); + } else if (this.isContextual(127)) { + if (!this.hasFollowingLineBreak()) { + node.abstract = true; + this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, { + at: node + }); + return this.tsParseInterfaceDeclaration(node); + } + } else { + this.unexpected(null, 80); + } + } + parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) { + const method = super.parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope); + if (method.abstract) { + const hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body; + if (hasBody) { + const { + key + } = method; + this.raise(TSErrors.AbstractMethodHasImplementation, { + at: method, + methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]` + }); + } + } + return method; + } + tsParseTypeParameterName() { + const typeName = this.parseIdentifier(); + return typeName.name; + } + shouldParseAsAmbientContext() { + return !!this.getPluginOption("typescript", "dts"); + } + parse() { + if (this.shouldParseAsAmbientContext()) { + this.state.isAmbientContext = true; + } + return super.parse(); + } + getExpression() { + if (this.shouldParseAsAmbientContext()) { + this.state.isAmbientContext = true; + } + return super.getExpression(); + } + parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) { + if (!isString && isMaybeTypeOnly) { + this.parseTypeOnlyImportExportSpecifier(node, false, isInTypeExport); + return this.finishNode(node, "ExportSpecifier"); + } + node.exportKind = "value"; + return super.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly); + } + parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) { + if (!importedIsString && isMaybeTypeOnly) { + this.parseTypeOnlyImportExportSpecifier(specifier, true, isInTypeOnlyImport); + return this.finishNode(specifier, "ImportSpecifier"); + } + specifier.importKind = "value"; + return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, isInTypeOnlyImport ? 4098 : 4096); + } + parseTypeOnlyImportExportSpecifier(node, isImport, isInTypeOnlyImportExport) { + const leftOfAsKey = isImport ? "imported" : "local"; + const rightOfAsKey = isImport ? "local" : "exported"; + let leftOfAs = node[leftOfAsKey]; + let rightOfAs; + let hasTypeSpecifier = false; + let canParseAsKeyword = true; + const loc = leftOfAs.loc.start; + if (this.isContextual(93)) { + const firstAs = this.parseIdentifier(); + if (this.isContextual(93)) { + const secondAs = this.parseIdentifier(); + if (tokenIsKeywordOrIdentifier(this.state.type)) { + hasTypeSpecifier = true; + leftOfAs = firstAs; + rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName(); + canParseAsKeyword = false; + } else { + rightOfAs = secondAs; + canParseAsKeyword = false; + } + } else if (tokenIsKeywordOrIdentifier(this.state.type)) { + canParseAsKeyword = false; + rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName(); + } else { + hasTypeSpecifier = true; + leftOfAs = firstAs; + } + } else if (tokenIsKeywordOrIdentifier(this.state.type)) { + hasTypeSpecifier = true; + if (isImport) { + leftOfAs = this.parseIdentifier(true); + if (!this.isContextual(93)) { + this.checkReservedWord(leftOfAs.name, leftOfAs.loc.start, true, true); + } + } else { + leftOfAs = this.parseModuleExportName(); + } + } + if (hasTypeSpecifier && isInTypeOnlyImportExport) { + this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, { + at: loc + }); + } + node[leftOfAsKey] = leftOfAs; + node[rightOfAsKey] = rightOfAs; + const kindKey = isImport ? "importKind" : "exportKind"; + node[kindKey] = hasTypeSpecifier ? "type" : "value"; + if (canParseAsKeyword && this.eatContextual(93)) { + node[rightOfAsKey] = isImport ? this.parseIdentifier() : this.parseModuleExportName(); + } + if (!node[rightOfAsKey]) { + node[rightOfAsKey] = cloneIdentifier(node[leftOfAsKey]); + } + if (isImport) { + this.checkIdentifier(node[rightOfAsKey], hasTypeSpecifier ? 4098 : 4096); + } + } +}; +function isPossiblyLiteralEnum(expression) { + if (expression.type !== "MemberExpression") return false; + const { + computed, + property + } = expression; + if (computed && property.type !== "StringLiteral" && (property.type !== "TemplateLiteral" || property.expressions.length > 0)) { + return false; + } + return isUncomputedMemberExpressionChain(expression.object); +} +function isValidAmbientConstInitializer(expression, estree) { + var _expression$extra; + const { + type + } = expression; + if ((_expression$extra = expression.extra) != null && _expression$extra.parenthesized) { + return false; + } + if (estree) { + if (type === "Literal") { + const { + value + } = expression; + if (typeof value === "string" || typeof value === "boolean") { + return true; + } + } + } else { + if (type === "StringLiteral" || type === "BooleanLiteral") { + return true; + } + } + if (isNumber(expression, estree) || isNegativeNumber(expression, estree)) { + return true; + } + if (type === "TemplateLiteral" && expression.expressions.length === 0) { + return true; + } + if (isPossiblyLiteralEnum(expression)) { + return true; + } + return false; +} +function isNumber(expression, estree) { + if (estree) { + return expression.type === "Literal" && (typeof expression.value === "number" || "bigint" in expression); + } + return expression.type === "NumericLiteral" || expression.type === "BigIntLiteral"; +} +function isNegativeNumber(expression, estree) { + if (expression.type === "UnaryExpression") { + const { + operator, + argument + } = expression; + if (operator === "-" && isNumber(argument, estree)) { + return true; + } + } + return false; +} +function isUncomputedMemberExpressionChain(expression) { + if (expression.type === "Identifier") return true; + if (expression.type !== "MemberExpression" || expression.computed) { + return false; + } + return isUncomputedMemberExpressionChain(expression.object); +} +const PlaceholderErrors = ParseErrorEnum`placeholders`({ + ClassNameIsRequired: "A class name is required.", + UnexpectedSpace: "Unexpected space in placeholder." +}); +var placeholders = superClass => class PlaceholdersParserMixin extends superClass { + parsePlaceholder(expectedNode) { + if (this.match(142)) { + const node = this.startNode(); + this.next(); + this.assertNoSpace(); + node.name = super.parseIdentifier(true); + this.assertNoSpace(); + this.expect(142); + return this.finishPlaceholder(node, expectedNode); + } + } + finishPlaceholder(node, expectedNode) { + const isFinished = !!(node.expectedNode && node.type === "Placeholder"); + node.expectedNode = expectedNode; + return isFinished ? node : this.finishNode(node, "Placeholder"); + } + getTokenFromCode(code) { + if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) { + this.finishOp(142, 2); + } else { + super.getTokenFromCode(code); + } + } + parseExprAtom(refExpressionErrors) { + return this.parsePlaceholder("Expression") || super.parseExprAtom(refExpressionErrors); + } + parseIdentifier(liberal) { + return this.parsePlaceholder("Identifier") || super.parseIdentifier(liberal); + } + checkReservedWord(word, startLoc, checkKeywords, isBinding) { + if (word !== undefined) { + super.checkReservedWord(word, startLoc, checkKeywords, isBinding); + } + } + parseBindingAtom() { + return this.parsePlaceholder("Pattern") || super.parseBindingAtom(); + } + isValidLVal(type, isParenthesized, binding) { + return type === "Placeholder" || super.isValidLVal(type, isParenthesized, binding); + } + toAssignable(node, isLHS) { + if (node && node.type === "Placeholder" && node.expectedNode === "Expression") { + node.expectedNode = "Pattern"; + } else { + super.toAssignable(node, isLHS); + } + } + chStartsBindingIdentifier(ch, pos) { + if (super.chStartsBindingIdentifier(ch, pos)) { + return true; + } + const nextToken = this.lookahead(); + if (nextToken.type === 142) { + return true; + } + return false; + } + verifyBreakContinue(node, isBreak) { + if (node.label && node.label.type === "Placeholder") return; + super.verifyBreakContinue(node, isBreak); + } + parseExpressionStatement(node, expr) { + var _expr$extra; + if (expr.type !== "Placeholder" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) { + return super.parseExpressionStatement(node, expr); + } + if (this.match(14)) { + const stmt = node; + stmt.label = this.finishPlaceholder(expr, "Identifier"); + this.next(); + stmt.body = super.parseStatementOrSloppyAnnexBFunctionDeclaration(); + return this.finishNode(stmt, "LabeledStatement"); + } + this.semicolon(); + node.name = expr.name; + return this.finishPlaceholder(node, "Statement"); + } + parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) { + return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse); + } + parseFunctionId(requireId) { + return this.parsePlaceholder("Identifier") || super.parseFunctionId(requireId); + } + parseClass(node, isStatement, optionalId) { + const type = isStatement ? "ClassDeclaration" : "ClassExpression"; + this.next(); + const oldStrict = this.state.strict; + const placeholder = this.parsePlaceholder("Identifier"); + if (placeholder) { + if (this.match(81) || this.match(142) || this.match(5)) { + node.id = placeholder; + } else if (optionalId || !isStatement) { + node.id = null; + node.body = this.finishPlaceholder(placeholder, "ClassBody"); + return this.finishNode(node, type); + } else { + throw this.raise(PlaceholderErrors.ClassNameIsRequired, { + at: this.state.startLoc + }); + } + } else { + this.parseClassId(node, isStatement, optionalId); + } + super.parseClassSuper(node); + node.body = this.parsePlaceholder("ClassBody") || super.parseClassBody(!!node.superClass, oldStrict); + return this.finishNode(node, type); + } + parseExport(node, decorators) { + const placeholder = this.parsePlaceholder("Identifier"); + if (!placeholder) return super.parseExport(node, decorators); + if (!this.isContextual(97) && !this.match(12)) { + node.specifiers = []; + node.source = null; + node.declaration = this.finishPlaceholder(placeholder, "Declaration"); + return this.finishNode(node, "ExportNamedDeclaration"); + } + this.expectPlugin("exportDefaultFrom"); + const specifier = this.startNode(); + specifier.exported = placeholder; + node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")]; + return super.parseExport(node, decorators); + } + isExportDefaultSpecifier() { + if (this.match(65)) { + const next = this.nextTokenStart(); + if (this.isUnparsedContextual(next, "from")) { + if (this.input.startsWith(tokenLabelName(142), this.nextTokenStartSince(next + 4))) { + return true; + } + } + } + return super.isExportDefaultSpecifier(); + } + maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) { + var _specifiers; + if ((_specifiers = node.specifiers) != null && _specifiers.length) { + return true; + } + return super.maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier); + } + checkExport(node) { + const { + specifiers + } = node; + if (specifiers != null && specifiers.length) { + node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder"); + } + super.checkExport(node); + node.specifiers = specifiers; + } + parseImport(node) { + const placeholder = this.parsePlaceholder("Identifier"); + if (!placeholder) return super.parseImport(node); + node.specifiers = []; + if (!this.isContextual(97) && !this.match(12)) { + node.source = this.finishPlaceholder(placeholder, "StringLiteral"); + this.semicolon(); + return this.finishNode(node, "ImportDeclaration"); + } + const specifier = this.startNodeAtNode(placeholder); + specifier.local = placeholder; + node.specifiers.push(this.finishNode(specifier, "ImportDefaultSpecifier")); + if (this.eat(12)) { + const hasStarImport = this.maybeParseStarImportSpecifier(node); + if (!hasStarImport) this.parseNamedImportSpecifiers(node); + } + this.expectContextual(97); + node.source = this.parseImportSource(); + this.semicolon(); + return this.finishNode(node, "ImportDeclaration"); + } + parseImportSource() { + return this.parsePlaceholder("StringLiteral") || super.parseImportSource(); + } + assertNoSpace() { + if (this.state.start > this.state.lastTokEndLoc.index) { + this.raise(PlaceholderErrors.UnexpectedSpace, { + at: this.state.lastTokEndLoc + }); + } + } +}; +var v8intrinsic = superClass => class V8IntrinsicMixin extends superClass { + parseV8Intrinsic() { + if (this.match(54)) { + const v8IntrinsicStartLoc = this.state.startLoc; + const node = this.startNode(); + this.next(); + if (tokenIsIdentifier(this.state.type)) { + const name = this.parseIdentifierName(); + const identifier = this.createIdentifier(node, name); + identifier.type = "V8IntrinsicIdentifier"; + if (this.match(10)) { + return identifier; + } + } + this.unexpected(v8IntrinsicStartLoc); + } + } + parseExprAtom(refExpressionErrors) { + return this.parseV8Intrinsic() || super.parseExprAtom(refExpressionErrors); + } +}; +function hasPlugin(plugins, expectedConfig) { + const [expectedName, expectedOptions] = typeof expectedConfig === "string" ? [expectedConfig, {}] : expectedConfig; + const expectedKeys = Object.keys(expectedOptions); + const expectedOptionsIsEmpty = expectedKeys.length === 0; + return plugins.some(p => { + if (typeof p === "string") { + return expectedOptionsIsEmpty && p === expectedName; + } else { + const [pluginName, pluginOptions] = p; + if (pluginName !== expectedName) { + return false; + } + for (const key of expectedKeys) { + if (pluginOptions[key] !== expectedOptions[key]) { + return false; + } + } + return true; + } + }); +} +function getPluginOption(plugins, name, option) { + const plugin = plugins.find(plugin => { + if (Array.isArray(plugin)) { + return plugin[0] === name; + } else { + return plugin === name; + } + }); + if (plugin && Array.isArray(plugin) && plugin.length > 1) { + return plugin[1][option]; + } + return null; +} +const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"]; +const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"]; +const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"]; +function validatePlugins(plugins) { + if (hasPlugin(plugins, "decorators")) { + if (hasPlugin(plugins, "decorators-legacy")) { + throw new Error("Cannot use the decorators and decorators-legacy plugin together"); + } + const decoratorsBeforeExport = getPluginOption(plugins, "decorators", "decoratorsBeforeExport"); + if (decoratorsBeforeExport != null && typeof decoratorsBeforeExport !== "boolean") { + throw new Error("'decoratorsBeforeExport' must be a boolean, if specified."); + } + const allowCallParenthesized = getPluginOption(plugins, "decorators", "allowCallParenthesized"); + if (allowCallParenthesized != null && typeof allowCallParenthesized !== "boolean") { + throw new Error("'allowCallParenthesized' must be a boolean."); + } + } + if (hasPlugin(plugins, "flow") && hasPlugin(plugins, "typescript")) { + throw new Error("Cannot combine flow and typescript plugins."); + } + if (hasPlugin(plugins, "placeholders") && hasPlugin(plugins, "v8intrinsic")) { + throw new Error("Cannot combine placeholders and v8intrinsic plugins."); + } + if (hasPlugin(plugins, "pipelineOperator")) { + const proposal = getPluginOption(plugins, "pipelineOperator", "proposal"); + if (!PIPELINE_PROPOSALS.includes(proposal)) { + const proposalList = PIPELINE_PROPOSALS.map(p => `"${p}"`).join(", "); + throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`); + } + const tupleSyntaxIsHash = hasPlugin(plugins, ["recordAndTuple", { + syntaxType: "hash" + }]); + if (proposal === "hack") { + if (hasPlugin(plugins, "placeholders")) { + throw new Error("Cannot combine placeholders plugin and Hack-style pipes."); + } + if (hasPlugin(plugins, "v8intrinsic")) { + throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes."); + } + const topicToken = getPluginOption(plugins, "pipelineOperator", "topicToken"); + if (!TOPIC_TOKENS.includes(topicToken)) { + const tokenList = TOPIC_TOKENS.map(t => `"${t}"`).join(", "); + throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`); + } + if (topicToken === "#" && tupleSyntaxIsHash) { + throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "hack", topicToken: "#" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.'); + } + } else if (proposal === "smart" && tupleSyntaxIsHash) { + throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "smart" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.'); + } + } + if (hasPlugin(plugins, "moduleAttributes")) { + { + if (hasPlugin(plugins, "importAssertions") || hasPlugin(plugins, "importAttributes")) { + throw new Error("Cannot combine importAssertions, importAttributes and moduleAttributes plugins."); + } + const moduleAttributesVersionPluginOption = getPluginOption(plugins, "moduleAttributes", "version"); + if (moduleAttributesVersionPluginOption !== "may-2020") { + throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'."); + } + } + } + if (hasPlugin(plugins, "importAssertions") && hasPlugin(plugins, "importAttributes")) { + throw new Error("Cannot combine importAssertions and importAttributes plugins."); + } + if (hasPlugin(plugins, "recordAndTuple") && getPluginOption(plugins, "recordAndTuple", "syntaxType") != null && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) { + throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", ")); + } + if (hasPlugin(plugins, "asyncDoExpressions") && !hasPlugin(plugins, "doExpressions")) { + const error = new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins."); + error.missingPlugins = "doExpressions"; + throw error; + } +} +const mixinPlugins = { + estree, + jsx, + flow, + typescript, + v8intrinsic, + placeholders +}; +const mixinPluginNames = Object.keys(mixinPlugins); +const defaultOptions = { + sourceType: "script", + sourceFilename: undefined, + startColumn: 0, + startLine: 1, + allowAwaitOutsideFunction: false, + allowReturnOutsideFunction: false, + allowNewTargetOutsideFunction: false, + allowImportExportEverywhere: false, + allowSuperOutsideMethod: false, + allowUndeclaredExports: false, + plugins: [], + strictMode: null, + ranges: false, + tokens: false, + createParenthesizedExpressions: false, + errorRecovery: false, + attachComment: true, + annexB: true +}; +function getOptions(opts) { + if (opts == null) { + return Object.assign({}, defaultOptions); + } + if (opts.annexB != null && opts.annexB !== false) { + throw new Error("The `annexB` option can only be set to `false`."); + } + const options = {}; + for (const key of Object.keys(defaultOptions)) { + var _opts$key; + options[key] = (_opts$key = opts[key]) != null ? _opts$key : defaultOptions[key]; + } + return options; +} +class ExpressionParser extends LValParser { + checkProto(prop, isRecord, protoRef, refExpressionErrors) { + if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) { + return; + } + const key = prop.key; + const name = key.type === "Identifier" ? key.name : key.value; + if (name === "__proto__") { + if (isRecord) { + this.raise(Errors.RecordNoProto, { + at: key + }); + return; + } + if (protoRef.used) { + if (refExpressionErrors) { + if (refExpressionErrors.doubleProtoLoc === null) { + refExpressionErrors.doubleProtoLoc = key.loc.start; + } + } else { + this.raise(Errors.DuplicateProto, { + at: key + }); + } + } + protoRef.used = true; + } + } + shouldExitDescending(expr, potentialArrowAt) { + return expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt; + } + getExpression() { + this.enterInitialScopes(); + this.nextToken(); + const expr = this.parseExpression(); + if (!this.match(137)) { + this.unexpected(); + } + this.finalizeRemainingComments(); + expr.comments = this.state.comments; + expr.errors = this.state.errors; + if (this.options.tokens) { + expr.tokens = this.tokens; + } + return expr; + } + parseExpression(disallowIn, refExpressionErrors) { + if (disallowIn) { + return this.disallowInAnd(() => this.parseExpressionBase(refExpressionErrors)); + } + return this.allowInAnd(() => this.parseExpressionBase(refExpressionErrors)); + } + parseExpressionBase(refExpressionErrors) { + const startLoc = this.state.startLoc; + const expr = this.parseMaybeAssign(refExpressionErrors); + if (this.match(12)) { + const node = this.startNodeAt(startLoc); + node.expressions = [expr]; + while (this.eat(12)) { + node.expressions.push(this.parseMaybeAssign(refExpressionErrors)); + } + this.toReferencedList(node.expressions); + return this.finishNode(node, "SequenceExpression"); + } + return expr; + } + parseMaybeAssignDisallowIn(refExpressionErrors, afterLeftParse) { + return this.disallowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse)); + } + parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) { + return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse)); + } + setOptionalParametersError(refExpressionErrors, resultError) { + var _resultError$loc; + refExpressionErrors.optionalParametersLoc = (_resultError$loc = resultError == null ? void 0 : resultError.loc) != null ? _resultError$loc : this.state.startLoc; + } + parseMaybeAssign(refExpressionErrors, afterLeftParse) { + const startLoc = this.state.startLoc; + if (this.isContextual(106)) { + if (this.prodParam.hasYield) { + let left = this.parseYield(); + if (afterLeftParse) { + left = afterLeftParse.call(this, left, startLoc); + } + return left; + } + } + let ownExpressionErrors; + if (refExpressionErrors) { + ownExpressionErrors = false; + } else { + refExpressionErrors = new ExpressionErrors(); + ownExpressionErrors = true; + } + const { + type + } = this.state; + if (type === 10 || tokenIsIdentifier(type)) { + this.state.potentialArrowAt = this.state.start; + } + let left = this.parseMaybeConditional(refExpressionErrors); + if (afterLeftParse) { + left = afterLeftParse.call(this, left, startLoc); + } + if (tokenIsAssignment(this.state.type)) { + const node = this.startNodeAt(startLoc); + const operator = this.state.value; + node.operator = operator; + if (this.match(29)) { + this.toAssignable(left, true); + node.left = left; + const startIndex = startLoc.index; + if (refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startIndex) { + refExpressionErrors.doubleProtoLoc = null; + } + if (refExpressionErrors.shorthandAssignLoc != null && refExpressionErrors.shorthandAssignLoc.index >= startIndex) { + refExpressionErrors.shorthandAssignLoc = null; + } + if (refExpressionErrors.privateKeyLoc != null && refExpressionErrors.privateKeyLoc.index >= startIndex) { + this.checkDestructuringPrivate(refExpressionErrors); + refExpressionErrors.privateKeyLoc = null; + } + } else { + node.left = left; + } + this.next(); + node.right = this.parseMaybeAssign(); + this.checkLVal(left, { + in: this.finishNode(node, "AssignmentExpression") + }); + return node; + } else if (ownExpressionErrors) { + this.checkExpressionErrors(refExpressionErrors, true); + } + return left; + } + parseMaybeConditional(refExpressionErrors) { + const startLoc = this.state.startLoc; + const potentialArrowAt = this.state.potentialArrowAt; + const expr = this.parseExprOps(refExpressionErrors); + if (this.shouldExitDescending(expr, potentialArrowAt)) { + return expr; + } + return this.parseConditional(expr, startLoc, refExpressionErrors); + } + parseConditional(expr, startLoc, refExpressionErrors) { + if (this.eat(17)) { + const node = this.startNodeAt(startLoc); + node.test = expr; + node.consequent = this.parseMaybeAssignAllowIn(); + this.expect(14); + node.alternate = this.parseMaybeAssign(); + return this.finishNode(node, "ConditionalExpression"); + } + return expr; + } + parseMaybeUnaryOrPrivate(refExpressionErrors) { + return this.match(136) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors); + } + parseExprOps(refExpressionErrors) { + const startLoc = this.state.startLoc; + const potentialArrowAt = this.state.potentialArrowAt; + const expr = this.parseMaybeUnaryOrPrivate(refExpressionErrors); + if (this.shouldExitDescending(expr, potentialArrowAt)) { + return expr; + } + return this.parseExprOp(expr, startLoc, -1); + } + parseExprOp(left, leftStartLoc, minPrec) { + if (this.isPrivateName(left)) { + const value = this.getPrivateNameSV(left); + if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) { + this.raise(Errors.PrivateInExpectedIn, { + at: left, + identifierName: value + }); + } + this.classScope.usePrivateName(value, left.loc.start); + } + const op = this.state.type; + if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(58))) { + let prec = tokenOperatorPrecedence(op); + if (prec > minPrec) { + if (op === 39) { + this.expectPlugin("pipelineOperator"); + if (this.state.inFSharpPipelineDirectBody) { + return left; + } + this.checkPipelineAtInfixOperator(left, leftStartLoc); + } + const node = this.startNodeAt(leftStartLoc); + node.left = left; + node.operator = this.state.value; + const logical = op === 41 || op === 42; + const coalesce = op === 40; + if (coalesce) { + prec = tokenOperatorPrecedence(42); + } + this.next(); + if (op === 39 && this.hasPlugin(["pipelineOperator", { + proposal: "minimal" + }])) { + if (this.state.type === 96 && this.prodParam.hasAwait) { + throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, { + at: this.state.startLoc + }); + } + } + node.right = this.parseExprOpRightExpr(op, prec); + const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression"); + const nextOp = this.state.type; + if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) { + throw this.raise(Errors.MixingCoalesceWithLogical, { + at: this.state.startLoc + }); + } + return this.parseExprOp(finishedNode, leftStartLoc, minPrec); + } + } + return left; + } + parseExprOpRightExpr(op, prec) { + const startLoc = this.state.startLoc; + switch (op) { + case 39: + switch (this.getPluginOption("pipelineOperator", "proposal")) { + case "hack": + return this.withTopicBindingContext(() => { + return this.parseHackPipeBody(); + }); + case "smart": + return this.withTopicBindingContext(() => { + if (this.prodParam.hasYield && this.isContextual(106)) { + throw this.raise(Errors.PipeBodyIsTighter, { + at: this.state.startLoc + }); + } + return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc); + }); + case "fsharp": + return this.withSoloAwaitPermittingContext(() => { + return this.parseFSharpPipelineBody(prec); + }); + } + default: + return this.parseExprOpBaseRightExpr(op, prec); + } + } + parseExprOpBaseRightExpr(op, prec) { + const startLoc = this.state.startLoc; + return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, tokenIsRightAssociative(op) ? prec - 1 : prec); + } + parseHackPipeBody() { + var _body$extra; + const { + startLoc + } = this.state; + const body = this.parseMaybeAssign(); + const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type); + if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) { + this.raise(Errors.PipeUnparenthesizedBody, { + at: startLoc, + type: body.type + }); + } + if (!this.topicReferenceWasUsedInCurrentContext()) { + this.raise(Errors.PipeTopicUnused, { + at: startLoc + }); + } + return body; + } + checkExponentialAfterUnary(node) { + if (this.match(57)) { + this.raise(Errors.UnexpectedTokenUnaryExponentiation, { + at: node.argument + }); + } + } + parseMaybeUnary(refExpressionErrors, sawUnary) { + const startLoc = this.state.startLoc; + const isAwait = this.isContextual(96); + if (isAwait && this.isAwaitAllowed()) { + this.next(); + const expr = this.parseAwait(startLoc); + if (!sawUnary) this.checkExponentialAfterUnary(expr); + return expr; + } + const update = this.match(34); + const node = this.startNode(); + if (tokenIsPrefix(this.state.type)) { + node.operator = this.state.value; + node.prefix = true; + if (this.match(72)) { + this.expectPlugin("throwExpressions"); + } + const isDelete = this.match(89); + this.next(); + node.argument = this.parseMaybeUnary(null, true); + this.checkExpressionErrors(refExpressionErrors, true); + if (this.state.strict && isDelete) { + const arg = node.argument; + if (arg.type === "Identifier") { + this.raise(Errors.StrictDelete, { + at: node + }); + } else if (this.hasPropertyAsPrivateName(arg)) { + this.raise(Errors.DeletePrivateField, { + at: node + }); + } + } + if (!update) { + if (!sawUnary) { + this.checkExponentialAfterUnary(node); + } + return this.finishNode(node, "UnaryExpression"); + } + } + const expr = this.parseUpdate(node, update, refExpressionErrors); + if (isAwait) { + const { + type + } = this.state; + const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54); + if (startsExpr && !this.isAmbiguousAwait()) { + this.raiseOverwrite(Errors.AwaitNotInAsyncContext, { + at: startLoc + }); + return this.parseAwait(startLoc); + } + } + return expr; + } + parseUpdate(node, update, refExpressionErrors) { + if (update) { + const updateExpressionNode = node; + this.checkLVal(updateExpressionNode.argument, { + in: this.finishNode(updateExpressionNode, "UpdateExpression") + }); + return node; + } + const startLoc = this.state.startLoc; + let expr = this.parseExprSubscripts(refExpressionErrors); + if (this.checkExpressionErrors(refExpressionErrors, false)) return expr; + while (tokenIsPostfix(this.state.type) && !this.canInsertSemicolon()) { + const node = this.startNodeAt(startLoc); + node.operator = this.state.value; + node.prefix = false; + node.argument = expr; + this.next(); + this.checkLVal(expr, { + in: expr = this.finishNode(node, "UpdateExpression") + }); + } + return expr; + } + parseExprSubscripts(refExpressionErrors) { + const startLoc = this.state.startLoc; + const potentialArrowAt = this.state.potentialArrowAt; + const expr = this.parseExprAtom(refExpressionErrors); + if (this.shouldExitDescending(expr, potentialArrowAt)) { + return expr; + } + return this.parseSubscripts(expr, startLoc); + } + parseSubscripts(base, startLoc, noCalls) { + const state = { + optionalChainMember: false, + maybeAsyncArrow: this.atPossibleAsyncArrow(base), + stop: false + }; + do { + base = this.parseSubscript(base, startLoc, noCalls, state); + state.maybeAsyncArrow = false; + } while (!state.stop); + return base; + } + parseSubscript(base, startLoc, noCalls, state) { + const { + type + } = this.state; + if (!noCalls && type === 15) { + return this.parseBind(base, startLoc, noCalls, state); + } else if (tokenIsTemplate(type)) { + return this.parseTaggedTemplateExpression(base, startLoc, state); + } + let optional = false; + if (type === 18) { + if (noCalls) { + this.raise(Errors.OptionalChainingNoNew, { + at: this.state.startLoc + }); + if (this.lookaheadCharCode() === 40) { + state.stop = true; + return base; + } + } + state.optionalChainMember = optional = true; + this.next(); + } + if (!noCalls && this.match(10)) { + return this.parseCoverCallAndAsyncArrowHead(base, startLoc, state, optional); + } else { + const computed = this.eat(0); + if (computed || optional || this.eat(16)) { + return this.parseMember(base, startLoc, state, computed, optional); + } else { + state.stop = true; + return base; + } + } + } + parseMember(base, startLoc, state, computed, optional) { + const node = this.startNodeAt(startLoc); + node.object = base; + node.computed = computed; + if (computed) { + node.property = this.parseExpression(); + this.expect(3); + } else if (this.match(136)) { + if (base.type === "Super") { + this.raise(Errors.SuperPrivateField, { + at: startLoc + }); + } + this.classScope.usePrivateName(this.state.value, this.state.startLoc); + node.property = this.parsePrivateName(); + } else { + node.property = this.parseIdentifier(true); + } + if (state.optionalChainMember) { + node.optional = optional; + return this.finishNode(node, "OptionalMemberExpression"); + } else { + return this.finishNode(node, "MemberExpression"); + } + } + parseBind(base, startLoc, noCalls, state) { + const node = this.startNodeAt(startLoc); + node.object = base; + this.next(); + node.callee = this.parseNoCallExpr(); + state.stop = true; + return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, noCalls); + } + parseCoverCallAndAsyncArrowHead(base, startLoc, state, optional) { + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + let refExpressionErrors = null; + this.state.maybeInArrowParameters = true; + this.next(); + const node = this.startNodeAt(startLoc); + node.callee = base; + const { + maybeAsyncArrow, + optionalChainMember + } = state; + if (maybeAsyncArrow) { + this.expressionScope.enter(newAsyncArrowScope()); + refExpressionErrors = new ExpressionErrors(); + } + if (optionalChainMember) { + node.optional = optional; + } + if (optional) { + node.arguments = this.parseCallExpressionArguments(11); + } else { + node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors); + } + let finishedNode = this.finishCallExpression(node, optionalChainMember); + if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) { + state.stop = true; + this.checkDestructuringPrivate(refExpressionErrors); + this.expressionScope.validateAsPattern(); + this.expressionScope.exit(); + finishedNode = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startLoc), finishedNode); + } else { + if (maybeAsyncArrow) { + this.checkExpressionErrors(refExpressionErrors, true); + this.expressionScope.exit(); + } + this.toReferencedArguments(finishedNode); + } + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + return finishedNode; + } + toReferencedArguments(node, isParenthesizedExpr) { + this.toReferencedListDeep(node.arguments, isParenthesizedExpr); + } + parseTaggedTemplateExpression(base, startLoc, state) { + const node = this.startNodeAt(startLoc); + node.tag = base; + node.quasi = this.parseTemplate(true); + if (state.optionalChainMember) { + this.raise(Errors.OptionalChainingNoTemplate, { + at: startLoc + }); + } + return this.finishNode(node, "TaggedTemplateExpression"); + } + atPossibleAsyncArrow(base) { + return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && base.start === this.state.potentialArrowAt; + } + expectImportAttributesPlugin() { + if (!this.hasPlugin("importAssertions")) { + this.expectPlugin("importAttributes"); + } + } + finishCallExpression(node, optional) { + if (node.callee.type === "Import") { + if (node.arguments.length === 2) { + { + if (!this.hasPlugin("moduleAttributes")) { + this.expectImportAttributesPlugin(); + } + } + } + if (node.arguments.length === 0 || node.arguments.length > 2) { + this.raise(Errors.ImportCallArity, { + at: node, + maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1 + }); + } else { + for (const arg of node.arguments) { + if (arg.type === "SpreadElement") { + this.raise(Errors.ImportCallSpreadArgument, { + at: arg + }); + } + } + } + } + return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression"); + } + parseCallExpressionArguments(close, dynamicImport, allowPlaceholder, nodeForExtra, refExpressionErrors) { + const elts = []; + let first = true; + const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; + this.state.inFSharpPipelineDirectBody = false; + while (!this.eat(close)) { + if (first) { + first = false; + } else { + this.expect(12); + if (this.match(close)) { + if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) { + this.raise(Errors.ImportCallArgumentTrailingComma, { + at: this.state.lastTokStartLoc + }); + } + if (nodeForExtra) { + this.addTrailingCommaExtraToNode(nodeForExtra); + } + this.next(); + break; + } + } + elts.push(this.parseExprListItem(false, refExpressionErrors, allowPlaceholder)); + } + this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; + return elts; + } + shouldParseAsyncArrow() { + return this.match(19) && !this.canInsertSemicolon(); + } + parseAsyncArrowFromCallExpression(node, call) { + var _call$extra; + this.resetPreviousNodeTrailingComments(call); + this.expect(19); + this.parseArrowExpression(node, call.arguments, true, (_call$extra = call.extra) == null ? void 0 : _call$extra.trailingCommaLoc); + if (call.innerComments) { + setInnerComments(node, call.innerComments); + } + if (call.callee.trailingComments) { + setInnerComments(node, call.callee.trailingComments); + } + return node; + } + parseNoCallExpr() { + const startLoc = this.state.startLoc; + return this.parseSubscripts(this.parseExprAtom(), startLoc, true); + } + parseExprAtom(refExpressionErrors) { + let node; + let decorators = null; + const { + type + } = this.state; + switch (type) { + case 79: + return this.parseSuper(); + case 83: + node = this.startNode(); + this.next(); + if (this.match(16)) { + return this.parseImportMetaProperty(node); + } + if (!this.match(10)) { + this.raise(Errors.UnsupportedImport, { + at: this.state.lastTokStartLoc + }); + } + return this.finishNode(node, "Import"); + case 78: + node = this.startNode(); + this.next(); + return this.finishNode(node, "ThisExpression"); + case 90: + { + return this.parseDo(this.startNode(), false); + } + case 56: + case 31: + { + this.readRegexp(); + return this.parseRegExpLiteral(this.state.value); + } + case 132: + return this.parseNumericLiteral(this.state.value); + case 133: + return this.parseBigIntLiteral(this.state.value); + case 134: + return this.parseDecimalLiteral(this.state.value); + case 131: + return this.parseStringLiteral(this.state.value); + case 84: + return this.parseNullLiteral(); + case 85: + return this.parseBooleanLiteral(true); + case 86: + return this.parseBooleanLiteral(false); + case 10: + { + const canBeArrow = this.state.potentialArrowAt === this.state.start; + return this.parseParenAndDistinguishExpression(canBeArrow); + } + case 2: + case 1: + { + return this.parseArrayLike(this.state.type === 2 ? 4 : 3, false, true); + } + case 0: + { + return this.parseArrayLike(3, true, false, refExpressionErrors); + } + case 6: + case 7: + { + return this.parseObjectLike(this.state.type === 6 ? 9 : 8, false, true); + } + case 5: + { + return this.parseObjectLike(8, false, false, refExpressionErrors); + } + case 68: + return this.parseFunctionOrFunctionSent(); + case 26: + decorators = this.parseDecorators(); + case 80: + return this.parseClass(this.maybeTakeDecorators(decorators, this.startNode()), false); + case 77: + return this.parseNewOrNewTarget(); + case 25: + case 24: + return this.parseTemplate(false); + case 15: + { + node = this.startNode(); + this.next(); + node.object = null; + const callee = node.callee = this.parseNoCallExpr(); + if (callee.type === "MemberExpression") { + return this.finishNode(node, "BindExpression"); + } else { + throw this.raise(Errors.UnsupportedBind, { + at: callee + }); + } + } + case 136: + { + this.raise(Errors.PrivateInExpectedIn, { + at: this.state.startLoc, + identifierName: this.state.value + }); + return this.parsePrivateName(); + } + case 33: + { + return this.parseTopicReferenceThenEqualsSign(54, "%"); + } + case 32: + { + return this.parseTopicReferenceThenEqualsSign(44, "^"); + } + case 37: + case 38: + { + return this.parseTopicReference("hack"); + } + case 44: + case 54: + case 27: + { + const pipeProposal = this.getPluginOption("pipelineOperator", "proposal"); + if (pipeProposal) { + return this.parseTopicReference(pipeProposal); + } + this.unexpected(); + break; + } + case 47: + { + const lookaheadCh = this.input.codePointAt(this.nextTokenStart()); + if (isIdentifierStart(lookaheadCh) || lookaheadCh === 62) { + this.expectOnePlugin(["jsx", "flow", "typescript"]); + } else { + this.unexpected(); + } + break; + } + default: + if (tokenIsIdentifier(type)) { + if (this.isContextual(125) && this.lookaheadInLineCharCode() === 123) { + return this.parseModuleExpression(); + } + const canBeArrow = this.state.potentialArrowAt === this.state.start; + const containsEsc = this.state.containsEsc; + const id = this.parseIdentifier(); + if (!containsEsc && id.name === "async" && !this.canInsertSemicolon()) { + const { + type + } = this.state; + if (type === 68) { + this.resetPreviousNodeTrailingComments(id); + this.next(); + return this.parseAsyncFunctionExpression(this.startNodeAtNode(id)); + } else if (tokenIsIdentifier(type)) { + if (this.lookaheadCharCode() === 61) { + return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(id)); + } else { + return id; + } + } else if (type === 90) { + this.resetPreviousNodeTrailingComments(id); + return this.parseDo(this.startNodeAtNode(id), true); + } + } + if (canBeArrow && this.match(19) && !this.canInsertSemicolon()) { + this.next(); + return this.parseArrowExpression(this.startNodeAtNode(id), [id], false); + } + return id; + } else { + this.unexpected(); + } + } + } + parseTopicReferenceThenEqualsSign(topicTokenType, topicTokenValue) { + const pipeProposal = this.getPluginOption("pipelineOperator", "proposal"); + if (pipeProposal) { + this.state.type = topicTokenType; + this.state.value = topicTokenValue; + this.state.pos--; + this.state.end--; + this.state.endLoc = createPositionWithColumnOffset(this.state.endLoc, -1); + return this.parseTopicReference(pipeProposal); + } else { + this.unexpected(); + } + } + parseTopicReference(pipeProposal) { + const node = this.startNode(); + const startLoc = this.state.startLoc; + const tokenType = this.state.type; + this.next(); + return this.finishTopicReference(node, startLoc, pipeProposal, tokenType); + } + finishTopicReference(node, startLoc, pipeProposal, tokenType) { + if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) { + const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference"; + if (!this.topicReferenceIsAllowedInCurrentContext()) { + this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, { + at: startLoc + }); + } + this.registerTopicReference(); + return this.finishNode(node, nodeType); + } else { + throw this.raise(Errors.PipeTopicUnconfiguredToken, { + at: startLoc, + token: tokenLabelName(tokenType) + }); + } + } + testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType) { + switch (pipeProposal) { + case "hack": + { + return this.hasPlugin(["pipelineOperator", { + topicToken: tokenLabelName(tokenType) + }]); + } + case "smart": + return tokenType === 27; + default: + throw this.raise(Errors.PipeTopicRequiresHackPipes, { + at: startLoc + }); + } + } + parseAsyncArrowUnaryFunction(node) { + this.prodParam.enter(functionFlags(true, this.prodParam.hasYield)); + const params = [this.parseIdentifier()]; + this.prodParam.exit(); + if (this.hasPrecedingLineBreak()) { + this.raise(Errors.LineTerminatorBeforeArrow, { + at: this.state.curPosition() + }); + } + this.expect(19); + return this.parseArrowExpression(node, params, true); + } + parseDo(node, isAsync) { + this.expectPlugin("doExpressions"); + if (isAsync) { + this.expectPlugin("asyncDoExpressions"); + } + node.async = isAsync; + this.next(); + const oldLabels = this.state.labels; + this.state.labels = []; + if (isAsync) { + this.prodParam.enter(PARAM_AWAIT); + node.body = this.parseBlock(); + this.prodParam.exit(); + } else { + node.body = this.parseBlock(); + } + this.state.labels = oldLabels; + return this.finishNode(node, "DoExpression"); + } + parseSuper() { + const node = this.startNode(); + this.next(); + if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) { + this.raise(Errors.SuperNotAllowed, { + at: node + }); + } else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) { + this.raise(Errors.UnexpectedSuper, { + at: node + }); + } + if (!this.match(10) && !this.match(0) && !this.match(16)) { + this.raise(Errors.UnsupportedSuper, { + at: node + }); + } + return this.finishNode(node, "Super"); + } + parsePrivateName() { + const node = this.startNode(); + const id = this.startNodeAt(createPositionWithColumnOffset(this.state.startLoc, 1)); + const name = this.state.value; + this.next(); + node.id = this.createIdentifier(id, name); + return this.finishNode(node, "PrivateName"); + } + parseFunctionOrFunctionSent() { + const node = this.startNode(); + this.next(); + if (this.prodParam.hasYield && this.match(16)) { + const meta = this.createIdentifier(this.startNodeAtNode(node), "function"); + this.next(); + if (this.match(102)) { + this.expectPlugin("functionSent"); + } else if (!this.hasPlugin("functionSent")) { + this.unexpected(); + } + return this.parseMetaProperty(node, meta, "sent"); + } + return this.parseFunction(node); + } + parseMetaProperty(node, meta, propertyName) { + node.meta = meta; + const containsEsc = this.state.containsEsc; + node.property = this.parseIdentifier(true); + if (node.property.name !== propertyName || containsEsc) { + this.raise(Errors.UnsupportedMetaProperty, { + at: node.property, + target: meta.name, + onlyValidPropertyName: propertyName + }); + } + return this.finishNode(node, "MetaProperty"); + } + parseImportMetaProperty(node) { + const id = this.createIdentifier(this.startNodeAtNode(node), "import"); + this.next(); + if (this.isContextual(100)) { + if (!this.inModule) { + this.raise(Errors.ImportMetaOutsideModule, { + at: id + }); + } + this.sawUnambiguousESM = true; + } + return this.parseMetaProperty(node, id, "meta"); + } + parseLiteralAtNode(value, type, node) { + this.addExtra(node, "rawValue", value); + this.addExtra(node, "raw", this.input.slice(node.start, this.state.end)); + node.value = value; + this.next(); + return this.finishNode(node, type); + } + parseLiteral(value, type) { + const node = this.startNode(); + return this.parseLiteralAtNode(value, type, node); + } + parseStringLiteral(value) { + return this.parseLiteral(value, "StringLiteral"); + } + parseNumericLiteral(value) { + return this.parseLiteral(value, "NumericLiteral"); + } + parseBigIntLiteral(value) { + return this.parseLiteral(value, "BigIntLiteral"); + } + parseDecimalLiteral(value) { + return this.parseLiteral(value, "DecimalLiteral"); + } + parseRegExpLiteral(value) { + const node = this.parseLiteral(value.value, "RegExpLiteral"); + node.pattern = value.pattern; + node.flags = value.flags; + return node; + } + parseBooleanLiteral(value) { + const node = this.startNode(); + node.value = value; + this.next(); + return this.finishNode(node, "BooleanLiteral"); + } + parseNullLiteral() { + const node = this.startNode(); + this.next(); + return this.finishNode(node, "NullLiteral"); + } + parseParenAndDistinguishExpression(canBeArrow) { + const startLoc = this.state.startLoc; + let val; + this.next(); + this.expressionScope.enter(newArrowHeadScope()); + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; + this.state.maybeInArrowParameters = true; + this.state.inFSharpPipelineDirectBody = false; + const innerStartLoc = this.state.startLoc; + const exprList = []; + const refExpressionErrors = new ExpressionErrors(); + let first = true; + let spreadStartLoc; + let optionalCommaStartLoc; + while (!this.match(11)) { + if (first) { + first = false; + } else { + this.expect(12, refExpressionErrors.optionalParametersLoc === null ? null : refExpressionErrors.optionalParametersLoc); + if (this.match(11)) { + optionalCommaStartLoc = this.state.startLoc; + break; + } + } + if (this.match(21)) { + const spreadNodeStartLoc = this.state.startLoc; + spreadStartLoc = this.state.startLoc; + exprList.push(this.parseParenItem(this.parseRestBinding(), spreadNodeStartLoc)); + if (!this.checkCommaAfterRest(41)) { + break; + } + } else { + exprList.push(this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem)); + } + } + const innerEndLoc = this.state.lastTokEndLoc; + this.expect(11); + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; + let arrowNode = this.startNodeAt(startLoc); + if (canBeArrow && this.shouldParseArrow(exprList) && (arrowNode = this.parseArrow(arrowNode))) { + this.checkDestructuringPrivate(refExpressionErrors); + this.expressionScope.validateAsPattern(); + this.expressionScope.exit(); + this.parseArrowExpression(arrowNode, exprList, false); + return arrowNode; + } + this.expressionScope.exit(); + if (!exprList.length) { + this.unexpected(this.state.lastTokStartLoc); + } + if (optionalCommaStartLoc) this.unexpected(optionalCommaStartLoc); + if (spreadStartLoc) this.unexpected(spreadStartLoc); + this.checkExpressionErrors(refExpressionErrors, true); + this.toReferencedListDeep(exprList, true); + if (exprList.length > 1) { + val = this.startNodeAt(innerStartLoc); + val.expressions = exprList; + this.finishNode(val, "SequenceExpression"); + this.resetEndLocation(val, innerEndLoc); + } else { + val = exprList[0]; + } + return this.wrapParenthesis(startLoc, val); + } + wrapParenthesis(startLoc, expression) { + if (!this.options.createParenthesizedExpressions) { + this.addExtra(expression, "parenthesized", true); + this.addExtra(expression, "parenStart", startLoc.index); + this.takeSurroundingComments(expression, startLoc.index, this.state.lastTokEndLoc.index); + return expression; + } + const parenExpression = this.startNodeAt(startLoc); + parenExpression.expression = expression; + return this.finishNode(parenExpression, "ParenthesizedExpression"); + } + shouldParseArrow(params) { + return !this.canInsertSemicolon(); + } + parseArrow(node) { + if (this.eat(19)) { + return node; + } + } + parseParenItem(node, startLoc) { + return node; + } + parseNewOrNewTarget() { + const node = this.startNode(); + this.next(); + if (this.match(16)) { + const meta = this.createIdentifier(this.startNodeAtNode(node), "new"); + this.next(); + const metaProp = this.parseMetaProperty(node, meta, "target"); + if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) { + this.raise(Errors.UnexpectedNewTarget, { + at: metaProp + }); + } + return metaProp; + } + return this.parseNew(node); + } + parseNew(node) { + this.parseNewCallee(node); + if (this.eat(10)) { + const args = this.parseExprList(11); + this.toReferencedList(args); + node.arguments = args; + } else { + node.arguments = []; + } + return this.finishNode(node, "NewExpression"); + } + parseNewCallee(node) { + node.callee = this.parseNoCallExpr(); + if (node.callee.type === "Import") { + this.raise(Errors.ImportCallNotNewExpression, { + at: node.callee + }); + } + } + parseTemplateElement(isTagged) { + const { + start, + startLoc, + end, + value + } = this.state; + const elemStart = start + 1; + const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1)); + if (value === null) { + if (!isTagged) { + this.raise(Errors.InvalidEscapeSequenceTemplate, { + at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1) + }); + } + } + const isTail = this.match(24); + const endOffset = isTail ? -1 : -2; + const elemEnd = end + endOffset; + elem.value = { + raw: this.input.slice(elemStart, elemEnd).replace(/\r\n?/g, "\n"), + cooked: value === null ? null : value.slice(1, endOffset) + }; + elem.tail = isTail; + this.next(); + const finishedNode = this.finishNode(elem, "TemplateElement"); + this.resetEndLocation(finishedNode, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset)); + return finishedNode; + } + parseTemplate(isTagged) { + const node = this.startNode(); + node.expressions = []; + let curElt = this.parseTemplateElement(isTagged); + node.quasis = [curElt]; + while (!curElt.tail) { + node.expressions.push(this.parseTemplateSubstitution()); + this.readTemplateContinuation(); + node.quasis.push(curElt = this.parseTemplateElement(isTagged)); + } + return this.finishNode(node, "TemplateLiteral"); + } + parseTemplateSubstitution() { + return this.parseExpression(); + } + parseObjectLike(close, isPattern, isRecord, refExpressionErrors) { + if (isRecord) { + this.expectPlugin("recordAndTuple"); + } + const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; + this.state.inFSharpPipelineDirectBody = false; + const propHash = Object.create(null); + let first = true; + const node = this.startNode(); + node.properties = []; + this.next(); + while (!this.match(close)) { + if (first) { + first = false; + } else { + this.expect(12); + if (this.match(close)) { + this.addTrailingCommaExtraToNode(node); + break; + } + } + let prop; + if (isPattern) { + prop = this.parseBindingProperty(); + } else { + prop = this.parsePropertyDefinition(refExpressionErrors); + this.checkProto(prop, isRecord, propHash, refExpressionErrors); + } + if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") { + this.raise(Errors.InvalidRecordProperty, { + at: prop + }); + } + if (prop.shorthand) { + this.addExtra(prop, "shorthand", true); + } + node.properties.push(prop); + } + this.next(); + this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; + let type = "ObjectExpression"; + if (isPattern) { + type = "ObjectPattern"; + } else if (isRecord) { + type = "RecordExpression"; + } + return this.finishNode(node, type); + } + addTrailingCommaExtraToNode(node) { + this.addExtra(node, "trailingComma", this.state.lastTokStart); + this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false); + } + maybeAsyncOrAccessorProp(prop) { + return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(55)); + } + parsePropertyDefinition(refExpressionErrors) { + let decorators = []; + if (this.match(26)) { + if (this.hasPlugin("decorators")) { + this.raise(Errors.UnsupportedPropertyDecorator, { + at: this.state.startLoc + }); + } + while (this.match(26)) { + decorators.push(this.parseDecorator()); + } + } + const prop = this.startNode(); + let isAsync = false; + let isAccessor = false; + let startLoc; + if (this.match(21)) { + if (decorators.length) this.unexpected(); + return this.parseSpread(); + } + if (decorators.length) { + prop.decorators = decorators; + decorators = []; + } + prop.method = false; + if (refExpressionErrors) { + startLoc = this.state.startLoc; + } + let isGenerator = this.eat(55); + this.parsePropertyNamePrefixOperator(prop); + const containsEsc = this.state.containsEsc; + const key = this.parsePropertyName(prop, refExpressionErrors); + if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) { + const keyName = key.name; + if (keyName === "async" && !this.hasPrecedingLineBreak()) { + isAsync = true; + this.resetPreviousNodeTrailingComments(key); + isGenerator = this.eat(55); + this.parsePropertyName(prop); + } + if (keyName === "get" || keyName === "set") { + isAccessor = true; + this.resetPreviousNodeTrailingComments(key); + prop.kind = keyName; + if (this.match(55)) { + isGenerator = true; + this.raise(Errors.AccessorIsGenerator, { + at: this.state.curPosition(), + kind: keyName + }); + this.next(); + } + this.parsePropertyName(prop); + } + } + return this.parseObjPropValue(prop, startLoc, isGenerator, isAsync, false, isAccessor, refExpressionErrors); + } + getGetterSetterExpectedParamCount(method) { + return method.kind === "get" ? 0 : 1; + } + getObjectOrClassMethodParams(method) { + return method.params; + } + checkGetterSetterParams(method) { + var _params; + const paramCount = this.getGetterSetterExpectedParamCount(method); + const params = this.getObjectOrClassMethodParams(method); + if (params.length !== paramCount) { + this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, { + at: method + }); + } + if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") { + this.raise(Errors.BadSetterRestParameter, { + at: method + }); + } + } + parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) { + if (isAccessor) { + const finishedProp = this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod"); + this.checkGetterSetterParams(finishedProp); + return finishedProp; + } + if (isAsync || isGenerator || this.match(10)) { + if (isPattern) this.unexpected(); + prop.kind = "method"; + prop.method = true; + return this.parseMethod(prop, isGenerator, isAsync, false, false, "ObjectMethod"); + } + } + parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) { + prop.shorthand = false; + if (this.eat(14)) { + prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowIn(refExpressionErrors); + return this.finishNode(prop, "ObjectProperty"); + } + if (!prop.computed && prop.key.type === "Identifier") { + this.checkReservedWord(prop.key.name, prop.key.loc.start, true, false); + if (isPattern) { + prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key)); + } else if (this.match(29)) { + const shorthandAssignLoc = this.state.startLoc; + if (refExpressionErrors != null) { + if (refExpressionErrors.shorthandAssignLoc === null) { + refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc; + } + } else { + this.raise(Errors.InvalidCoverInitializedName, { + at: shorthandAssignLoc + }); + } + prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key)); + } else { + prop.value = cloneIdentifier(prop.key); + } + prop.shorthand = true; + return this.finishNode(prop, "ObjectProperty"); + } + } + parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) { + const node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) || this.parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors); + if (!node) this.unexpected(); + return node; + } + parsePropertyName(prop, refExpressionErrors) { + if (this.eat(0)) { + prop.computed = true; + prop.key = this.parseMaybeAssignAllowIn(); + this.expect(3); + } else { + const { + type, + value + } = this.state; + let key; + if (tokenIsKeywordOrIdentifier(type)) { + key = this.parseIdentifier(true); + } else { + switch (type) { + case 132: + key = this.parseNumericLiteral(value); + break; + case 131: + key = this.parseStringLiteral(value); + break; + case 133: + key = this.parseBigIntLiteral(value); + break; + case 134: + key = this.parseDecimalLiteral(value); + break; + case 136: + { + const privateKeyLoc = this.state.startLoc; + if (refExpressionErrors != null) { + if (refExpressionErrors.privateKeyLoc === null) { + refExpressionErrors.privateKeyLoc = privateKeyLoc; + } + } else { + this.raise(Errors.UnexpectedPrivateField, { + at: privateKeyLoc + }); + } + key = this.parsePrivateName(); + break; + } + default: + this.unexpected(); + } + } + prop.key = key; + if (type !== 136) { + prop.computed = false; + } + } + return prop.key; + } + initFunction(node, isAsync) { + node.id = null; + node.generator = false; + node.async = isAsync; + } + parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) { + this.initFunction(node, isAsync); + node.generator = isGenerator; + this.scope.enter(2 | 16 | (inClassScope ? 64 : 0) | (allowDirectSuper ? 32 : 0)); + this.prodParam.enter(functionFlags(isAsync, node.generator)); + this.parseFunctionParams(node, isConstructor); + const finishedNode = this.parseFunctionBodyAndFinish(node, type, true); + this.prodParam.exit(); + this.scope.exit(); + return finishedNode; + } + parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) { + if (isTuple) { + this.expectPlugin("recordAndTuple"); + } + const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; + this.state.inFSharpPipelineDirectBody = false; + const node = this.startNode(); + this.next(); + node.elements = this.parseExprList(close, !isTuple, refExpressionErrors, node); + this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; + return this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression"); + } + parseArrowExpression(node, params, isAsync, trailingCommaLoc) { + this.scope.enter(2 | 4); + let flags = functionFlags(isAsync, false); + if (!this.match(5) && this.prodParam.hasIn) { + flags |= PARAM_IN; + } + this.prodParam.enter(flags); + this.initFunction(node, isAsync); + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + if (params) { + this.state.maybeInArrowParameters = true; + this.setArrowFunctionParameters(node, params, trailingCommaLoc); + } + this.state.maybeInArrowParameters = false; + this.parseFunctionBody(node, true); + this.prodParam.exit(); + this.scope.exit(); + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + return this.finishNode(node, "ArrowFunctionExpression"); + } + setArrowFunctionParameters(node, params, trailingCommaLoc) { + this.toAssignableList(params, trailingCommaLoc, false); + node.params = params; + } + parseFunctionBodyAndFinish(node, type, isMethod = false) { + this.parseFunctionBody(node, false, isMethod); + return this.finishNode(node, type); + } + parseFunctionBody(node, allowExpression, isMethod = false) { + const isExpression = allowExpression && !this.match(5); + this.expressionScope.enter(newExpressionScope()); + if (isExpression) { + node.body = this.parseMaybeAssign(); + this.checkParams(node, false, allowExpression, false); + } else { + const oldStrict = this.state.strict; + const oldLabels = this.state.labels; + this.state.labels = []; + this.prodParam.enter(this.prodParam.currentFlags() | PARAM_RETURN); + node.body = this.parseBlock(true, false, hasStrictModeDirective => { + const nonSimple = !this.isSimpleParamList(node.params); + if (hasStrictModeDirective && nonSimple) { + this.raise(Errors.IllegalLanguageModeDirective, { + at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node + }); + } + const strictModeChanged = !oldStrict && this.state.strict; + this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged); + if (this.state.strict && node.id) { + this.checkIdentifier(node.id, 65, strictModeChanged); + } + }); + this.prodParam.exit(); + this.state.labels = oldLabels; + } + this.expressionScope.exit(); + } + isSimpleParameter(node) { + return node.type === "Identifier"; + } + isSimpleParamList(params) { + for (let i = 0, len = params.length; i < len; i++) { + if (!this.isSimpleParameter(params[i])) return false; + } + return true; + } + checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) { + const checkClashes = !allowDuplicates && new Set(); + const formalParameters = { + type: "FormalParameters" + }; + for (const param of node.params) { + this.checkLVal(param, { + in: formalParameters, + binding: 5, + checkClashes, + strictModeChanged + }); + } + } + parseExprList(close, allowEmpty, refExpressionErrors, nodeForExtra) { + const elts = []; + let first = true; + while (!this.eat(close)) { + if (first) { + first = false; + } else { + this.expect(12); + if (this.match(close)) { + if (nodeForExtra) { + this.addTrailingCommaExtraToNode(nodeForExtra); + } + this.next(); + break; + } + } + elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors)); + } + return elts; + } + parseExprListItem(allowEmpty, refExpressionErrors, allowPlaceholder) { + let elt; + if (this.match(12)) { + if (!allowEmpty) { + this.raise(Errors.UnexpectedToken, { + at: this.state.curPosition(), + unexpected: "," + }); + } + elt = null; + } else if (this.match(21)) { + const spreadNodeStartLoc = this.state.startLoc; + elt = this.parseParenItem(this.parseSpread(refExpressionErrors), spreadNodeStartLoc); + } else if (this.match(17)) { + this.expectPlugin("partialApplication"); + if (!allowPlaceholder) { + this.raise(Errors.UnexpectedArgumentPlaceholder, { + at: this.state.startLoc + }); + } + const node = this.startNode(); + this.next(); + elt = this.finishNode(node, "ArgumentPlaceholder"); + } else { + elt = this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem); + } + return elt; + } + parseIdentifier(liberal) { + const node = this.startNode(); + const name = this.parseIdentifierName(liberal); + return this.createIdentifier(node, name); + } + createIdentifier(node, name) { + node.name = name; + node.loc.identifierName = name; + return this.finishNode(node, "Identifier"); + } + parseIdentifierName(liberal) { + let name; + const { + startLoc, + type + } = this.state; + if (tokenIsKeywordOrIdentifier(type)) { + name = this.state.value; + } else { + this.unexpected(); + } + const tokenIsKeyword = tokenKeywordOrIdentifierIsKeyword(type); + if (liberal) { + if (tokenIsKeyword) { + this.replaceToken(130); + } + } else { + this.checkReservedWord(name, startLoc, tokenIsKeyword, false); + } + this.next(); + return name; + } + checkReservedWord(word, startLoc, checkKeywords, isBinding) { + if (word.length > 10) { + return; + } + if (!canBeReservedWord(word)) { + return; + } + if (checkKeywords && isKeyword(word)) { + this.raise(Errors.UnexpectedKeyword, { + at: startLoc, + keyword: word + }); + return; + } + const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord; + if (reservedTest(word, this.inModule)) { + this.raise(Errors.UnexpectedReservedWord, { + at: startLoc, + reservedWord: word + }); + return; + } else if (word === "yield") { + if (this.prodParam.hasYield) { + this.raise(Errors.YieldBindingIdentifier, { + at: startLoc + }); + return; + } + } else if (word === "await") { + if (this.prodParam.hasAwait) { + this.raise(Errors.AwaitBindingIdentifier, { + at: startLoc + }); + return; + } + if (this.scope.inStaticBlock) { + this.raise(Errors.AwaitBindingIdentifierInStaticBlock, { + at: startLoc + }); + return; + } + this.expressionScope.recordAsyncArrowParametersError({ + at: startLoc + }); + } else if (word === "arguments") { + if (this.scope.inClassAndNotInNonArrowFunction) { + this.raise(Errors.ArgumentsInClass, { + at: startLoc + }); + return; + } + } + } + isAwaitAllowed() { + if (this.prodParam.hasAwait) return true; + if (this.options.allowAwaitOutsideFunction && !this.scope.inFunction) { + return true; + } + return false; + } + parseAwait(startLoc) { + const node = this.startNodeAt(startLoc); + this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, { + at: node + }); + if (this.eat(55)) { + this.raise(Errors.ObsoleteAwaitStar, { + at: node + }); + } + if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) { + if (this.isAmbiguousAwait()) { + this.ambiguousScriptDifferentAst = true; + } else { + this.sawUnambiguousESM = true; + } + } + if (!this.state.soloAwait) { + node.argument = this.parseMaybeUnary(null, true); + } + return this.finishNode(node, "AwaitExpression"); + } + isAmbiguousAwait() { + if (this.hasPrecedingLineBreak()) return true; + const { + type + } = this.state; + return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 101 && !this.state.containsEsc || type === 135 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54; + } + parseYield() { + const node = this.startNode(); + this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, { + at: node + }); + this.next(); + let delegating = false; + let argument = null; + if (!this.hasPrecedingLineBreak()) { + delegating = this.eat(55); + switch (this.state.type) { + case 13: + case 137: + case 8: + case 11: + case 3: + case 9: + case 14: + case 12: + if (!delegating) break; + default: + argument = this.parseMaybeAssign(); + } + } + node.delegate = delegating; + node.argument = argument; + return this.finishNode(node, "YieldExpression"); + } + checkPipelineAtInfixOperator(left, leftStartLoc) { + if (this.hasPlugin(["pipelineOperator", { + proposal: "smart" + }])) { + if (left.type === "SequenceExpression") { + this.raise(Errors.PipelineHeadSequenceExpression, { + at: leftStartLoc + }); + } + } + } + parseSmartPipelineBodyInStyle(childExpr, startLoc) { + if (this.isSimpleReference(childExpr)) { + const bodyNode = this.startNodeAt(startLoc); + bodyNode.callee = childExpr; + return this.finishNode(bodyNode, "PipelineBareFunction"); + } else { + const bodyNode = this.startNodeAt(startLoc); + this.checkSmartPipeTopicBodyEarlyErrors(startLoc); + bodyNode.expression = childExpr; + return this.finishNode(bodyNode, "PipelineTopicExpression"); + } + } + isSimpleReference(expression) { + switch (expression.type) { + case "MemberExpression": + return !expression.computed && this.isSimpleReference(expression.object); + case "Identifier": + return true; + default: + return false; + } + } + checkSmartPipeTopicBodyEarlyErrors(startLoc) { + if (this.match(19)) { + throw this.raise(Errors.PipelineBodyNoArrow, { + at: this.state.startLoc + }); + } + if (!this.topicReferenceWasUsedInCurrentContext()) { + this.raise(Errors.PipelineTopicUnused, { + at: startLoc + }); + } + } + withTopicBindingContext(callback) { + const outerContextTopicState = this.state.topicContext; + this.state.topicContext = { + maxNumOfResolvableTopics: 1, + maxTopicIndex: null + }; + try { + return callback(); + } finally { + this.state.topicContext = outerContextTopicState; + } + } + withSmartMixTopicForbiddingContext(callback) { + if (this.hasPlugin(["pipelineOperator", { + proposal: "smart" + }])) { + const outerContextTopicState = this.state.topicContext; + this.state.topicContext = { + maxNumOfResolvableTopics: 0, + maxTopicIndex: null + }; + try { + return callback(); + } finally { + this.state.topicContext = outerContextTopicState; + } + } else { + return callback(); + } + } + withSoloAwaitPermittingContext(callback) { + const outerContextSoloAwaitState = this.state.soloAwait; + this.state.soloAwait = true; + try { + return callback(); + } finally { + this.state.soloAwait = outerContextSoloAwaitState; + } + } + allowInAnd(callback) { + const flags = this.prodParam.currentFlags(); + const prodParamToSet = PARAM_IN & ~flags; + if (prodParamToSet) { + this.prodParam.enter(flags | PARAM_IN); + try { + return callback(); + } finally { + this.prodParam.exit(); + } + } + return callback(); + } + disallowInAnd(callback) { + const flags = this.prodParam.currentFlags(); + const prodParamToClear = PARAM_IN & flags; + if (prodParamToClear) { + this.prodParam.enter(flags & ~PARAM_IN); + try { + return callback(); + } finally { + this.prodParam.exit(); + } + } + return callback(); + } + registerTopicReference() { + this.state.topicContext.maxTopicIndex = 0; + } + topicReferenceIsAllowedInCurrentContext() { + return this.state.topicContext.maxNumOfResolvableTopics >= 1; + } + topicReferenceWasUsedInCurrentContext() { + return this.state.topicContext.maxTopicIndex != null && this.state.topicContext.maxTopicIndex >= 0; + } + parseFSharpPipelineBody(prec) { + const startLoc = this.state.startLoc; + this.state.potentialArrowAt = this.state.start; + const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; + this.state.inFSharpPipelineDirectBody = true; + const ret = this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, prec); + this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; + return ret; + } + parseModuleExpression() { + this.expectPlugin("moduleBlocks"); + const node = this.startNode(); + this.next(); + if (!this.match(5)) { + this.unexpected(null, 5); + } + const program = this.startNodeAt(this.state.endLoc); + this.next(); + const revertScopes = this.initializeScopes(true); + this.enterInitialScopes(); + try { + node.body = this.parseProgram(program, 8, "module"); + } finally { + revertScopes(); + } + return this.finishNode(node, "ModuleExpression"); + } + parsePropertyNamePrefixOperator(prop) {} +} +const loopLabel = { + kind: "loop" + }, + switchLabel = { + kind: "switch" + }; +const loneSurrogate = /[\uD800-\uDFFF]/u; +const keywordRelationalOperator = /in(?:stanceof)?/y; +function babel7CompatTokens(tokens, input) { + for (let i = 0; i < tokens.length; i++) { + const token = tokens[i]; + const { + type + } = token; + if (typeof type === "number") { + { + if (type === 136) { + const { + loc, + start, + value, + end + } = token; + const hashEndPos = start + 1; + const hashEndLoc = createPositionWithColumnOffset(loc.start, 1); + tokens.splice(i, 1, new Token({ + type: getExportedToken(27), + value: "#", + start: start, + end: hashEndPos, + startLoc: loc.start, + endLoc: hashEndLoc + }), new Token({ + type: getExportedToken(130), + value: value, + start: hashEndPos, + end: end, + startLoc: hashEndLoc, + endLoc: loc.end + })); + i++; + continue; + } + if (tokenIsTemplate(type)) { + const { + loc, + start, + value, + end + } = token; + const backquoteEnd = start + 1; + const backquoteEndLoc = createPositionWithColumnOffset(loc.start, 1); + let startToken; + if (input.charCodeAt(start) === 96) { + startToken = new Token({ + type: getExportedToken(22), + value: "`", + start: start, + end: backquoteEnd, + startLoc: loc.start, + endLoc: backquoteEndLoc + }); + } else { + startToken = new Token({ + type: getExportedToken(8), + value: "}", + start: start, + end: backquoteEnd, + startLoc: loc.start, + endLoc: backquoteEndLoc + }); + } + let templateValue, templateElementEnd, templateElementEndLoc, endToken; + if (type === 24) { + templateElementEnd = end - 1; + templateElementEndLoc = createPositionWithColumnOffset(loc.end, -1); + templateValue = value === null ? null : value.slice(1, -1); + endToken = new Token({ + type: getExportedToken(22), + value: "`", + start: templateElementEnd, + end: end, + startLoc: templateElementEndLoc, + endLoc: loc.end + }); + } else { + templateElementEnd = end - 2; + templateElementEndLoc = createPositionWithColumnOffset(loc.end, -2); + templateValue = value === null ? null : value.slice(1, -2); + endToken = new Token({ + type: getExportedToken(23), + value: "${", + start: templateElementEnd, + end: end, + startLoc: templateElementEndLoc, + endLoc: loc.end + }); + } + tokens.splice(i, 1, startToken, new Token({ + type: getExportedToken(20), + value: templateValue, + start: backquoteEnd, + end: templateElementEnd, + startLoc: backquoteEndLoc, + endLoc: templateElementEndLoc + }), endToken); + i += 2; + continue; + } + } + token.type = getExportedToken(type); + } + } + return tokens; +} +class StatementParser extends ExpressionParser { + parseTopLevel(file, program) { + file.program = this.parseProgram(program); + file.comments = this.state.comments; + if (this.options.tokens) { + file.tokens = babel7CompatTokens(this.tokens, this.input); + } + return this.finishNode(file, "File"); + } + parseProgram(program, end = 137, sourceType = this.options.sourceType) { + program.sourceType = sourceType; + program.interpreter = this.parseInterpreterDirective(); + this.parseBlockBody(program, true, true, end); + if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) { + for (const [localName, at] of Array.from(this.scope.undefinedExports)) { + this.raise(Errors.ModuleExportUndefined, { + at, + localName + }); + } + } + let finishedProgram; + if (end === 137) { + finishedProgram = this.finishNode(program, "Program"); + } else { + finishedProgram = this.finishNodeAt(program, "Program", createPositionWithColumnOffset(this.state.startLoc, -1)); + } + return finishedProgram; + } + stmtToDirective(stmt) { + const directive = stmt; + directive.type = "Directive"; + directive.value = directive.expression; + delete directive.expression; + const directiveLiteral = directive.value; + const expressionValue = directiveLiteral.value; + const raw = this.input.slice(directiveLiteral.start, directiveLiteral.end); + const val = directiveLiteral.value = raw.slice(1, -1); + this.addExtra(directiveLiteral, "raw", raw); + this.addExtra(directiveLiteral, "rawValue", val); + this.addExtra(directiveLiteral, "expressionValue", expressionValue); + directiveLiteral.type = "DirectiveLiteral"; + return directive; + } + parseInterpreterDirective() { + if (!this.match(28)) { + return null; + } + const node = this.startNode(); + node.value = this.state.value; + this.next(); + return this.finishNode(node, "InterpreterDirective"); + } + isLet() { + if (!this.isContextual(99)) { + return false; + } + return this.hasFollowingBindingAtom(); + } + chStartsBindingIdentifier(ch, pos) { + if (isIdentifierStart(ch)) { + keywordRelationalOperator.lastIndex = pos; + if (keywordRelationalOperator.test(this.input)) { + const endCh = this.codePointAtPos(keywordRelationalOperator.lastIndex); + if (!isIdentifierChar(endCh) && endCh !== 92) { + return false; + } + } + return true; + } else if (ch === 92) { + return true; + } else { + return false; + } + } + chStartsBindingPattern(ch) { + return ch === 91 || ch === 123; + } + hasFollowingBindingAtom() { + const next = this.nextTokenStart(); + const nextCh = this.codePointAtPos(next); + return this.chStartsBindingPattern(nextCh) || this.chStartsBindingIdentifier(nextCh, next); + } + hasInLineFollowingBindingIdentifier() { + const next = this.nextTokenInLineStart(); + const nextCh = this.codePointAtPos(next); + return this.chStartsBindingIdentifier(nextCh, next); + } + startsUsingForOf() { + const { + type, + containsEsc + } = this.lookahead(); + if (type === 101 && !containsEsc) { + return false; + } else if (tokenIsIdentifier(type) && !this.hasFollowingLineBreak()) { + this.expectPlugin("explicitResourceManagement"); + return true; + } + } + startsAwaitUsing() { + let next = this.nextTokenInLineStart(); + if (this.isUnparsedContextual(next, "using")) { + next = this.nextTokenInLineStartSince(next + 5); + const nextCh = this.codePointAtPos(next); + if (this.chStartsBindingIdentifier(nextCh, next)) { + this.expectPlugin("explicitResourceManagement"); + return true; + } + } + return false; + } + parseModuleItem() { + return this.parseStatementLike(1 | 2 | 4 | 8); + } + parseStatementListItem() { + return this.parseStatementLike(2 | 4 | (!this.options.annexB || this.state.strict ? 0 : 8)); + } + parseStatementOrSloppyAnnexBFunctionDeclaration(allowLabeledFunction = false) { + let flags = 0; + if (this.options.annexB && !this.state.strict) { + flags |= 4; + if (allowLabeledFunction) { + flags |= 8; + } + } + return this.parseStatementLike(flags); + } + parseStatement() { + return this.parseStatementLike(0); + } + parseStatementLike(flags) { + let decorators = null; + if (this.match(26)) { + decorators = this.parseDecorators(true); + } + return this.parseStatementContent(flags, decorators); + } + parseStatementContent(flags, decorators) { + const starttype = this.state.type; + const node = this.startNode(); + const allowDeclaration = !!(flags & 2); + const allowFunctionDeclaration = !!(flags & 4); + const topLevel = flags & 1; + switch (starttype) { + case 60: + return this.parseBreakContinueStatement(node, true); + case 63: + return this.parseBreakContinueStatement(node, false); + case 64: + return this.parseDebuggerStatement(node); + case 90: + return this.parseDoWhileStatement(node); + case 91: + return this.parseForStatement(node); + case 68: + if (this.lookaheadCharCode() === 46) break; + if (!allowFunctionDeclaration) { + this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, { + at: this.state.startLoc + }); + } + return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration); + case 80: + if (!allowDeclaration) this.unexpected(); + return this.parseClass(this.maybeTakeDecorators(decorators, node), true); + case 69: + return this.parseIfStatement(node); + case 70: + return this.parseReturnStatement(node); + case 71: + return this.parseSwitchStatement(node); + case 72: + return this.parseThrowStatement(node); + case 73: + return this.parseTryStatement(node); + case 96: + if (!this.state.containsEsc && this.startsAwaitUsing()) { + if (!this.isAwaitAllowed()) { + this.raise(Errors.AwaitUsingNotInAsyncContext, { + at: node + }); + } else if (!allowDeclaration) { + this.raise(Errors.UnexpectedLexicalDeclaration, { + at: node + }); + } + this.next(); + return this.parseVarStatement(node, "await using"); + } + break; + case 105: + if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifier()) { + break; + } + this.expectPlugin("explicitResourceManagement"); + if (!this.scope.inModule && this.scope.inTopLevel) { + this.raise(Errors.UnexpectedUsingDeclaration, { + at: this.state.startLoc + }); + } else if (!allowDeclaration) { + this.raise(Errors.UnexpectedLexicalDeclaration, { + at: this.state.startLoc + }); + } + return this.parseVarStatement(node, "using"); + case 99: + { + if (this.state.containsEsc) { + break; + } + const next = this.nextTokenStart(); + const nextCh = this.codePointAtPos(next); + if (nextCh !== 91) { + if (!allowDeclaration && this.hasFollowingLineBreak()) break; + if (!this.chStartsBindingIdentifier(nextCh, next) && nextCh !== 123) { + break; + } + } + } + case 75: + { + if (!allowDeclaration) { + this.raise(Errors.UnexpectedLexicalDeclaration, { + at: this.state.startLoc + }); + } + } + case 74: + { + const kind = this.state.value; + return this.parseVarStatement(node, kind); + } + case 92: + return this.parseWhileStatement(node); + case 76: + return this.parseWithStatement(node); + case 5: + return this.parseBlock(); + case 13: + return this.parseEmptyStatement(node); + case 83: + { + const nextTokenCharCode = this.lookaheadCharCode(); + if (nextTokenCharCode === 40 || nextTokenCharCode === 46) { + break; + } + } + case 82: + { + if (!this.options.allowImportExportEverywhere && !topLevel) { + this.raise(Errors.UnexpectedImportExport, { + at: this.state.startLoc + }); + } + this.next(); + let result; + if (starttype === 83) { + result = this.parseImport(node); + if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) { + this.sawUnambiguousESM = true; + } + } else { + result = this.parseExport(node, decorators); + if (result.type === "ExportNamedDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportAllDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportDefaultDeclaration") { + this.sawUnambiguousESM = true; + } + } + this.assertModuleNodeAllowed(result); + return result; + } + default: + { + if (this.isAsyncFunction()) { + if (!allowDeclaration) { + this.raise(Errors.AsyncFunctionInSingleStatementContext, { + at: this.state.startLoc + }); + } + this.next(); + return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration); + } + } + } + const maybeName = this.state.value; + const expr = this.parseExpression(); + if (tokenIsIdentifier(starttype) && expr.type === "Identifier" && this.eat(14)) { + return this.parseLabeledStatement(node, maybeName, expr, flags); + } else { + return this.parseExpressionStatement(node, expr, decorators); + } + } + assertModuleNodeAllowed(node) { + if (!this.options.allowImportExportEverywhere && !this.inModule) { + this.raise(Errors.ImportOutsideModule, { + at: node + }); + } + } + decoratorsEnabledBeforeExport() { + if (this.hasPlugin("decorators-legacy")) return true; + return this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") !== false; + } + maybeTakeDecorators(maybeDecorators, classNode, exportNode) { + if (maybeDecorators) { + if (classNode.decorators && classNode.decorators.length > 0) { + if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") { + this.raise(Errors.DecoratorsBeforeAfterExport, { + at: classNode.decorators[0] + }); + } + classNode.decorators.unshift(...maybeDecorators); + } else { + classNode.decorators = maybeDecorators; + } + this.resetStartLocationFromNode(classNode, maybeDecorators[0]); + if (exportNode) this.resetStartLocationFromNode(exportNode, classNode); + } + return classNode; + } + canHaveLeadingDecorator() { + return this.match(80); + } + parseDecorators(allowExport) { + const decorators = []; + do { + decorators.push(this.parseDecorator()); + } while (this.match(26)); + if (this.match(82)) { + if (!allowExport) { + this.unexpected(); + } + if (!this.decoratorsEnabledBeforeExport()) { + this.raise(Errors.DecoratorExportClass, { + at: this.state.startLoc + }); + } + } else if (!this.canHaveLeadingDecorator()) { + throw this.raise(Errors.UnexpectedLeadingDecorator, { + at: this.state.startLoc + }); + } + return decorators; + } + parseDecorator() { + this.expectOnePlugin(["decorators", "decorators-legacy"]); + const node = this.startNode(); + this.next(); + if (this.hasPlugin("decorators")) { + const startLoc = this.state.startLoc; + let expr; + if (this.match(10)) { + const startLoc = this.state.startLoc; + this.next(); + expr = this.parseExpression(); + this.expect(11); + expr = this.wrapParenthesis(startLoc, expr); + const paramsStartLoc = this.state.startLoc; + node.expression = this.parseMaybeDecoratorArguments(expr); + if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) { + this.raise(Errors.DecoratorArgumentsOutsideParentheses, { + at: paramsStartLoc + }); + } + } else { + expr = this.parseIdentifier(false); + while (this.eat(16)) { + const node = this.startNodeAt(startLoc); + node.object = expr; + if (this.match(136)) { + this.classScope.usePrivateName(this.state.value, this.state.startLoc); + node.property = this.parsePrivateName(); + } else { + node.property = this.parseIdentifier(true); + } + node.computed = false; + expr = this.finishNode(node, "MemberExpression"); + } + node.expression = this.parseMaybeDecoratorArguments(expr); + } + } else { + node.expression = this.parseExprSubscripts(); + } + return this.finishNode(node, "Decorator"); + } + parseMaybeDecoratorArguments(expr) { + if (this.eat(10)) { + const node = this.startNodeAtNode(expr); + node.callee = expr; + node.arguments = this.parseCallExpressionArguments(11, false); + this.toReferencedList(node.arguments); + return this.finishNode(node, "CallExpression"); + } + return expr; + } + parseBreakContinueStatement(node, isBreak) { + this.next(); + if (this.isLineTerminator()) { + node.label = null; + } else { + node.label = this.parseIdentifier(); + this.semicolon(); + } + this.verifyBreakContinue(node, isBreak); + return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); + } + verifyBreakContinue(node, isBreak) { + let i; + for (i = 0; i < this.state.labels.length; ++i) { + const lab = this.state.labels[i]; + if (node.label == null || lab.name === node.label.name) { + if (lab.kind != null && (isBreak || lab.kind === "loop")) break; + if (node.label && isBreak) break; + } + } + if (i === this.state.labels.length) { + const type = isBreak ? "BreakStatement" : "ContinueStatement"; + this.raise(Errors.IllegalBreakContinue, { + at: node, + type + }); + } + } + parseDebuggerStatement(node) { + this.next(); + this.semicolon(); + return this.finishNode(node, "DebuggerStatement"); + } + parseHeaderExpression() { + this.expect(10); + const val = this.parseExpression(); + this.expect(11); + return val; + } + parseDoWhileStatement(node) { + this.next(); + this.state.labels.push(loopLabel); + node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement()); + this.state.labels.pop(); + this.expect(92); + node.test = this.parseHeaderExpression(); + this.eat(13); + return this.finishNode(node, "DoWhileStatement"); + } + parseForStatement(node) { + this.next(); + this.state.labels.push(loopLabel); + let awaitAt = null; + if (this.isAwaitAllowed() && this.eatContextual(96)) { + awaitAt = this.state.lastTokStartLoc; + } + this.scope.enter(0); + this.expect(10); + if (this.match(13)) { + if (awaitAt !== null) { + this.unexpected(awaitAt); + } + return this.parseFor(node, null); + } + const startsWithLet = this.isContextual(99); + { + const startsWithAwaitUsing = this.isContextual(96) && this.startsAwaitUsing(); + const starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(105) && this.startsUsingForOf(); + const isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration; + if (this.match(74) || this.match(75) || isLetOrUsing) { + const initNode = this.startNode(); + let kind; + if (startsWithAwaitUsing) { + kind = "await using"; + if (!this.isAwaitAllowed()) { + this.raise(Errors.AwaitUsingNotInAsyncContext, { + at: this.state.startLoc + }); + } + this.next(); + } else { + kind = this.state.value; + } + this.next(); + this.parseVar(initNode, true, kind); + const init = this.finishNode(initNode, "VariableDeclaration"); + const isForIn = this.match(58); + if (isForIn && starsWithUsingDeclaration) { + this.raise(Errors.ForInUsing, { + at: init + }); + } + if ((isForIn || this.isContextual(101)) && init.declarations.length === 1) { + return this.parseForIn(node, init, awaitAt); + } + if (awaitAt !== null) { + this.unexpected(awaitAt); + } + return this.parseFor(node, init); + } + } + const startsWithAsync = this.isContextual(95); + const refExpressionErrors = new ExpressionErrors(); + const init = this.parseExpression(true, refExpressionErrors); + const isForOf = this.isContextual(101); + if (isForOf) { + if (startsWithLet) { + this.raise(Errors.ForOfLet, { + at: init + }); + } + if (awaitAt === null && startsWithAsync && init.type === "Identifier") { + this.raise(Errors.ForOfAsync, { + at: init + }); + } + } + if (isForOf || this.match(58)) { + this.checkDestructuringPrivate(refExpressionErrors); + this.toAssignable(init, true); + const type = isForOf ? "ForOfStatement" : "ForInStatement"; + this.checkLVal(init, { + in: { + type + } + }); + return this.parseForIn(node, init, awaitAt); + } else { + this.checkExpressionErrors(refExpressionErrors, true); + } + if (awaitAt !== null) { + this.unexpected(awaitAt); + } + return this.parseFor(node, init); + } + parseFunctionStatement(node, isAsync, isHangingDeclaration) { + this.next(); + return this.parseFunction(node, 1 | (isHangingDeclaration ? 2 : 0) | (isAsync ? 8 : 0)); + } + parseIfStatement(node) { + this.next(); + node.test = this.parseHeaderExpression(); + node.consequent = this.parseStatementOrSloppyAnnexBFunctionDeclaration(); + node.alternate = this.eat(66) ? this.parseStatementOrSloppyAnnexBFunctionDeclaration() : null; + return this.finishNode(node, "IfStatement"); + } + parseReturnStatement(node) { + if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) { + this.raise(Errors.IllegalReturn, { + at: this.state.startLoc + }); + } + this.next(); + if (this.isLineTerminator()) { + node.argument = null; + } else { + node.argument = this.parseExpression(); + this.semicolon(); + } + return this.finishNode(node, "ReturnStatement"); + } + parseSwitchStatement(node) { + this.next(); + node.discriminant = this.parseHeaderExpression(); + const cases = node.cases = []; + this.expect(5); + this.state.labels.push(switchLabel); + this.scope.enter(0); + let cur; + for (let sawDefault; !this.match(8);) { + if (this.match(61) || this.match(65)) { + const isCase = this.match(61); + if (cur) this.finishNode(cur, "SwitchCase"); + cases.push(cur = this.startNode()); + cur.consequent = []; + this.next(); + if (isCase) { + cur.test = this.parseExpression(); + } else { + if (sawDefault) { + this.raise(Errors.MultipleDefaultsInSwitch, { + at: this.state.lastTokStartLoc + }); + } + sawDefault = true; + cur.test = null; + } + this.expect(14); + } else { + if (cur) { + cur.consequent.push(this.parseStatementListItem()); + } else { + this.unexpected(); + } + } + } + this.scope.exit(); + if (cur) this.finishNode(cur, "SwitchCase"); + this.next(); + this.state.labels.pop(); + return this.finishNode(node, "SwitchStatement"); + } + parseThrowStatement(node) { + this.next(); + if (this.hasPrecedingLineBreak()) { + this.raise(Errors.NewlineAfterThrow, { + at: this.state.lastTokEndLoc + }); + } + node.argument = this.parseExpression(); + this.semicolon(); + return this.finishNode(node, "ThrowStatement"); + } + parseCatchClauseParam() { + const param = this.parseBindingAtom(); + this.scope.enter(this.options.annexB && param.type === "Identifier" ? 8 : 0); + this.checkLVal(param, { + in: { + type: "CatchClause" + }, + binding: 9 + }); + return param; + } + parseTryStatement(node) { + this.next(); + node.block = this.parseBlock(); + node.handler = null; + if (this.match(62)) { + const clause = this.startNode(); + this.next(); + if (this.match(10)) { + this.expect(10); + clause.param = this.parseCatchClauseParam(); + this.expect(11); + } else { + clause.param = null; + this.scope.enter(0); + } + clause.body = this.withSmartMixTopicForbiddingContext(() => this.parseBlock(false, false)); + this.scope.exit(); + node.handler = this.finishNode(clause, "CatchClause"); + } + node.finalizer = this.eat(67) ? this.parseBlock() : null; + if (!node.handler && !node.finalizer) { + this.raise(Errors.NoCatchOrFinally, { + at: node + }); + } + return this.finishNode(node, "TryStatement"); + } + parseVarStatement(node, kind, allowMissingInitializer = false) { + this.next(); + this.parseVar(node, false, kind, allowMissingInitializer); + this.semicolon(); + return this.finishNode(node, "VariableDeclaration"); + } + parseWhileStatement(node) { + this.next(); + node.test = this.parseHeaderExpression(); + this.state.labels.push(loopLabel); + node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement()); + this.state.labels.pop(); + return this.finishNode(node, "WhileStatement"); + } + parseWithStatement(node) { + if (this.state.strict) { + this.raise(Errors.StrictWith, { + at: this.state.startLoc + }); + } + this.next(); + node.object = this.parseHeaderExpression(); + node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement()); + return this.finishNode(node, "WithStatement"); + } + parseEmptyStatement(node) { + this.next(); + return this.finishNode(node, "EmptyStatement"); + } + parseLabeledStatement(node, maybeName, expr, flags) { + for (const label of this.state.labels) { + if (label.name === maybeName) { + this.raise(Errors.LabelRedeclaration, { + at: expr, + labelName: maybeName + }); + } + } + const kind = tokenIsLoop(this.state.type) ? "loop" : this.match(71) ? "switch" : null; + for (let i = this.state.labels.length - 1; i >= 0; i--) { + const label = this.state.labels[i]; + if (label.statementStart === node.start) { + label.statementStart = this.state.start; + label.kind = kind; + } else { + break; + } + } + this.state.labels.push({ + name: maybeName, + kind: kind, + statementStart: this.state.start + }); + node.body = flags & 8 ? this.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : this.parseStatement(); + this.state.labels.pop(); + node.label = expr; + return this.finishNode(node, "LabeledStatement"); + } + parseExpressionStatement(node, expr, decorators) { + node.expression = expr; + this.semicolon(); + return this.finishNode(node, "ExpressionStatement"); + } + parseBlock(allowDirectives = false, createNewLexicalScope = true, afterBlockParse) { + const node = this.startNode(); + if (allowDirectives) { + this.state.strictErrors.clear(); + } + this.expect(5); + if (createNewLexicalScope) { + this.scope.enter(0); + } + this.parseBlockBody(node, allowDirectives, false, 8, afterBlockParse); + if (createNewLexicalScope) { + this.scope.exit(); + } + return this.finishNode(node, "BlockStatement"); + } + isValidDirective(stmt) { + return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized; + } + parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) { + const body = node.body = []; + const directives = node.directives = []; + this.parseBlockOrModuleBlockBody(body, allowDirectives ? directives : undefined, topLevel, end, afterBlockParse); + } + parseBlockOrModuleBlockBody(body, directives, topLevel, end, afterBlockParse) { + const oldStrict = this.state.strict; + let hasStrictModeDirective = false; + let parsedNonDirective = false; + while (!this.match(end)) { + const stmt = topLevel ? this.parseModuleItem() : this.parseStatementListItem(); + if (directives && !parsedNonDirective) { + if (this.isValidDirective(stmt)) { + const directive = this.stmtToDirective(stmt); + directives.push(directive); + if (!hasStrictModeDirective && directive.value.value === "use strict") { + hasStrictModeDirective = true; + this.setStrict(true); + } + continue; + } + parsedNonDirective = true; + this.state.strictErrors.clear(); + } + body.push(stmt); + } + afterBlockParse == null ? void 0 : afterBlockParse.call(this, hasStrictModeDirective); + if (!oldStrict) { + this.setStrict(false); + } + this.next(); + } + parseFor(node, init) { + node.init = init; + this.semicolon(false); + node.test = this.match(13) ? null : this.parseExpression(); + this.semicolon(false); + node.update = this.match(11) ? null : this.parseExpression(); + this.expect(11); + node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement()); + this.scope.exit(); + this.state.labels.pop(); + return this.finishNode(node, "ForStatement"); + } + parseForIn(node, init, awaitAt) { + const isForIn = this.match(58); + this.next(); + if (isForIn) { + if (awaitAt !== null) this.unexpected(awaitAt); + } else { + node.await = awaitAt !== null; + } + if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || !this.options.annexB || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { + this.raise(Errors.ForInOfLoopInitializer, { + at: init, + type: isForIn ? "ForInStatement" : "ForOfStatement" + }); + } + if (init.type === "AssignmentPattern") { + this.raise(Errors.InvalidLhs, { + at: init, + ancestor: { + type: "ForStatement" + } + }); + } + node.left = init; + node.right = isForIn ? this.parseExpression() : this.parseMaybeAssignAllowIn(); + this.expect(11); + node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement()); + this.scope.exit(); + this.state.labels.pop(); + return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement"); + } + parseVar(node, isFor, kind, allowMissingInitializer = false) { + const declarations = node.declarations = []; + node.kind = kind; + for (;;) { + const decl = this.startNode(); + this.parseVarId(decl, kind); + decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn(); + if (decl.init === null && !allowMissingInitializer) { + if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(101)))) { + this.raise(Errors.DeclarationMissingInitializer, { + at: this.state.lastTokEndLoc, + kind: "destructuring" + }); + } else if (kind === "const" && !(this.match(58) || this.isContextual(101))) { + this.raise(Errors.DeclarationMissingInitializer, { + at: this.state.lastTokEndLoc, + kind: "const" + }); + } + } + declarations.push(this.finishNode(decl, "VariableDeclarator")); + if (!this.eat(12)) break; + } + return node; + } + parseVarId(decl, kind) { + const id = this.parseBindingAtom(); + this.checkLVal(id, { + in: { + type: "VariableDeclarator" + }, + binding: kind === "var" ? 5 : 8201 + }); + decl.id = id; + } + parseAsyncFunctionExpression(node) { + return this.parseFunction(node, 8); + } + parseFunction(node, flags = 0) { + const hangingDeclaration = flags & 2; + const isDeclaration = !!(flags & 1); + const requireId = isDeclaration && !(flags & 4); + const isAsync = !!(flags & 8); + this.initFunction(node, isAsync); + if (this.match(55)) { + if (hangingDeclaration) { + this.raise(Errors.GeneratorInSingleStatementContext, { + at: this.state.startLoc + }); + } + this.next(); + node.generator = true; + } + if (isDeclaration) { + node.id = this.parseFunctionId(requireId); + } + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + this.state.maybeInArrowParameters = false; + this.scope.enter(2); + this.prodParam.enter(functionFlags(isAsync, node.generator)); + if (!isDeclaration) { + node.id = this.parseFunctionId(); + } + this.parseFunctionParams(node, false); + this.withSmartMixTopicForbiddingContext(() => { + this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression"); + }); + this.prodParam.exit(); + this.scope.exit(); + if (isDeclaration && !hangingDeclaration) { + this.registerFunctionStatementId(node); + } + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + return node; + } + parseFunctionId(requireId) { + return requireId || tokenIsIdentifier(this.state.type) ? this.parseIdentifier() : null; + } + parseFunctionParams(node, isConstructor) { + this.expect(10); + this.expressionScope.enter(newParameterDeclarationScope()); + node.params = this.parseBindingList(11, 41, 2 | (isConstructor ? 4 : 0)); + this.expressionScope.exit(); + } + registerFunctionStatementId(node) { + if (!node.id) return; + this.scope.declareName(node.id.name, !this.options.annexB || this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? 5 : 8201 : 17, node.id.loc.start); + } + parseClass(node, isStatement, optionalId) { + this.next(); + const oldStrict = this.state.strict; + this.state.strict = true; + this.parseClassId(node, isStatement, optionalId); + this.parseClassSuper(node); + node.body = this.parseClassBody(!!node.superClass, oldStrict); + return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); + } + isClassProperty() { + return this.match(29) || this.match(13) || this.match(8); + } + isClassMethod() { + return this.match(10); + } + isNonstaticConstructor(method) { + return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor"); + } + parseClassBody(hadSuperClass, oldStrict) { + this.classScope.enter(); + const state = { + hadConstructor: false, + hadSuperClass + }; + let decorators = []; + const classBody = this.startNode(); + classBody.body = []; + this.expect(5); + this.withSmartMixTopicForbiddingContext(() => { + while (!this.match(8)) { + if (this.eat(13)) { + if (decorators.length > 0) { + throw this.raise(Errors.DecoratorSemicolon, { + at: this.state.lastTokEndLoc + }); + } + continue; + } + if (this.match(26)) { + decorators.push(this.parseDecorator()); + continue; + } + const member = this.startNode(); + if (decorators.length) { + member.decorators = decorators; + this.resetStartLocationFromNode(member, decorators[0]); + decorators = []; + } + this.parseClassMember(classBody, member, state); + if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) { + this.raise(Errors.DecoratorConstructor, { + at: member + }); + } + } + }); + this.state.strict = oldStrict; + this.next(); + if (decorators.length) { + throw this.raise(Errors.TrailingDecorator, { + at: this.state.startLoc + }); + } + this.classScope.exit(); + return this.finishNode(classBody, "ClassBody"); + } + parseClassMemberFromModifier(classBody, member) { + const key = this.parseIdentifier(true); + if (this.isClassMethod()) { + const method = member; + method.kind = "method"; + method.computed = false; + method.key = key; + method.static = false; + this.pushClassMethod(classBody, method, false, false, false, false); + return true; + } else if (this.isClassProperty()) { + const prop = member; + prop.computed = false; + prop.key = key; + prop.static = false; + classBody.body.push(this.parseClassProperty(prop)); + return true; + } + this.resetPreviousNodeTrailingComments(key); + return false; + } + parseClassMember(classBody, member, state) { + const isStatic = this.isContextual(104); + if (isStatic) { + if (this.parseClassMemberFromModifier(classBody, member)) { + return; + } + if (this.eat(5)) { + this.parseClassStaticBlock(classBody, member); + return; + } + } + this.parseClassMemberWithIsStatic(classBody, member, state, isStatic); + } + parseClassMemberWithIsStatic(classBody, member, state, isStatic) { + const publicMethod = member; + const privateMethod = member; + const publicProp = member; + const privateProp = member; + const accessorProp = member; + const method = publicMethod; + const publicMember = publicMethod; + member.static = isStatic; + this.parsePropertyNamePrefixOperator(member); + if (this.eat(55)) { + method.kind = "method"; + const isPrivateName = this.match(136); + this.parseClassElementName(method); + if (isPrivateName) { + this.pushClassPrivateMethod(classBody, privateMethod, true, false); + return; + } + if (this.isNonstaticConstructor(publicMethod)) { + this.raise(Errors.ConstructorIsGenerator, { + at: publicMethod.key + }); + } + this.pushClassMethod(classBody, publicMethod, true, false, false, false); + return; + } + const isContextual = tokenIsIdentifier(this.state.type) && !this.state.containsEsc; + const isPrivate = this.match(136); + const key = this.parseClassElementName(member); + const maybeQuestionTokenStartLoc = this.state.startLoc; + this.parsePostMemberNameModifiers(publicMember); + if (this.isClassMethod()) { + method.kind = "method"; + if (isPrivate) { + this.pushClassPrivateMethod(classBody, privateMethod, false, false); + return; + } + const isConstructor = this.isNonstaticConstructor(publicMethod); + let allowsDirectSuper = false; + if (isConstructor) { + publicMethod.kind = "constructor"; + if (state.hadConstructor && !this.hasPlugin("typescript")) { + this.raise(Errors.DuplicateConstructor, { + at: key + }); + } + if (isConstructor && this.hasPlugin("typescript") && member.override) { + this.raise(Errors.OverrideOnConstructor, { + at: key + }); + } + state.hadConstructor = true; + allowsDirectSuper = state.hadSuperClass; + } + this.pushClassMethod(classBody, publicMethod, false, false, isConstructor, allowsDirectSuper); + } else if (this.isClassProperty()) { + if (isPrivate) { + this.pushClassPrivateProperty(classBody, privateProp); + } else { + this.pushClassProperty(classBody, publicProp); + } + } else if (isContextual && key.name === "async" && !this.isLineTerminator()) { + this.resetPreviousNodeTrailingComments(key); + const isGenerator = this.eat(55); + if (publicMember.optional) { + this.unexpected(maybeQuestionTokenStartLoc); + } + method.kind = "method"; + const isPrivate = this.match(136); + this.parseClassElementName(method); + this.parsePostMemberNameModifiers(publicMember); + if (isPrivate) { + this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true); + } else { + if (this.isNonstaticConstructor(publicMethod)) { + this.raise(Errors.ConstructorIsAsync, { + at: publicMethod.key + }); + } + this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false); + } + } else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(55) && this.isLineTerminator())) { + this.resetPreviousNodeTrailingComments(key); + method.kind = key.name; + const isPrivate = this.match(136); + this.parseClassElementName(publicMethod); + if (isPrivate) { + this.pushClassPrivateMethod(classBody, privateMethod, false, false); + } else { + if (this.isNonstaticConstructor(publicMethod)) { + this.raise(Errors.ConstructorIsAccessor, { + at: publicMethod.key + }); + } + this.pushClassMethod(classBody, publicMethod, false, false, false, false); + } + this.checkGetterSetterParams(publicMethod); + } else if (isContextual && key.name === "accessor" && !this.isLineTerminator()) { + this.expectPlugin("decoratorAutoAccessors"); + this.resetPreviousNodeTrailingComments(key); + const isPrivate = this.match(136); + this.parseClassElementName(publicProp); + this.pushClassAccessorProperty(classBody, accessorProp, isPrivate); + } else if (this.isLineTerminator()) { + if (isPrivate) { + this.pushClassPrivateProperty(classBody, privateProp); + } else { + this.pushClassProperty(classBody, publicProp); + } + } else { + this.unexpected(); + } + } + parseClassElementName(member) { + const { + type, + value + } = this.state; + if ((type === 130 || type === 131) && member.static && value === "prototype") { + this.raise(Errors.StaticPrototype, { + at: this.state.startLoc + }); + } + if (type === 136) { + if (value === "constructor") { + this.raise(Errors.ConstructorClassPrivateField, { + at: this.state.startLoc + }); + } + const key = this.parsePrivateName(); + member.key = key; + return key; + } + return this.parsePropertyName(member); + } + parseClassStaticBlock(classBody, member) { + var _member$decorators; + this.scope.enter(64 | 128 | 16); + const oldLabels = this.state.labels; + this.state.labels = []; + this.prodParam.enter(PARAM); + const body = member.body = []; + this.parseBlockOrModuleBlockBody(body, undefined, false, 8); + this.prodParam.exit(); + this.scope.exit(); + this.state.labels = oldLabels; + classBody.body.push(this.finishNode(member, "StaticBlock")); + if ((_member$decorators = member.decorators) != null && _member$decorators.length) { + this.raise(Errors.DecoratorStaticBlock, { + at: member + }); + } + } + pushClassProperty(classBody, prop) { + if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) { + this.raise(Errors.ConstructorClassField, { + at: prop.key + }); + } + classBody.body.push(this.parseClassProperty(prop)); + } + pushClassPrivateProperty(classBody, prop) { + const node = this.parseClassPrivateProperty(prop); + classBody.body.push(node); + this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start); + } + pushClassAccessorProperty(classBody, prop, isPrivate) { + if (!isPrivate && !prop.computed) { + const key = prop.key; + if (key.name === "constructor" || key.value === "constructor") { + this.raise(Errors.ConstructorClassField, { + at: key + }); + } + } + const node = this.parseClassAccessorProperty(prop); + classBody.body.push(node); + if (isPrivate) { + this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start); + } + } + pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) { + classBody.body.push(this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true)); + } + pushClassPrivateMethod(classBody, method, isGenerator, isAsync) { + const node = this.parseMethod(method, isGenerator, isAsync, false, false, "ClassPrivateMethod", true); + classBody.body.push(node); + const kind = node.kind === "get" ? node.static ? 6 : 2 : node.kind === "set" ? node.static ? 5 : 1 : 0; + this.declareClassPrivateMethodInScope(node, kind); + } + declareClassPrivateMethodInScope(node, kind) { + this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.loc.start); + } + parsePostMemberNameModifiers(methodOrProp) {} + parseClassPrivateProperty(node) { + this.parseInitializer(node); + this.semicolon(); + return this.finishNode(node, "ClassPrivateProperty"); + } + parseClassProperty(node) { + this.parseInitializer(node); + this.semicolon(); + return this.finishNode(node, "ClassProperty"); + } + parseClassAccessorProperty(node) { + this.parseInitializer(node); + this.semicolon(); + return this.finishNode(node, "ClassAccessorProperty"); + } + parseInitializer(node) { + this.scope.enter(64 | 16); + this.expressionScope.enter(newExpressionScope()); + this.prodParam.enter(PARAM); + node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null; + this.expressionScope.exit(); + this.prodParam.exit(); + this.scope.exit(); + } + parseClassId(node, isStatement, optionalId, bindingType = 8331) { + if (tokenIsIdentifier(this.state.type)) { + node.id = this.parseIdentifier(); + if (isStatement) { + this.declareNameFromIdentifier(node.id, bindingType); + } + } else { + if (optionalId || !isStatement) { + node.id = null; + } else { + throw this.raise(Errors.MissingClassName, { + at: this.state.startLoc + }); + } + } + } + parseClassSuper(node) { + node.superClass = this.eat(81) ? this.parseExprSubscripts() : null; + } + parseExport(node, decorators) { + const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, true); + const hasDefault = this.maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier); + const parseAfterDefault = !hasDefault || this.eat(12); + const hasStar = parseAfterDefault && this.eatExportStar(node); + const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node); + const parseAfterNamespace = parseAfterDefault && (!hasNamespace || this.eat(12)); + const isFromRequired = hasDefault || hasStar; + if (hasStar && !hasNamespace) { + if (hasDefault) this.unexpected(); + if (decorators) { + throw this.raise(Errors.UnsupportedDecoratorExport, { + at: node + }); + } + this.parseExportFrom(node, true); + return this.finishNode(node, "ExportAllDeclaration"); + } + const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node); + if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers) { + this.unexpected(null, 5); + } + if (hasNamespace && parseAfterNamespace) { + this.unexpected(null, 97); + } + let hasDeclaration; + if (isFromRequired || hasSpecifiers) { + hasDeclaration = false; + if (decorators) { + throw this.raise(Errors.UnsupportedDecoratorExport, { + at: node + }); + } + this.parseExportFrom(node, isFromRequired); + } else { + hasDeclaration = this.maybeParseExportDeclaration(node); + } + if (isFromRequired || hasSpecifiers || hasDeclaration) { + var _node2$declaration; + const node2 = node; + this.checkExport(node2, true, false, !!node2.source); + if (((_node2$declaration = node2.declaration) == null ? void 0 : _node2$declaration.type) === "ClassDeclaration") { + this.maybeTakeDecorators(decorators, node2.declaration, node2); + } else if (decorators) { + throw this.raise(Errors.UnsupportedDecoratorExport, { + at: node + }); + } + return this.finishNode(node2, "ExportNamedDeclaration"); + } + if (this.eat(65)) { + const node2 = node; + const decl = this.parseExportDefaultExpression(); + node2.declaration = decl; + if (decl.type === "ClassDeclaration") { + this.maybeTakeDecorators(decorators, decl, node2); + } else if (decorators) { + throw this.raise(Errors.UnsupportedDecoratorExport, { + at: node + }); + } + this.checkExport(node2, true, true); + return this.finishNode(node2, "ExportDefaultDeclaration"); + } + this.unexpected(null, 5); + } + eatExportStar(node) { + return this.eat(55); + } + maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) { + if (maybeDefaultIdentifier || this.isExportDefaultSpecifier()) { + this.expectPlugin("exportDefaultFrom", maybeDefaultIdentifier == null ? void 0 : maybeDefaultIdentifier.loc.start); + const id = maybeDefaultIdentifier || this.parseIdentifier(true); + const specifier = this.startNodeAtNode(id); + specifier.exported = id; + node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")]; + return true; + } + return false; + } + maybeParseExportNamespaceSpecifier(node) { + if (this.isContextual(93)) { + if (!node.specifiers) node.specifiers = []; + const specifier = this.startNodeAt(this.state.lastTokStartLoc); + this.next(); + specifier.exported = this.parseModuleExportName(); + node.specifiers.push(this.finishNode(specifier, "ExportNamespaceSpecifier")); + return true; + } + return false; + } + maybeParseExportNamedSpecifiers(node) { + if (this.match(5)) { + if (!node.specifiers) node.specifiers = []; + const isTypeExport = node.exportKind === "type"; + node.specifiers.push(...this.parseExportSpecifiers(isTypeExport)); + node.source = null; + node.declaration = null; + if (this.hasPlugin("importAssertions")) { + node.assertions = []; + } + return true; + } + return false; + } + maybeParseExportDeclaration(node) { + if (this.shouldParseExportDeclaration()) { + node.specifiers = []; + node.source = null; + if (this.hasPlugin("importAssertions")) { + node.assertions = []; + } + node.declaration = this.parseExportDeclaration(node); + return true; + } + return false; + } + isAsyncFunction() { + if (!this.isContextual(95)) return false; + const next = this.nextTokenInLineStart(); + return this.isUnparsedContextual(next, "function"); + } + parseExportDefaultExpression() { + const expr = this.startNode(); + if (this.match(68)) { + this.next(); + return this.parseFunction(expr, 1 | 4); + } else if (this.isAsyncFunction()) { + this.next(); + this.next(); + return this.parseFunction(expr, 1 | 4 | 8); + } + if (this.match(80)) { + return this.parseClass(expr, true, true); + } + if (this.match(26)) { + if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === true) { + this.raise(Errors.DecoratorBeforeExport, { + at: this.state.startLoc + }); + } + return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true); + } + if (this.match(75) || this.match(74) || this.isLet()) { + throw this.raise(Errors.UnsupportedDefaultExport, { + at: this.state.startLoc + }); + } + const res = this.parseMaybeAssignAllowIn(); + this.semicolon(); + return res; + } + parseExportDeclaration(node) { + if (this.match(80)) { + const node = this.parseClass(this.startNode(), true, false); + return node; + } + return this.parseStatementListItem(); + } + isExportDefaultSpecifier() { + const { + type + } = this.state; + if (tokenIsIdentifier(type)) { + if (type === 95 && !this.state.containsEsc || type === 99) { + return false; + } + if ((type === 128 || type === 127) && !this.state.containsEsc) { + const { + type: nextType + } = this.lookahead(); + if (tokenIsIdentifier(nextType) && nextType !== 97 || nextType === 5) { + this.expectOnePlugin(["flow", "typescript"]); + return false; + } + } + } else if (!this.match(65)) { + return false; + } + const next = this.nextTokenStart(); + const hasFrom = this.isUnparsedContextual(next, "from"); + if (this.input.charCodeAt(next) === 44 || tokenIsIdentifier(this.state.type) && hasFrom) { + return true; + } + if (this.match(65) && hasFrom) { + const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4)); + return nextAfterFrom === 34 || nextAfterFrom === 39; + } + return false; + } + parseExportFrom(node, expect) { + if (this.eatContextual(97)) { + node.source = this.parseImportSource(); + this.checkExport(node); + this.maybeParseImportAttributes(node); + this.checkJSONModuleImport(node); + } else if (expect) { + this.unexpected(); + } + this.semicolon(); + } + shouldParseExportDeclaration() { + const { + type + } = this.state; + if (type === 26) { + this.expectOnePlugin(["decorators", "decorators-legacy"]); + if (this.hasPlugin("decorators")) { + if (this.getPluginOption("decorators", "decoratorsBeforeExport") === true) { + this.raise(Errors.DecoratorBeforeExport, { + at: this.state.startLoc + }); + } + return true; + } + } + return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction(); + } + checkExport(node, checkNames, isDefault, isFrom) { + if (checkNames) { + var _node$specifiers; + if (isDefault) { + this.checkDuplicateExports(node, "default"); + if (this.hasPlugin("exportDefaultFrom")) { + var _declaration$extra; + const declaration = node.declaration; + if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) { + this.raise(Errors.ExportDefaultFromAsIdentifier, { + at: declaration + }); + } + } + } else if ((_node$specifiers = node.specifiers) != null && _node$specifiers.length) { + for (const specifier of node.specifiers) { + const { + exported + } = specifier; + const exportName = exported.type === "Identifier" ? exported.name : exported.value; + this.checkDuplicateExports(specifier, exportName); + if (!isFrom && specifier.local) { + const { + local + } = specifier; + if (local.type !== "Identifier") { + this.raise(Errors.ExportBindingIsString, { + at: specifier, + localName: local.value, + exportName + }); + } else { + this.checkReservedWord(local.name, local.loc.start, true, false); + this.scope.checkLocalExport(local); + } + } + } + } else if (node.declaration) { + if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") { + const id = node.declaration.id; + if (!id) throw new Error("Assertion failure"); + this.checkDuplicateExports(node, id.name); + } else if (node.declaration.type === "VariableDeclaration") { + for (const declaration of node.declaration.declarations) { + this.checkDeclaration(declaration.id); + } + } + } + } + } + checkDeclaration(node) { + if (node.type === "Identifier") { + this.checkDuplicateExports(node, node.name); + } else if (node.type === "ObjectPattern") { + for (const prop of node.properties) { + this.checkDeclaration(prop); + } + } else if (node.type === "ArrayPattern") { + for (const elem of node.elements) { + if (elem) { + this.checkDeclaration(elem); + } + } + } else if (node.type === "ObjectProperty") { + this.checkDeclaration(node.value); + } else if (node.type === "RestElement") { + this.checkDeclaration(node.argument); + } else if (node.type === "AssignmentPattern") { + this.checkDeclaration(node.left); + } + } + checkDuplicateExports(node, exportName) { + if (this.exportedIdentifiers.has(exportName)) { + if (exportName === "default") { + this.raise(Errors.DuplicateDefaultExport, { + at: node + }); + } else { + this.raise(Errors.DuplicateExport, { + at: node, + exportName + }); + } + } + this.exportedIdentifiers.add(exportName); + } + parseExportSpecifiers(isInTypeExport) { + const nodes = []; + let first = true; + this.expect(5); + while (!this.eat(8)) { + if (first) { + first = false; + } else { + this.expect(12); + if (this.eat(8)) break; + } + const isMaybeTypeOnly = this.isContextual(128); + const isString = this.match(131); + const node = this.startNode(); + node.local = this.parseModuleExportName(); + nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly)); + } + return nodes; + } + parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) { + if (this.eatContextual(93)) { + node.exported = this.parseModuleExportName(); + } else if (isString) { + node.exported = cloneStringLiteral(node.local); + } else if (!node.exported) { + node.exported = cloneIdentifier(node.local); + } + return this.finishNode(node, "ExportSpecifier"); + } + parseModuleExportName() { + if (this.match(131)) { + const result = this.parseStringLiteral(this.state.value); + const surrogate = result.value.match(loneSurrogate); + if (surrogate) { + this.raise(Errors.ModuleExportNameHasLoneSurrogate, { + at: result, + surrogateCharCode: surrogate[0].charCodeAt(0) + }); + } + return result; + } + return this.parseIdentifier(true); + } + isJSONModuleImport(node) { + if (node.assertions != null) { + return node.assertions.some(({ + key, + value + }) => { + return value.value === "json" && (key.type === "Identifier" ? key.name === "type" : key.value === "type"); + }); + } + return false; + } + checkImportReflection(node) { + if (node.module) { + var _node$assertions; + if (node.specifiers.length !== 1 || node.specifiers[0].type !== "ImportDefaultSpecifier") { + this.raise(Errors.ImportReflectionNotBinding, { + at: node.specifiers[0].loc.start + }); + } + if (((_node$assertions = node.assertions) == null ? void 0 : _node$assertions.length) > 0) { + this.raise(Errors.ImportReflectionHasAssertion, { + at: node.specifiers[0].loc.start + }); + } + } + } + checkJSONModuleImport(node) { + if (this.isJSONModuleImport(node) && node.type !== "ExportAllDeclaration") { + const { + specifiers + } = node; + if (specifiers != null) { + const nonDefaultNamedSpecifier = specifiers.find(specifier => { + let imported; + if (specifier.type === "ExportSpecifier") { + imported = specifier.local; + } else if (specifier.type === "ImportSpecifier") { + imported = specifier.imported; + } + if (imported !== undefined) { + return imported.type === "Identifier" ? imported.name !== "default" : imported.value !== "default"; + } + }); + if (nonDefaultNamedSpecifier !== undefined) { + this.raise(Errors.ImportJSONBindingNotDefault, { + at: nonDefaultNamedSpecifier.loc.start + }); + } + } + } + } + isPotentialImportPhase(isExport) { + return !isExport && this.isContextual(125); + } + applyImportPhase(node, isExport, phase, loc) { + if (isExport) { + return; + } + if (phase === "module") { + this.expectPlugin("importReflection", loc); + node.module = true; + } else if (this.hasPlugin("importReflection")) { + node.module = false; + } + } + parseMaybeImportPhase(node, isExport) { + if (!this.isPotentialImportPhase(isExport)) { + this.applyImportPhase(node, isExport, null); + return null; + } + const phaseIdentifier = this.parseIdentifier(true); + const { + type + } = this.state; + const isImportPhase = tokenIsKeywordOrIdentifier(type) ? type !== 97 || this.lookaheadCharCode() === 102 : type !== 12; + if (isImportPhase) { + this.resetPreviousIdentifierLeadingComments(phaseIdentifier); + this.applyImportPhase(node, isExport, phaseIdentifier.name, phaseIdentifier.loc.start); + return null; + } else { + this.applyImportPhase(node, isExport, null); + return phaseIdentifier; + } + } + isPrecedingIdImportPhase(phase) { + const { + type + } = this.state; + return tokenIsIdentifier(type) ? type !== 97 || this.lookaheadCharCode() === 102 : type !== 12; + } + parseImport(node) { + if (this.match(131)) { + return this.parseImportSourceAndAttributes(node); + } + return this.parseImportSpecifiersAndAfter(node, this.parseMaybeImportPhase(node, false)); + } + parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier) { + node.specifiers = []; + const hasDefault = this.maybeParseDefaultImportSpecifier(node, maybeDefaultIdentifier); + const parseNext = !hasDefault || this.eat(12); + const hasStar = parseNext && this.maybeParseStarImportSpecifier(node); + if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node); + this.expectContextual(97); + return this.parseImportSourceAndAttributes(node); + } + parseImportSourceAndAttributes(node) { + var _node$specifiers2; + (_node$specifiers2 = node.specifiers) != null ? _node$specifiers2 : node.specifiers = []; + node.source = this.parseImportSource(); + this.maybeParseImportAttributes(node); + this.checkImportReflection(node); + this.checkJSONModuleImport(node); + this.semicolon(); + return this.finishNode(node, "ImportDeclaration"); + } + parseImportSource() { + if (!this.match(131)) this.unexpected(); + return this.parseExprAtom(); + } + parseImportSpecifierLocal(node, specifier, type) { + specifier.local = this.parseIdentifier(); + node.specifiers.push(this.finishImportSpecifier(specifier, type)); + } + finishImportSpecifier(specifier, type, bindingType = 8201) { + this.checkLVal(specifier.local, { + in: { + type + }, + binding: bindingType + }); + return this.finishNode(specifier, type); + } + parseImportAttributes() { + this.expect(5); + const attrs = []; + const attrNames = new Set(); + do { + if (this.match(8)) { + break; + } + const node = this.startNode(); + const keyName = this.state.value; + if (attrNames.has(keyName)) { + this.raise(Errors.ModuleAttributesWithDuplicateKeys, { + at: this.state.startLoc, + key: keyName + }); + } + attrNames.add(keyName); + if (this.match(131)) { + node.key = this.parseStringLiteral(keyName); + } else { + node.key = this.parseIdentifier(true); + } + this.expect(14); + if (!this.match(131)) { + throw this.raise(Errors.ModuleAttributeInvalidValue, { + at: this.state.startLoc + }); + } + node.value = this.parseStringLiteral(this.state.value); + attrs.push(this.finishNode(node, "ImportAttribute")); + } while (this.eat(12)); + this.expect(8); + return attrs; + } + parseModuleAttributes() { + const attrs = []; + const attributes = new Set(); + do { + const node = this.startNode(); + node.key = this.parseIdentifier(true); + if (node.key.name !== "type") { + this.raise(Errors.ModuleAttributeDifferentFromType, { + at: node.key + }); + } + if (attributes.has(node.key.name)) { + this.raise(Errors.ModuleAttributesWithDuplicateKeys, { + at: node.key, + key: node.key.name + }); + } + attributes.add(node.key.name); + this.expect(14); + if (!this.match(131)) { + throw this.raise(Errors.ModuleAttributeInvalidValue, { + at: this.state.startLoc + }); + } + node.value = this.parseStringLiteral(this.state.value); + attrs.push(this.finishNode(node, "ImportAttribute")); + } while (this.eat(12)); + return attrs; + } + maybeParseImportAttributes(node) { + let attributes; + let useWith = false; + if (this.match(76)) { + if (this.hasPrecedingLineBreak() && this.lookaheadCharCode() === 40) { + return; + } + this.next(); + { + if (this.hasPlugin("moduleAttributes")) { + attributes = this.parseModuleAttributes(); + } else { + this.expectImportAttributesPlugin(); + attributes = this.parseImportAttributes(); + } + } + useWith = true; + } else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) { + if (this.hasPlugin("importAttributes")) { + if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) { + this.raise(Errors.ImportAttributesUseAssert, { + at: this.state.startLoc + }); + } + this.addExtra(node, "deprecatedAssertSyntax", true); + } else { + this.expectOnePlugin(["importAttributes", "importAssertions"]); + } + this.next(); + attributes = this.parseImportAttributes(); + } else if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) { + attributes = []; + } else { + if (this.hasPlugin("moduleAttributes")) { + attributes = []; + } else return; + } + if (!useWith && this.hasPlugin("importAssertions")) { + node.assertions = attributes; + } else { + node.attributes = attributes; + } + } + maybeParseDefaultImportSpecifier(node, maybeDefaultIdentifier) { + if (maybeDefaultIdentifier) { + const specifier = this.startNodeAtNode(maybeDefaultIdentifier); + specifier.local = maybeDefaultIdentifier; + node.specifiers.push(this.finishImportSpecifier(specifier, "ImportDefaultSpecifier")); + return true; + } else if (tokenIsKeywordOrIdentifier(this.state.type)) { + this.parseImportSpecifierLocal(node, this.startNode(), "ImportDefaultSpecifier"); + return true; + } + return false; + } + maybeParseStarImportSpecifier(node) { + if (this.match(55)) { + const specifier = this.startNode(); + this.next(); + this.expectContextual(93); + this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier"); + return true; + } + return false; + } + parseNamedImportSpecifiers(node) { + let first = true; + this.expect(5); + while (!this.eat(8)) { + if (first) { + first = false; + } else { + if (this.eat(14)) { + throw this.raise(Errors.DestructureNamedImport, { + at: this.state.startLoc + }); + } + this.expect(12); + if (this.eat(8)) break; + } + const specifier = this.startNode(); + const importedIsString = this.match(131); + const isMaybeTypeOnly = this.isContextual(128); + specifier.imported = this.parseModuleExportName(); + const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, undefined); + node.specifiers.push(importSpecifier); + } + } + parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) { + if (this.eatContextual(93)) { + specifier.local = this.parseIdentifier(); + } else { + const { + imported + } = specifier; + if (importedIsString) { + throw this.raise(Errors.ImportBindingIsString, { + at: specifier, + importName: imported.value + }); + } + this.checkReservedWord(imported.name, specifier.loc.start, true, true); + if (!specifier.local) { + specifier.local = cloneIdentifier(imported); + } + } + return this.finishImportSpecifier(specifier, "ImportSpecifier", bindingType); + } + isThisParam(param) { + return param.type === "Identifier" && param.name === "this"; + } +} +class Parser extends StatementParser { + constructor(options, input) { + options = getOptions(options); + super(options, input); + this.options = options; + this.initializeScopes(); + this.plugins = pluginsMap(this.options.plugins); + this.filename = options.sourceFilename; + } + getScopeHandler() { + return ScopeHandler; + } + parse() { + this.enterInitialScopes(); + const file = this.startNode(); + const program = this.startNode(); + this.nextToken(); + file.errors = null; + this.parseTopLevel(file, program); + file.errors = this.state.errors; + return file; + } +} +function pluginsMap(plugins) { + const pluginMap = new Map(); + for (const plugin of plugins) { + const [name, options] = Array.isArray(plugin) ? plugin : [plugin, {}]; + if (!pluginMap.has(name)) pluginMap.set(name, options || {}); + } + return pluginMap; +} +function parse(input, options) { + var _options; + if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") { + options = Object.assign({}, options); + try { + options.sourceType = "module"; + const parser = getParser(options, input); + const ast = parser.parse(); + if (parser.sawUnambiguousESM) { + return ast; + } + if (parser.ambiguousScriptDifferentAst) { + try { + options.sourceType = "script"; + return getParser(options, input).parse(); + } catch (_unused) {} + } else { + ast.program.sourceType = "script"; + } + return ast; + } catch (moduleError) { + try { + options.sourceType = "script"; + return getParser(options, input).parse(); + } catch (_unused2) {} + throw moduleError; + } + } else { + return getParser(options, input).parse(); + } +} +function parseExpression(input, options) { + const parser = getParser(options, input); + if (parser.options.strictMode) { + parser.state.strict = true; + } + return parser.getExpression(); +} +function generateExportedTokenTypes(internalTokenTypes) { + const tokenTypes = {}; + for (const typeName of Object.keys(internalTokenTypes)) { + tokenTypes[typeName] = getExportedToken(internalTokenTypes[typeName]); + } + return tokenTypes; +} +const tokTypes = generateExportedTokenTypes(tt); +function getParser(options, input) { + let cls = Parser; + if (options != null && options.plugins) { + validatePlugins(options.plugins); + cls = getParserClass(options.plugins); + } + return new cls(options, input); +} +const parserClassCache = {}; +function getParserClass(pluginsFromOptions) { + const pluginList = mixinPluginNames.filter(name => hasPlugin(pluginsFromOptions, name)); + const key = pluginList.join("/"); + let cls = parserClassCache[key]; + if (!cls) { + cls = Parser; + for (const plugin of pluginList) { + cls = mixinPlugins[plugin](cls); + } + parserClassCache[key] = cls; + } + return cls; +} +exports.parse = parse; +exports.parseExpression = parseExpression; +exports.tokTypes = tokTypes; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 3556: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = createTemplateBuilder; +var _options = __nccwpck_require__(6328); +var _string = __nccwpck_require__(2639); +var _literal = __nccwpck_require__(9226); +const NO_PLACEHOLDER = (0, _options.validate)({ + placeholderPattern: false +}); +function createTemplateBuilder(formatter, defaultOpts) { + const templateFnCache = new WeakMap(); + const templateAstCache = new WeakMap(); + const cachedOpts = defaultOpts || (0, _options.validate)(null); + return Object.assign((tpl, ...args) => { + if (typeof tpl === "string") { + if (args.length > 1) throw new Error("Unexpected extra params."); + return extendedTrace((0, _string.default)(formatter, tpl, (0, _options.merge)(cachedOpts, (0, _options.validate)(args[0])))); + } else if (Array.isArray(tpl)) { + let builder = templateFnCache.get(tpl); + if (!builder) { + builder = (0, _literal.default)(formatter, tpl, cachedOpts); + templateFnCache.set(tpl, builder); + } + return extendedTrace(builder(args)); + } else if (typeof tpl === "object" && tpl) { + if (args.length > 0) throw new Error("Unexpected extra params."); + return createTemplateBuilder(formatter, (0, _options.merge)(cachedOpts, (0, _options.validate)(tpl))); + } + throw new Error(`Unexpected template param ${typeof tpl}`); + }, { + ast: (tpl, ...args) => { + if (typeof tpl === "string") { + if (args.length > 1) throw new Error("Unexpected extra params."); + return (0, _string.default)(formatter, tpl, (0, _options.merge)((0, _options.merge)(cachedOpts, (0, _options.validate)(args[0])), NO_PLACEHOLDER))(); + } else if (Array.isArray(tpl)) { + let builder = templateAstCache.get(tpl); + if (!builder) { + builder = (0, _literal.default)(formatter, tpl, (0, _options.merge)(cachedOpts, NO_PLACEHOLDER)); + templateAstCache.set(tpl, builder); + } + return builder(args)(); + } + throw new Error(`Unexpected template param ${typeof tpl}`); + } + }); +} +function extendedTrace(fn) { + let rootStack = ""; + try { + throw new Error(); + } catch (error) { + if (error.stack) { + rootStack = error.stack.split("\n").slice(3).join("\n"); + } + } + return arg => { + try { + return fn(arg); + } catch (err) { + err.stack += `\n =============\n${rootStack}`; + throw err; + } + }; +} + +//# sourceMappingURL=builder.js.map + + +/***/ }), + +/***/ 9434: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.statements = exports.statement = exports.smart = exports.program = exports.expression = void 0; +var _t = __nccwpck_require__(7012); +const { + assertExpressionStatement +} = _t; +function makeStatementFormatter(fn) { + return { + code: str => `/* @babel/template */;\n${str}`, + validate: () => {}, + unwrap: ast => { + return fn(ast.program.body.slice(1)); + } + }; +} +const smart = makeStatementFormatter(body => { + if (body.length > 1) { + return body; + } else { + return body[0]; + } +}); +exports.smart = smart; +const statements = makeStatementFormatter(body => body); +exports.statements = statements; +const statement = makeStatementFormatter(body => { + if (body.length === 0) { + throw new Error("Found nothing to return."); + } + if (body.length > 1) { + throw new Error("Found multiple statements but wanted one"); + } + return body[0]; +}); +exports.statement = statement; +const expression = { + code: str => `(\n${str}\n)`, + validate: ast => { + if (ast.program.body.length > 1) { + throw new Error("Found multiple statements but wanted one"); + } + if (expression.unwrap(ast).start === 0) { + throw new Error("Parse result included parens."); + } + }, + unwrap: ({ + program + }) => { + const [stmt] = program.body; + assertExpressionStatement(stmt); + return stmt.expression; + } +}; +exports.expression = expression; +const program = { + code: str => str, + validate: () => {}, + unwrap: ast => ast.program +}; +exports.program = program; + +//# sourceMappingURL=formatters.js.map + + +/***/ }), + +/***/ 6745: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.statements = exports.statement = exports.smart = exports.program = exports.expression = exports.default = void 0; +var formatters = __nccwpck_require__(9434); +var _builder = __nccwpck_require__(3556); +const smart = (0, _builder.default)(formatters.smart); +exports.smart = smart; +const statement = (0, _builder.default)(formatters.statement); +exports.statement = statement; +const statements = (0, _builder.default)(formatters.statements); +exports.statements = statements; +const expression = (0, _builder.default)(formatters.expression); +exports.expression = expression; +const program = (0, _builder.default)(formatters.program); +exports.program = program; +var _default = Object.assign(smart.bind(undefined), { + smart, + statement, + statements, + expression, + program, + ast: smart.ast +}); +exports.default = _default; + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 9226: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = literalTemplate; +var _options = __nccwpck_require__(6328); +var _parse = __nccwpck_require__(488); +var _populate = __nccwpck_require__(3579); +function literalTemplate(formatter, tpl, opts) { + const { + metadata, + names + } = buildLiteralData(formatter, tpl, opts); + return arg => { + const defaultReplacements = {}; + arg.forEach((replacement, i) => { + defaultReplacements[names[i]] = replacement; + }); + return arg => { + const replacements = (0, _options.normalizeReplacements)(arg); + if (replacements) { + Object.keys(replacements).forEach(key => { + if (Object.prototype.hasOwnProperty.call(defaultReplacements, key)) { + throw new Error("Unexpected replacement overlap."); + } + }); + } + return formatter.unwrap((0, _populate.default)(metadata, replacements ? Object.assign(replacements, defaultReplacements) : defaultReplacements)); + }; + }; +} +function buildLiteralData(formatter, tpl, opts) { + let prefix = "BABEL_TPL$"; + const raw = tpl.join(""); + do { + prefix = "$$" + prefix; + } while (raw.includes(prefix)); + const { + names, + code + } = buildTemplateCode(tpl, prefix); + const metadata = (0, _parse.default)(formatter, formatter.code(code), { + parser: opts.parser, + placeholderWhitelist: new Set(names.concat(opts.placeholderWhitelist ? Array.from(opts.placeholderWhitelist) : [])), + placeholderPattern: opts.placeholderPattern, + preserveComments: opts.preserveComments, + syntacticPlaceholders: opts.syntacticPlaceholders + }); + return { + metadata, + names + }; +} +function buildTemplateCode(tpl, prefix) { + const names = []; + let code = tpl[0]; + for (let i = 1; i < tpl.length; i++) { + const value = `${prefix}${i - 1}`; + names.push(value); + code += value + tpl[i]; + } + return { + names, + code + }; +} + +//# sourceMappingURL=literal.js.map + + +/***/ }), + +/***/ 6328: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.merge = merge; +exports.normalizeReplacements = normalizeReplacements; +exports.validate = validate; +const _excluded = ["placeholderWhitelist", "placeholderPattern", "preserveComments", "syntacticPlaceholders"]; +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } +function merge(a, b) { + const { + placeholderWhitelist = a.placeholderWhitelist, + placeholderPattern = a.placeholderPattern, + preserveComments = a.preserveComments, + syntacticPlaceholders = a.syntacticPlaceholders + } = b; + return { + parser: Object.assign({}, a.parser, b.parser), + placeholderWhitelist, + placeholderPattern, + preserveComments, + syntacticPlaceholders + }; +} +function validate(opts) { + if (opts != null && typeof opts !== "object") { + throw new Error("Unknown template options."); + } + const _ref = opts || {}, + { + placeholderWhitelist, + placeholderPattern, + preserveComments, + syntacticPlaceholders + } = _ref, + parser = _objectWithoutPropertiesLoose(_ref, _excluded); + if (placeholderWhitelist != null && !(placeholderWhitelist instanceof Set)) { + throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined"); + } + if (placeholderPattern != null && !(placeholderPattern instanceof RegExp) && placeholderPattern !== false) { + throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined"); + } + if (preserveComments != null && typeof preserveComments !== "boolean") { + throw new Error("'.preserveComments' must be a boolean, null, or undefined"); + } + if (syntacticPlaceholders != null && typeof syntacticPlaceholders !== "boolean") { + throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined"); + } + if (syntacticPlaceholders === true && (placeholderWhitelist != null || placeholderPattern != null)) { + throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible" + " with '.syntacticPlaceholders: true'"); + } + return { + parser, + placeholderWhitelist: placeholderWhitelist || undefined, + placeholderPattern: placeholderPattern == null ? undefined : placeholderPattern, + preserveComments: preserveComments == null ? undefined : preserveComments, + syntacticPlaceholders: syntacticPlaceholders == null ? undefined : syntacticPlaceholders + }; +} +function normalizeReplacements(replacements) { + if (Array.isArray(replacements)) { + return replacements.reduce((acc, replacement, i) => { + acc["$" + i] = replacement; + return acc; + }, {}); + } else if (typeof replacements === "object" || replacements == null) { + return replacements || undefined; + } + throw new Error("Template replacements must be an array, object, null, or undefined"); +} + +//# sourceMappingURL=options.js.map + + +/***/ }), + +/***/ 488: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = parseAndBuildMetadata; +var _t = __nccwpck_require__(7012); +var _parser = __nccwpck_require__(639); +var _codeFrame = __nccwpck_require__(5211); +const { + isCallExpression, + isExpressionStatement, + isFunction, + isIdentifier, + isJSXIdentifier, + isNewExpression, + isPlaceholder, + isStatement, + isStringLiteral, + removePropertiesDeep, + traverse +} = _t; +const PATTERN = /^[_$A-Z0-9]+$/; +function parseAndBuildMetadata(formatter, code, opts) { + const { + placeholderWhitelist, + placeholderPattern, + preserveComments, + syntacticPlaceholders + } = opts; + const ast = parseWithCodeFrame(code, opts.parser, syntacticPlaceholders); + removePropertiesDeep(ast, { + preserveComments + }); + formatter.validate(ast); + const state = { + syntactic: { + placeholders: [], + placeholderNames: new Set() + }, + legacy: { + placeholders: [], + placeholderNames: new Set() + }, + placeholderWhitelist, + placeholderPattern, + syntacticPlaceholders + }; + traverse(ast, placeholderVisitorHandler, state); + return Object.assign({ + ast + }, state.syntactic.placeholders.length ? state.syntactic : state.legacy); +} +function placeholderVisitorHandler(node, ancestors, state) { + var _state$placeholderWhi; + let name; + let hasSyntacticPlaceholders = state.syntactic.placeholders.length > 0; + if (isPlaceholder(node)) { + if (state.syntacticPlaceholders === false) { + throw new Error("%%foo%%-style placeholders can't be used when " + "'.syntacticPlaceholders' is false."); + } + name = node.name.name; + hasSyntacticPlaceholders = true; + } else if (hasSyntacticPlaceholders || state.syntacticPlaceholders) { + return; + } else if (isIdentifier(node) || isJSXIdentifier(node)) { + name = node.name; + } else if (isStringLiteral(node)) { + name = node.value; + } else { + return; + } + if (hasSyntacticPlaceholders && (state.placeholderPattern != null || state.placeholderWhitelist != null)) { + throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible" + " with '.syntacticPlaceholders: true'"); + } + if (!hasSyntacticPlaceholders && (state.placeholderPattern === false || !(state.placeholderPattern || PATTERN).test(name)) && !((_state$placeholderWhi = state.placeholderWhitelist) != null && _state$placeholderWhi.has(name))) { + return; + } + ancestors = ancestors.slice(); + const { + node: parent, + key + } = ancestors[ancestors.length - 1]; + let type; + if (isStringLiteral(node) || isPlaceholder(node, { + expectedNode: "StringLiteral" + })) { + type = "string"; + } else if (isNewExpression(parent) && key === "arguments" || isCallExpression(parent) && key === "arguments" || isFunction(parent) && key === "params") { + type = "param"; + } else if (isExpressionStatement(parent) && !isPlaceholder(node)) { + type = "statement"; + ancestors = ancestors.slice(0, -1); + } else if (isStatement(node) && isPlaceholder(node)) { + type = "statement"; + } else { + type = "other"; + } + const { + placeholders, + placeholderNames + } = !hasSyntacticPlaceholders ? state.legacy : state.syntactic; + placeholders.push({ + name, + type, + resolve: ast => resolveAncestors(ast, ancestors), + isDuplicate: placeholderNames.has(name) + }); + placeholderNames.add(name); +} +function resolveAncestors(ast, ancestors) { + let parent = ast; + for (let i = 0; i < ancestors.length - 1; i++) { + const { + key, + index + } = ancestors[i]; + if (index === undefined) { + parent = parent[key]; + } else { + parent = parent[key][index]; + } + } + const { + key, + index + } = ancestors[ancestors.length - 1]; + return { + parent, + key, + index + }; +} +function parseWithCodeFrame(code, parserOpts, syntacticPlaceholders) { + const plugins = (parserOpts.plugins || []).slice(); + if (syntacticPlaceholders !== false) { + plugins.push("placeholders"); + } + parserOpts = Object.assign({ + allowReturnOutsideFunction: true, + allowSuperOutsideMethod: true, + sourceType: "module" + }, parserOpts, { + plugins + }); + try { + return (0, _parser.parse)(code, parserOpts); + } catch (err) { + const loc = err.loc; + if (loc) { + err.message += "\n" + (0, _codeFrame.codeFrameColumns)(code, { + start: loc + }); + err.code = "BABEL_TEMPLATE_PARSE_ERROR"; + } + throw err; + } +} + +//# sourceMappingURL=parse.js.map + + +/***/ }), + +/***/ 3579: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = populatePlaceholders; +var _t = __nccwpck_require__(7012); +const { + blockStatement, + cloneNode, + emptyStatement, + expressionStatement, + identifier, + isStatement, + isStringLiteral, + stringLiteral, + validate +} = _t; +function populatePlaceholders(metadata, replacements) { + const ast = cloneNode(metadata.ast); + if (replacements) { + metadata.placeholders.forEach(placeholder => { + if (!Object.prototype.hasOwnProperty.call(replacements, placeholder.name)) { + const placeholderName = placeholder.name; + throw new Error(`Error: No substitution given for "${placeholderName}". If this is not meant to be a + placeholder you may want to consider passing one of the following options to @babel/template: + - { placeholderPattern: false, placeholderWhitelist: new Set(['${placeholderName}'])} + - { placeholderPattern: /^${placeholderName}$/ }`); + } + }); + Object.keys(replacements).forEach(key => { + if (!metadata.placeholderNames.has(key)) { + throw new Error(`Unknown substitution "${key}" given`); + } + }); + } + metadata.placeholders.slice().reverse().forEach(placeholder => { + try { + applyReplacement(placeholder, ast, replacements && replacements[placeholder.name] || null); + } catch (e) { + e.message = `@babel/template placeholder "${placeholder.name}": ${e.message}`; + throw e; + } + }); + return ast; +} +function applyReplacement(placeholder, ast, replacement) { + if (placeholder.isDuplicate) { + if (Array.isArray(replacement)) { + replacement = replacement.map(node => cloneNode(node)); + } else if (typeof replacement === "object") { + replacement = cloneNode(replacement); + } + } + const { + parent, + key, + index + } = placeholder.resolve(ast); + if (placeholder.type === "string") { + if (typeof replacement === "string") { + replacement = stringLiteral(replacement); + } + if (!replacement || !isStringLiteral(replacement)) { + throw new Error("Expected string substitution"); + } + } else if (placeholder.type === "statement") { + if (index === undefined) { + if (!replacement) { + replacement = emptyStatement(); + } else if (Array.isArray(replacement)) { + replacement = blockStatement(replacement); + } else if (typeof replacement === "string") { + replacement = expressionStatement(identifier(replacement)); + } else if (!isStatement(replacement)) { + replacement = expressionStatement(replacement); + } + } else { + if (replacement && !Array.isArray(replacement)) { + if (typeof replacement === "string") { + replacement = identifier(replacement); + } + if (!isStatement(replacement)) { + replacement = expressionStatement(replacement); + } + } + } + } else if (placeholder.type === "param") { + if (typeof replacement === "string") { + replacement = identifier(replacement); + } + if (index === undefined) throw new Error("Assertion failure."); + } else { + if (typeof replacement === "string") { + replacement = identifier(replacement); + } + if (Array.isArray(replacement)) { + throw new Error("Cannot replace single expression with an array."); + } + } + if (index === undefined) { + validate(parent, key, replacement); + parent[key] = replacement; + } else { + const items = parent[key].slice(); + if (placeholder.type === "statement" || placeholder.type === "param") { + if (replacement == null) { + items.splice(index, 1); + } else if (Array.isArray(replacement)) { + items.splice(index, 1, ...replacement); + } else { + items[index] = replacement; + } + } else { + items[index] = replacement; + } + validate(parent, key, items); + parent[key] = items; + } +} + +//# sourceMappingURL=populate.js.map + + +/***/ }), + +/***/ 2639: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = stringTemplate; +var _options = __nccwpck_require__(6328); +var _parse = __nccwpck_require__(488); +var _populate = __nccwpck_require__(3579); +function stringTemplate(formatter, code, opts) { + code = formatter.code(code); + let metadata; + return arg => { + const replacements = (0, _options.normalizeReplacements)(arg); + if (!metadata) metadata = (0, _parse.default)(formatter, code, opts); + return formatter.unwrap((0, _populate.default)(metadata, replacements)); + }; +} + +//# sourceMappingURL=string.js.map + + +/***/ }), + +/***/ 1503: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.clear = clear; +exports.clearPath = clearPath; +exports.clearScope = clearScope; +exports.getCachedPaths = getCachedPaths; +exports.getOrCreateCachedPaths = getOrCreateCachedPaths; +exports.scope = exports.path = void 0; +let pathsCache = new WeakMap(); +exports.path = pathsCache; +let scope = new WeakMap(); +exports.scope = scope; +function clear() { + clearPath(); + clearScope(); +} +function clearPath() { + exports.path = pathsCache = new WeakMap(); +} +function clearScope() { + exports.scope = scope = new WeakMap(); +} +const nullHub = Object.freeze({}); +function getCachedPaths(hub, parent) { + var _pathsCache$get, _hub; + { + hub = null; + } + return (_pathsCache$get = pathsCache.get((_hub = hub) != null ? _hub : nullHub)) == null ? void 0 : _pathsCache$get.get(parent); +} +function getOrCreateCachedPaths(hub, parent) { + var _hub2, _hub3; + { + hub = null; + } + let parents = pathsCache.get((_hub2 = hub) != null ? _hub2 : nullHub); + if (!parents) pathsCache.set((_hub3 = hub) != null ? _hub3 : nullHub, parents = new WeakMap()); + let paths = parents.get(parent); + if (!paths) parents.set(parent, paths = new Map()); + return paths; +} + +//# sourceMappingURL=cache.js.map + + +/***/ }), + +/***/ 622: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _index = __nccwpck_require__(7773); +var _t = __nccwpck_require__(7012); +const { + VISITOR_KEYS +} = _t; +class TraversalContext { + constructor(scope, opts, state, parentPath) { + this.queue = null; + this.priorityQueue = null; + this.parentPath = parentPath; + this.scope = scope; + this.state = state; + this.opts = opts; + } + shouldVisit(node) { + const opts = this.opts; + if (opts.enter || opts.exit) return true; + if (opts[node.type]) return true; + const keys = VISITOR_KEYS[node.type]; + if (!(keys != null && keys.length)) return false; + for (const key of keys) { + if (node[key]) { + return true; + } + } + return false; + } + create(node, container, key, listKey) { + return _index.default.get({ + parentPath: this.parentPath, + parent: node, + container, + key: key, + listKey + }); + } + maybeQueue(path, notPriority) { + if (this.queue) { + if (notPriority) { + this.queue.push(path); + } else { + this.priorityQueue.push(path); + } + } + } + visitMultiple(container, parent, listKey) { + if (container.length === 0) return false; + const queue = []; + for (let key = 0; key < container.length; key++) { + const node = container[key]; + if (node && this.shouldVisit(node)) { + queue.push(this.create(parent, container, key, listKey)); + } + } + return this.visitQueue(queue); + } + visitSingle(node, key) { + if (this.shouldVisit(node[key])) { + return this.visitQueue([this.create(node, node, key)]); + } else { + return false; + } + } + visitQueue(queue) { + this.queue = queue; + this.priorityQueue = []; + const visited = new WeakSet(); + let stop = false; + for (const path of queue) { + path.resync(); + if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) { + path.pushContext(this); + } + if (path.key === null) continue; + const { + node + } = path; + if (visited.has(node)) continue; + if (node) visited.add(node); + if (path.visit()) { + stop = true; + break; + } + if (this.priorityQueue.length) { + stop = this.visitQueue(this.priorityQueue); + this.priorityQueue = []; + this.queue = queue; + if (stop) break; + } + } + for (const path of queue) { + path.popContext(); + } + this.queue = null; + return stop; + } + visit(node, key) { + const nodes = node[key]; + if (!nodes) return false; + if (Array.isArray(nodes)) { + return this.visitMultiple(nodes, node, key); + } else { + return this.visitSingle(node, key); + } + } +} +exports.default = TraversalContext; + +//# sourceMappingURL=context.js.map + + +/***/ }), + +/***/ 9853: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +class Hub { + getCode() {} + getScope() {} + addHelper() { + throw new Error("Helpers are not supported by the default hub."); + } + buildError(node, msg, Error = TypeError) { + return new Error(msg); + } +} +exports.default = Hub; + +//# sourceMappingURL=hub.js.map + + +/***/ }), + +/***/ 5008: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "Hub", ({ + enumerable: true, + get: function () { + return _hub.default; + } +})); +Object.defineProperty(exports, "NodePath", ({ + enumerable: true, + get: function () { + return _index.default; + } +})); +Object.defineProperty(exports, "Scope", ({ + enumerable: true, + get: function () { + return _index2.default; + } +})); +exports.visitors = exports.default = void 0; +var visitors = __nccwpck_require__(9269); +exports.visitors = visitors; +var _t = __nccwpck_require__(7012); +var cache = __nccwpck_require__(1503); +var _traverseNode = __nccwpck_require__(1452); +var _index = __nccwpck_require__(7773); +var _index2 = __nccwpck_require__(1958); +var _hub = __nccwpck_require__(9853); +const { + VISITOR_KEYS, + removeProperties, + traverseFast +} = _t; +function traverse(parent, opts = {}, scope, state, parentPath, visitSelf) { + if (!parent) return; + if (!opts.noScope && !scope) { + if (parent.type !== "Program" && parent.type !== "File") { + throw new Error("You must pass a scope and parentPath unless traversing a Program/File. " + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath."); + } + } + if (!parentPath && visitSelf) { + throw new Error("visitSelf can only be used when providing a NodePath."); + } + if (!VISITOR_KEYS[parent.type]) { + return; + } + visitors.explode(opts); + (0, _traverseNode.traverseNode)(parent, opts, scope, state, parentPath, null, visitSelf); +} +var _default = traverse; +exports.default = _default; +traverse.visitors = visitors; +traverse.verify = visitors.verify; +traverse.explode = visitors.explode; +traverse.cheap = function (node, enter) { + traverseFast(node, enter); + return; +}; +traverse.node = function (node, opts, scope, state, path, skipKeys) { + (0, _traverseNode.traverseNode)(node, opts, scope, state, path, skipKeys); +}; +traverse.clearNode = function (node, opts) { + removeProperties(node, opts); +}; +traverse.removeProperties = function (tree, opts) { + traverseFast(tree, traverse.clearNode, opts); + return tree; +}; +function hasDenylistedType(path, state) { + if (path.node.type === state.type) { + state.has = true; + path.stop(); + } +} +traverse.hasType = function (tree, type, denylistTypes) { + if (denylistTypes != null && denylistTypes.includes(tree.type)) return false; + if (tree.type === type) return true; + const state = { + has: false, + type: type + }; + traverse(tree, { + noScope: true, + denylist: denylistTypes, + enter: hasDenylistedType + }, null, state); + return state.has; +}; +traverse.cache = cache; + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 1658: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.find = find; +exports.findParent = findParent; +exports.getAncestry = getAncestry; +exports.getDeepestCommonAncestorFrom = getDeepestCommonAncestorFrom; +exports.getEarliestCommonAncestorFrom = getEarliestCommonAncestorFrom; +exports.getFunctionParent = getFunctionParent; +exports.getStatementParent = getStatementParent; +exports.inType = inType; +exports.isAncestor = isAncestor; +exports.isDescendant = isDescendant; +var _t = __nccwpck_require__(7012); +const { + VISITOR_KEYS +} = _t; +function findParent(callback) { + let path = this; + while (path = path.parentPath) { + if (callback(path)) return path; + } + return null; +} +function find(callback) { + let path = this; + do { + if (callback(path)) return path; + } while (path = path.parentPath); + return null; +} +function getFunctionParent() { + return this.findParent(p => p.isFunction()); +} +function getStatementParent() { + let path = this; + do { + if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) { + break; + } else { + path = path.parentPath; + } + } while (path); + if (path && (path.isProgram() || path.isFile())) { + throw new Error("File/Program node, we can't possibly find a statement parent to this"); + } + return path; +} +function getEarliestCommonAncestorFrom(paths) { + return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) { + let earliest; + const keys = VISITOR_KEYS[deepest.type]; + for (const ancestry of ancestries) { + const path = ancestry[i + 1]; + if (!earliest) { + earliest = path; + continue; + } + if (path.listKey && earliest.listKey === path.listKey) { + if (path.key < earliest.key) { + earliest = path; + continue; + } + } + const earliestKeyIndex = keys.indexOf(earliest.parentKey); + const currentKeyIndex = keys.indexOf(path.parentKey); + if (earliestKeyIndex > currentKeyIndex) { + earliest = path; + } + } + return earliest; + }); +} +function getDeepestCommonAncestorFrom(paths, filter) { + if (!paths.length) { + return this; + } + if (paths.length === 1) { + return paths[0]; + } + let minDepth = Infinity; + let lastCommonIndex, lastCommon; + const ancestries = paths.map(path => { + const ancestry = []; + do { + ancestry.unshift(path); + } while ((path = path.parentPath) && path !== this); + if (ancestry.length < minDepth) { + minDepth = ancestry.length; + } + return ancestry; + }); + const first = ancestries[0]; + depthLoop: for (let i = 0; i < minDepth; i++) { + const shouldMatch = first[i]; + for (const ancestry of ancestries) { + if (ancestry[i] !== shouldMatch) { + break depthLoop; + } + } + lastCommonIndex = i; + lastCommon = shouldMatch; + } + if (lastCommon) { + if (filter) { + return filter(lastCommon, lastCommonIndex, ancestries); + } else { + return lastCommon; + } + } else { + throw new Error("Couldn't find intersection"); + } +} +function getAncestry() { + let path = this; + const paths = []; + do { + paths.push(path); + } while (path = path.parentPath); + return paths; +} +function isAncestor(maybeDescendant) { + return maybeDescendant.isDescendant(this); +} +function isDescendant(maybeAncestor) { + return !!this.findParent(parent => parent === maybeAncestor); +} +function inType(...candidateTypes) { + let path = this; + while (path) { + for (const type of candidateTypes) { + if (path.node.type === type) return true; + } + path = path.parentPath; + } + return false; +} + +//# sourceMappingURL=ancestry.js.map + + +/***/ }), + +/***/ 3187: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.addComment = addComment; +exports.addComments = addComments; +exports.shareCommentsWithSiblings = shareCommentsWithSiblings; +var _t = __nccwpck_require__(7012); +const { + addComment: _addComment, + addComments: _addComments +} = _t; +function shareCommentsWithSiblings() { + if (typeof this.key === "string") return; + const node = this.node; + if (!node) return; + const trailing = node.trailingComments; + const leading = node.leadingComments; + if (!trailing && !leading) return; + const prev = this.getSibling(this.key - 1); + const next = this.getSibling(this.key + 1); + const hasPrev = Boolean(prev.node); + const hasNext = Boolean(next.node); + if (hasPrev) { + if (leading) { + prev.addComments("trailing", removeIfExisting(leading, prev.node.trailingComments)); + } + if (trailing && !hasNext) prev.addComments("trailing", trailing); + } + if (hasNext) { + if (trailing) { + next.addComments("leading", removeIfExisting(trailing, next.node.leadingComments)); + } + if (leading && !hasPrev) next.addComments("leading", leading); + } +} +function removeIfExisting(list, toRemove) { + if (!toRemove) return list; + let lastFoundIndex = -1; + return list.filter(el => { + const i = toRemove.indexOf(el, lastFoundIndex); + if (i === -1) return true; + lastFoundIndex = i; + }); +} +function addComment(type, content, line) { + _addComment(this.node, type, content, line); +} +function addComments(type, comments) { + _addComments(this.node, type, comments); +} + +//# sourceMappingURL=comments.js.map + + +/***/ }), + +/***/ 4533: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports._call = _call; +exports._getQueueContexts = _getQueueContexts; +exports._resyncKey = _resyncKey; +exports._resyncList = _resyncList; +exports._resyncParent = _resyncParent; +exports._resyncRemoved = _resyncRemoved; +exports.call = call; +exports.isBlacklisted = exports.isDenylisted = isDenylisted; +exports.popContext = popContext; +exports.pushContext = pushContext; +exports.requeue = requeue; +exports.resync = resync; +exports.setContext = setContext; +exports.setKey = setKey; +exports.setScope = setScope; +exports.setup = setup; +exports.skip = skip; +exports.skipKey = skipKey; +exports.stop = stop; +exports.visit = visit; +var _traverseNode = __nccwpck_require__(1452); +var _index = __nccwpck_require__(7773); +function call(key) { + const opts = this.opts; + this.debug(key); + if (this.node) { + if (this._call(opts[key])) return true; + } + if (this.node) { + var _opts$this$node$type; + return this._call((_opts$this$node$type = opts[this.node.type]) == null ? void 0 : _opts$this$node$type[key]); + } + return false; +} +function _call(fns) { + if (!fns) return false; + for (const fn of fns) { + if (!fn) continue; + const node = this.node; + if (!node) return true; + const ret = fn.call(this.state, this, this.state); + if (ret && typeof ret === "object" && typeof ret.then === "function") { + throw new Error(`You appear to be using a plugin with an async traversal visitor, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`); + } + if (ret) { + throw new Error(`Unexpected return value from visitor method ${fn}`); + } + if (this.node !== node) return true; + if (this._traverseFlags > 0) return true; + } + return false; +} +function isDenylisted() { + var _this$opts$denylist; + const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist; + return denylist && denylist.indexOf(this.node.type) > -1; +} +function restoreContext(path, context) { + if (path.context !== context) { + path.context = context; + path.state = context.state; + path.opts = context.opts; + } +} +function visit() { + var _this$opts$shouldSkip, _this$opts; + if (!this.node) { + return false; + } + if (this.isDenylisted()) { + return false; + } + if ((_this$opts$shouldSkip = (_this$opts = this.opts).shouldSkip) != null && _this$opts$shouldSkip.call(_this$opts, this)) { + return false; + } + const currentContext = this.context; + if (this.shouldSkip || this.call("enter")) { + this.debug("Skip..."); + return this.shouldStop; + } + restoreContext(this, currentContext); + this.debug("Recursing into..."); + this.shouldStop = (0, _traverseNode.traverseNode)(this.node, this.opts, this.scope, this.state, this, this.skipKeys); + restoreContext(this, currentContext); + this.call("exit"); + return this.shouldStop; +} +function skip() { + this.shouldSkip = true; +} +function skipKey(key) { + if (this.skipKeys == null) { + this.skipKeys = {}; + } + this.skipKeys[key] = true; +} +function stop() { + this._traverseFlags |= _index.SHOULD_SKIP | _index.SHOULD_STOP; +} +function setScope() { + var _this$opts2, _this$scope; + if ((_this$opts2 = this.opts) != null && _this$opts2.noScope) return; + let path = this.parentPath; + if ((this.key === "key" || this.listKey === "decorators") && path.isMethod() || this.key === "discriminant" && path.isSwitchStatement()) { + path = path.parentPath; + } + let target; + while (path && !target) { + var _path$opts; + if ((_path$opts = path.opts) != null && _path$opts.noScope) return; + target = path.scope; + path = path.parentPath; + } + this.scope = this.getScope(target); + (_this$scope = this.scope) == null ? void 0 : _this$scope.init(); +} +function setContext(context) { + if (this.skipKeys != null) { + this.skipKeys = {}; + } + this._traverseFlags = 0; + if (context) { + this.context = context; + this.state = context.state; + this.opts = context.opts; + } + this.setScope(); + return this; +} +function resync() { + if (this.removed) return; + this._resyncParent(); + this._resyncList(); + this._resyncKey(); +} +function _resyncParent() { + if (this.parentPath) { + this.parent = this.parentPath.node; + } +} +function _resyncKey() { + if (!this.container) return; + if (this.node === this.container[this.key]) { + return; + } + if (Array.isArray(this.container)) { + for (let i = 0; i < this.container.length; i++) { + if (this.container[i] === this.node) { + this.setKey(i); + return; + } + } + } else { + for (const key of Object.keys(this.container)) { + if (this.container[key] === this.node) { + this.setKey(key); + return; + } + } + } + this.key = null; +} +function _resyncList() { + if (!this.parent || !this.inList) return; + const newContainer = this.parent[this.listKey]; + if (this.container === newContainer) return; + this.container = newContainer || null; +} +function _resyncRemoved() { + if (this.key == null || !this.container || this.container[this.key] !== this.node) { + this._markRemoved(); + } +} +function popContext() { + this.contexts.pop(); + if (this.contexts.length > 0) { + this.setContext(this.contexts[this.contexts.length - 1]); + } else { + this.setContext(undefined); + } +} +function pushContext(context) { + this.contexts.push(context); + this.setContext(context); +} +function setup(parentPath, container, listKey, key) { + this.listKey = listKey; + this.container = container; + this.parentPath = parentPath || this.parentPath; + this.setKey(key); +} +function setKey(key) { + var _this$node; + this.key = key; + this.node = this.container[this.key]; + this.type = (_this$node = this.node) == null ? void 0 : _this$node.type; +} +function requeue(pathToQueue = this) { + if (pathToQueue.removed) return; + ; + const contexts = this.contexts; + for (const context of contexts) { + context.maybeQueue(pathToQueue); + } +} +function _getQueueContexts() { + let path = this; + let contexts = this.contexts; + while (!contexts.length) { + path = path.parentPath; + if (!path) break; + contexts = path.contexts; + } + return contexts; +} + +//# sourceMappingURL=context.js.map + + +/***/ }), + +/***/ 8674: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.arrowFunctionToExpression = arrowFunctionToExpression; +exports.ensureBlock = ensureBlock; +exports.toComputedKey = toComputedKey; +exports.unwrapFunctionEnvironment = unwrapFunctionEnvironment; +var _t = __nccwpck_require__(7012); +var _helperEnvironmentVisitor = __nccwpck_require__(2056); +var _helperFunctionName = __nccwpck_require__(9879); +var _visitors = __nccwpck_require__(9269); +const { + arrowFunctionExpression, + assignmentExpression, + binaryExpression, + blockStatement, + callExpression, + conditionalExpression, + expressionStatement, + identifier, + isIdentifier, + jsxIdentifier, + logicalExpression, + LOGICAL_OPERATORS, + memberExpression, + metaProperty, + numericLiteral, + objectExpression, + restElement, + returnStatement, + sequenceExpression, + spreadElement, + stringLiteral, + super: _super, + thisExpression, + toExpression, + unaryExpression +} = _t; +function toComputedKey() { + let key; + if (this.isMemberExpression()) { + key = this.node.property; + } else if (this.isProperty() || this.isMethod()) { + key = this.node.key; + } else { + throw new ReferenceError("todo"); + } + if (!this.node.computed) { + if (isIdentifier(key)) key = stringLiteral(key.name); + } + return key; +} +function ensureBlock() { + const body = this.get("body"); + const bodyNode = body.node; + if (Array.isArray(body)) { + throw new Error("Can't convert array path to a block statement"); + } + if (!bodyNode) { + throw new Error("Can't convert node without a body"); + } + if (body.isBlockStatement()) { + return bodyNode; + } + const statements = []; + let stringPath = "body"; + let key; + let listKey; + if (body.isStatement()) { + listKey = "body"; + key = 0; + statements.push(body.node); + } else { + stringPath += ".body.0"; + if (this.isFunction()) { + key = "argument"; + statements.push(returnStatement(body.node)); + } else { + key = "expression"; + statements.push(expressionStatement(body.node)); + } + } + this.node.body = blockStatement(statements); + const parentPath = this.get(stringPath); + body.setup(parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key); + return this.node; +} +{ + exports.arrowFunctionToShadowed = function () { + if (!this.isArrowFunctionExpression()) return; + this.arrowFunctionToExpression(); + }; +} +function unwrapFunctionEnvironment() { + if (!this.isArrowFunctionExpression() && !this.isFunctionExpression() && !this.isFunctionDeclaration()) { + throw this.buildCodeFrameError("Can only unwrap the environment of a function."); + } + hoistFunctionEnvironment(this); +} +function setType(path, type) { + path.node.type = type; +} +function arrowFunctionToExpression({ + allowInsertArrow = true, + allowInsertArrowWithRest = allowInsertArrow, + noNewArrows = !(_arguments$ => (_arguments$ = arguments[0]) == null ? void 0 : _arguments$.specCompliant)() +} = {}) { + if (!this.isArrowFunctionExpression()) { + throw this.buildCodeFrameError("Cannot convert non-arrow function to a function expression."); + } + const { + thisBinding, + fnPath: fn + } = hoistFunctionEnvironment(this, noNewArrows, allowInsertArrow, allowInsertArrowWithRest); + fn.ensureBlock(); + setType(fn, "FunctionExpression"); + if (!noNewArrows) { + const checkBinding = thisBinding ? null : fn.scope.generateUidIdentifier("arrowCheckId"); + if (checkBinding) { + fn.parentPath.scope.push({ + id: checkBinding, + init: objectExpression([]) + }); + } + fn.get("body").unshiftContainer("body", expressionStatement(callExpression(this.hub.addHelper("newArrowCheck"), [thisExpression(), checkBinding ? identifier(checkBinding.name) : identifier(thisBinding)]))); + fn.replaceWith(callExpression(memberExpression((0, _helperFunctionName.default)(this, true) || fn.node, identifier("bind")), [checkBinding ? identifier(checkBinding.name) : thisExpression()])); + return fn.get("callee.object"); + } + return fn; +} +const getSuperCallsVisitor = (0, _visitors.merge)([{ + CallExpression(child, { + allSuperCalls + }) { + if (!child.get("callee").isSuper()) return; + allSuperCalls.push(child); + } +}, _helperEnvironmentVisitor.default]); +function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow = true, allowInsertArrowWithRest = true) { + let arrowParent; + let thisEnvFn = fnPath.findParent(p => { + if (p.isArrowFunctionExpression()) { + var _arrowParent; + (_arrowParent = arrowParent) != null ? _arrowParent : arrowParent = p; + return false; + } + return p.isFunction() || p.isProgram() || p.isClassProperty({ + static: false + }) || p.isClassPrivateProperty({ + static: false + }); + }); + const inConstructor = thisEnvFn.isClassMethod({ + kind: "constructor" + }); + if (thisEnvFn.isClassProperty() || thisEnvFn.isClassPrivateProperty()) { + if (arrowParent) { + thisEnvFn = arrowParent; + } else if (allowInsertArrow) { + fnPath.replaceWith(callExpression(arrowFunctionExpression([], toExpression(fnPath.node)), [])); + thisEnvFn = fnPath.get("callee"); + fnPath = thisEnvFn.get("body"); + } else { + throw fnPath.buildCodeFrameError("Unable to transform arrow inside class property"); + } + } + const { + thisPaths, + argumentsPaths, + newTargetPaths, + superProps, + superCalls + } = getScopeInformation(fnPath); + if (inConstructor && superCalls.length > 0) { + if (!allowInsertArrow) { + throw superCalls[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', " + "it's not possible to compile `super()` in an arrow function without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration."); + } + if (!allowInsertArrowWithRest) { + throw superCalls[0].buildCodeFrameError("When using '@babel/plugin-transform-parameters', " + "it's not possible to compile `super()` in an arrow function with default or rest parameters without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration."); + } + const allSuperCalls = []; + thisEnvFn.traverse(getSuperCallsVisitor, { + allSuperCalls + }); + const superBinding = getSuperBinding(thisEnvFn); + allSuperCalls.forEach(superCall => { + const callee = identifier(superBinding); + callee.loc = superCall.node.callee.loc; + superCall.get("callee").replaceWith(callee); + }); + } + if (argumentsPaths.length > 0) { + const argumentsBinding = getBinding(thisEnvFn, "arguments", () => { + const args = () => identifier("arguments"); + if (thisEnvFn.scope.path.isProgram()) { + return conditionalExpression(binaryExpression("===", unaryExpression("typeof", args()), stringLiteral("undefined")), thisEnvFn.scope.buildUndefinedNode(), args()); + } else { + return args(); + } + }); + argumentsPaths.forEach(argumentsChild => { + const argsRef = identifier(argumentsBinding); + argsRef.loc = argumentsChild.node.loc; + argumentsChild.replaceWith(argsRef); + }); + } + if (newTargetPaths.length > 0) { + const newTargetBinding = getBinding(thisEnvFn, "newtarget", () => metaProperty(identifier("new"), identifier("target"))); + newTargetPaths.forEach(targetChild => { + const targetRef = identifier(newTargetBinding); + targetRef.loc = targetChild.node.loc; + targetChild.replaceWith(targetRef); + }); + } + if (superProps.length > 0) { + if (!allowInsertArrow) { + throw superProps[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', " + "it's not possible to compile `super.prop` in an arrow function without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration."); + } + const flatSuperProps = superProps.reduce((acc, superProp) => acc.concat(standardizeSuperProperty(superProp)), []); + flatSuperProps.forEach(superProp => { + const key = superProp.node.computed ? "" : superProp.get("property").node.name; + const superParentPath = superProp.parentPath; + const isAssignment = superParentPath.isAssignmentExpression({ + left: superProp.node + }); + const isCall = superParentPath.isCallExpression({ + callee: superProp.node + }); + const isTaggedTemplate = superParentPath.isTaggedTemplateExpression({ + tag: superProp.node + }); + const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key); + const args = []; + if (superProp.node.computed) { + args.push(superProp.get("property").node); + } + if (isAssignment) { + const value = superParentPath.node.right; + args.push(value); + } + const call = callExpression(identifier(superBinding), args); + if (isCall) { + superParentPath.unshiftContainer("arguments", thisExpression()); + superProp.replaceWith(memberExpression(call, identifier("call"))); + thisPaths.push(superParentPath.get("arguments.0")); + } else if (isAssignment) { + superParentPath.replaceWith(call); + } else if (isTaggedTemplate) { + superProp.replaceWith(callExpression(memberExpression(call, identifier("bind"), false), [thisExpression()])); + thisPaths.push(superProp.get("arguments.0")); + } else { + superProp.replaceWith(call); + } + }); + } + let thisBinding; + if (thisPaths.length > 0 || !noNewArrows) { + thisBinding = getThisBinding(thisEnvFn, inConstructor); + if (noNewArrows || inConstructor && hasSuperClass(thisEnvFn)) { + thisPaths.forEach(thisChild => { + const thisRef = thisChild.isJSX() ? jsxIdentifier(thisBinding) : identifier(thisBinding); + thisRef.loc = thisChild.node.loc; + thisChild.replaceWith(thisRef); + }); + if (!noNewArrows) thisBinding = null; + } + } + return { + thisBinding, + fnPath + }; +} +function isLogicalOp(op) { + return LOGICAL_OPERATORS.includes(op); +} +function standardizeSuperProperty(superProp) { + if (superProp.parentPath.isAssignmentExpression() && superProp.parentPath.node.operator !== "=") { + const assignmentPath = superProp.parentPath; + const op = assignmentPath.node.operator.slice(0, -1); + const value = assignmentPath.node.right; + const isLogicalAssignment = isLogicalOp(op); + if (superProp.node.computed) { + const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp"); + const object = superProp.node.object; + const property = superProp.node.property; + assignmentPath.get("left").replaceWith(memberExpression(object, assignmentExpression("=", tmp, property), true)); + assignmentPath.get("right").replaceWith(rightExpression(isLogicalAssignment ? "=" : op, memberExpression(object, identifier(tmp.name), true), value)); + } else { + const object = superProp.node.object; + const property = superProp.node.property; + assignmentPath.get("left").replaceWith(memberExpression(object, property)); + assignmentPath.get("right").replaceWith(rightExpression(isLogicalAssignment ? "=" : op, memberExpression(object, identifier(property.name)), value)); + } + if (isLogicalAssignment) { + assignmentPath.replaceWith(logicalExpression(op, assignmentPath.node.left, assignmentPath.node.right)); + } else { + assignmentPath.node.operator = "="; + } + return [assignmentPath.get("left"), assignmentPath.get("right").get("left")]; + } else if (superProp.parentPath.isUpdateExpression()) { + const updateExpr = superProp.parentPath; + const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp"); + const computedKey = superProp.node.computed ? superProp.scope.generateDeclaredUidIdentifier("prop") : null; + const parts = [assignmentExpression("=", tmp, memberExpression(superProp.node.object, computedKey ? assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), assignmentExpression("=", memberExpression(superProp.node.object, computedKey ? identifier(computedKey.name) : superProp.node.property, superProp.node.computed), binaryExpression(superProp.parentPath.node.operator[0], identifier(tmp.name), numericLiteral(1)))]; + if (!superProp.parentPath.node.prefix) { + parts.push(identifier(tmp.name)); + } + updateExpr.replaceWith(sequenceExpression(parts)); + const left = updateExpr.get("expressions.0.right"); + const right = updateExpr.get("expressions.1.left"); + return [left, right]; + } + return [superProp]; + function rightExpression(op, left, right) { + if (op === "=") { + return assignmentExpression("=", left, right); + } else { + return binaryExpression(op, left, right); + } + } +} +function hasSuperClass(thisEnvFn) { + return thisEnvFn.isClassMethod() && !!thisEnvFn.parentPath.parentPath.node.superClass; +} +const assignSuperThisVisitor = (0, _visitors.merge)([{ + CallExpression(child, { + supers, + thisBinding + }) { + if (!child.get("callee").isSuper()) return; + if (supers.has(child.node)) return; + supers.add(child.node); + child.replaceWithMultiple([child.node, assignmentExpression("=", identifier(thisBinding), identifier("this"))]); + } +}, _helperEnvironmentVisitor.default]); +function getThisBinding(thisEnvFn, inConstructor) { + return getBinding(thisEnvFn, "this", thisBinding => { + if (!inConstructor || !hasSuperClass(thisEnvFn)) return thisExpression(); + thisEnvFn.traverse(assignSuperThisVisitor, { + supers: new WeakSet(), + thisBinding + }); + }); +} +function getSuperBinding(thisEnvFn) { + return getBinding(thisEnvFn, "supercall", () => { + const argsBinding = thisEnvFn.scope.generateUidIdentifier("args"); + return arrowFunctionExpression([restElement(argsBinding)], callExpression(_super(), [spreadElement(identifier(argsBinding.name))])); + }); +} +function getSuperPropBinding(thisEnvFn, isAssignment, propName) { + const op = isAssignment ? "set" : "get"; + return getBinding(thisEnvFn, `superprop_${op}:${propName || ""}`, () => { + const argsList = []; + let fnBody; + if (propName) { + fnBody = memberExpression(_super(), identifier(propName)); + } else { + const method = thisEnvFn.scope.generateUidIdentifier("prop"); + argsList.unshift(method); + fnBody = memberExpression(_super(), identifier(method.name), true); + } + if (isAssignment) { + const valueIdent = thisEnvFn.scope.generateUidIdentifier("value"); + argsList.push(valueIdent); + fnBody = assignmentExpression("=", fnBody, identifier(valueIdent.name)); + } + return arrowFunctionExpression(argsList, fnBody); + }); +} +function getBinding(thisEnvFn, key, init) { + const cacheKey = "binding:" + key; + let data = thisEnvFn.getData(cacheKey); + if (!data) { + const id = thisEnvFn.scope.generateUidIdentifier(key); + data = id.name; + thisEnvFn.setData(cacheKey, data); + thisEnvFn.scope.push({ + id: id, + init: init(data) + }); + } + return data; +} +const getScopeInformationVisitor = (0, _visitors.merge)([{ + ThisExpression(child, { + thisPaths + }) { + thisPaths.push(child); + }, + JSXIdentifier(child, { + thisPaths + }) { + if (child.node.name !== "this") return; + if (!child.parentPath.isJSXMemberExpression({ + object: child.node + }) && !child.parentPath.isJSXOpeningElement({ + name: child.node + })) { + return; + } + thisPaths.push(child); + }, + CallExpression(child, { + superCalls + }) { + if (child.get("callee").isSuper()) superCalls.push(child); + }, + MemberExpression(child, { + superProps + }) { + if (child.get("object").isSuper()) superProps.push(child); + }, + Identifier(child, { + argumentsPaths + }) { + if (!child.isReferencedIdentifier({ + name: "arguments" + })) return; + let curr = child.scope; + do { + if (curr.hasOwnBinding("arguments")) { + curr.rename("arguments"); + return; + } + if (curr.path.isFunction() && !curr.path.isArrowFunctionExpression()) { + break; + } + } while (curr = curr.parent); + argumentsPaths.push(child); + }, + MetaProperty(child, { + newTargetPaths + }) { + if (!child.get("meta").isIdentifier({ + name: "new" + })) return; + if (!child.get("property").isIdentifier({ + name: "target" + })) return; + newTargetPaths.push(child); + } +}, _helperEnvironmentVisitor.default]); +function getScopeInformation(fnPath) { + const thisPaths = []; + const argumentsPaths = []; + const newTargetPaths = []; + const superProps = []; + const superCalls = []; + fnPath.traverse(getScopeInformationVisitor, { + thisPaths, + argumentsPaths, + newTargetPaths, + superProps, + superCalls + }); + return { + thisPaths, + argumentsPaths, + newTargetPaths, + superProps, + superCalls + }; +} + +//# sourceMappingURL=conversion.js.map + + +/***/ }), + +/***/ 3608: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.evaluate = evaluate; +exports.evaluateTruthy = evaluateTruthy; +const VALID_CALLEES = ["String", "Number", "Math"]; +const INVALID_METHODS = ["random"]; +function isValidCallee(val) { + return VALID_CALLEES.includes(val); +} +function isInvalidMethod(val) { + return INVALID_METHODS.includes(val); +} +function evaluateTruthy() { + const res = this.evaluate(); + if (res.confident) return !!res.value; +} +function deopt(path, state) { + if (!state.confident) return; + state.deoptPath = path; + state.confident = false; +} +const Globals = new Map([["undefined", undefined], ["Infinity", Infinity], ["NaN", NaN]]); +function evaluateCached(path, state) { + const { + node + } = path; + const { + seen + } = state; + if (seen.has(node)) { + const existing = seen.get(node); + if (existing.resolved) { + return existing.value; + } else { + deopt(path, state); + return; + } + } else { + const item = { + resolved: false + }; + seen.set(node, item); + const val = _evaluate(path, state); + if (state.confident) { + item.resolved = true; + item.value = val; + } + return val; + } +} +function _evaluate(path, state) { + if (!state.confident) return; + if (path.isSequenceExpression()) { + const exprs = path.get("expressions"); + return evaluateCached(exprs[exprs.length - 1], state); + } + if (path.isStringLiteral() || path.isNumericLiteral() || path.isBooleanLiteral()) { + return path.node.value; + } + if (path.isNullLiteral()) { + return null; + } + if (path.isTemplateLiteral()) { + return evaluateQuasis(path, path.node.quasis, state); + } + if (path.isTaggedTemplateExpression() && path.get("tag").isMemberExpression()) { + const object = path.get("tag.object"); + const { + node: { + name + } + } = object; + const property = path.get("tag.property"); + if (object.isIdentifier() && name === "String" && !path.scope.getBinding(name) && property.isIdentifier() && property.node.name === "raw") { + return evaluateQuasis(path, path.node.quasi.quasis, state, true); + } + } + if (path.isConditionalExpression()) { + const testResult = evaluateCached(path.get("test"), state); + if (!state.confident) return; + if (testResult) { + return evaluateCached(path.get("consequent"), state); + } else { + return evaluateCached(path.get("alternate"), state); + } + } + if (path.isExpressionWrapper()) { + return evaluateCached(path.get("expression"), state); + } + if (path.isMemberExpression() && !path.parentPath.isCallExpression({ + callee: path.node + })) { + const property = path.get("property"); + const object = path.get("object"); + if (object.isLiteral()) { + const value = object.node.value; + const type = typeof value; + let key = null; + if (path.node.computed) { + key = evaluateCached(property, state); + if (!state.confident) return; + } else if (property.isIdentifier()) { + key = property.node.name; + } + if ((type === "number" || type === "string") && key != null && (typeof key === "number" || typeof key === "string")) { + return value[key]; + } + } + } + if (path.isReferencedIdentifier()) { + const binding = path.scope.getBinding(path.node.name); + if (binding) { + if (binding.constantViolations.length > 0 || path.node.start < binding.path.node.end) { + deopt(binding.path, state); + return; + } + if (binding.hasValue) { + return binding.value; + } + } + const name = path.node.name; + if (Globals.has(name)) { + if (!binding) { + return Globals.get(name); + } + deopt(binding.path, state); + return; + } + const resolved = path.resolve(); + if (resolved === path) { + deopt(path, state); + return; + } else { + return evaluateCached(resolved, state); + } + } + if (path.isUnaryExpression({ + prefix: true + })) { + if (path.node.operator === "void") { + return undefined; + } + const argument = path.get("argument"); + if (path.node.operator === "typeof" && (argument.isFunction() || argument.isClass())) { + return "function"; + } + const arg = evaluateCached(argument, state); + if (!state.confident) return; + switch (path.node.operator) { + case "!": + return !arg; + case "+": + return +arg; + case "-": + return -arg; + case "~": + return ~arg; + case "typeof": + return typeof arg; + } + } + if (path.isArrayExpression()) { + const arr = []; + const elems = path.get("elements"); + for (const elem of elems) { + const elemValue = elem.evaluate(); + if (elemValue.confident) { + arr.push(elemValue.value); + } else { + deopt(elemValue.deopt, state); + return; + } + } + return arr; + } + if (path.isObjectExpression()) { + const obj = {}; + const props = path.get("properties"); + for (const prop of props) { + if (prop.isObjectMethod() || prop.isSpreadElement()) { + deopt(prop, state); + return; + } + const keyPath = prop.get("key"); + let key; + if (prop.node.computed) { + key = keyPath.evaluate(); + if (!key.confident) { + deopt(key.deopt, state); + return; + } + key = key.value; + } else if (keyPath.isIdentifier()) { + key = keyPath.node.name; + } else { + key = keyPath.node.value; + } + const valuePath = prop.get("value"); + let value = valuePath.evaluate(); + if (!value.confident) { + deopt(value.deopt, state); + return; + } + value = value.value; + obj[key] = value; + } + return obj; + } + if (path.isLogicalExpression()) { + const wasConfident = state.confident; + const left = evaluateCached(path.get("left"), state); + const leftConfident = state.confident; + state.confident = wasConfident; + const right = evaluateCached(path.get("right"), state); + const rightConfident = state.confident; + switch (path.node.operator) { + case "||": + state.confident = leftConfident && (!!left || rightConfident); + if (!state.confident) return; + return left || right; + case "&&": + state.confident = leftConfident && (!left || rightConfident); + if (!state.confident) return; + return left && right; + case "??": + state.confident = leftConfident && (left != null || rightConfident); + if (!state.confident) return; + return left != null ? left : right; + } + } + if (path.isBinaryExpression()) { + const left = evaluateCached(path.get("left"), state); + if (!state.confident) return; + const right = evaluateCached(path.get("right"), state); + if (!state.confident) return; + switch (path.node.operator) { + case "-": + return left - right; + case "+": + return left + right; + case "/": + return left / right; + case "*": + return left * right; + case "%": + return left % right; + case "**": + return Math.pow(left, right); + case "<": + return left < right; + case ">": + return left > right; + case "<=": + return left <= right; + case ">=": + return left >= right; + case "==": + return left == right; + case "!=": + return left != right; + case "===": + return left === right; + case "!==": + return left !== right; + case "|": + return left | right; + case "&": + return left & right; + case "^": + return left ^ right; + case "<<": + return left << right; + case ">>": + return left >> right; + case ">>>": + return left >>> right; + } + } + if (path.isCallExpression()) { + const callee = path.get("callee"); + let context; + let func; + if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name) && isValidCallee(callee.node.name)) { + func = global[callee.node.name]; + } + if (callee.isMemberExpression()) { + const object = callee.get("object"); + const property = callee.get("property"); + if (object.isIdentifier() && property.isIdentifier() && isValidCallee(object.node.name) && !isInvalidMethod(property.node.name)) { + context = global[object.node.name]; + func = context[property.node.name]; + } + if (object.isLiteral() && property.isIdentifier()) { + const type = typeof object.node.value; + if (type === "string" || type === "number") { + context = object.node.value; + func = context[property.node.name]; + } + } + } + if (func) { + const args = path.get("arguments").map(arg => evaluateCached(arg, state)); + if (!state.confident) return; + return func.apply(context, args); + } + } + deopt(path, state); +} +function evaluateQuasis(path, quasis, state, raw = false) { + let str = ""; + let i = 0; + const exprs = path.isTemplateLiteral() ? path.get("expressions") : path.get("quasi.expressions"); + for (const elem of quasis) { + if (!state.confident) break; + str += raw ? elem.value.raw : elem.value.cooked; + const expr = exprs[i++]; + if (expr) str += String(evaluateCached(expr, state)); + } + if (!state.confident) return; + return str; +} +function evaluate() { + const state = { + confident: true, + deoptPath: null, + seen: new Map() + }; + let value = evaluateCached(this, state); + if (!state.confident) value = undefined; + return { + confident: state.confident, + deopt: state.deoptPath, + value: value + }; +} + +//# sourceMappingURL=evaluation.js.map + + +/***/ }), + +/***/ 2405: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports._getKey = _getKey; +exports._getPattern = _getPattern; +exports.get = get; +exports.getAllNextSiblings = getAllNextSiblings; +exports.getAllPrevSiblings = getAllPrevSiblings; +exports.getBindingIdentifierPaths = getBindingIdentifierPaths; +exports.getBindingIdentifiers = getBindingIdentifiers; +exports.getCompletionRecords = getCompletionRecords; +exports.getNextSibling = getNextSibling; +exports.getOpposite = getOpposite; +exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths; +exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers; +exports.getPrevSibling = getPrevSibling; +exports.getSibling = getSibling; +var _index = __nccwpck_require__(7773); +var _t = __nccwpck_require__(7012); +const { + getBindingIdentifiers: _getBindingIdentifiers, + getOuterBindingIdentifiers: _getOuterBindingIdentifiers, + isDeclaration, + numericLiteral, + unaryExpression +} = _t; +const NORMAL_COMPLETION = 0; +const BREAK_COMPLETION = 1; +function NormalCompletion(path) { + return { + type: NORMAL_COMPLETION, + path + }; +} +function BreakCompletion(path) { + return { + type: BREAK_COMPLETION, + path + }; +} +function getOpposite() { + if (this.key === "left") { + return this.getSibling("right"); + } else if (this.key === "right") { + return this.getSibling("left"); + } + return null; +} +function addCompletionRecords(path, records, context) { + if (path) { + records.push(..._getCompletionRecords(path, context)); + } + return records; +} +function completionRecordForSwitch(cases, records, context) { + let lastNormalCompletions = []; + for (let i = 0; i < cases.length; i++) { + const casePath = cases[i]; + const caseCompletions = _getCompletionRecords(casePath, context); + const normalCompletions = []; + const breakCompletions = []; + for (const c of caseCompletions) { + if (c.type === NORMAL_COMPLETION) { + normalCompletions.push(c); + } + if (c.type === BREAK_COMPLETION) { + breakCompletions.push(c); + } + } + if (normalCompletions.length) { + lastNormalCompletions = normalCompletions; + } + records.push(...breakCompletions); + } + records.push(...lastNormalCompletions); + return records; +} +function normalCompletionToBreak(completions) { + completions.forEach(c => { + c.type = BREAK_COMPLETION; + }); +} +function replaceBreakStatementInBreakCompletion(completions, reachable) { + completions.forEach(c => { + if (c.path.isBreakStatement({ + label: null + })) { + if (reachable) { + c.path.replaceWith(unaryExpression("void", numericLiteral(0))); + } else { + c.path.remove(); + } + } + }); +} +function getStatementListCompletion(paths, context) { + const completions = []; + if (context.canHaveBreak) { + let lastNormalCompletions = []; + for (let i = 0; i < paths.length; i++) { + const path = paths[i]; + const newContext = Object.assign({}, context, { + inCaseClause: false + }); + if (path.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) { + newContext.shouldPopulateBreak = true; + } else { + newContext.shouldPopulateBreak = false; + } + const statementCompletions = _getCompletionRecords(path, newContext); + if (statementCompletions.length > 0 && statementCompletions.every(c => c.type === BREAK_COMPLETION)) { + if (lastNormalCompletions.length > 0 && statementCompletions.every(c => c.path.isBreakStatement({ + label: null + }))) { + normalCompletionToBreak(lastNormalCompletions); + completions.push(...lastNormalCompletions); + if (lastNormalCompletions.some(c => c.path.isDeclaration())) { + completions.push(...statementCompletions); + replaceBreakStatementInBreakCompletion(statementCompletions, true); + } + replaceBreakStatementInBreakCompletion(statementCompletions, false); + } else { + completions.push(...statementCompletions); + if (!context.shouldPopulateBreak) { + replaceBreakStatementInBreakCompletion(statementCompletions, true); + } + } + break; + } + if (i === paths.length - 1) { + completions.push(...statementCompletions); + } else { + lastNormalCompletions = []; + for (let i = 0; i < statementCompletions.length; i++) { + const c = statementCompletions[i]; + if (c.type === BREAK_COMPLETION) { + completions.push(c); + } + if (c.type === NORMAL_COMPLETION) { + lastNormalCompletions.push(c); + } + } + } + } + } else if (paths.length) { + for (let i = paths.length - 1; i >= 0; i--) { + const pathCompletions = _getCompletionRecords(paths[i], context); + if (pathCompletions.length > 1 || pathCompletions.length === 1 && !pathCompletions[0].path.isVariableDeclaration()) { + completions.push(...pathCompletions); + break; + } + } + } + return completions; +} +function _getCompletionRecords(path, context) { + let records = []; + if (path.isIfStatement()) { + records = addCompletionRecords(path.get("consequent"), records, context); + records = addCompletionRecords(path.get("alternate"), records, context); + } else if (path.isDoExpression() || path.isFor() || path.isWhile() || path.isLabeledStatement()) { + return addCompletionRecords(path.get("body"), records, context); + } else if (path.isProgram() || path.isBlockStatement()) { + return getStatementListCompletion(path.get("body"), context); + } else if (path.isFunction()) { + return _getCompletionRecords(path.get("body"), context); + } else if (path.isTryStatement()) { + records = addCompletionRecords(path.get("block"), records, context); + records = addCompletionRecords(path.get("handler"), records, context); + } else if (path.isCatchClause()) { + return addCompletionRecords(path.get("body"), records, context); + } else if (path.isSwitchStatement()) { + return completionRecordForSwitch(path.get("cases"), records, context); + } else if (path.isSwitchCase()) { + return getStatementListCompletion(path.get("consequent"), { + canHaveBreak: true, + shouldPopulateBreak: false, + inCaseClause: true + }); + } else if (path.isBreakStatement()) { + records.push(BreakCompletion(path)); + } else { + records.push(NormalCompletion(path)); + } + return records; +} +function getCompletionRecords() { + const records = _getCompletionRecords(this, { + canHaveBreak: false, + shouldPopulateBreak: false, + inCaseClause: false + }); + return records.map(r => r.path); +} +function getSibling(key) { + return _index.default.get({ + parentPath: this.parentPath, + parent: this.parent, + container: this.container, + listKey: this.listKey, + key: key + }).setContext(this.context); +} +function getPrevSibling() { + return this.getSibling(this.key - 1); +} +function getNextSibling() { + return this.getSibling(this.key + 1); +} +function getAllNextSiblings() { + let _key = this.key; + let sibling = this.getSibling(++_key); + const siblings = []; + while (sibling.node) { + siblings.push(sibling); + sibling = this.getSibling(++_key); + } + return siblings; +} +function getAllPrevSiblings() { + let _key = this.key; + let sibling = this.getSibling(--_key); + const siblings = []; + while (sibling.node) { + siblings.push(sibling); + sibling = this.getSibling(--_key); + } + return siblings; +} +function get(key, context = true) { + if (context === true) context = this.context; + const parts = key.split("."); + if (parts.length === 1) { + return this._getKey(key, context); + } else { + return this._getPattern(parts, context); + } +} +function _getKey(key, context) { + const node = this.node; + const container = node[key]; + if (Array.isArray(container)) { + return container.map((_, i) => { + return _index.default.get({ + listKey: key, + parentPath: this, + parent: node, + container: container, + key: i + }).setContext(context); + }); + } else { + return _index.default.get({ + parentPath: this, + parent: node, + container: node, + key: key + }).setContext(context); + } +} +function _getPattern(parts, context) { + let path = this; + for (const part of parts) { + if (part === ".") { + path = path.parentPath; + } else { + if (Array.isArray(path)) { + path = path[part]; + } else { + path = path.get(part, context); + } + } + } + return path; +} +function getBindingIdentifiers(duplicates) { + return _getBindingIdentifiers(this.node, duplicates); +} +function getOuterBindingIdentifiers(duplicates) { + return _getOuterBindingIdentifiers(this.node, duplicates); +} +function getBindingIdentifierPaths(duplicates = false, outerOnly = false) { + const path = this; + const search = [path]; + const ids = Object.create(null); + while (search.length) { + const id = search.shift(); + if (!id) continue; + if (!id.node) continue; + const keys = _getBindingIdentifiers.keys[id.node.type]; + if (id.isIdentifier()) { + if (duplicates) { + const _ids = ids[id.node.name] = ids[id.node.name] || []; + _ids.push(id); + } else { + ids[id.node.name] = id; + } + continue; + } + if (id.isExportDeclaration()) { + const declaration = id.get("declaration"); + if (isDeclaration(declaration)) { + search.push(declaration); + } + continue; + } + if (outerOnly) { + if (id.isFunctionDeclaration()) { + search.push(id.get("id")); + continue; + } + if (id.isFunctionExpression()) { + continue; + } + } + if (keys) { + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const child = id.get(key); + if (Array.isArray(child)) { + search.push(...child); + } else if (child.node) { + search.push(child); + } + } + } + } + return ids; +} +function getOuterBindingIdentifierPaths(duplicates = false) { + return this.getBindingIdentifierPaths(duplicates, true); +} + +//# sourceMappingURL=family.js.map + + +/***/ }), + +/***/ 7773: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = exports.SHOULD_STOP = exports.SHOULD_SKIP = exports.REMOVED = void 0; +var virtualTypes = __nccwpck_require__(1314); +var _debug = __nccwpck_require__(8237); +var _index = __nccwpck_require__(5008); +var _index2 = __nccwpck_require__(1958); +var _t = __nccwpck_require__(7012); +var t = _t; +var cache = __nccwpck_require__(1503); +var _generator = __nccwpck_require__(2482); +var NodePath_ancestry = __nccwpck_require__(1658); +var NodePath_inference = __nccwpck_require__(8760); +var NodePath_replacement = __nccwpck_require__(8034); +var NodePath_evaluation = __nccwpck_require__(3608); +var NodePath_conversion = __nccwpck_require__(8674); +var NodePath_introspection = __nccwpck_require__(5469); +var NodePath_context = __nccwpck_require__(4533); +var NodePath_removal = __nccwpck_require__(4171); +var NodePath_modification = __nccwpck_require__(2340); +var NodePath_family = __nccwpck_require__(2405); +var NodePath_comments = __nccwpck_require__(3187); +var NodePath_virtual_types_validator = __nccwpck_require__(4971); +const { + validate +} = _t; +const debug = _debug("babel"); +const REMOVED = 1 << 0; +exports.REMOVED = REMOVED; +const SHOULD_STOP = 1 << 1; +exports.SHOULD_STOP = SHOULD_STOP; +const SHOULD_SKIP = 1 << 2; +exports.SHOULD_SKIP = SHOULD_SKIP; +class NodePath { + constructor(hub, parent) { + this.contexts = []; + this.state = null; + this.opts = null; + this._traverseFlags = 0; + this.skipKeys = null; + this.parentPath = null; + this.container = null; + this.listKey = null; + this.key = null; + this.node = null; + this.type = null; + this.parent = parent; + this.hub = hub; + this.data = null; + this.context = null; + this.scope = null; + } + static get({ + hub, + parentPath, + parent, + container, + listKey, + key + }) { + if (!hub && parentPath) { + hub = parentPath.hub; + } + if (!parent) { + throw new Error("To get a node path the parent needs to exist"); + } + const targetNode = container[key]; + const paths = cache.getOrCreateCachedPaths(hub, parent); + let path = paths.get(targetNode); + if (!path) { + path = new NodePath(hub, parent); + if (targetNode) paths.set(targetNode, path); + } + path.setup(parentPath, container, listKey, key); + return path; + } + getScope(scope) { + return this.isScope() ? new _index2.default(this) : scope; + } + setData(key, val) { + if (this.data == null) { + this.data = Object.create(null); + } + return this.data[key] = val; + } + getData(key, def) { + if (this.data == null) { + this.data = Object.create(null); + } + let val = this.data[key]; + if (val === undefined && def !== undefined) val = this.data[key] = def; + return val; + } + hasNode() { + return this.node != null; + } + buildCodeFrameError(msg, Error = SyntaxError) { + return this.hub.buildError(this.node, msg, Error); + } + traverse(visitor, state) { + (0, _index.default)(this.node, visitor, this.scope, state, this); + } + set(key, node) { + validate(this.node, key, node); + this.node[key] = node; + } + getPathLocation() { + const parts = []; + let path = this; + do { + let key = path.key; + if (path.inList) key = `${path.listKey}[${key}]`; + parts.unshift(key); + } while (path = path.parentPath); + return parts.join("."); + } + debug(message) { + if (!debug.enabled) return; + debug(`${this.getPathLocation()} ${this.type}: ${message}`); + } + toString() { + return (0, _generator.default)(this.node).code; + } + get inList() { + return !!this.listKey; + } + set inList(inList) { + if (!inList) { + this.listKey = null; + } + } + get parentKey() { + return this.listKey || this.key; + } + get shouldSkip() { + return !!(this._traverseFlags & SHOULD_SKIP); + } + set shouldSkip(v) { + if (v) { + this._traverseFlags |= SHOULD_SKIP; + } else { + this._traverseFlags &= ~SHOULD_SKIP; + } + } + get shouldStop() { + return !!(this._traverseFlags & SHOULD_STOP); + } + set shouldStop(v) { + if (v) { + this._traverseFlags |= SHOULD_STOP; + } else { + this._traverseFlags &= ~SHOULD_STOP; + } + } + get removed() { + return !!(this._traverseFlags & REMOVED); + } + set removed(v) { + if (v) { + this._traverseFlags |= REMOVED; + } else { + this._traverseFlags &= ~REMOVED; + } + } +} +Object.assign(NodePath.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, NodePath_evaluation, NodePath_conversion, NodePath_introspection, NodePath_context, NodePath_removal, NodePath_modification, NodePath_family, NodePath_comments); +{ + NodePath.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo; +} +for (const type of t.TYPES) { + const typeKey = `is${type}`; + const fn = t[typeKey]; + NodePath.prototype[typeKey] = function (opts) { + return fn(this.node, opts); + }; + NodePath.prototype[`assert${type}`] = function (opts) { + if (!fn(this.node, opts)) { + throw new TypeError(`Expected node path of type ${type}`); + } + }; +} +Object.assign(NodePath.prototype, NodePath_virtual_types_validator); +for (const type of Object.keys(virtualTypes)) { + if (type[0] === "_") continue; + if (!t.TYPES.includes(type)) t.TYPES.push(type); +} +var _default = NodePath; +exports.default = _default; + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 8760: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports._getTypeAnnotation = _getTypeAnnotation; +exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches; +exports.couldBeBaseType = couldBeBaseType; +exports.getTypeAnnotation = getTypeAnnotation; +exports.isBaseType = isBaseType; +exports.isGenericType = isGenericType; +var inferers = __nccwpck_require__(5146); +var _t = __nccwpck_require__(7012); +const { + anyTypeAnnotation, + isAnyTypeAnnotation, + isArrayTypeAnnotation, + isBooleanTypeAnnotation, + isEmptyTypeAnnotation, + isFlowBaseAnnotation, + isGenericTypeAnnotation, + isIdentifier, + isMixedTypeAnnotation, + isNumberTypeAnnotation, + isStringTypeAnnotation, + isTSArrayType, + isTSTypeAnnotation, + isTSTypeReference, + isTupleTypeAnnotation, + isTypeAnnotation, + isUnionTypeAnnotation, + isVoidTypeAnnotation, + stringTypeAnnotation, + voidTypeAnnotation +} = _t; +function getTypeAnnotation() { + let type = this.getData("typeAnnotation"); + if (type != null) { + return type; + } + type = this._getTypeAnnotation() || anyTypeAnnotation(); + if (isTypeAnnotation(type) || isTSTypeAnnotation(type)) { + type = type.typeAnnotation; + } + this.setData("typeAnnotation", type); + return type; +} +const typeAnnotationInferringNodes = new WeakSet(); +function _getTypeAnnotation() { + const node = this.node; + if (!node) { + if (this.key === "init" && this.parentPath.isVariableDeclarator()) { + const declar = this.parentPath.parentPath; + const declarParent = declar.parentPath; + if (declar.key === "left" && declarParent.isForInStatement()) { + return stringTypeAnnotation(); + } + if (declar.key === "left" && declarParent.isForOfStatement()) { + return anyTypeAnnotation(); + } + return voidTypeAnnotation(); + } else { + return; + } + } + if (node.typeAnnotation) { + return node.typeAnnotation; + } + if (typeAnnotationInferringNodes.has(node)) { + return; + } + typeAnnotationInferringNodes.add(node); + try { + var _inferer; + let inferer = inferers[node.type]; + if (inferer) { + return inferer.call(this, node); + } + inferer = inferers[this.parentPath.type]; + if ((_inferer = inferer) != null && _inferer.validParent) { + return this.parentPath.getTypeAnnotation(); + } + } finally { + typeAnnotationInferringNodes.delete(node); + } +} +function isBaseType(baseName, soft) { + return _isBaseType(baseName, this.getTypeAnnotation(), soft); +} +function _isBaseType(baseName, type, soft) { + if (baseName === "string") { + return isStringTypeAnnotation(type); + } else if (baseName === "number") { + return isNumberTypeAnnotation(type); + } else if (baseName === "boolean") { + return isBooleanTypeAnnotation(type); + } else if (baseName === "any") { + return isAnyTypeAnnotation(type); + } else if (baseName === "mixed") { + return isMixedTypeAnnotation(type); + } else if (baseName === "empty") { + return isEmptyTypeAnnotation(type); + } else if (baseName === "void") { + return isVoidTypeAnnotation(type); + } else { + if (soft) { + return false; + } else { + throw new Error(`Unknown base type ${baseName}`); + } + } +} +function couldBeBaseType(name) { + const type = this.getTypeAnnotation(); + if (isAnyTypeAnnotation(type)) return true; + if (isUnionTypeAnnotation(type)) { + for (const type2 of type.types) { + if (isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) { + return true; + } + } + return false; + } else { + return _isBaseType(name, type, true); + } +} +function baseTypeStrictlyMatches(rightArg) { + const left = this.getTypeAnnotation(); + const right = rightArg.getTypeAnnotation(); + if (!isAnyTypeAnnotation(left) && isFlowBaseAnnotation(left)) { + return right.type === left.type; + } + return false; +} +function isGenericType(genericName) { + const type = this.getTypeAnnotation(); + if (genericName === "Array") { + if (isTSArrayType(type) || isArrayTypeAnnotation(type) || isTupleTypeAnnotation(type)) { + return true; + } + } + return isGenericTypeAnnotation(type) && isIdentifier(type.id, { + name: genericName + }) || isTSTypeReference(type) && isIdentifier(type.typeName, { + name: genericName + }); +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 8923: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = _default; +var _t = __nccwpck_require__(7012); +var _util = __nccwpck_require__(5408); +const { + BOOLEAN_NUMBER_BINARY_OPERATORS, + createTypeAnnotationBasedOnTypeof, + numberTypeAnnotation, + voidTypeAnnotation +} = _t; +function _default(node) { + if (!this.isReferenced()) return; + const binding = this.scope.getBinding(node.name); + if (binding) { + if (binding.identifier.typeAnnotation) { + return binding.identifier.typeAnnotation; + } else { + return getTypeAnnotationBindingConstantViolations(binding, this, node.name); + } + } + if (node.name === "undefined") { + return voidTypeAnnotation(); + } else if (node.name === "NaN" || node.name === "Infinity") { + return numberTypeAnnotation(); + } else if (node.name === "arguments") {} +} +function getTypeAnnotationBindingConstantViolations(binding, path, name) { + const types = []; + const functionConstantViolations = []; + let constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations); + const testType = getConditionalAnnotation(binding, path, name); + if (testType) { + const testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement); + constantViolations = constantViolations.filter(path => testConstantViolations.indexOf(path) < 0); + types.push(testType.typeAnnotation); + } + if (constantViolations.length) { + constantViolations.push(...functionConstantViolations); + for (const violation of constantViolations) { + types.push(violation.getTypeAnnotation()); + } + } + if (!types.length) { + return; + } + return (0, _util.createUnionType)(types); +} +function getConstantViolationsBefore(binding, path, functions) { + const violations = binding.constantViolations.slice(); + violations.unshift(binding.path); + return violations.filter(violation => { + violation = violation.resolve(); + const status = violation._guessExecutionStatusRelativeTo(path); + if (functions && status === "unknown") functions.push(violation); + return status === "before"; + }); +} +function inferAnnotationFromBinaryExpression(name, path) { + const operator = path.node.operator; + const right = path.get("right").resolve(); + const left = path.get("left").resolve(); + let target; + if (left.isIdentifier({ + name + })) { + target = right; + } else if (right.isIdentifier({ + name + })) { + target = left; + } + if (target) { + if (operator === "===") { + return target.getTypeAnnotation(); + } + if (BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) { + return numberTypeAnnotation(); + } + return; + } + if (operator !== "===" && operator !== "==") return; + let typeofPath; + let typePath; + if (left.isUnaryExpression({ + operator: "typeof" + })) { + typeofPath = left; + typePath = right; + } else if (right.isUnaryExpression({ + operator: "typeof" + })) { + typeofPath = right; + typePath = left; + } + if (!typeofPath) return; + if (!typeofPath.get("argument").isIdentifier({ + name + })) return; + typePath = typePath.resolve(); + if (!typePath.isLiteral()) return; + const typeValue = typePath.node.value; + if (typeof typeValue !== "string") return; + return createTypeAnnotationBasedOnTypeof(typeValue); +} +function getParentConditionalPath(binding, path, name) { + let parentPath; + while (parentPath = path.parentPath) { + if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) { + if (path.key === "test") { + return; + } + return parentPath; + } + if (parentPath.isFunction()) { + if (parentPath.parentPath.scope.getBinding(name) !== binding) return; + } + path = parentPath; + } +} +function getConditionalAnnotation(binding, path, name) { + const ifStatement = getParentConditionalPath(binding, path, name); + if (!ifStatement) return; + const test = ifStatement.get("test"); + const paths = [test]; + const types = []; + for (let i = 0; i < paths.length; i++) { + const path = paths[i]; + if (path.isLogicalExpression()) { + if (path.node.operator === "&&") { + paths.push(path.get("left")); + paths.push(path.get("right")); + } + } else if (path.isBinaryExpression()) { + const type = inferAnnotationFromBinaryExpression(name, path); + if (type) types.push(type); + } + } + if (types.length) { + return { + typeAnnotation: (0, _util.createUnionType)(types), + ifStatement + }; + } + return getConditionalAnnotation(binding, ifStatement, name); +} + +//# sourceMappingURL=inferer-reference.js.map + + +/***/ }), + +/***/ 5146: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.ArrayExpression = ArrayExpression; +exports.AssignmentExpression = AssignmentExpression; +exports.BinaryExpression = BinaryExpression; +exports.BooleanLiteral = BooleanLiteral; +exports.CallExpression = CallExpression; +exports.ConditionalExpression = ConditionalExpression; +exports.ClassDeclaration = exports.ClassExpression = exports.FunctionDeclaration = exports.ArrowFunctionExpression = exports.FunctionExpression = Func; +Object.defineProperty(exports, "Identifier", ({ + enumerable: true, + get: function () { + return _infererReference.default; + } +})); +exports.LogicalExpression = LogicalExpression; +exports.NewExpression = NewExpression; +exports.NullLiteral = NullLiteral; +exports.NumericLiteral = NumericLiteral; +exports.ObjectExpression = ObjectExpression; +exports.ParenthesizedExpression = ParenthesizedExpression; +exports.RegExpLiteral = RegExpLiteral; +exports.RestElement = RestElement; +exports.SequenceExpression = SequenceExpression; +exports.StringLiteral = StringLiteral; +exports.TSAsExpression = TSAsExpression; +exports.TSNonNullExpression = TSNonNullExpression; +exports.TaggedTemplateExpression = TaggedTemplateExpression; +exports.TemplateLiteral = TemplateLiteral; +exports.TypeCastExpression = TypeCastExpression; +exports.UnaryExpression = UnaryExpression; +exports.UpdateExpression = UpdateExpression; +exports.VariableDeclarator = VariableDeclarator; +var _t = __nccwpck_require__(7012); +var _infererReference = __nccwpck_require__(8923); +var _util = __nccwpck_require__(5408); +const { + BOOLEAN_BINARY_OPERATORS, + BOOLEAN_UNARY_OPERATORS, + NUMBER_BINARY_OPERATORS, + NUMBER_UNARY_OPERATORS, + STRING_UNARY_OPERATORS, + anyTypeAnnotation, + arrayTypeAnnotation, + booleanTypeAnnotation, + buildMatchMemberExpression, + genericTypeAnnotation, + identifier, + nullLiteralTypeAnnotation, + numberTypeAnnotation, + stringTypeAnnotation, + tupleTypeAnnotation, + unionTypeAnnotation, + voidTypeAnnotation, + isIdentifier +} = _t; +function VariableDeclarator() { + if (!this.get("id").isIdentifier()) return; + return this.get("init").getTypeAnnotation(); +} +function TypeCastExpression(node) { + return node.typeAnnotation; +} +TypeCastExpression.validParent = true; +function TSAsExpression(node) { + return node.typeAnnotation; +} +TSAsExpression.validParent = true; +function TSNonNullExpression() { + return this.get("expression").getTypeAnnotation(); +} +function NewExpression(node) { + if (node.callee.type === "Identifier") { + return genericTypeAnnotation(node.callee); + } +} +function TemplateLiteral() { + return stringTypeAnnotation(); +} +function UnaryExpression(node) { + const operator = node.operator; + if (operator === "void") { + return voidTypeAnnotation(); + } else if (NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) { + return numberTypeAnnotation(); + } else if (STRING_UNARY_OPERATORS.indexOf(operator) >= 0) { + return stringTypeAnnotation(); + } else if (BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) { + return booleanTypeAnnotation(); + } +} +function BinaryExpression(node) { + const operator = node.operator; + if (NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) { + return numberTypeAnnotation(); + } else if (BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) { + return booleanTypeAnnotation(); + } else if (operator === "+") { + const right = this.get("right"); + const left = this.get("left"); + if (left.isBaseType("number") && right.isBaseType("number")) { + return numberTypeAnnotation(); + } else if (left.isBaseType("string") || right.isBaseType("string")) { + return stringTypeAnnotation(); + } + return unionTypeAnnotation([stringTypeAnnotation(), numberTypeAnnotation()]); + } +} +function LogicalExpression() { + const argumentTypes = [this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()]; + return (0, _util.createUnionType)(argumentTypes); +} +function ConditionalExpression() { + const argumentTypes = [this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()]; + return (0, _util.createUnionType)(argumentTypes); +} +function SequenceExpression() { + return this.get("expressions").pop().getTypeAnnotation(); +} +function ParenthesizedExpression() { + return this.get("expression").getTypeAnnotation(); +} +function AssignmentExpression() { + return this.get("right").getTypeAnnotation(); +} +function UpdateExpression(node) { + const operator = node.operator; + if (operator === "++" || operator === "--") { + return numberTypeAnnotation(); + } +} +function StringLiteral() { + return stringTypeAnnotation(); +} +function NumericLiteral() { + return numberTypeAnnotation(); +} +function BooleanLiteral() { + return booleanTypeAnnotation(); +} +function NullLiteral() { + return nullLiteralTypeAnnotation(); +} +function RegExpLiteral() { + return genericTypeAnnotation(identifier("RegExp")); +} +function ObjectExpression() { + return genericTypeAnnotation(identifier("Object")); +} +function ArrayExpression() { + return genericTypeAnnotation(identifier("Array")); +} +function RestElement() { + return ArrayExpression(); +} +RestElement.validParent = true; +function Func() { + return genericTypeAnnotation(identifier("Function")); +} +const isArrayFrom = buildMatchMemberExpression("Array.from"); +const isObjectKeys = buildMatchMemberExpression("Object.keys"); +const isObjectValues = buildMatchMemberExpression("Object.values"); +const isObjectEntries = buildMatchMemberExpression("Object.entries"); +function CallExpression() { + const { + callee + } = this.node; + if (isObjectKeys(callee)) { + return arrayTypeAnnotation(stringTypeAnnotation()); + } else if (isArrayFrom(callee) || isObjectValues(callee) || isIdentifier(callee, { + name: "Array" + })) { + return arrayTypeAnnotation(anyTypeAnnotation()); + } else if (isObjectEntries(callee)) { + return arrayTypeAnnotation(tupleTypeAnnotation([stringTypeAnnotation(), anyTypeAnnotation()])); + } + return resolveCall(this.get("callee")); +} +function TaggedTemplateExpression() { + return resolveCall(this.get("tag")); +} +function resolveCall(callee) { + callee = callee.resolve(); + if (callee.isFunction()) { + const { + node + } = callee; + if (node.async) { + if (node.generator) { + return genericTypeAnnotation(identifier("AsyncIterator")); + } else { + return genericTypeAnnotation(identifier("Promise")); + } + } else { + if (node.generator) { + return genericTypeAnnotation(identifier("Iterator")); + } else if (callee.node.returnType) { + return callee.node.returnType; + } else {} + } + } +} + +//# sourceMappingURL=inferers.js.map + + +/***/ }), + +/***/ 5408: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.createUnionType = createUnionType; +var _t = __nccwpck_require__(7012); +const { + createFlowUnionType, + createTSUnionType, + createUnionTypeAnnotation, + isFlowType, + isTSType +} = _t; +function createUnionType(types) { + { + if (isFlowType(types[0])) { + if (createFlowUnionType) { + return createFlowUnionType(types); + } + return createUnionTypeAnnotation(types); + } else { + if (createTSUnionType) { + return createTSUnionType(types); + } + } + } +} + +//# sourceMappingURL=util.js.map + + +/***/ }), + +/***/ 5469: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports._guessExecutionStatusRelativeTo = _guessExecutionStatusRelativeTo; +exports._resolve = _resolve; +exports.canHaveVariableDeclarationOrExpression = canHaveVariableDeclarationOrExpression; +exports.canSwapBetweenExpressionAndStatement = canSwapBetweenExpressionAndStatement; +exports.equals = equals; +exports.getSource = getSource; +exports.has = has; +exports.is = void 0; +exports.isCompletionRecord = isCompletionRecord; +exports.isConstantExpression = isConstantExpression; +exports.isInStrictMode = isInStrictMode; +exports.isNodeType = isNodeType; +exports.isStatementOrBlock = isStatementOrBlock; +exports.isStatic = isStatic; +exports.isnt = isnt; +exports.matchesPattern = matchesPattern; +exports.referencesImport = referencesImport; +exports.resolve = resolve; +exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore; +var _t = __nccwpck_require__(7012); +const { + STATEMENT_OR_BLOCK_KEYS, + VISITOR_KEYS, + isBlockStatement, + isExpression, + isIdentifier, + isLiteral, + isStringLiteral, + isType, + matchesPattern: _matchesPattern +} = _t; +function matchesPattern(pattern, allowPartial) { + return _matchesPattern(this.node, pattern, allowPartial); +} +function has(key) { + const val = this.node && this.node[key]; + if (val && Array.isArray(val)) { + return !!val.length; + } else { + return !!val; + } +} +function isStatic() { + return this.scope.isStatic(this.node); +} +const is = has; +exports.is = is; +function isnt(key) { + return !this.has(key); +} +function equals(key, value) { + return this.node[key] === value; +} +function isNodeType(type) { + return isType(this.type, type); +} +function canHaveVariableDeclarationOrExpression() { + return (this.key === "init" || this.key === "left") && this.parentPath.isFor(); +} +function canSwapBetweenExpressionAndStatement(replacement) { + if (this.key !== "body" || !this.parentPath.isArrowFunctionExpression()) { + return false; + } + if (this.isExpression()) { + return isBlockStatement(replacement); + } else if (this.isBlockStatement()) { + return isExpression(replacement); + } + return false; +} +function isCompletionRecord(allowInsideFunction) { + let path = this; + let first = true; + do { + const { + type, + container + } = path; + if (!first && (path.isFunction() || type === "StaticBlock")) { + return !!allowInsideFunction; + } + first = false; + if (Array.isArray(container) && path.key !== container.length - 1) { + return false; + } + } while ((path = path.parentPath) && !path.isProgram() && !path.isDoExpression()); + return true; +} +function isStatementOrBlock() { + if (this.parentPath.isLabeledStatement() || isBlockStatement(this.container)) { + return false; + } else { + return STATEMENT_OR_BLOCK_KEYS.includes(this.key); + } +} +function referencesImport(moduleSource, importName) { + if (!this.isReferencedIdentifier()) { + if (this.isJSXMemberExpression() && this.node.property.name === importName || (this.isMemberExpression() || this.isOptionalMemberExpression()) && (this.node.computed ? isStringLiteral(this.node.property, { + value: importName + }) : this.node.property.name === importName)) { + const object = this.get("object"); + return object.isReferencedIdentifier() && object.referencesImport(moduleSource, "*"); + } + return false; + } + const binding = this.scope.getBinding(this.node.name); + if (!binding || binding.kind !== "module") return false; + const path = binding.path; + const parent = path.parentPath; + if (!parent.isImportDeclaration()) return false; + if (parent.node.source.value === moduleSource) { + if (!importName) return true; + } else { + return false; + } + if (path.isImportDefaultSpecifier() && importName === "default") { + return true; + } + if (path.isImportNamespaceSpecifier() && importName === "*") { + return true; + } + if (path.isImportSpecifier() && isIdentifier(path.node.imported, { + name: importName + })) { + return true; + } + return false; +} +function getSource() { + const node = this.node; + if (node.end) { + const code = this.hub.getCode(); + if (code) return code.slice(node.start, node.end); + } + return ""; +} +function willIMaybeExecuteBefore(target) { + return this._guessExecutionStatusRelativeTo(target) !== "after"; +} +function getOuterFunction(path) { + return path.isProgram() ? path : (path.parentPath.scope.getFunctionParent() || path.parentPath.scope.getProgramParent()).path; +} +function isExecutionUncertain(type, key) { + switch (type) { + case "LogicalExpression": + return key === "right"; + case "ConditionalExpression": + case "IfStatement": + return key === "consequent" || key === "alternate"; + case "WhileStatement": + case "DoWhileStatement": + case "ForInStatement": + case "ForOfStatement": + return key === "body"; + case "ForStatement": + return key === "body" || key === "update"; + case "SwitchStatement": + return key === "cases"; + case "TryStatement": + return key === "handler"; + case "AssignmentPattern": + return key === "right"; + case "OptionalMemberExpression": + return key === "property"; + case "OptionalCallExpression": + return key === "arguments"; + default: + return false; + } +} +function isExecutionUncertainInList(paths, maxIndex) { + for (let i = 0; i < maxIndex; i++) { + const path = paths[i]; + if (isExecutionUncertain(path.parent.type, path.parentKey)) { + return true; + } + } + return false; +} +const SYMBOL_CHECKING = Symbol(); +function _guessExecutionStatusRelativeTo(target) { + return _guessExecutionStatusRelativeToCached(this, target, new Map()); +} +function _guessExecutionStatusRelativeToCached(base, target, cache) { + const funcParent = { + this: getOuterFunction(base), + target: getOuterFunction(target) + }; + if (funcParent.target.node !== funcParent.this.node) { + return _guessExecutionStatusRelativeToDifferentFunctionsCached(base, funcParent.target, cache); + } + const paths = { + target: target.getAncestry(), + this: base.getAncestry() + }; + if (paths.target.indexOf(base) >= 0) return "after"; + if (paths.this.indexOf(target) >= 0) return "before"; + let commonPath; + const commonIndex = { + target: 0, + this: 0 + }; + while (!commonPath && commonIndex.this < paths.this.length) { + const path = paths.this[commonIndex.this]; + commonIndex.target = paths.target.indexOf(path); + if (commonIndex.target >= 0) { + commonPath = path; + } else { + commonIndex.this++; + } + } + if (!commonPath) { + throw new Error("Internal Babel error - The two compared nodes" + " don't appear to belong to the same program."); + } + if (isExecutionUncertainInList(paths.this, commonIndex.this - 1) || isExecutionUncertainInList(paths.target, commonIndex.target - 1)) { + return "unknown"; + } + const divergence = { + this: paths.this[commonIndex.this - 1], + target: paths.target[commonIndex.target - 1] + }; + if (divergence.target.listKey && divergence.this.listKey && divergence.target.container === divergence.this.container) { + return divergence.target.key > divergence.this.key ? "before" : "after"; + } + const keys = VISITOR_KEYS[commonPath.type]; + const keyPosition = { + this: keys.indexOf(divergence.this.parentKey), + target: keys.indexOf(divergence.target.parentKey) + }; + return keyPosition.target > keyPosition.this ? "before" : "after"; +} +function _guessExecutionStatusRelativeToDifferentFunctionsInternal(base, target, cache) { + if (!target.isFunctionDeclaration()) { + if (_guessExecutionStatusRelativeToCached(base, target, cache) === "before") { + return "before"; + } + return "unknown"; + } else if (target.parentPath.isExportDeclaration()) { + return "unknown"; + } + const binding = target.scope.getBinding(target.node.id.name); + if (!binding.references) return "before"; + const referencePaths = binding.referencePaths; + let allStatus; + for (const path of referencePaths) { + const childOfFunction = !!path.find(path => path.node === target.node); + if (childOfFunction) continue; + if (path.key !== "callee" || !path.parentPath.isCallExpression()) { + return "unknown"; + } + const status = _guessExecutionStatusRelativeToCached(base, path, cache); + if (allStatus && allStatus !== status) { + return "unknown"; + } else { + allStatus = status; + } + } + return allStatus; +} +function _guessExecutionStatusRelativeToDifferentFunctionsCached(base, target, cache) { + let nodeMap = cache.get(base.node); + let cached; + if (!nodeMap) { + cache.set(base.node, nodeMap = new Map()); + } else if (cached = nodeMap.get(target.node)) { + if (cached === SYMBOL_CHECKING) { + return "unknown"; + } + return cached; + } + nodeMap.set(target.node, SYMBOL_CHECKING); + const result = _guessExecutionStatusRelativeToDifferentFunctionsInternal(base, target, cache); + nodeMap.set(target.node, result); + return result; +} +function resolve(dangerous, resolved) { + return this._resolve(dangerous, resolved) || this; +} +function _resolve(dangerous, resolved) { + if (resolved && resolved.indexOf(this) >= 0) return; + resolved = resolved || []; + resolved.push(this); + if (this.isVariableDeclarator()) { + if (this.get("id").isIdentifier()) { + return this.get("init").resolve(dangerous, resolved); + } else {} + } else if (this.isReferencedIdentifier()) { + const binding = this.scope.getBinding(this.node.name); + if (!binding) return; + if (!binding.constant) return; + if (binding.kind === "module") return; + if (binding.path !== this) { + const ret = binding.path.resolve(dangerous, resolved); + if (this.find(parent => parent.node === ret.node)) return; + return ret; + } + } else if (this.isTypeCastExpression()) { + return this.get("expression").resolve(dangerous, resolved); + } else if (dangerous && this.isMemberExpression()) { + const targetKey = this.toComputedKey(); + if (!isLiteral(targetKey)) return; + const targetName = targetKey.value; + const target = this.get("object").resolve(dangerous, resolved); + if (target.isObjectExpression()) { + const props = target.get("properties"); + for (const prop of props) { + if (!prop.isProperty()) continue; + const key = prop.get("key"); + let match = prop.isnt("computed") && key.isIdentifier({ + name: targetName + }); + match = match || key.isLiteral({ + value: targetName + }); + if (match) return prop.get("value").resolve(dangerous, resolved); + } + } else if (target.isArrayExpression() && !isNaN(+targetName)) { + const elems = target.get("elements"); + const elem = elems[targetName]; + if (elem) return elem.resolve(dangerous, resolved); + } + } +} +function isConstantExpression() { + if (this.isIdentifier()) { + const binding = this.scope.getBinding(this.node.name); + if (!binding) return false; + return binding.constant; + } + if (this.isLiteral()) { + if (this.isRegExpLiteral()) { + return false; + } + if (this.isTemplateLiteral()) { + return this.get("expressions").every(expression => expression.isConstantExpression()); + } + return true; + } + if (this.isUnaryExpression()) { + if (this.node.operator !== "void") { + return false; + } + return this.get("argument").isConstantExpression(); + } + if (this.isBinaryExpression()) { + const { + operator + } = this.node; + return operator !== "in" && operator !== "instanceof" && this.get("left").isConstantExpression() && this.get("right").isConstantExpression(); + } + return false; +} +function isInStrictMode() { + const start = this.isProgram() ? this : this.parentPath; + const strictParent = start.find(path => { + if (path.isProgram({ + sourceType: "module" + })) return true; + if (path.isClass()) return true; + if (path.isArrowFunctionExpression() && !path.get("body").isBlockStatement()) { + return false; + } + let body; + if (path.isFunction()) { + body = path.node.body; + } else if (path.isProgram()) { + body = path.node; + } else { + return false; + } + for (const directive of body.directives) { + if (directive.value.value === "use strict") { + return true; + } + } + }); + return !!strictParent; +} + +//# sourceMappingURL=introspection.js.map + + +/***/ }), + +/***/ 662: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _t = __nccwpck_require__(7012); +var _t2 = _t; +const { + react +} = _t; +const { + cloneNode, + jsxExpressionContainer, + variableDeclaration, + variableDeclarator +} = _t2; +const referenceVisitor = { + ReferencedIdentifier(path, state) { + if (path.isJSXIdentifier() && react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) { + return; + } + if (path.node.name === "this") { + let scope = path.scope; + do { + if (scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) { + break; + } + } while (scope = scope.parent); + if (scope) state.breakOnScopePaths.push(scope.path); + } + const binding = path.scope.getBinding(path.node.name); + if (!binding) return; + for (const violation of binding.constantViolations) { + if (violation.scope !== binding.path.scope) { + state.mutableBinding = true; + path.stop(); + return; + } + } + if (binding !== state.scope.getBinding(path.node.name)) return; + state.bindings[path.node.name] = binding; + } +}; +class PathHoister { + constructor(path, scope) { + this.breakOnScopePaths = void 0; + this.bindings = void 0; + this.mutableBinding = void 0; + this.scopes = void 0; + this.scope = void 0; + this.path = void 0; + this.attachAfter = void 0; + this.breakOnScopePaths = []; + this.bindings = {}; + this.mutableBinding = false; + this.scopes = []; + this.scope = scope; + this.path = path; + this.attachAfter = false; + } + isCompatibleScope(scope) { + for (const key of Object.keys(this.bindings)) { + const binding = this.bindings[key]; + if (!scope.bindingIdentifierEquals(key, binding.identifier)) { + return false; + } + } + return true; + } + getCompatibleScopes() { + let scope = this.path.scope; + do { + if (this.isCompatibleScope(scope)) { + this.scopes.push(scope); + } else { + break; + } + if (this.breakOnScopePaths.indexOf(scope.path) >= 0) { + break; + } + } while (scope = scope.parent); + } + getAttachmentPath() { + let path = this._getAttachmentPath(); + if (!path) return; + let targetScope = path.scope; + if (targetScope.path === path) { + targetScope = path.scope.parent; + } + if (targetScope.path.isProgram() || targetScope.path.isFunction()) { + for (const name of Object.keys(this.bindings)) { + if (!targetScope.hasOwnBinding(name)) continue; + const binding = this.bindings[name]; + if (binding.kind === "param" || binding.path.parentKey === "params") { + continue; + } + const bindingParentPath = this.getAttachmentParentForPath(binding.path); + if (bindingParentPath.key >= path.key) { + this.attachAfter = true; + path = binding.path; + for (const violationPath of binding.constantViolations) { + if (this.getAttachmentParentForPath(violationPath).key > path.key) { + path = violationPath; + } + } + } + } + } + return path; + } + _getAttachmentPath() { + const scopes = this.scopes; + const scope = scopes.pop(); + if (!scope) return; + if (scope.path.isFunction()) { + if (this.hasOwnParamBindings(scope)) { + if (this.scope === scope) return; + const bodies = scope.path.get("body").get("body"); + for (let i = 0; i < bodies.length; i++) { + if (bodies[i].node._blockHoist) continue; + return bodies[i]; + } + } else { + return this.getNextScopeAttachmentParent(); + } + } else if (scope.path.isProgram()) { + return this.getNextScopeAttachmentParent(); + } + } + getNextScopeAttachmentParent() { + const scope = this.scopes.pop(); + if (scope) return this.getAttachmentParentForPath(scope.path); + } + getAttachmentParentForPath(path) { + do { + if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) { + return path; + } + } while (path = path.parentPath); + } + hasOwnParamBindings(scope) { + for (const name of Object.keys(this.bindings)) { + if (!scope.hasOwnBinding(name)) continue; + const binding = this.bindings[name]; + if (binding.kind === "param" && binding.constant) return true; + } + return false; + } + run() { + this.path.traverse(referenceVisitor, this); + if (this.mutableBinding) return; + this.getCompatibleScopes(); + const attachTo = this.getAttachmentPath(); + if (!attachTo) return; + if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return; + let uid = attachTo.scope.generateUidIdentifier("ref"); + const declarator = variableDeclarator(uid, this.path.node); + const insertFn = this.attachAfter ? "insertAfter" : "insertBefore"; + const [attached] = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : variableDeclaration("var", [declarator])]); + const parent = this.path.parentPath; + if (parent.isJSXElement() && this.path.container === parent.node.children) { + uid = jsxExpressionContainer(uid); + } + this.path.replaceWith(cloneNode(uid)); + return attachTo.isVariableDeclarator() ? attached.get("init") : attached.get("declarations.0.init"); + } +} +exports.default = PathHoister; + +//# sourceMappingURL=hoister.js.map + + +/***/ }), + +/***/ 6757: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.hooks = void 0; +const hooks = [function (self, parent) { + const removeParent = self.key === "test" && (parent.isWhile() || parent.isSwitchCase()) || self.key === "declaration" && parent.isExportDeclaration() || self.key === "body" && parent.isLabeledStatement() || self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 1 || self.key === "expression" && parent.isExpressionStatement(); + if (removeParent) { + parent.remove(); + return true; + } +}, function (self, parent) { + if (parent.isSequenceExpression() && parent.node.expressions.length === 1) { + parent.replaceWith(parent.node.expressions[0]); + return true; + } +}, function (self, parent) { + if (parent.isBinary()) { + if (self.key === "left") { + parent.replaceWith(parent.node.right); + } else { + parent.replaceWith(parent.node.left); + } + return true; + } +}, function (self, parent) { + if (parent.isIfStatement() && self.key === "consequent" || self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) { + self.replaceWith({ + type: "BlockStatement", + body: [] + }); + return true; + } +}]; +exports.hooks = hooks; + +//# sourceMappingURL=removal-hooks.js.map + + +/***/ }), + +/***/ 4971: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isBindingIdentifier = isBindingIdentifier; +exports.isBlockScoped = isBlockScoped; +exports.isExpression = isExpression; +exports.isFlow = isFlow; +exports.isForAwaitStatement = isForAwaitStatement; +exports.isGenerated = isGenerated; +exports.isPure = isPure; +exports.isReferenced = isReferenced; +exports.isReferencedIdentifier = isReferencedIdentifier; +exports.isReferencedMemberExpression = isReferencedMemberExpression; +exports.isRestProperty = isRestProperty; +exports.isScope = isScope; +exports.isSpreadProperty = isSpreadProperty; +exports.isStatement = isStatement; +exports.isUser = isUser; +exports.isVar = isVar; +var _t = __nccwpck_require__(7012); +const { + isBinding, + isBlockScoped: nodeIsBlockScoped, + isExportDeclaration, + isExpression: nodeIsExpression, + isFlow: nodeIsFlow, + isForStatement, + isForXStatement, + isIdentifier, + isImportDeclaration, + isImportSpecifier, + isJSXIdentifier, + isJSXMemberExpression, + isMemberExpression, + isRestElement: nodeIsRestElement, + isReferenced: nodeIsReferenced, + isScope: nodeIsScope, + isStatement: nodeIsStatement, + isVar: nodeIsVar, + isVariableDeclaration, + react, + isForOfStatement +} = _t; +const { + isCompatTag +} = react; +function isReferencedIdentifier(opts) { + const { + node, + parent + } = this; + if (!isIdentifier(node, opts) && !isJSXMemberExpression(parent, opts)) { + if (isJSXIdentifier(node, opts)) { + if (isCompatTag(node.name)) return false; + } else { + return false; + } + } + return nodeIsReferenced(node, parent, this.parentPath.parent); +} +function isReferencedMemberExpression() { + const { + node, + parent + } = this; + return isMemberExpression(node) && nodeIsReferenced(node, parent); +} +function isBindingIdentifier() { + const { + node, + parent + } = this; + const grandparent = this.parentPath.parent; + return isIdentifier(node) && isBinding(node, parent, grandparent); +} +function isStatement() { + const { + node, + parent + } = this; + if (nodeIsStatement(node)) { + if (isVariableDeclaration(node)) { + if (isForXStatement(parent, { + left: node + })) return false; + if (isForStatement(parent, { + init: node + })) return false; + } + return true; + } else { + return false; + } +} +function isExpression() { + if (this.isIdentifier()) { + return this.isReferencedIdentifier(); + } else { + return nodeIsExpression(this.node); + } +} +function isScope() { + return nodeIsScope(this.node, this.parent); +} +function isReferenced() { + return nodeIsReferenced(this.node, this.parent); +} +function isBlockScoped() { + return nodeIsBlockScoped(this.node); +} +function isVar() { + return nodeIsVar(this.node); +} +function isUser() { + return this.node && !!this.node.loc; +} +function isGenerated() { + return !this.isUser(); +} +function isPure(constantsOnly) { + return this.scope.isPure(this.node, constantsOnly); +} +function isFlow() { + const { + node + } = this; + if (nodeIsFlow(node)) { + return true; + } else if (isImportDeclaration(node)) { + return node.importKind === "type" || node.importKind === "typeof"; + } else if (isExportDeclaration(node)) { + return node.exportKind === "type"; + } else if (isImportSpecifier(node)) { + return node.importKind === "type" || node.importKind === "typeof"; + } else { + return false; + } +} +function isRestProperty() { + return nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectPattern(); +} +function isSpreadProperty() { + return nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectExpression(); +} +function isForAwaitStatement() { + return isForOfStatement(this.node, { + await: true + }); +} +{ + exports.isExistentialTypeParam = function isExistentialTypeParam() { + throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7."); + }; + exports.isNumericLiteralTypeAnnotation = function isNumericLiteralTypeAnnotation() { + throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7."); + }; +} + +//# sourceMappingURL=virtual-types-validator.js.map + + +/***/ }), + +/***/ 1314: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.Var = exports.User = exports.Statement = exports.SpreadProperty = exports.Scope = exports.RestProperty = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = exports.Referenced = exports.Pure = exports.NumericLiteralTypeAnnotation = exports.Generated = exports.ForAwaitStatement = exports.Flow = exports.Expression = exports.ExistentialTypeParam = exports.BlockScoped = exports.BindingIdentifier = void 0; +const ReferencedIdentifier = ["Identifier", "JSXIdentifier"]; +exports.ReferencedIdentifier = ReferencedIdentifier; +const ReferencedMemberExpression = ["MemberExpression"]; +exports.ReferencedMemberExpression = ReferencedMemberExpression; +const BindingIdentifier = ["Identifier"]; +exports.BindingIdentifier = BindingIdentifier; +const Statement = ["Statement"]; +exports.Statement = Statement; +const Expression = ["Expression"]; +exports.Expression = Expression; +const Scope = ["Scopable", "Pattern"]; +exports.Scope = Scope; +const Referenced = null; +exports.Referenced = Referenced; +const BlockScoped = null; +exports.BlockScoped = BlockScoped; +const Var = ["VariableDeclaration"]; +exports.Var = Var; +const User = null; +exports.User = User; +const Generated = null; +exports.Generated = Generated; +const Pure = null; +exports.Pure = Pure; +const Flow = ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"]; +exports.Flow = Flow; +const RestProperty = ["RestElement"]; +exports.RestProperty = RestProperty; +const SpreadProperty = ["RestElement"]; +exports.SpreadProperty = SpreadProperty; +const ExistentialTypeParam = ["ExistsTypeAnnotation"]; +exports.ExistentialTypeParam = ExistentialTypeParam; +const NumericLiteralTypeAnnotation = ["NumberLiteralTypeAnnotation"]; +exports.NumericLiteralTypeAnnotation = NumericLiteralTypeAnnotation; +const ForAwaitStatement = ["ForOfStatement"]; +exports.ForAwaitStatement = ForAwaitStatement; + +//# sourceMappingURL=virtual-types.js.map + + +/***/ }), + +/***/ 2340: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports._containerInsert = _containerInsert; +exports._containerInsertAfter = _containerInsertAfter; +exports._containerInsertBefore = _containerInsertBefore; +exports._verifyNodeList = _verifyNodeList; +exports.hoist = hoist; +exports.insertAfter = insertAfter; +exports.insertBefore = insertBefore; +exports.pushContainer = pushContainer; +exports.unshiftContainer = unshiftContainer; +exports.updateSiblingKeys = updateSiblingKeys; +var _cache = __nccwpck_require__(1503); +var _hoister = __nccwpck_require__(662); +var _index = __nccwpck_require__(7773); +var _t = __nccwpck_require__(7012); +const { + arrowFunctionExpression, + assertExpression, + assignmentExpression, + blockStatement, + callExpression, + cloneNode, + expressionStatement, + isAssignmentExpression, + isCallExpression, + isExportNamedDeclaration, + isExpression, + isIdentifier, + isSequenceExpression, + isSuper, + thisExpression +} = _t; +function insertBefore(nodes_) { + this._assertUnremoved(); + const nodes = this._verifyNodeList(nodes_); + const { + parentPath, + parent + } = this; + if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || isExportNamedDeclaration(parent) || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) { + return parentPath.insertBefore(nodes); + } else if (this.isNodeType("Expression") && !this.isJSXElement() || parentPath.isForStatement() && this.key === "init") { + if (this.node) nodes.push(this.node); + return this.replaceExpressionWithStatements(nodes); + } else if (Array.isArray(this.container)) { + return this._containerInsertBefore(nodes); + } else if (this.isStatementOrBlock()) { + const node = this.node; + const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null); + this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : [])); + return this.unshiftContainer("body", nodes); + } else { + throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?"); + } +} +function _containerInsert(from, nodes) { + this.updateSiblingKeys(from, nodes.length); + const paths = []; + this.container.splice(from, 0, ...nodes); + for (let i = 0; i < nodes.length; i++) { + var _this$context; + const to = from + i; + const path = this.getSibling(to); + paths.push(path); + if ((_this$context = this.context) != null && _this$context.queue) { + path.pushContext(this.context); + } + } + const contexts = this._getQueueContexts(); + for (const path of paths) { + path.setScope(); + path.debug("Inserted."); + for (const context of contexts) { + context.maybeQueue(path, true); + } + } + return paths; +} +function _containerInsertBefore(nodes) { + return this._containerInsert(this.key, nodes); +} +function _containerInsertAfter(nodes) { + return this._containerInsert(this.key + 1, nodes); +} +const last = arr => arr[arr.length - 1]; +function isHiddenInSequenceExpression(path) { + return isSequenceExpression(path.parent) && (last(path.parent.expressions) !== path.node || isHiddenInSequenceExpression(path.parentPath)); +} +function isAlmostConstantAssignment(node, scope) { + if (!isAssignmentExpression(node) || !isIdentifier(node.left)) { + return false; + } + const blockScope = scope.getBlockParent(); + return blockScope.hasOwnBinding(node.left.name) && blockScope.getOwnBinding(node.left.name).constantViolations.length <= 1; +} +function insertAfter(nodes_) { + this._assertUnremoved(); + if (this.isSequenceExpression()) { + return last(this.get("expressions")).insertAfter(nodes_); + } + const nodes = this._verifyNodeList(nodes_); + const { + parentPath, + parent + } = this; + if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || isExportNamedDeclaration(parent) || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) { + return parentPath.insertAfter(nodes.map(node => { + return isExpression(node) ? expressionStatement(node) : node; + })); + } else if (this.isNodeType("Expression") && !this.isJSXElement() && !parentPath.isJSXElement() || parentPath.isForStatement() && this.key === "init") { + if (this.node) { + const node = this.node; + let { + scope + } = this; + if (scope.path.isPattern()) { + assertExpression(node); + this.replaceWith(callExpression(arrowFunctionExpression([], node), [])); + this.get("callee.body").insertAfter(nodes); + return [this]; + } + if (isHiddenInSequenceExpression(this)) { + nodes.unshift(node); + } else if (isCallExpression(node) && isSuper(node.callee)) { + nodes.unshift(node); + nodes.push(thisExpression()); + } else if (isAlmostConstantAssignment(node, scope)) { + nodes.unshift(node); + nodes.push(cloneNode(node.left)); + } else if (scope.isPure(node, true)) { + nodes.push(node); + } else { + if (parentPath.isMethod({ + computed: true, + key: node + })) { + scope = scope.parent; + } + const temp = scope.generateDeclaredUidIdentifier(); + nodes.unshift(expressionStatement(assignmentExpression("=", cloneNode(temp), node))); + nodes.push(expressionStatement(cloneNode(temp))); + } + } + return this.replaceExpressionWithStatements(nodes); + } else if (Array.isArray(this.container)) { + return this._containerInsertAfter(nodes); + } else if (this.isStatementOrBlock()) { + const node = this.node; + const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null); + this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : [])); + return this.pushContainer("body", nodes); + } else { + throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?"); + } +} +function updateSiblingKeys(fromIndex, incrementBy) { + if (!this.parent) return; + const paths = (0, _cache.getCachedPaths)(this.hub, this.parent) || []; + for (const [, path] of paths) { + if (typeof path.key === "number" && path.key >= fromIndex) { + path.key += incrementBy; + } + } +} +function _verifyNodeList(nodes) { + if (!nodes) { + return []; + } + if (!Array.isArray(nodes)) { + nodes = [nodes]; + } + for (let i = 0; i < nodes.length; i++) { + const node = nodes[i]; + let msg; + if (!node) { + msg = "has falsy node"; + } else if (typeof node !== "object") { + msg = "contains a non-object node"; + } else if (!node.type) { + msg = "without a type"; + } else if (node instanceof _index.default) { + msg = "has a NodePath when it expected a raw object"; + } + if (msg) { + const type = Array.isArray(node) ? "array" : typeof node; + throw new Error(`Node list ${msg} with the index of ${i} and type of ${type}`); + } + } + return nodes; +} +function unshiftContainer(listKey, nodes) { + this._assertUnremoved(); + nodes = this._verifyNodeList(nodes); + const path = _index.default.get({ + parentPath: this, + parent: this.node, + container: this.node[listKey], + listKey, + key: 0 + }).setContext(this.context); + return path._containerInsertBefore(nodes); +} +function pushContainer(listKey, nodes) { + this._assertUnremoved(); + const verifiedNodes = this._verifyNodeList(nodes); + const container = this.node[listKey]; + const path = _index.default.get({ + parentPath: this, + parent: this.node, + container: container, + listKey, + key: container.length + }).setContext(this.context); + return path.replaceWithMultiple(verifiedNodes); +} +function hoist(scope = this.scope) { + const hoister = new _hoister.default(this, scope); + return hoister.run(); +} + +//# sourceMappingURL=modification.js.map + + +/***/ }), + +/***/ 4171: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports._assertUnremoved = _assertUnremoved; +exports._callRemovalHooks = _callRemovalHooks; +exports._markRemoved = _markRemoved; +exports._remove = _remove; +exports._removeFromScope = _removeFromScope; +exports.remove = remove; +var _removalHooks = __nccwpck_require__(6757); +var _cache = __nccwpck_require__(1503); +var _index = __nccwpck_require__(7773); +function remove() { + var _this$opts; + this._assertUnremoved(); + this.resync(); + if (!((_this$opts = this.opts) != null && _this$opts.noScope)) { + this._removeFromScope(); + } + if (this._callRemovalHooks()) { + this._markRemoved(); + return; + } + this.shareCommentsWithSiblings(); + this._remove(); + this._markRemoved(); +} +function _removeFromScope() { + const bindings = this.getBindingIdentifiers(); + Object.keys(bindings).forEach(name => this.scope.removeBinding(name)); +} +function _callRemovalHooks() { + for (const fn of _removalHooks.hooks) { + if (fn(this, this.parentPath)) return true; + } +} +function _remove() { + if (Array.isArray(this.container)) { + this.container.splice(this.key, 1); + this.updateSiblingKeys(this.key, -1); + } else { + this._replaceWith(null); + } +} +function _markRemoved() { + this._traverseFlags |= _index.SHOULD_SKIP | _index.REMOVED; + if (this.parent) { + (0, _cache.getCachedPaths)(this.hub, this.parent).delete(this.node); + } + this.node = null; +} +function _assertUnremoved() { + if (this.removed) { + throw this.buildCodeFrameError("NodePath has been removed so is read-only."); + } +} + +//# sourceMappingURL=removal.js.map + + +/***/ }), + +/***/ 8034: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports._replaceWith = _replaceWith; +exports.replaceExpressionWithStatements = replaceExpressionWithStatements; +exports.replaceInline = replaceInline; +exports.replaceWith = replaceWith; +exports.replaceWithMultiple = replaceWithMultiple; +exports.replaceWithSourceString = replaceWithSourceString; +var _codeFrame = __nccwpck_require__(5211); +var _index = __nccwpck_require__(5008); +var _index2 = __nccwpck_require__(7773); +var _cache = __nccwpck_require__(1503); +var _parser = __nccwpck_require__(639); +var _t = __nccwpck_require__(7012); +var _helperHoistVariables = __nccwpck_require__(3896); +const { + FUNCTION_TYPES, + arrowFunctionExpression, + assignmentExpression, + awaitExpression, + blockStatement, + callExpression, + cloneNode, + expressionStatement, + identifier, + inheritLeadingComments, + inheritTrailingComments, + inheritsComments, + isExpression, + isProgram, + isStatement, + removeComments, + returnStatement, + toSequenceExpression, + validate, + yieldExpression +} = _t; +function replaceWithMultiple(nodes) { + var _getCachedPaths; + this.resync(); + nodes = this._verifyNodeList(nodes); + inheritLeadingComments(nodes[0], this.node); + inheritTrailingComments(nodes[nodes.length - 1], this.node); + (_getCachedPaths = (0, _cache.getCachedPaths)(this.hub, this.parent)) == null ? void 0 : _getCachedPaths.delete(this.node); + this.node = this.container[this.key] = null; + const paths = this.insertAfter(nodes); + if (this.node) { + this.requeue(); + } else { + this.remove(); + } + return paths; +} +function replaceWithSourceString(replacement) { + this.resync(); + let ast; + try { + replacement = `(${replacement})`; + ast = (0, _parser.parse)(replacement); + } catch (err) { + const loc = err.loc; + if (loc) { + err.message += " - make sure this is an expression.\n" + (0, _codeFrame.codeFrameColumns)(replacement, { + start: { + line: loc.line, + column: loc.column + 1 + } + }); + err.code = "BABEL_REPLACE_SOURCE_ERROR"; + } + throw err; + } + const expressionAST = ast.program.body[0].expression; + _index.default.removeProperties(expressionAST); + return this.replaceWith(expressionAST); +} +function replaceWith(replacementPath) { + this.resync(); + if (this.removed) { + throw new Error("You can't replace this node, we've already removed it"); + } + let replacement = replacementPath instanceof _index2.default ? replacementPath.node : replacementPath; + if (!replacement) { + throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead"); + } + if (this.node === replacement) { + return [this]; + } + if (this.isProgram() && !isProgram(replacement)) { + throw new Error("You can only replace a Program root node with another Program node"); + } + if (Array.isArray(replacement)) { + throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`"); + } + if (typeof replacement === "string") { + throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`"); + } + let nodePath = ""; + if (this.isNodeType("Statement") && isExpression(replacement)) { + if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) { + replacement = expressionStatement(replacement); + nodePath = "expression"; + } + } + if (this.isNodeType("Expression") && isStatement(replacement)) { + if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) { + return this.replaceExpressionWithStatements([replacement]); + } + } + const oldNode = this.node; + if (oldNode) { + inheritsComments(replacement, oldNode); + removeComments(oldNode); + } + this._replaceWith(replacement); + this.type = replacement.type; + this.setScope(); + this.requeue(); + return [nodePath ? this.get(nodePath) : this]; +} +function _replaceWith(node) { + var _getCachedPaths2; + if (!this.container) { + throw new ReferenceError("Container is falsy"); + } + if (this.inList) { + validate(this.parent, this.key, [node]); + } else { + validate(this.parent, this.key, node); + } + this.debug(`Replace with ${node == null ? void 0 : node.type}`); + (_getCachedPaths2 = (0, _cache.getCachedPaths)(this.hub, this.parent)) == null ? void 0 : _getCachedPaths2.set(node, this).delete(this.node); + this.node = this.container[this.key] = node; +} +function replaceExpressionWithStatements(nodes) { + this.resync(); + const nodesAsSequenceExpression = toSequenceExpression(nodes, this.scope); + if (nodesAsSequenceExpression) { + return this.replaceWith(nodesAsSequenceExpression)[0].get("expressions"); + } + const functionParent = this.getFunctionParent(); + const isParentAsync = functionParent == null ? void 0 : functionParent.is("async"); + const isParentGenerator = functionParent == null ? void 0 : functionParent.is("generator"); + const container = arrowFunctionExpression([], blockStatement(nodes)); + this.replaceWith(callExpression(container, [])); + const callee = this.get("callee"); + (0, _helperHoistVariables.default)(callee.get("body"), id => { + this.scope.push({ + id + }); + }, "var"); + const completionRecords = this.get("callee").getCompletionRecords(); + for (const path of completionRecords) { + if (!path.isExpressionStatement()) continue; + const loop = path.findParent(path => path.isLoop()); + if (loop) { + let uid = loop.getData("expressionReplacementReturnUid"); + if (!uid) { + uid = callee.scope.generateDeclaredUidIdentifier("ret"); + callee.get("body").pushContainer("body", returnStatement(cloneNode(uid))); + loop.setData("expressionReplacementReturnUid", uid); + } else { + uid = identifier(uid.name); + } + path.get("expression").replaceWith(assignmentExpression("=", cloneNode(uid), path.node.expression)); + } else { + path.replaceWith(returnStatement(path.node.expression)); + } + } + callee.arrowFunctionToExpression(); + const newCallee = callee; + const needToAwaitFunction = isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", FUNCTION_TYPES); + const needToYieldFunction = isParentGenerator && _index.default.hasType(this.get("callee.body").node, "YieldExpression", FUNCTION_TYPES); + if (needToAwaitFunction) { + newCallee.set("async", true); + if (!needToYieldFunction) { + this.replaceWith(awaitExpression(this.node)); + } + } + if (needToYieldFunction) { + newCallee.set("generator", true); + this.replaceWith(yieldExpression(this.node, true)); + } + return newCallee.get("body.body"); +} +function replaceInline(nodes) { + this.resync(); + if (Array.isArray(nodes)) { + if (Array.isArray(this.container)) { + nodes = this._verifyNodeList(nodes); + const paths = this._containerInsertAfter(nodes); + this.remove(); + return paths; + } else { + return this.replaceWithMultiple(nodes); + } + } else { + return this.replaceWith(nodes); + } +} + +//# sourceMappingURL=replacement.js.map + + +/***/ }), + +/***/ 390: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +class Binding { + constructor({ + identifier, + scope, + path, + kind + }) { + this.identifier = void 0; + this.scope = void 0; + this.path = void 0; + this.kind = void 0; + this.constantViolations = []; + this.constant = true; + this.referencePaths = []; + this.referenced = false; + this.references = 0; + this.identifier = identifier; + this.scope = scope; + this.path = path; + this.kind = kind; + if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(path)) { + this.reassign(path); + } + this.clearValue(); + } + deoptValue() { + this.clearValue(); + this.hasDeoptedValue = true; + } + setValue(value) { + if (this.hasDeoptedValue) return; + this.hasValue = true; + this.value = value; + } + clearValue() { + this.hasDeoptedValue = false; + this.hasValue = false; + this.value = null; + } + reassign(path) { + this.constant = false; + if (this.constantViolations.indexOf(path) !== -1) { + return; + } + this.constantViolations.push(path); + } + reference(path) { + if (this.referencePaths.indexOf(path) !== -1) { + return; + } + this.referenced = true; + this.references++; + this.referencePaths.push(path); + } + dereference() { + this.references--; + this.referenced = !!this.references; + } +} +exports.default = Binding; +function isDeclaredInLoop(path) { + for (let { + parentPath, + key + } = path; parentPath; ({ + parentPath, + key + } = parentPath)) { + if (parentPath.isFunctionParent()) return false; + if (parentPath.isWhile() || parentPath.isForXStatement() || parentPath.isForStatement() && key === "body") { + return true; + } + } + return false; +} + +//# sourceMappingURL=binding.js.map + + +/***/ }), + +/***/ 1958: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _renamer = __nccwpck_require__(5235); +var _index = __nccwpck_require__(5008); +var _binding = __nccwpck_require__(390); +var _globals = __nccwpck_require__(455); +var _t = __nccwpck_require__(7012); +var t = _t; +var _cache = __nccwpck_require__(1503); +var _visitors = __nccwpck_require__(9269); +const { + NOT_LOCAL_BINDING, + callExpression, + cloneNode, + getBindingIdentifiers, + identifier, + isArrayExpression, + isBinary, + isClass, + isClassBody, + isClassDeclaration, + isExportAllDeclaration, + isExportDefaultDeclaration, + isExportNamedDeclaration, + isFunctionDeclaration, + isIdentifier, + isImportDeclaration, + isLiteral, + isMethod, + isModuleSpecifier, + isNullLiteral, + isObjectExpression, + isProperty, + isPureish, + isRegExpLiteral, + isSuper, + isTaggedTemplateExpression, + isTemplateLiteral, + isThisExpression, + isUnaryExpression, + isVariableDeclaration, + matchesPattern, + memberExpression, + numericLiteral, + toIdentifier, + unaryExpression, + variableDeclaration, + variableDeclarator, + isRecordExpression, + isTupleExpression, + isObjectProperty, + isTopicReference, + isMetaProperty, + isPrivateName, + isExportDeclaration +} = _t; +function gatherNodeParts(node, parts) { + switch (node == null ? void 0 : node.type) { + default: + if (isImportDeclaration(node) || isExportDeclaration(node)) { + var _node$specifiers; + if ((isExportAllDeclaration(node) || isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.source) { + gatherNodeParts(node.source, parts); + } else if ((isExportNamedDeclaration(node) || isImportDeclaration(node)) && (_node$specifiers = node.specifiers) != null && _node$specifiers.length) { + for (const e of node.specifiers) gatherNodeParts(e, parts); + } else if ((isExportDefaultDeclaration(node) || isExportNamedDeclaration(node)) && node.declaration) { + gatherNodeParts(node.declaration, parts); + } + } else if (isModuleSpecifier(node)) { + gatherNodeParts(node.local, parts); + } else if (isLiteral(node) && !isNullLiteral(node) && !isRegExpLiteral(node) && !isTemplateLiteral(node)) { + parts.push(node.value); + } + break; + case "MemberExpression": + case "OptionalMemberExpression": + case "JSXMemberExpression": + gatherNodeParts(node.object, parts); + gatherNodeParts(node.property, parts); + break; + case "Identifier": + case "JSXIdentifier": + parts.push(node.name); + break; + case "CallExpression": + case "OptionalCallExpression": + case "NewExpression": + gatherNodeParts(node.callee, parts); + break; + case "ObjectExpression": + case "ObjectPattern": + for (const e of node.properties) { + gatherNodeParts(e, parts); + } + break; + case "SpreadElement": + case "RestElement": + gatherNodeParts(node.argument, parts); + break; + case "ObjectProperty": + case "ObjectMethod": + case "ClassProperty": + case "ClassMethod": + case "ClassPrivateProperty": + case "ClassPrivateMethod": + gatherNodeParts(node.key, parts); + break; + case "ThisExpression": + parts.push("this"); + break; + case "Super": + parts.push("super"); + break; + case "Import": + parts.push("import"); + break; + case "DoExpression": + parts.push("do"); + break; + case "YieldExpression": + parts.push("yield"); + gatherNodeParts(node.argument, parts); + break; + case "AwaitExpression": + parts.push("await"); + gatherNodeParts(node.argument, parts); + break; + case "AssignmentExpression": + gatherNodeParts(node.left, parts); + break; + case "VariableDeclarator": + gatherNodeParts(node.id, parts); + break; + case "FunctionExpression": + case "FunctionDeclaration": + case "ClassExpression": + case "ClassDeclaration": + gatherNodeParts(node.id, parts); + break; + case "PrivateName": + gatherNodeParts(node.id, parts); + break; + case "ParenthesizedExpression": + gatherNodeParts(node.expression, parts); + break; + case "UnaryExpression": + case "UpdateExpression": + gatherNodeParts(node.argument, parts); + break; + case "MetaProperty": + gatherNodeParts(node.meta, parts); + gatherNodeParts(node.property, parts); + break; + case "JSXElement": + gatherNodeParts(node.openingElement, parts); + break; + case "JSXOpeningElement": + gatherNodeParts(node.name, parts); + break; + case "JSXFragment": + gatherNodeParts(node.openingFragment, parts); + break; + case "JSXOpeningFragment": + parts.push("Fragment"); + break; + case "JSXNamespacedName": + gatherNodeParts(node.namespace, parts); + gatherNodeParts(node.name, parts); + break; + } +} +const collectorVisitor = { + ForStatement(path) { + const declar = path.get("init"); + if (declar.isVar()) { + const { + scope + } = path; + const parentScope = scope.getFunctionParent() || scope.getProgramParent(); + parentScope.registerBinding("var", declar); + } + }, + Declaration(path) { + if (path.isBlockScoped()) return; + if (path.isImportDeclaration()) return; + if (path.isExportDeclaration()) return; + const parent = path.scope.getFunctionParent() || path.scope.getProgramParent(); + parent.registerDeclaration(path); + }, + ImportDeclaration(path) { + const parent = path.scope.getBlockParent(); + parent.registerDeclaration(path); + }, + ReferencedIdentifier(path, state) { + state.references.push(path); + }, + ForXStatement(path, state) { + const left = path.get("left"); + if (left.isPattern() || left.isIdentifier()) { + state.constantViolations.push(path); + } else if (left.isVar()) { + const { + scope + } = path; + const parentScope = scope.getFunctionParent() || scope.getProgramParent(); + parentScope.registerBinding("var", left); + } + }, + ExportDeclaration: { + exit(path) { + const { + node, + scope + } = path; + if (isExportAllDeclaration(node)) return; + const declar = node.declaration; + if (isClassDeclaration(declar) || isFunctionDeclaration(declar)) { + const id = declar.id; + if (!id) return; + const binding = scope.getBinding(id.name); + binding == null ? void 0 : binding.reference(path); + } else if (isVariableDeclaration(declar)) { + for (const decl of declar.declarations) { + for (const name of Object.keys(getBindingIdentifiers(decl))) { + const binding = scope.getBinding(name); + binding == null ? void 0 : binding.reference(path); + } + } + } + } + }, + LabeledStatement(path) { + path.scope.getBlockParent().registerDeclaration(path); + }, + AssignmentExpression(path, state) { + state.assignments.push(path); + }, + UpdateExpression(path, state) { + state.constantViolations.push(path); + }, + UnaryExpression(path, state) { + if (path.node.operator === "delete") { + state.constantViolations.push(path); + } + }, + BlockScoped(path) { + let scope = path.scope; + if (scope.path === path) scope = scope.parent; + const parent = scope.getBlockParent(); + parent.registerDeclaration(path); + if (path.isClassDeclaration() && path.node.id) { + const id = path.node.id; + const name = id.name; + path.scope.bindings[name] = path.scope.parent.getBinding(name); + } + }, + CatchClause(path) { + path.scope.registerBinding("let", path); + }, + Function(path) { + const params = path.get("params"); + for (const param of params) { + path.scope.registerBinding("param", param); + } + if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) { + path.scope.registerBinding("local", path.get("id"), path); + } + }, + ClassExpression(path) { + if (path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) { + path.scope.registerBinding("local", path); + } + } +}; +let uid = 0; +class Scope { + constructor(path) { + this.uid = void 0; + this.path = void 0; + this.block = void 0; + this.labels = void 0; + this.inited = void 0; + this.bindings = void 0; + this.references = void 0; + this.globals = void 0; + this.uids = void 0; + this.data = void 0; + this.crawling = void 0; + const { + node + } = path; + const cached = _cache.scope.get(node); + if ((cached == null ? void 0 : cached.path) === path) { + return cached; + } + _cache.scope.set(node, this); + this.uid = uid++; + this.block = node; + this.path = path; + this.labels = new Map(); + this.inited = false; + } + get parent() { + var _parent; + let parent, + path = this.path; + do { + const shouldSkip = path.key === "key" || path.listKey === "decorators"; + path = path.parentPath; + if (shouldSkip && path.isMethod()) path = path.parentPath; + if (path && path.isScope()) parent = path; + } while (path && !parent); + return (_parent = parent) == null ? void 0 : _parent.scope; + } + get parentBlock() { + return this.path.parent; + } + get hub() { + return this.path.hub; + } + traverse(node, opts, state) { + (0, _index.default)(node, opts, this, state, this.path); + } + generateDeclaredUidIdentifier(name) { + const id = this.generateUidIdentifier(name); + this.push({ + id + }); + return cloneNode(id); + } + generateUidIdentifier(name) { + return identifier(this.generateUid(name)); + } + generateUid(name = "temp") { + name = toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, ""); + let uid; + let i = 1; + do { + uid = this._generateUid(name, i); + i++; + } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid)); + const program = this.getProgramParent(); + program.references[uid] = true; + program.uids[uid] = true; + return uid; + } + _generateUid(name, i) { + let id = name; + if (i > 1) id += i; + return `_${id}`; + } + generateUidBasedOnNode(node, defaultName) { + const parts = []; + gatherNodeParts(node, parts); + let id = parts.join("$"); + id = id.replace(/^_/, "") || defaultName || "ref"; + return this.generateUid(id.slice(0, 20)); + } + generateUidIdentifierBasedOnNode(node, defaultName) { + return identifier(this.generateUidBasedOnNode(node, defaultName)); + } + isStatic(node) { + if (isThisExpression(node) || isSuper(node) || isTopicReference(node)) { + return true; + } + if (isIdentifier(node)) { + const binding = this.getBinding(node.name); + if (binding) { + return binding.constant; + } else { + return this.hasBinding(node.name); + } + } + return false; + } + maybeGenerateMemoised(node, dontPush) { + if (this.isStatic(node)) { + return null; + } else { + const id = this.generateUidIdentifierBasedOnNode(node); + if (!dontPush) { + this.push({ + id + }); + return cloneNode(id); + } + return id; + } + } + checkBlockScopedCollisions(local, kind, name, id) { + if (kind === "param") return; + if (local.kind === "local") return; + const duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && kind === "const"; + if (duplicate) { + throw this.hub.buildError(id, `Duplicate declaration "${name}"`, TypeError); + } + } + rename(oldName, newName) { + const binding = this.getBinding(oldName); + if (binding) { + newName || (newName = this.generateUidIdentifier(oldName).name); + const renamer = new _renamer.default(binding, oldName, newName); + { + renamer.rename(arguments[2]); + } + } + } + _renameFromMap(map, oldName, newName, value) { + if (map[oldName]) { + map[newName] = value; + map[oldName] = null; + } + } + dump() { + const sep = "-".repeat(60); + console.log(sep); + let scope = this; + do { + console.log("#", scope.block.type); + for (const name of Object.keys(scope.bindings)) { + const binding = scope.bindings[name]; + console.log(" -", name, { + constant: binding.constant, + references: binding.references, + violations: binding.constantViolations.length, + kind: binding.kind + }); + } + } while (scope = scope.parent); + console.log(sep); + } + toArray(node, i, arrayLikeIsIterable) { + if (isIdentifier(node)) { + const binding = this.getBinding(node.name); + if (binding != null && binding.constant && binding.path.isGenericType("Array")) { + return node; + } + } + if (isArrayExpression(node)) { + return node; + } + if (isIdentifier(node, { + name: "arguments" + })) { + return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]); + } + let helperName; + const args = [node]; + if (i === true) { + helperName = "toConsumableArray"; + } else if (typeof i === "number") { + args.push(numericLiteral(i)); + helperName = "slicedToArray"; + } else { + helperName = "toArray"; + } + if (arrayLikeIsIterable) { + args.unshift(this.hub.addHelper(helperName)); + helperName = "maybeArrayLike"; + } + return callExpression(this.hub.addHelper(helperName), args); + } + hasLabel(name) { + return !!this.getLabel(name); + } + getLabel(name) { + return this.labels.get(name); + } + registerLabel(path) { + this.labels.set(path.node.label.name, path); + } + registerDeclaration(path) { + if (path.isLabeledStatement()) { + this.registerLabel(path); + } else if (path.isFunctionDeclaration()) { + this.registerBinding("hoisted", path.get("id"), path); + } else if (path.isVariableDeclaration()) { + const declarations = path.get("declarations"); + const { + kind + } = path.node; + for (const declar of declarations) { + this.registerBinding(kind === "using" || kind === "await using" ? "const" : kind, declar); + } + } else if (path.isClassDeclaration()) { + if (path.node.declare) return; + this.registerBinding("let", path); + } else if (path.isImportDeclaration()) { + const isTypeDeclaration = path.node.importKind === "type" || path.node.importKind === "typeof"; + const specifiers = path.get("specifiers"); + for (const specifier of specifiers) { + const isTypeSpecifier = isTypeDeclaration || specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof"); + this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier); + } + } else if (path.isExportDeclaration()) { + const declar = path.get("declaration"); + if (declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration()) { + this.registerDeclaration(declar); + } + } else { + this.registerBinding("unknown", path); + } + } + buildUndefinedNode() { + return unaryExpression("void", numericLiteral(0), true); + } + registerConstantViolation(path) { + const ids = path.getBindingIdentifiers(); + for (const name of Object.keys(ids)) { + var _this$getBinding; + (_this$getBinding = this.getBinding(name)) == null ? void 0 : _this$getBinding.reassign(path); + } + } + registerBinding(kind, path, bindingPath = path) { + if (!kind) throw new ReferenceError("no `kind`"); + if (path.isVariableDeclaration()) { + const declarators = path.get("declarations"); + for (const declar of declarators) { + this.registerBinding(kind, declar); + } + return; + } + const parent = this.getProgramParent(); + const ids = path.getOuterBindingIdentifiers(true); + for (const name of Object.keys(ids)) { + parent.references[name] = true; + for (const id of ids[name]) { + const local = this.getOwnBinding(name); + if (local) { + if (local.identifier === id) continue; + this.checkBlockScopedCollisions(local, kind, name, id); + } + if (local) { + this.registerConstantViolation(bindingPath); + } else { + this.bindings[name] = new _binding.default({ + identifier: id, + scope: this, + path: bindingPath, + kind: kind + }); + } + } + } + } + addGlobal(node) { + this.globals[node.name] = node; + } + hasUid(name) { + let scope = this; + do { + if (scope.uids[name]) return true; + } while (scope = scope.parent); + return false; + } + hasGlobal(name) { + let scope = this; + do { + if (scope.globals[name]) return true; + } while (scope = scope.parent); + return false; + } + hasReference(name) { + return !!this.getProgramParent().references[name]; + } + isPure(node, constantsOnly) { + if (isIdentifier(node)) { + const binding = this.getBinding(node.name); + if (!binding) return false; + if (constantsOnly) return binding.constant; + return true; + } else if (isThisExpression(node) || isMetaProperty(node) || isTopicReference(node) || isPrivateName(node)) { + return true; + } else if (isClass(node)) { + var _node$decorators; + if (node.superClass && !this.isPure(node.superClass, constantsOnly)) { + return false; + } + if (((_node$decorators = node.decorators) == null ? void 0 : _node$decorators.length) > 0) { + return false; + } + return this.isPure(node.body, constantsOnly); + } else if (isClassBody(node)) { + for (const method of node.body) { + if (!this.isPure(method, constantsOnly)) return false; + } + return true; + } else if (isBinary(node)) { + return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly); + } else if (isArrayExpression(node) || isTupleExpression(node)) { + for (const elem of node.elements) { + if (elem !== null && !this.isPure(elem, constantsOnly)) return false; + } + return true; + } else if (isObjectExpression(node) || isRecordExpression(node)) { + for (const prop of node.properties) { + if (!this.isPure(prop, constantsOnly)) return false; + } + return true; + } else if (isMethod(node)) { + var _node$decorators2; + if (node.computed && !this.isPure(node.key, constantsOnly)) return false; + if (((_node$decorators2 = node.decorators) == null ? void 0 : _node$decorators2.length) > 0) { + return false; + } + return true; + } else if (isProperty(node)) { + var _node$decorators3; + if (node.computed && !this.isPure(node.key, constantsOnly)) return false; + if (((_node$decorators3 = node.decorators) == null ? void 0 : _node$decorators3.length) > 0) { + return false; + } + if (isObjectProperty(node) || node.static) { + if (node.value !== null && !this.isPure(node.value, constantsOnly)) { + return false; + } + } + return true; + } else if (isUnaryExpression(node)) { + return this.isPure(node.argument, constantsOnly); + } else if (isTaggedTemplateExpression(node)) { + return matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly); + } else if (isTemplateLiteral(node)) { + for (const expression of node.expressions) { + if (!this.isPure(expression, constantsOnly)) return false; + } + return true; + } else { + return isPureish(node); + } + } + setData(key, val) { + return this.data[key] = val; + } + getData(key) { + let scope = this; + do { + const data = scope.data[key]; + if (data != null) return data; + } while (scope = scope.parent); + } + removeData(key) { + let scope = this; + do { + const data = scope.data[key]; + if (data != null) scope.data[key] = null; + } while (scope = scope.parent); + } + init() { + if (!this.inited) { + this.inited = true; + this.crawl(); + } + } + crawl() { + const path = this.path; + this.references = Object.create(null); + this.bindings = Object.create(null); + this.globals = Object.create(null); + this.uids = Object.create(null); + this.data = Object.create(null); + const programParent = this.getProgramParent(); + if (programParent.crawling) return; + const state = { + references: [], + constantViolations: [], + assignments: [] + }; + this.crawling = true; + if (path.type !== "Program" && (0, _visitors.isExplodedVisitor)(collectorVisitor)) { + for (const visit of collectorVisitor.enter) { + visit.call(state, path, state); + } + const typeVisitors = collectorVisitor[path.type]; + if (typeVisitors) { + for (const visit of typeVisitors.enter) { + visit.call(state, path, state); + } + } + } + path.traverse(collectorVisitor, state); + this.crawling = false; + for (const path of state.assignments) { + const ids = path.getBindingIdentifiers(); + for (const name of Object.keys(ids)) { + if (path.scope.getBinding(name)) continue; + programParent.addGlobal(ids[name]); + } + path.scope.registerConstantViolation(path); + } + for (const ref of state.references) { + const binding = ref.scope.getBinding(ref.node.name); + if (binding) { + binding.reference(ref); + } else { + programParent.addGlobal(ref.node); + } + } + for (const path of state.constantViolations) { + path.scope.registerConstantViolation(path); + } + } + push(opts) { + let path = this.path; + if (path.isPattern()) { + path = this.getPatternParent().path; + } else if (!path.isBlockStatement() && !path.isProgram()) { + path = this.getBlockParent().path; + } + if (path.isSwitchStatement()) { + path = (this.getFunctionParent() || this.getProgramParent()).path; + } + const { + init, + unique, + kind = "var", + id + } = opts; + if (!init && !unique && (kind === "var" || kind === "let") && path.isFunction() && !path.node.name && t.isCallExpression(path.parent, { + callee: path.node + }) && path.parent.arguments.length <= path.node.params.length && t.isIdentifier(id)) { + path.pushContainer("params", id); + path.scope.registerBinding("param", path.get("params")[path.node.params.length - 1]); + return; + } + if (path.isLoop() || path.isCatchClause() || path.isFunction()) { + path.ensureBlock(); + path = path.get("body"); + } + const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; + const dataKey = `declaration:${kind}:${blockHoist}`; + let declarPath = !unique && path.getData(dataKey); + if (!declarPath) { + const declar = variableDeclaration(kind, []); + declar._blockHoist = blockHoist; + [declarPath] = path.unshiftContainer("body", [declar]); + if (!unique) path.setData(dataKey, declarPath); + } + const declarator = variableDeclarator(id, init); + const len = declarPath.node.declarations.push(declarator); + path.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]); + } + getProgramParent() { + let scope = this; + do { + if (scope.path.isProgram()) { + return scope; + } + } while (scope = scope.parent); + throw new Error("Couldn't find a Program"); + } + getFunctionParent() { + let scope = this; + do { + if (scope.path.isFunctionParent()) { + return scope; + } + } while (scope = scope.parent); + return null; + } + getBlockParent() { + let scope = this; + do { + if (scope.path.isBlockParent()) { + return scope; + } + } while (scope = scope.parent); + throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program..."); + } + getPatternParent() { + let scope = this; + do { + if (!scope.path.isPattern()) { + return scope.getBlockParent(); + } + } while (scope = scope.parent.parent); + throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program..."); + } + getAllBindings() { + const ids = Object.create(null); + let scope = this; + do { + for (const key of Object.keys(scope.bindings)) { + if (key in ids === false) { + ids[key] = scope.bindings[key]; + } + } + scope = scope.parent; + } while (scope); + return ids; + } + getAllBindingsOfKind(...kinds) { + const ids = Object.create(null); + for (const kind of kinds) { + let scope = this; + do { + for (const name of Object.keys(scope.bindings)) { + const binding = scope.bindings[name]; + if (binding.kind === kind) ids[name] = binding; + } + scope = scope.parent; + } while (scope); + } + return ids; + } + bindingIdentifierEquals(name, node) { + return this.getBindingIdentifier(name) === node; + } + getBinding(name) { + let scope = this; + let previousPath; + do { + const binding = scope.getOwnBinding(name); + if (binding) { + var _previousPath; + if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param" && binding.kind !== "local") {} else { + return binding; + } + } else if (!binding && name === "arguments" && scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) { + break; + } + previousPath = scope.path; + } while (scope = scope.parent); + } + getOwnBinding(name) { + return this.bindings[name]; + } + getBindingIdentifier(name) { + var _this$getBinding2; + return (_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.identifier; + } + getOwnBindingIdentifier(name) { + const binding = this.bindings[name]; + return binding == null ? void 0 : binding.identifier; + } + hasOwnBinding(name) { + return !!this.getOwnBinding(name); + } + hasBinding(name, opts) { + var _opts, _opts2, _opts3; + if (!name) return false; + if (this.hasOwnBinding(name)) return true; + { + if (typeof opts === "boolean") opts = { + noGlobals: opts + }; + } + if (this.parentHasBinding(name, opts)) return true; + if (!((_opts = opts) != null && _opts.noUids) && this.hasUid(name)) return true; + if (!((_opts2 = opts) != null && _opts2.noGlobals) && Scope.globals.includes(name)) return true; + if (!((_opts3 = opts) != null && _opts3.noGlobals) && Scope.contextVariables.includes(name)) return true; + return false; + } + parentHasBinding(name, opts) { + var _this$parent; + return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, opts); + } + moveBindingTo(name, scope) { + const info = this.getBinding(name); + if (info) { + info.scope.removeOwnBinding(name); + info.scope = scope; + scope.bindings[name] = info; + } + } + removeOwnBinding(name) { + delete this.bindings[name]; + } + removeBinding(name) { + var _this$getBinding3; + (_this$getBinding3 = this.getBinding(name)) == null ? void 0 : _this$getBinding3.scope.removeOwnBinding(name); + let scope = this; + do { + if (scope.uids[name]) { + scope.uids[name] = false; + } + } while (scope = scope.parent); + } +} +exports.default = Scope; +Scope.globals = Object.keys(_globals.builtin); +Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"]; + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 5235: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _helperSplitExportDeclaration = __nccwpck_require__(7731); +var t = __nccwpck_require__(7012); +var _helperEnvironmentVisitor = __nccwpck_require__(2056); +var _traverseNode = __nccwpck_require__(1452); +var _visitors = __nccwpck_require__(9269); +const renameVisitor = { + ReferencedIdentifier({ + node + }, state) { + if (node.name === state.oldName) { + node.name = state.newName; + } + }, + Scope(path, state) { + if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) { + path.skip(); + if (path.isMethod()) { + (0, _helperEnvironmentVisitor.requeueComputedKeyAndDecorators)(path); + } + } + }, + ObjectProperty({ + node, + scope + }, state) { + const { + name + } = node.key; + if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) { + var _node$extra; + node.shorthand = false; + if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false; + } + }, + "AssignmentExpression|Declaration|VariableDeclarator"(path, state) { + if (path.isVariableDeclaration()) return; + const ids = path.getOuterBindingIdentifiers(); + for (const name in ids) { + if (name === state.oldName) ids[name].name = state.newName; + } + } +}; +class Renamer { + constructor(binding, oldName, newName) { + this.newName = newName; + this.oldName = oldName; + this.binding = binding; + } + maybeConvertFromExportDeclaration(parentDeclar) { + const maybeExportDeclar = parentDeclar.parentPath; + if (!maybeExportDeclar.isExportDeclaration()) { + return; + } + if (maybeExportDeclar.isExportDefaultDeclaration()) { + const { + declaration + } = maybeExportDeclar.node; + if (t.isDeclaration(declaration) && !declaration.id) { + return; + } + } + if (maybeExportDeclar.isExportAllDeclaration()) { + return; + } + (0, _helperSplitExportDeclaration.default)(maybeExportDeclar); + } + maybeConvertFromClassFunctionDeclaration(path) { + return path; + } + maybeConvertFromClassFunctionExpression(path) { + return path; + } + rename() { + const { + binding, + oldName, + newName + } = this; + const { + scope, + path + } = binding; + const parentDeclar = path.find(path => path.isDeclaration() || path.isFunctionExpression() || path.isClassExpression()); + if (parentDeclar) { + const bindingIds = parentDeclar.getOuterBindingIdentifiers(); + if (bindingIds[oldName] === binding.identifier) { + this.maybeConvertFromExportDeclaration(parentDeclar); + } + } + const blockToTraverse = arguments[0] || scope.block; + (0, _traverseNode.traverseNode)(blockToTraverse, (0, _visitors.explode)(renameVisitor), scope, this, scope.path, { + discriminant: true + }); + if (!arguments[0]) { + scope.removeOwnBinding(oldName); + scope.bindings[newName] = binding; + this.binding.identifier.name = newName; + } + if (parentDeclar) { + this.maybeConvertFromClassFunctionDeclaration(path); + this.maybeConvertFromClassFunctionExpression(path); + } + } +} +exports.default = Renamer; + +//# sourceMappingURL=renamer.js.map + + +/***/ }), + +/***/ 1452: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.traverseNode = traverseNode; +var _context = __nccwpck_require__(622); +var _t = __nccwpck_require__(7012); +const { + VISITOR_KEYS +} = _t; +function traverseNode(node, opts, scope, state, path, skipKeys, visitSelf) { + const keys = VISITOR_KEYS[node.type]; + if (!keys) return false; + const context = new _context.default(scope, opts, state, path); + if (visitSelf) { + if (skipKeys != null && skipKeys[path.parentKey]) return false; + return context.visitQueue([path]); + } + for (const key of keys) { + if (skipKeys != null && skipKeys[key]) continue; + if (context.visit(node, key)) { + return true; + } + } + return false; +} + +//# sourceMappingURL=traverse-node.js.map + + +/***/ }), + +/***/ 9269: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.explode = explode; +exports.isExplodedVisitor = isExplodedVisitor; +exports.merge = merge; +exports.verify = verify; +var virtualTypes = __nccwpck_require__(1314); +var _t = __nccwpck_require__(7012); +const { + DEPRECATED_KEYS, + DEPRECATED_ALIASES, + FLIPPED_ALIAS_KEYS, + TYPES, + __internal__deprecationWarning: deprecationWarning +} = _t; +function isVirtualType(type) { + return type in virtualTypes; +} +function isExplodedVisitor(visitor) { + return visitor == null ? void 0 : visitor._exploded; +} +function explode(visitor) { + if (isExplodedVisitor(visitor)) return visitor; + visitor._exploded = true; + for (const nodeType of Object.keys(visitor)) { + if (shouldIgnoreKey(nodeType)) continue; + const parts = nodeType.split("|"); + if (parts.length === 1) continue; + const fns = visitor[nodeType]; + delete visitor[nodeType]; + for (const part of parts) { + visitor[part] = fns; + } + } + verify(visitor); + delete visitor.__esModule; + ensureEntranceObjects(visitor); + ensureCallbackArrays(visitor); + for (const nodeType of Object.keys(visitor)) { + if (shouldIgnoreKey(nodeType)) continue; + if (!isVirtualType(nodeType)) continue; + const fns = visitor[nodeType]; + for (const type of Object.keys(fns)) { + fns[type] = wrapCheck(nodeType, fns[type]); + } + delete visitor[nodeType]; + const types = virtualTypes[nodeType]; + if (types !== null) { + for (const type of types) { + if (visitor[type]) { + mergePair(visitor[type], fns); + } else { + visitor[type] = fns; + } + } + } else { + mergePair(visitor, fns); + } + } + for (const nodeType of Object.keys(visitor)) { + if (shouldIgnoreKey(nodeType)) continue; + let aliases = FLIPPED_ALIAS_KEYS[nodeType]; + if (nodeType in DEPRECATED_KEYS) { + const deprecatedKey = DEPRECATED_KEYS[nodeType]; + deprecationWarning(nodeType, deprecatedKey, "Visitor "); + aliases = [deprecatedKey]; + } else if (nodeType in DEPRECATED_ALIASES) { + const deprecatedAlias = DEPRECATED_ALIASES[nodeType]; + deprecationWarning(nodeType, deprecatedAlias, "Visitor "); + aliases = FLIPPED_ALIAS_KEYS[deprecatedAlias]; + } + if (!aliases) continue; + const fns = visitor[nodeType]; + delete visitor[nodeType]; + for (const alias of aliases) { + const existing = visitor[alias]; + if (existing) { + mergePair(existing, fns); + } else { + visitor[alias] = Object.assign({}, fns); + } + } + } + for (const nodeType of Object.keys(visitor)) { + if (shouldIgnoreKey(nodeType)) continue; + ensureCallbackArrays(visitor[nodeType]); + } + return visitor; +} +function verify(visitor) { + if (visitor._verified) return; + if (typeof visitor === "function") { + throw new Error("You passed `traverse()` a function when it expected a visitor object, " + "are you sure you didn't mean `{ enter: Function }`?"); + } + for (const nodeType of Object.keys(visitor)) { + if (nodeType === "enter" || nodeType === "exit") { + validateVisitorMethods(nodeType, visitor[nodeType]); + } + if (shouldIgnoreKey(nodeType)) continue; + if (TYPES.indexOf(nodeType) < 0) { + throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type`); + } + const visitors = visitor[nodeType]; + if (typeof visitors === "object") { + for (const visitorKey of Object.keys(visitors)) { + if (visitorKey === "enter" || visitorKey === "exit") { + validateVisitorMethods(`${nodeType}.${visitorKey}`, visitors[visitorKey]); + } else { + throw new Error("You passed `traverse()` a visitor object with the property " + `${nodeType} that has the invalid property ${visitorKey}`); + } + } + } + } + visitor._verified = true; +} +function validateVisitorMethods(path, val) { + const fns = [].concat(val); + for (const fn of fns) { + if (typeof fn !== "function") { + throw new TypeError(`Non-function found defined in ${path} with type ${typeof fn}`); + } + } +} +function merge(visitors, states = [], wrapper) { + const mergedVisitor = {}; + for (let i = 0; i < visitors.length; i++) { + const visitor = explode(visitors[i]); + const state = states[i]; + let topVisitor = visitor; + if (state || wrapper) { + topVisitor = wrapWithStateOrWrapper(topVisitor, state, wrapper); + } + mergePair(mergedVisitor, topVisitor); + for (const key of Object.keys(visitor)) { + if (shouldIgnoreKey(key)) continue; + let typeVisitor = visitor[key]; + if (state || wrapper) { + typeVisitor = wrapWithStateOrWrapper(typeVisitor, state, wrapper); + } + const nodeVisitor = mergedVisitor[key] || (mergedVisitor[key] = {}); + mergePair(nodeVisitor, typeVisitor); + } + } + ; + return mergedVisitor; +} +function wrapWithStateOrWrapper(oldVisitor, state, wrapper) { + const newVisitor = {}; + for (const phase of ["enter", "exit"]) { + let fns = oldVisitor[phase]; + if (!Array.isArray(fns)) continue; + fns = fns.map(function (fn) { + let newFn = fn; + if (state) { + newFn = function (path) { + fn.call(state, path, state); + }; + } + if (wrapper) { + newFn = wrapper(state == null ? void 0 : state.key, phase, newFn); + } + if (newFn !== fn) { + newFn.toString = () => fn.toString(); + } + return newFn; + }); + newVisitor[phase] = fns; + } + return newVisitor; +} +function ensureEntranceObjects(obj) { + for (const key of Object.keys(obj)) { + if (shouldIgnoreKey(key)) continue; + const fns = obj[key]; + if (typeof fns === "function") { + obj[key] = { + enter: fns + }; + } + } +} +function ensureCallbackArrays(obj) { + if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter]; + if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit]; +} +function wrapCheck(nodeType, fn) { + const newFn = function (path) { + if (path[`is${nodeType}`]()) { + return fn.apply(this, arguments); + } + }; + newFn.toString = () => fn.toString(); + return newFn; +} +function shouldIgnoreKey(key) { + if (key[0] === "_") return true; + if (key === "enter" || key === "exit" || key === "shouldSkip") return true; + if (key === "denylist" || key === "noScope" || key === "skipKeys") { + return true; + } + { + if (key === "blacklist") { + return true; + } + } + return false; +} +function mergePair(dest, src) { + for (const phase of ["enter", "exit"]) { + if (!src[phase]) continue; + dest[phase] = [].concat(dest[phase] || [], src[phase]); + } +} + +//# sourceMappingURL=visitors.js.map + + +/***/ }), + +/***/ 5508: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = assertNode; +var _isNode = __nccwpck_require__(8582); +function assertNode(node) { + if (!(0, _isNode.default)(node)) { + var _node$type; + const type = (_node$type = node == null ? void 0 : node.type) != null ? _node$type : JSON.stringify(node); + throw new TypeError(`Not a valid node of type "${type}"`); + } +} + +//# sourceMappingURL=assertNode.js.map + + +/***/ }), + +/***/ 412: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.assertAccessor = assertAccessor; +exports.assertAnyTypeAnnotation = assertAnyTypeAnnotation; +exports.assertArgumentPlaceholder = assertArgumentPlaceholder; +exports.assertArrayExpression = assertArrayExpression; +exports.assertArrayPattern = assertArrayPattern; +exports.assertArrayTypeAnnotation = assertArrayTypeAnnotation; +exports.assertArrowFunctionExpression = assertArrowFunctionExpression; +exports.assertAssignmentExpression = assertAssignmentExpression; +exports.assertAssignmentPattern = assertAssignmentPattern; +exports.assertAwaitExpression = assertAwaitExpression; +exports.assertBigIntLiteral = assertBigIntLiteral; +exports.assertBinary = assertBinary; +exports.assertBinaryExpression = assertBinaryExpression; +exports.assertBindExpression = assertBindExpression; +exports.assertBlock = assertBlock; +exports.assertBlockParent = assertBlockParent; +exports.assertBlockStatement = assertBlockStatement; +exports.assertBooleanLiteral = assertBooleanLiteral; +exports.assertBooleanLiteralTypeAnnotation = assertBooleanLiteralTypeAnnotation; +exports.assertBooleanTypeAnnotation = assertBooleanTypeAnnotation; +exports.assertBreakStatement = assertBreakStatement; +exports.assertCallExpression = assertCallExpression; +exports.assertCatchClause = assertCatchClause; +exports.assertClass = assertClass; +exports.assertClassAccessorProperty = assertClassAccessorProperty; +exports.assertClassBody = assertClassBody; +exports.assertClassDeclaration = assertClassDeclaration; +exports.assertClassExpression = assertClassExpression; +exports.assertClassImplements = assertClassImplements; +exports.assertClassMethod = assertClassMethod; +exports.assertClassPrivateMethod = assertClassPrivateMethod; +exports.assertClassPrivateProperty = assertClassPrivateProperty; +exports.assertClassProperty = assertClassProperty; +exports.assertCompletionStatement = assertCompletionStatement; +exports.assertConditional = assertConditional; +exports.assertConditionalExpression = assertConditionalExpression; +exports.assertContinueStatement = assertContinueStatement; +exports.assertDebuggerStatement = assertDebuggerStatement; +exports.assertDecimalLiteral = assertDecimalLiteral; +exports.assertDeclaration = assertDeclaration; +exports.assertDeclareClass = assertDeclareClass; +exports.assertDeclareExportAllDeclaration = assertDeclareExportAllDeclaration; +exports.assertDeclareExportDeclaration = assertDeclareExportDeclaration; +exports.assertDeclareFunction = assertDeclareFunction; +exports.assertDeclareInterface = assertDeclareInterface; +exports.assertDeclareModule = assertDeclareModule; +exports.assertDeclareModuleExports = assertDeclareModuleExports; +exports.assertDeclareOpaqueType = assertDeclareOpaqueType; +exports.assertDeclareTypeAlias = assertDeclareTypeAlias; +exports.assertDeclareVariable = assertDeclareVariable; +exports.assertDeclaredPredicate = assertDeclaredPredicate; +exports.assertDecorator = assertDecorator; +exports.assertDirective = assertDirective; +exports.assertDirectiveLiteral = assertDirectiveLiteral; +exports.assertDoExpression = assertDoExpression; +exports.assertDoWhileStatement = assertDoWhileStatement; +exports.assertEmptyStatement = assertEmptyStatement; +exports.assertEmptyTypeAnnotation = assertEmptyTypeAnnotation; +exports.assertEnumBody = assertEnumBody; +exports.assertEnumBooleanBody = assertEnumBooleanBody; +exports.assertEnumBooleanMember = assertEnumBooleanMember; +exports.assertEnumDeclaration = assertEnumDeclaration; +exports.assertEnumDefaultedMember = assertEnumDefaultedMember; +exports.assertEnumMember = assertEnumMember; +exports.assertEnumNumberBody = assertEnumNumberBody; +exports.assertEnumNumberMember = assertEnumNumberMember; +exports.assertEnumStringBody = assertEnumStringBody; +exports.assertEnumStringMember = assertEnumStringMember; +exports.assertEnumSymbolBody = assertEnumSymbolBody; +exports.assertExistsTypeAnnotation = assertExistsTypeAnnotation; +exports.assertExportAllDeclaration = assertExportAllDeclaration; +exports.assertExportDeclaration = assertExportDeclaration; +exports.assertExportDefaultDeclaration = assertExportDefaultDeclaration; +exports.assertExportDefaultSpecifier = assertExportDefaultSpecifier; +exports.assertExportNamedDeclaration = assertExportNamedDeclaration; +exports.assertExportNamespaceSpecifier = assertExportNamespaceSpecifier; +exports.assertExportSpecifier = assertExportSpecifier; +exports.assertExpression = assertExpression; +exports.assertExpressionStatement = assertExpressionStatement; +exports.assertExpressionWrapper = assertExpressionWrapper; +exports.assertFile = assertFile; +exports.assertFlow = assertFlow; +exports.assertFlowBaseAnnotation = assertFlowBaseAnnotation; +exports.assertFlowDeclaration = assertFlowDeclaration; +exports.assertFlowPredicate = assertFlowPredicate; +exports.assertFlowType = assertFlowType; +exports.assertFor = assertFor; +exports.assertForInStatement = assertForInStatement; +exports.assertForOfStatement = assertForOfStatement; +exports.assertForStatement = assertForStatement; +exports.assertForXStatement = assertForXStatement; +exports.assertFunction = assertFunction; +exports.assertFunctionDeclaration = assertFunctionDeclaration; +exports.assertFunctionExpression = assertFunctionExpression; +exports.assertFunctionParent = assertFunctionParent; +exports.assertFunctionTypeAnnotation = assertFunctionTypeAnnotation; +exports.assertFunctionTypeParam = assertFunctionTypeParam; +exports.assertGenericTypeAnnotation = assertGenericTypeAnnotation; +exports.assertIdentifier = assertIdentifier; +exports.assertIfStatement = assertIfStatement; +exports.assertImmutable = assertImmutable; +exports.assertImport = assertImport; +exports.assertImportAttribute = assertImportAttribute; +exports.assertImportDeclaration = assertImportDeclaration; +exports.assertImportDefaultSpecifier = assertImportDefaultSpecifier; +exports.assertImportNamespaceSpecifier = assertImportNamespaceSpecifier; +exports.assertImportOrExportDeclaration = assertImportOrExportDeclaration; +exports.assertImportSpecifier = assertImportSpecifier; +exports.assertIndexedAccessType = assertIndexedAccessType; +exports.assertInferredPredicate = assertInferredPredicate; +exports.assertInterfaceDeclaration = assertInterfaceDeclaration; +exports.assertInterfaceExtends = assertInterfaceExtends; +exports.assertInterfaceTypeAnnotation = assertInterfaceTypeAnnotation; +exports.assertInterpreterDirective = assertInterpreterDirective; +exports.assertIntersectionTypeAnnotation = assertIntersectionTypeAnnotation; +exports.assertJSX = assertJSX; +exports.assertJSXAttribute = assertJSXAttribute; +exports.assertJSXClosingElement = assertJSXClosingElement; +exports.assertJSXClosingFragment = assertJSXClosingFragment; +exports.assertJSXElement = assertJSXElement; +exports.assertJSXEmptyExpression = assertJSXEmptyExpression; +exports.assertJSXExpressionContainer = assertJSXExpressionContainer; +exports.assertJSXFragment = assertJSXFragment; +exports.assertJSXIdentifier = assertJSXIdentifier; +exports.assertJSXMemberExpression = assertJSXMemberExpression; +exports.assertJSXNamespacedName = assertJSXNamespacedName; +exports.assertJSXOpeningElement = assertJSXOpeningElement; +exports.assertJSXOpeningFragment = assertJSXOpeningFragment; +exports.assertJSXSpreadAttribute = assertJSXSpreadAttribute; +exports.assertJSXSpreadChild = assertJSXSpreadChild; +exports.assertJSXText = assertJSXText; +exports.assertLVal = assertLVal; +exports.assertLabeledStatement = assertLabeledStatement; +exports.assertLiteral = assertLiteral; +exports.assertLogicalExpression = assertLogicalExpression; +exports.assertLoop = assertLoop; +exports.assertMemberExpression = assertMemberExpression; +exports.assertMetaProperty = assertMetaProperty; +exports.assertMethod = assertMethod; +exports.assertMiscellaneous = assertMiscellaneous; +exports.assertMixedTypeAnnotation = assertMixedTypeAnnotation; +exports.assertModuleDeclaration = assertModuleDeclaration; +exports.assertModuleExpression = assertModuleExpression; +exports.assertModuleSpecifier = assertModuleSpecifier; +exports.assertNewExpression = assertNewExpression; +exports.assertNoop = assertNoop; +exports.assertNullLiteral = assertNullLiteral; +exports.assertNullLiteralTypeAnnotation = assertNullLiteralTypeAnnotation; +exports.assertNullableTypeAnnotation = assertNullableTypeAnnotation; +exports.assertNumberLiteral = assertNumberLiteral; +exports.assertNumberLiteralTypeAnnotation = assertNumberLiteralTypeAnnotation; +exports.assertNumberTypeAnnotation = assertNumberTypeAnnotation; +exports.assertNumericLiteral = assertNumericLiteral; +exports.assertObjectExpression = assertObjectExpression; +exports.assertObjectMember = assertObjectMember; +exports.assertObjectMethod = assertObjectMethod; +exports.assertObjectPattern = assertObjectPattern; +exports.assertObjectProperty = assertObjectProperty; +exports.assertObjectTypeAnnotation = assertObjectTypeAnnotation; +exports.assertObjectTypeCallProperty = assertObjectTypeCallProperty; +exports.assertObjectTypeIndexer = assertObjectTypeIndexer; +exports.assertObjectTypeInternalSlot = assertObjectTypeInternalSlot; +exports.assertObjectTypeProperty = assertObjectTypeProperty; +exports.assertObjectTypeSpreadProperty = assertObjectTypeSpreadProperty; +exports.assertOpaqueType = assertOpaqueType; +exports.assertOptionalCallExpression = assertOptionalCallExpression; +exports.assertOptionalIndexedAccessType = assertOptionalIndexedAccessType; +exports.assertOptionalMemberExpression = assertOptionalMemberExpression; +exports.assertParenthesizedExpression = assertParenthesizedExpression; +exports.assertPattern = assertPattern; +exports.assertPatternLike = assertPatternLike; +exports.assertPipelineBareFunction = assertPipelineBareFunction; +exports.assertPipelinePrimaryTopicReference = assertPipelinePrimaryTopicReference; +exports.assertPipelineTopicExpression = assertPipelineTopicExpression; +exports.assertPlaceholder = assertPlaceholder; +exports.assertPrivate = assertPrivate; +exports.assertPrivateName = assertPrivateName; +exports.assertProgram = assertProgram; +exports.assertProperty = assertProperty; +exports.assertPureish = assertPureish; +exports.assertQualifiedTypeIdentifier = assertQualifiedTypeIdentifier; +exports.assertRecordExpression = assertRecordExpression; +exports.assertRegExpLiteral = assertRegExpLiteral; +exports.assertRegexLiteral = assertRegexLiteral; +exports.assertRestElement = assertRestElement; +exports.assertRestProperty = assertRestProperty; +exports.assertReturnStatement = assertReturnStatement; +exports.assertScopable = assertScopable; +exports.assertSequenceExpression = assertSequenceExpression; +exports.assertSpreadElement = assertSpreadElement; +exports.assertSpreadProperty = assertSpreadProperty; +exports.assertStandardized = assertStandardized; +exports.assertStatement = assertStatement; +exports.assertStaticBlock = assertStaticBlock; +exports.assertStringLiteral = assertStringLiteral; +exports.assertStringLiteralTypeAnnotation = assertStringLiteralTypeAnnotation; +exports.assertStringTypeAnnotation = assertStringTypeAnnotation; +exports.assertSuper = assertSuper; +exports.assertSwitchCase = assertSwitchCase; +exports.assertSwitchStatement = assertSwitchStatement; +exports.assertSymbolTypeAnnotation = assertSymbolTypeAnnotation; +exports.assertTSAnyKeyword = assertTSAnyKeyword; +exports.assertTSArrayType = assertTSArrayType; +exports.assertTSAsExpression = assertTSAsExpression; +exports.assertTSBaseType = assertTSBaseType; +exports.assertTSBigIntKeyword = assertTSBigIntKeyword; +exports.assertTSBooleanKeyword = assertTSBooleanKeyword; +exports.assertTSCallSignatureDeclaration = assertTSCallSignatureDeclaration; +exports.assertTSConditionalType = assertTSConditionalType; +exports.assertTSConstructSignatureDeclaration = assertTSConstructSignatureDeclaration; +exports.assertTSConstructorType = assertTSConstructorType; +exports.assertTSDeclareFunction = assertTSDeclareFunction; +exports.assertTSDeclareMethod = assertTSDeclareMethod; +exports.assertTSEntityName = assertTSEntityName; +exports.assertTSEnumDeclaration = assertTSEnumDeclaration; +exports.assertTSEnumMember = assertTSEnumMember; +exports.assertTSExportAssignment = assertTSExportAssignment; +exports.assertTSExpressionWithTypeArguments = assertTSExpressionWithTypeArguments; +exports.assertTSExternalModuleReference = assertTSExternalModuleReference; +exports.assertTSFunctionType = assertTSFunctionType; +exports.assertTSImportEqualsDeclaration = assertTSImportEqualsDeclaration; +exports.assertTSImportType = assertTSImportType; +exports.assertTSIndexSignature = assertTSIndexSignature; +exports.assertTSIndexedAccessType = assertTSIndexedAccessType; +exports.assertTSInferType = assertTSInferType; +exports.assertTSInstantiationExpression = assertTSInstantiationExpression; +exports.assertTSInterfaceBody = assertTSInterfaceBody; +exports.assertTSInterfaceDeclaration = assertTSInterfaceDeclaration; +exports.assertTSIntersectionType = assertTSIntersectionType; +exports.assertTSIntrinsicKeyword = assertTSIntrinsicKeyword; +exports.assertTSLiteralType = assertTSLiteralType; +exports.assertTSMappedType = assertTSMappedType; +exports.assertTSMethodSignature = assertTSMethodSignature; +exports.assertTSModuleBlock = assertTSModuleBlock; +exports.assertTSModuleDeclaration = assertTSModuleDeclaration; +exports.assertTSNamedTupleMember = assertTSNamedTupleMember; +exports.assertTSNamespaceExportDeclaration = assertTSNamespaceExportDeclaration; +exports.assertTSNeverKeyword = assertTSNeverKeyword; +exports.assertTSNonNullExpression = assertTSNonNullExpression; +exports.assertTSNullKeyword = assertTSNullKeyword; +exports.assertTSNumberKeyword = assertTSNumberKeyword; +exports.assertTSObjectKeyword = assertTSObjectKeyword; +exports.assertTSOptionalType = assertTSOptionalType; +exports.assertTSParameterProperty = assertTSParameterProperty; +exports.assertTSParenthesizedType = assertTSParenthesizedType; +exports.assertTSPropertySignature = assertTSPropertySignature; +exports.assertTSQualifiedName = assertTSQualifiedName; +exports.assertTSRestType = assertTSRestType; +exports.assertTSSatisfiesExpression = assertTSSatisfiesExpression; +exports.assertTSStringKeyword = assertTSStringKeyword; +exports.assertTSSymbolKeyword = assertTSSymbolKeyword; +exports.assertTSThisType = assertTSThisType; +exports.assertTSTupleType = assertTSTupleType; +exports.assertTSType = assertTSType; +exports.assertTSTypeAliasDeclaration = assertTSTypeAliasDeclaration; +exports.assertTSTypeAnnotation = assertTSTypeAnnotation; +exports.assertTSTypeAssertion = assertTSTypeAssertion; +exports.assertTSTypeElement = assertTSTypeElement; +exports.assertTSTypeLiteral = assertTSTypeLiteral; +exports.assertTSTypeOperator = assertTSTypeOperator; +exports.assertTSTypeParameter = assertTSTypeParameter; +exports.assertTSTypeParameterDeclaration = assertTSTypeParameterDeclaration; +exports.assertTSTypeParameterInstantiation = assertTSTypeParameterInstantiation; +exports.assertTSTypePredicate = assertTSTypePredicate; +exports.assertTSTypeQuery = assertTSTypeQuery; +exports.assertTSTypeReference = assertTSTypeReference; +exports.assertTSUndefinedKeyword = assertTSUndefinedKeyword; +exports.assertTSUnionType = assertTSUnionType; +exports.assertTSUnknownKeyword = assertTSUnknownKeyword; +exports.assertTSVoidKeyword = assertTSVoidKeyword; +exports.assertTaggedTemplateExpression = assertTaggedTemplateExpression; +exports.assertTemplateElement = assertTemplateElement; +exports.assertTemplateLiteral = assertTemplateLiteral; +exports.assertTerminatorless = assertTerminatorless; +exports.assertThisExpression = assertThisExpression; +exports.assertThisTypeAnnotation = assertThisTypeAnnotation; +exports.assertThrowStatement = assertThrowStatement; +exports.assertTopicReference = assertTopicReference; +exports.assertTryStatement = assertTryStatement; +exports.assertTupleExpression = assertTupleExpression; +exports.assertTupleTypeAnnotation = assertTupleTypeAnnotation; +exports.assertTypeAlias = assertTypeAlias; +exports.assertTypeAnnotation = assertTypeAnnotation; +exports.assertTypeCastExpression = assertTypeCastExpression; +exports.assertTypeParameter = assertTypeParameter; +exports.assertTypeParameterDeclaration = assertTypeParameterDeclaration; +exports.assertTypeParameterInstantiation = assertTypeParameterInstantiation; +exports.assertTypeScript = assertTypeScript; +exports.assertTypeofTypeAnnotation = assertTypeofTypeAnnotation; +exports.assertUnaryExpression = assertUnaryExpression; +exports.assertUnaryLike = assertUnaryLike; +exports.assertUnionTypeAnnotation = assertUnionTypeAnnotation; +exports.assertUpdateExpression = assertUpdateExpression; +exports.assertUserWhitespacable = assertUserWhitespacable; +exports.assertV8IntrinsicIdentifier = assertV8IntrinsicIdentifier; +exports.assertVariableDeclaration = assertVariableDeclaration; +exports.assertVariableDeclarator = assertVariableDeclarator; +exports.assertVariance = assertVariance; +exports.assertVoidTypeAnnotation = assertVoidTypeAnnotation; +exports.assertWhile = assertWhile; +exports.assertWhileStatement = assertWhileStatement; +exports.assertWithStatement = assertWithStatement; +exports.assertYieldExpression = assertYieldExpression; +var _is = __nccwpck_require__(9242); +var _deprecationWarning = __nccwpck_require__(7290); +function assert(type, node, opts) { + if (!(0, _is.default)(type, node, opts)) { + throw new Error(`Expected type "${type}" with option ${JSON.stringify(opts)}, ` + `but instead got "${node.type}".`); + } +} +function assertArrayExpression(node, opts) { + assert("ArrayExpression", node, opts); +} +function assertAssignmentExpression(node, opts) { + assert("AssignmentExpression", node, opts); +} +function assertBinaryExpression(node, opts) { + assert("BinaryExpression", node, opts); +} +function assertInterpreterDirective(node, opts) { + assert("InterpreterDirective", node, opts); +} +function assertDirective(node, opts) { + assert("Directive", node, opts); +} +function assertDirectiveLiteral(node, opts) { + assert("DirectiveLiteral", node, opts); +} +function assertBlockStatement(node, opts) { + assert("BlockStatement", node, opts); +} +function assertBreakStatement(node, opts) { + assert("BreakStatement", node, opts); +} +function assertCallExpression(node, opts) { + assert("CallExpression", node, opts); +} +function assertCatchClause(node, opts) { + assert("CatchClause", node, opts); +} +function assertConditionalExpression(node, opts) { + assert("ConditionalExpression", node, opts); +} +function assertContinueStatement(node, opts) { + assert("ContinueStatement", node, opts); +} +function assertDebuggerStatement(node, opts) { + assert("DebuggerStatement", node, opts); +} +function assertDoWhileStatement(node, opts) { + assert("DoWhileStatement", node, opts); +} +function assertEmptyStatement(node, opts) { + assert("EmptyStatement", node, opts); +} +function assertExpressionStatement(node, opts) { + assert("ExpressionStatement", node, opts); +} +function assertFile(node, opts) { + assert("File", node, opts); +} +function assertForInStatement(node, opts) { + assert("ForInStatement", node, opts); +} +function assertForStatement(node, opts) { + assert("ForStatement", node, opts); +} +function assertFunctionDeclaration(node, opts) { + assert("FunctionDeclaration", node, opts); +} +function assertFunctionExpression(node, opts) { + assert("FunctionExpression", node, opts); +} +function assertIdentifier(node, opts) { + assert("Identifier", node, opts); +} +function assertIfStatement(node, opts) { + assert("IfStatement", node, opts); +} +function assertLabeledStatement(node, opts) { + assert("LabeledStatement", node, opts); +} +function assertStringLiteral(node, opts) { + assert("StringLiteral", node, opts); +} +function assertNumericLiteral(node, opts) { + assert("NumericLiteral", node, opts); +} +function assertNullLiteral(node, opts) { + assert("NullLiteral", node, opts); +} +function assertBooleanLiteral(node, opts) { + assert("BooleanLiteral", node, opts); +} +function assertRegExpLiteral(node, opts) { + assert("RegExpLiteral", node, opts); +} +function assertLogicalExpression(node, opts) { + assert("LogicalExpression", node, opts); +} +function assertMemberExpression(node, opts) { + assert("MemberExpression", node, opts); +} +function assertNewExpression(node, opts) { + assert("NewExpression", node, opts); +} +function assertProgram(node, opts) { + assert("Program", node, opts); +} +function assertObjectExpression(node, opts) { + assert("ObjectExpression", node, opts); +} +function assertObjectMethod(node, opts) { + assert("ObjectMethod", node, opts); +} +function assertObjectProperty(node, opts) { + assert("ObjectProperty", node, opts); +} +function assertRestElement(node, opts) { + assert("RestElement", node, opts); +} +function assertReturnStatement(node, opts) { + assert("ReturnStatement", node, opts); +} +function assertSequenceExpression(node, opts) { + assert("SequenceExpression", node, opts); +} +function assertParenthesizedExpression(node, opts) { + assert("ParenthesizedExpression", node, opts); +} +function assertSwitchCase(node, opts) { + assert("SwitchCase", node, opts); +} +function assertSwitchStatement(node, opts) { + assert("SwitchStatement", node, opts); +} +function assertThisExpression(node, opts) { + assert("ThisExpression", node, opts); +} +function assertThrowStatement(node, opts) { + assert("ThrowStatement", node, opts); +} +function assertTryStatement(node, opts) { + assert("TryStatement", node, opts); +} +function assertUnaryExpression(node, opts) { + assert("UnaryExpression", node, opts); +} +function assertUpdateExpression(node, opts) { + assert("UpdateExpression", node, opts); +} +function assertVariableDeclaration(node, opts) { + assert("VariableDeclaration", node, opts); +} +function assertVariableDeclarator(node, opts) { + assert("VariableDeclarator", node, opts); +} +function assertWhileStatement(node, opts) { + assert("WhileStatement", node, opts); +} +function assertWithStatement(node, opts) { + assert("WithStatement", node, opts); +} +function assertAssignmentPattern(node, opts) { + assert("AssignmentPattern", node, opts); +} +function assertArrayPattern(node, opts) { + assert("ArrayPattern", node, opts); +} +function assertArrowFunctionExpression(node, opts) { + assert("ArrowFunctionExpression", node, opts); +} +function assertClassBody(node, opts) { + assert("ClassBody", node, opts); +} +function assertClassExpression(node, opts) { + assert("ClassExpression", node, opts); +} +function assertClassDeclaration(node, opts) { + assert("ClassDeclaration", node, opts); +} +function assertExportAllDeclaration(node, opts) { + assert("ExportAllDeclaration", node, opts); +} +function assertExportDefaultDeclaration(node, opts) { + assert("ExportDefaultDeclaration", node, opts); +} +function assertExportNamedDeclaration(node, opts) { + assert("ExportNamedDeclaration", node, opts); +} +function assertExportSpecifier(node, opts) { + assert("ExportSpecifier", node, opts); +} +function assertForOfStatement(node, opts) { + assert("ForOfStatement", node, opts); +} +function assertImportDeclaration(node, opts) { + assert("ImportDeclaration", node, opts); +} +function assertImportDefaultSpecifier(node, opts) { + assert("ImportDefaultSpecifier", node, opts); +} +function assertImportNamespaceSpecifier(node, opts) { + assert("ImportNamespaceSpecifier", node, opts); +} +function assertImportSpecifier(node, opts) { + assert("ImportSpecifier", node, opts); +} +function assertMetaProperty(node, opts) { + assert("MetaProperty", node, opts); +} +function assertClassMethod(node, opts) { + assert("ClassMethod", node, opts); +} +function assertObjectPattern(node, opts) { + assert("ObjectPattern", node, opts); +} +function assertSpreadElement(node, opts) { + assert("SpreadElement", node, opts); +} +function assertSuper(node, opts) { + assert("Super", node, opts); +} +function assertTaggedTemplateExpression(node, opts) { + assert("TaggedTemplateExpression", node, opts); +} +function assertTemplateElement(node, opts) { + assert("TemplateElement", node, opts); +} +function assertTemplateLiteral(node, opts) { + assert("TemplateLiteral", node, opts); +} +function assertYieldExpression(node, opts) { + assert("YieldExpression", node, opts); +} +function assertAwaitExpression(node, opts) { + assert("AwaitExpression", node, opts); +} +function assertImport(node, opts) { + assert("Import", node, opts); +} +function assertBigIntLiteral(node, opts) { + assert("BigIntLiteral", node, opts); +} +function assertExportNamespaceSpecifier(node, opts) { + assert("ExportNamespaceSpecifier", node, opts); +} +function assertOptionalMemberExpression(node, opts) { + assert("OptionalMemberExpression", node, opts); +} +function assertOptionalCallExpression(node, opts) { + assert("OptionalCallExpression", node, opts); +} +function assertClassProperty(node, opts) { + assert("ClassProperty", node, opts); +} +function assertClassAccessorProperty(node, opts) { + assert("ClassAccessorProperty", node, opts); +} +function assertClassPrivateProperty(node, opts) { + assert("ClassPrivateProperty", node, opts); +} +function assertClassPrivateMethod(node, opts) { + assert("ClassPrivateMethod", node, opts); +} +function assertPrivateName(node, opts) { + assert("PrivateName", node, opts); +} +function assertStaticBlock(node, opts) { + assert("StaticBlock", node, opts); +} +function assertAnyTypeAnnotation(node, opts) { + assert("AnyTypeAnnotation", node, opts); +} +function assertArrayTypeAnnotation(node, opts) { + assert("ArrayTypeAnnotation", node, opts); +} +function assertBooleanTypeAnnotation(node, opts) { + assert("BooleanTypeAnnotation", node, opts); +} +function assertBooleanLiteralTypeAnnotation(node, opts) { + assert("BooleanLiteralTypeAnnotation", node, opts); +} +function assertNullLiteralTypeAnnotation(node, opts) { + assert("NullLiteralTypeAnnotation", node, opts); +} +function assertClassImplements(node, opts) { + assert("ClassImplements", node, opts); +} +function assertDeclareClass(node, opts) { + assert("DeclareClass", node, opts); +} +function assertDeclareFunction(node, opts) { + assert("DeclareFunction", node, opts); +} +function assertDeclareInterface(node, opts) { + assert("DeclareInterface", node, opts); +} +function assertDeclareModule(node, opts) { + assert("DeclareModule", node, opts); +} +function assertDeclareModuleExports(node, opts) { + assert("DeclareModuleExports", node, opts); +} +function assertDeclareTypeAlias(node, opts) { + assert("DeclareTypeAlias", node, opts); +} +function assertDeclareOpaqueType(node, opts) { + assert("DeclareOpaqueType", node, opts); +} +function assertDeclareVariable(node, opts) { + assert("DeclareVariable", node, opts); +} +function assertDeclareExportDeclaration(node, opts) { + assert("DeclareExportDeclaration", node, opts); +} +function assertDeclareExportAllDeclaration(node, opts) { + assert("DeclareExportAllDeclaration", node, opts); +} +function assertDeclaredPredicate(node, opts) { + assert("DeclaredPredicate", node, opts); +} +function assertExistsTypeAnnotation(node, opts) { + assert("ExistsTypeAnnotation", node, opts); +} +function assertFunctionTypeAnnotation(node, opts) { + assert("FunctionTypeAnnotation", node, opts); +} +function assertFunctionTypeParam(node, opts) { + assert("FunctionTypeParam", node, opts); +} +function assertGenericTypeAnnotation(node, opts) { + assert("GenericTypeAnnotation", node, opts); +} +function assertInferredPredicate(node, opts) { + assert("InferredPredicate", node, opts); +} +function assertInterfaceExtends(node, opts) { + assert("InterfaceExtends", node, opts); +} +function assertInterfaceDeclaration(node, opts) { + assert("InterfaceDeclaration", node, opts); +} +function assertInterfaceTypeAnnotation(node, opts) { + assert("InterfaceTypeAnnotation", node, opts); +} +function assertIntersectionTypeAnnotation(node, opts) { + assert("IntersectionTypeAnnotation", node, opts); +} +function assertMixedTypeAnnotation(node, opts) { + assert("MixedTypeAnnotation", node, opts); +} +function assertEmptyTypeAnnotation(node, opts) { + assert("EmptyTypeAnnotation", node, opts); +} +function assertNullableTypeAnnotation(node, opts) { + assert("NullableTypeAnnotation", node, opts); +} +function assertNumberLiteralTypeAnnotation(node, opts) { + assert("NumberLiteralTypeAnnotation", node, opts); +} +function assertNumberTypeAnnotation(node, opts) { + assert("NumberTypeAnnotation", node, opts); +} +function assertObjectTypeAnnotation(node, opts) { + assert("ObjectTypeAnnotation", node, opts); +} +function assertObjectTypeInternalSlot(node, opts) { + assert("ObjectTypeInternalSlot", node, opts); +} +function assertObjectTypeCallProperty(node, opts) { + assert("ObjectTypeCallProperty", node, opts); +} +function assertObjectTypeIndexer(node, opts) { + assert("ObjectTypeIndexer", node, opts); +} +function assertObjectTypeProperty(node, opts) { + assert("ObjectTypeProperty", node, opts); +} +function assertObjectTypeSpreadProperty(node, opts) { + assert("ObjectTypeSpreadProperty", node, opts); +} +function assertOpaqueType(node, opts) { + assert("OpaqueType", node, opts); +} +function assertQualifiedTypeIdentifier(node, opts) { + assert("QualifiedTypeIdentifier", node, opts); +} +function assertStringLiteralTypeAnnotation(node, opts) { + assert("StringLiteralTypeAnnotation", node, opts); +} +function assertStringTypeAnnotation(node, opts) { + assert("StringTypeAnnotation", node, opts); +} +function assertSymbolTypeAnnotation(node, opts) { + assert("SymbolTypeAnnotation", node, opts); +} +function assertThisTypeAnnotation(node, opts) { + assert("ThisTypeAnnotation", node, opts); +} +function assertTupleTypeAnnotation(node, opts) { + assert("TupleTypeAnnotation", node, opts); +} +function assertTypeofTypeAnnotation(node, opts) { + assert("TypeofTypeAnnotation", node, opts); +} +function assertTypeAlias(node, opts) { + assert("TypeAlias", node, opts); +} +function assertTypeAnnotation(node, opts) { + assert("TypeAnnotation", node, opts); +} +function assertTypeCastExpression(node, opts) { + assert("TypeCastExpression", node, opts); +} +function assertTypeParameter(node, opts) { + assert("TypeParameter", node, opts); +} +function assertTypeParameterDeclaration(node, opts) { + assert("TypeParameterDeclaration", node, opts); +} +function assertTypeParameterInstantiation(node, opts) { + assert("TypeParameterInstantiation", node, opts); +} +function assertUnionTypeAnnotation(node, opts) { + assert("UnionTypeAnnotation", node, opts); +} +function assertVariance(node, opts) { + assert("Variance", node, opts); +} +function assertVoidTypeAnnotation(node, opts) { + assert("VoidTypeAnnotation", node, opts); +} +function assertEnumDeclaration(node, opts) { + assert("EnumDeclaration", node, opts); +} +function assertEnumBooleanBody(node, opts) { + assert("EnumBooleanBody", node, opts); +} +function assertEnumNumberBody(node, opts) { + assert("EnumNumberBody", node, opts); +} +function assertEnumStringBody(node, opts) { + assert("EnumStringBody", node, opts); +} +function assertEnumSymbolBody(node, opts) { + assert("EnumSymbolBody", node, opts); +} +function assertEnumBooleanMember(node, opts) { + assert("EnumBooleanMember", node, opts); +} +function assertEnumNumberMember(node, opts) { + assert("EnumNumberMember", node, opts); +} +function assertEnumStringMember(node, opts) { + assert("EnumStringMember", node, opts); +} +function assertEnumDefaultedMember(node, opts) { + assert("EnumDefaultedMember", node, opts); +} +function assertIndexedAccessType(node, opts) { + assert("IndexedAccessType", node, opts); +} +function assertOptionalIndexedAccessType(node, opts) { + assert("OptionalIndexedAccessType", node, opts); +} +function assertJSXAttribute(node, opts) { + assert("JSXAttribute", node, opts); +} +function assertJSXClosingElement(node, opts) { + assert("JSXClosingElement", node, opts); +} +function assertJSXElement(node, opts) { + assert("JSXElement", node, opts); +} +function assertJSXEmptyExpression(node, opts) { + assert("JSXEmptyExpression", node, opts); +} +function assertJSXExpressionContainer(node, opts) { + assert("JSXExpressionContainer", node, opts); +} +function assertJSXSpreadChild(node, opts) { + assert("JSXSpreadChild", node, opts); +} +function assertJSXIdentifier(node, opts) { + assert("JSXIdentifier", node, opts); +} +function assertJSXMemberExpression(node, opts) { + assert("JSXMemberExpression", node, opts); +} +function assertJSXNamespacedName(node, opts) { + assert("JSXNamespacedName", node, opts); +} +function assertJSXOpeningElement(node, opts) { + assert("JSXOpeningElement", node, opts); +} +function assertJSXSpreadAttribute(node, opts) { + assert("JSXSpreadAttribute", node, opts); +} +function assertJSXText(node, opts) { + assert("JSXText", node, opts); +} +function assertJSXFragment(node, opts) { + assert("JSXFragment", node, opts); +} +function assertJSXOpeningFragment(node, opts) { + assert("JSXOpeningFragment", node, opts); +} +function assertJSXClosingFragment(node, opts) { + assert("JSXClosingFragment", node, opts); +} +function assertNoop(node, opts) { + assert("Noop", node, opts); +} +function assertPlaceholder(node, opts) { + assert("Placeholder", node, opts); +} +function assertV8IntrinsicIdentifier(node, opts) { + assert("V8IntrinsicIdentifier", node, opts); +} +function assertArgumentPlaceholder(node, opts) { + assert("ArgumentPlaceholder", node, opts); +} +function assertBindExpression(node, opts) { + assert("BindExpression", node, opts); +} +function assertImportAttribute(node, opts) { + assert("ImportAttribute", node, opts); +} +function assertDecorator(node, opts) { + assert("Decorator", node, opts); +} +function assertDoExpression(node, opts) { + assert("DoExpression", node, opts); +} +function assertExportDefaultSpecifier(node, opts) { + assert("ExportDefaultSpecifier", node, opts); +} +function assertRecordExpression(node, opts) { + assert("RecordExpression", node, opts); +} +function assertTupleExpression(node, opts) { + assert("TupleExpression", node, opts); +} +function assertDecimalLiteral(node, opts) { + assert("DecimalLiteral", node, opts); +} +function assertModuleExpression(node, opts) { + assert("ModuleExpression", node, opts); +} +function assertTopicReference(node, opts) { + assert("TopicReference", node, opts); +} +function assertPipelineTopicExpression(node, opts) { + assert("PipelineTopicExpression", node, opts); +} +function assertPipelineBareFunction(node, opts) { + assert("PipelineBareFunction", node, opts); +} +function assertPipelinePrimaryTopicReference(node, opts) { + assert("PipelinePrimaryTopicReference", node, opts); +} +function assertTSParameterProperty(node, opts) { + assert("TSParameterProperty", node, opts); +} +function assertTSDeclareFunction(node, opts) { + assert("TSDeclareFunction", node, opts); +} +function assertTSDeclareMethod(node, opts) { + assert("TSDeclareMethod", node, opts); +} +function assertTSQualifiedName(node, opts) { + assert("TSQualifiedName", node, opts); +} +function assertTSCallSignatureDeclaration(node, opts) { + assert("TSCallSignatureDeclaration", node, opts); +} +function assertTSConstructSignatureDeclaration(node, opts) { + assert("TSConstructSignatureDeclaration", node, opts); +} +function assertTSPropertySignature(node, opts) { + assert("TSPropertySignature", node, opts); +} +function assertTSMethodSignature(node, opts) { + assert("TSMethodSignature", node, opts); +} +function assertTSIndexSignature(node, opts) { + assert("TSIndexSignature", node, opts); +} +function assertTSAnyKeyword(node, opts) { + assert("TSAnyKeyword", node, opts); +} +function assertTSBooleanKeyword(node, opts) { + assert("TSBooleanKeyword", node, opts); +} +function assertTSBigIntKeyword(node, opts) { + assert("TSBigIntKeyword", node, opts); +} +function assertTSIntrinsicKeyword(node, opts) { + assert("TSIntrinsicKeyword", node, opts); +} +function assertTSNeverKeyword(node, opts) { + assert("TSNeverKeyword", node, opts); +} +function assertTSNullKeyword(node, opts) { + assert("TSNullKeyword", node, opts); +} +function assertTSNumberKeyword(node, opts) { + assert("TSNumberKeyword", node, opts); +} +function assertTSObjectKeyword(node, opts) { + assert("TSObjectKeyword", node, opts); +} +function assertTSStringKeyword(node, opts) { + assert("TSStringKeyword", node, opts); +} +function assertTSSymbolKeyword(node, opts) { + assert("TSSymbolKeyword", node, opts); +} +function assertTSUndefinedKeyword(node, opts) { + assert("TSUndefinedKeyword", node, opts); +} +function assertTSUnknownKeyword(node, opts) { + assert("TSUnknownKeyword", node, opts); +} +function assertTSVoidKeyword(node, opts) { + assert("TSVoidKeyword", node, opts); +} +function assertTSThisType(node, opts) { + assert("TSThisType", node, opts); +} +function assertTSFunctionType(node, opts) { + assert("TSFunctionType", node, opts); +} +function assertTSConstructorType(node, opts) { + assert("TSConstructorType", node, opts); +} +function assertTSTypeReference(node, opts) { + assert("TSTypeReference", node, opts); +} +function assertTSTypePredicate(node, opts) { + assert("TSTypePredicate", node, opts); +} +function assertTSTypeQuery(node, opts) { + assert("TSTypeQuery", node, opts); +} +function assertTSTypeLiteral(node, opts) { + assert("TSTypeLiteral", node, opts); +} +function assertTSArrayType(node, opts) { + assert("TSArrayType", node, opts); +} +function assertTSTupleType(node, opts) { + assert("TSTupleType", node, opts); +} +function assertTSOptionalType(node, opts) { + assert("TSOptionalType", node, opts); +} +function assertTSRestType(node, opts) { + assert("TSRestType", node, opts); +} +function assertTSNamedTupleMember(node, opts) { + assert("TSNamedTupleMember", node, opts); +} +function assertTSUnionType(node, opts) { + assert("TSUnionType", node, opts); +} +function assertTSIntersectionType(node, opts) { + assert("TSIntersectionType", node, opts); +} +function assertTSConditionalType(node, opts) { + assert("TSConditionalType", node, opts); +} +function assertTSInferType(node, opts) { + assert("TSInferType", node, opts); +} +function assertTSParenthesizedType(node, opts) { + assert("TSParenthesizedType", node, opts); +} +function assertTSTypeOperator(node, opts) { + assert("TSTypeOperator", node, opts); +} +function assertTSIndexedAccessType(node, opts) { + assert("TSIndexedAccessType", node, opts); +} +function assertTSMappedType(node, opts) { + assert("TSMappedType", node, opts); +} +function assertTSLiteralType(node, opts) { + assert("TSLiteralType", node, opts); +} +function assertTSExpressionWithTypeArguments(node, opts) { + assert("TSExpressionWithTypeArguments", node, opts); +} +function assertTSInterfaceDeclaration(node, opts) { + assert("TSInterfaceDeclaration", node, opts); +} +function assertTSInterfaceBody(node, opts) { + assert("TSInterfaceBody", node, opts); +} +function assertTSTypeAliasDeclaration(node, opts) { + assert("TSTypeAliasDeclaration", node, opts); +} +function assertTSInstantiationExpression(node, opts) { + assert("TSInstantiationExpression", node, opts); +} +function assertTSAsExpression(node, opts) { + assert("TSAsExpression", node, opts); +} +function assertTSSatisfiesExpression(node, opts) { + assert("TSSatisfiesExpression", node, opts); +} +function assertTSTypeAssertion(node, opts) { + assert("TSTypeAssertion", node, opts); +} +function assertTSEnumDeclaration(node, opts) { + assert("TSEnumDeclaration", node, opts); +} +function assertTSEnumMember(node, opts) { + assert("TSEnumMember", node, opts); +} +function assertTSModuleDeclaration(node, opts) { + assert("TSModuleDeclaration", node, opts); +} +function assertTSModuleBlock(node, opts) { + assert("TSModuleBlock", node, opts); +} +function assertTSImportType(node, opts) { + assert("TSImportType", node, opts); +} +function assertTSImportEqualsDeclaration(node, opts) { + assert("TSImportEqualsDeclaration", node, opts); +} +function assertTSExternalModuleReference(node, opts) { + assert("TSExternalModuleReference", node, opts); +} +function assertTSNonNullExpression(node, opts) { + assert("TSNonNullExpression", node, opts); +} +function assertTSExportAssignment(node, opts) { + assert("TSExportAssignment", node, opts); +} +function assertTSNamespaceExportDeclaration(node, opts) { + assert("TSNamespaceExportDeclaration", node, opts); +} +function assertTSTypeAnnotation(node, opts) { + assert("TSTypeAnnotation", node, opts); +} +function assertTSTypeParameterInstantiation(node, opts) { + assert("TSTypeParameterInstantiation", node, opts); +} +function assertTSTypeParameterDeclaration(node, opts) { + assert("TSTypeParameterDeclaration", node, opts); +} +function assertTSTypeParameter(node, opts) { + assert("TSTypeParameter", node, opts); +} +function assertStandardized(node, opts) { + assert("Standardized", node, opts); +} +function assertExpression(node, opts) { + assert("Expression", node, opts); +} +function assertBinary(node, opts) { + assert("Binary", node, opts); +} +function assertScopable(node, opts) { + assert("Scopable", node, opts); +} +function assertBlockParent(node, opts) { + assert("BlockParent", node, opts); +} +function assertBlock(node, opts) { + assert("Block", node, opts); +} +function assertStatement(node, opts) { + assert("Statement", node, opts); +} +function assertTerminatorless(node, opts) { + assert("Terminatorless", node, opts); +} +function assertCompletionStatement(node, opts) { + assert("CompletionStatement", node, opts); +} +function assertConditional(node, opts) { + assert("Conditional", node, opts); +} +function assertLoop(node, opts) { + assert("Loop", node, opts); +} +function assertWhile(node, opts) { + assert("While", node, opts); +} +function assertExpressionWrapper(node, opts) { + assert("ExpressionWrapper", node, opts); +} +function assertFor(node, opts) { + assert("For", node, opts); +} +function assertForXStatement(node, opts) { + assert("ForXStatement", node, opts); +} +function assertFunction(node, opts) { + assert("Function", node, opts); +} +function assertFunctionParent(node, opts) { + assert("FunctionParent", node, opts); +} +function assertPureish(node, opts) { + assert("Pureish", node, opts); +} +function assertDeclaration(node, opts) { + assert("Declaration", node, opts); +} +function assertPatternLike(node, opts) { + assert("PatternLike", node, opts); +} +function assertLVal(node, opts) { + assert("LVal", node, opts); +} +function assertTSEntityName(node, opts) { + assert("TSEntityName", node, opts); +} +function assertLiteral(node, opts) { + assert("Literal", node, opts); +} +function assertImmutable(node, opts) { + assert("Immutable", node, opts); +} +function assertUserWhitespacable(node, opts) { + assert("UserWhitespacable", node, opts); +} +function assertMethod(node, opts) { + assert("Method", node, opts); +} +function assertObjectMember(node, opts) { + assert("ObjectMember", node, opts); +} +function assertProperty(node, opts) { + assert("Property", node, opts); +} +function assertUnaryLike(node, opts) { + assert("UnaryLike", node, opts); +} +function assertPattern(node, opts) { + assert("Pattern", node, opts); +} +function assertClass(node, opts) { + assert("Class", node, opts); +} +function assertImportOrExportDeclaration(node, opts) { + assert("ImportOrExportDeclaration", node, opts); +} +function assertExportDeclaration(node, opts) { + assert("ExportDeclaration", node, opts); +} +function assertModuleSpecifier(node, opts) { + assert("ModuleSpecifier", node, opts); +} +function assertAccessor(node, opts) { + assert("Accessor", node, opts); +} +function assertPrivate(node, opts) { + assert("Private", node, opts); +} +function assertFlow(node, opts) { + assert("Flow", node, opts); +} +function assertFlowType(node, opts) { + assert("FlowType", node, opts); +} +function assertFlowBaseAnnotation(node, opts) { + assert("FlowBaseAnnotation", node, opts); +} +function assertFlowDeclaration(node, opts) { + assert("FlowDeclaration", node, opts); +} +function assertFlowPredicate(node, opts) { + assert("FlowPredicate", node, opts); +} +function assertEnumBody(node, opts) { + assert("EnumBody", node, opts); +} +function assertEnumMember(node, opts) { + assert("EnumMember", node, opts); +} +function assertJSX(node, opts) { + assert("JSX", node, opts); +} +function assertMiscellaneous(node, opts) { + assert("Miscellaneous", node, opts); +} +function assertTypeScript(node, opts) { + assert("TypeScript", node, opts); +} +function assertTSTypeElement(node, opts) { + assert("TSTypeElement", node, opts); +} +function assertTSType(node, opts) { + assert("TSType", node, opts); +} +function assertTSBaseType(node, opts) { + assert("TSBaseType", node, opts); +} +function assertNumberLiteral(node, opts) { + (0, _deprecationWarning.default)("assertNumberLiteral", "assertNumericLiteral"); + assert("NumberLiteral", node, opts); +} +function assertRegexLiteral(node, opts) { + (0, _deprecationWarning.default)("assertRegexLiteral", "assertRegExpLiteral"); + assert("RegexLiteral", node, opts); +} +function assertRestProperty(node, opts) { + (0, _deprecationWarning.default)("assertRestProperty", "assertRestElement"); + assert("RestProperty", node, opts); +} +function assertSpreadProperty(node, opts) { + (0, _deprecationWarning.default)("assertSpreadProperty", "assertSpreadElement"); + assert("SpreadProperty", node, opts); +} +function assertModuleDeclaration(node, opts) { + (0, _deprecationWarning.default)("assertModuleDeclaration", "assertImportOrExportDeclaration"); + assert("ModuleDeclaration", node, opts); +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 3672: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = createFlowUnionType; +var _index = __nccwpck_require__(4485); +var _removeTypeDuplicates = __nccwpck_require__(1537); +function createFlowUnionType(types) { + const flattened = (0, _removeTypeDuplicates.default)(types); + if (flattened.length === 1) { + return flattened[0]; + } else { + return (0, _index.unionTypeAnnotation)(flattened); + } +} + +//# sourceMappingURL=createFlowUnionType.js.map + + +/***/ }), + +/***/ 4241: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _index = __nccwpck_require__(4485); +var _default = createTypeAnnotationBasedOnTypeof; +exports.default = _default; +function createTypeAnnotationBasedOnTypeof(type) { + switch (type) { + case "string": + return (0, _index.stringTypeAnnotation)(); + case "number": + return (0, _index.numberTypeAnnotation)(); + case "undefined": + return (0, _index.voidTypeAnnotation)(); + case "boolean": + return (0, _index.booleanTypeAnnotation)(); + case "function": + return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Function")); + case "object": + return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Object")); + case "symbol": + return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Symbol")); + case "bigint": + return (0, _index.anyTypeAnnotation)(); + } + throw new Error("Invalid typeof value: " + type); +} + +//# sourceMappingURL=createTypeAnnotationBasedOnTypeof.js.map + + +/***/ }), + +/***/ 4485: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.anyTypeAnnotation = anyTypeAnnotation; +exports.argumentPlaceholder = argumentPlaceholder; +exports.arrayExpression = arrayExpression; +exports.arrayPattern = arrayPattern; +exports.arrayTypeAnnotation = arrayTypeAnnotation; +exports.arrowFunctionExpression = arrowFunctionExpression; +exports.assignmentExpression = assignmentExpression; +exports.assignmentPattern = assignmentPattern; +exports.awaitExpression = awaitExpression; +exports.bigIntLiteral = bigIntLiteral; +exports.binaryExpression = binaryExpression; +exports.bindExpression = bindExpression; +exports.blockStatement = blockStatement; +exports.booleanLiteral = booleanLiteral; +exports.booleanLiteralTypeAnnotation = booleanLiteralTypeAnnotation; +exports.booleanTypeAnnotation = booleanTypeAnnotation; +exports.breakStatement = breakStatement; +exports.callExpression = callExpression; +exports.catchClause = catchClause; +exports.classAccessorProperty = classAccessorProperty; +exports.classBody = classBody; +exports.classDeclaration = classDeclaration; +exports.classExpression = classExpression; +exports.classImplements = classImplements; +exports.classMethod = classMethod; +exports.classPrivateMethod = classPrivateMethod; +exports.classPrivateProperty = classPrivateProperty; +exports.classProperty = classProperty; +exports.conditionalExpression = conditionalExpression; +exports.continueStatement = continueStatement; +exports.debuggerStatement = debuggerStatement; +exports.decimalLiteral = decimalLiteral; +exports.declareClass = declareClass; +exports.declareExportAllDeclaration = declareExportAllDeclaration; +exports.declareExportDeclaration = declareExportDeclaration; +exports.declareFunction = declareFunction; +exports.declareInterface = declareInterface; +exports.declareModule = declareModule; +exports.declareModuleExports = declareModuleExports; +exports.declareOpaqueType = declareOpaqueType; +exports.declareTypeAlias = declareTypeAlias; +exports.declareVariable = declareVariable; +exports.declaredPredicate = declaredPredicate; +exports.decorator = decorator; +exports.directive = directive; +exports.directiveLiteral = directiveLiteral; +exports.doExpression = doExpression; +exports.doWhileStatement = doWhileStatement; +exports.emptyStatement = emptyStatement; +exports.emptyTypeAnnotation = emptyTypeAnnotation; +exports.enumBooleanBody = enumBooleanBody; +exports.enumBooleanMember = enumBooleanMember; +exports.enumDeclaration = enumDeclaration; +exports.enumDefaultedMember = enumDefaultedMember; +exports.enumNumberBody = enumNumberBody; +exports.enumNumberMember = enumNumberMember; +exports.enumStringBody = enumStringBody; +exports.enumStringMember = enumStringMember; +exports.enumSymbolBody = enumSymbolBody; +exports.existsTypeAnnotation = existsTypeAnnotation; +exports.exportAllDeclaration = exportAllDeclaration; +exports.exportDefaultDeclaration = exportDefaultDeclaration; +exports.exportDefaultSpecifier = exportDefaultSpecifier; +exports.exportNamedDeclaration = exportNamedDeclaration; +exports.exportNamespaceSpecifier = exportNamespaceSpecifier; +exports.exportSpecifier = exportSpecifier; +exports.expressionStatement = expressionStatement; +exports.file = file; +exports.forInStatement = forInStatement; +exports.forOfStatement = forOfStatement; +exports.forStatement = forStatement; +exports.functionDeclaration = functionDeclaration; +exports.functionExpression = functionExpression; +exports.functionTypeAnnotation = functionTypeAnnotation; +exports.functionTypeParam = functionTypeParam; +exports.genericTypeAnnotation = genericTypeAnnotation; +exports.identifier = identifier; +exports.ifStatement = ifStatement; +exports.import = _import; +exports.importAttribute = importAttribute; +exports.importDeclaration = importDeclaration; +exports.importDefaultSpecifier = importDefaultSpecifier; +exports.importNamespaceSpecifier = importNamespaceSpecifier; +exports.importSpecifier = importSpecifier; +exports.indexedAccessType = indexedAccessType; +exports.inferredPredicate = inferredPredicate; +exports.interfaceDeclaration = interfaceDeclaration; +exports.interfaceExtends = interfaceExtends; +exports.interfaceTypeAnnotation = interfaceTypeAnnotation; +exports.interpreterDirective = interpreterDirective; +exports.intersectionTypeAnnotation = intersectionTypeAnnotation; +exports.jSXAttribute = exports.jsxAttribute = jsxAttribute; +exports.jSXClosingElement = exports.jsxClosingElement = jsxClosingElement; +exports.jSXClosingFragment = exports.jsxClosingFragment = jsxClosingFragment; +exports.jSXElement = exports.jsxElement = jsxElement; +exports.jSXEmptyExpression = exports.jsxEmptyExpression = jsxEmptyExpression; +exports.jSXExpressionContainer = exports.jsxExpressionContainer = jsxExpressionContainer; +exports.jSXFragment = exports.jsxFragment = jsxFragment; +exports.jSXIdentifier = exports.jsxIdentifier = jsxIdentifier; +exports.jSXMemberExpression = exports.jsxMemberExpression = jsxMemberExpression; +exports.jSXNamespacedName = exports.jsxNamespacedName = jsxNamespacedName; +exports.jSXOpeningElement = exports.jsxOpeningElement = jsxOpeningElement; +exports.jSXOpeningFragment = exports.jsxOpeningFragment = jsxOpeningFragment; +exports.jSXSpreadAttribute = exports.jsxSpreadAttribute = jsxSpreadAttribute; +exports.jSXSpreadChild = exports.jsxSpreadChild = jsxSpreadChild; +exports.jSXText = exports.jsxText = jsxText; +exports.labeledStatement = labeledStatement; +exports.logicalExpression = logicalExpression; +exports.memberExpression = memberExpression; +exports.metaProperty = metaProperty; +exports.mixedTypeAnnotation = mixedTypeAnnotation; +exports.moduleExpression = moduleExpression; +exports.newExpression = newExpression; +exports.noop = noop; +exports.nullLiteral = nullLiteral; +exports.nullLiteralTypeAnnotation = nullLiteralTypeAnnotation; +exports.nullableTypeAnnotation = nullableTypeAnnotation; +exports.numberLiteral = NumberLiteral; +exports.numberLiteralTypeAnnotation = numberLiteralTypeAnnotation; +exports.numberTypeAnnotation = numberTypeAnnotation; +exports.numericLiteral = numericLiteral; +exports.objectExpression = objectExpression; +exports.objectMethod = objectMethod; +exports.objectPattern = objectPattern; +exports.objectProperty = objectProperty; +exports.objectTypeAnnotation = objectTypeAnnotation; +exports.objectTypeCallProperty = objectTypeCallProperty; +exports.objectTypeIndexer = objectTypeIndexer; +exports.objectTypeInternalSlot = objectTypeInternalSlot; +exports.objectTypeProperty = objectTypeProperty; +exports.objectTypeSpreadProperty = objectTypeSpreadProperty; +exports.opaqueType = opaqueType; +exports.optionalCallExpression = optionalCallExpression; +exports.optionalIndexedAccessType = optionalIndexedAccessType; +exports.optionalMemberExpression = optionalMemberExpression; +exports.parenthesizedExpression = parenthesizedExpression; +exports.pipelineBareFunction = pipelineBareFunction; +exports.pipelinePrimaryTopicReference = pipelinePrimaryTopicReference; +exports.pipelineTopicExpression = pipelineTopicExpression; +exports.placeholder = placeholder; +exports.privateName = privateName; +exports.program = program; +exports.qualifiedTypeIdentifier = qualifiedTypeIdentifier; +exports.recordExpression = recordExpression; +exports.regExpLiteral = regExpLiteral; +exports.regexLiteral = RegexLiteral; +exports.restElement = restElement; +exports.restProperty = RestProperty; +exports.returnStatement = returnStatement; +exports.sequenceExpression = sequenceExpression; +exports.spreadElement = spreadElement; +exports.spreadProperty = SpreadProperty; +exports.staticBlock = staticBlock; +exports.stringLiteral = stringLiteral; +exports.stringLiteralTypeAnnotation = stringLiteralTypeAnnotation; +exports.stringTypeAnnotation = stringTypeAnnotation; +exports.super = _super; +exports.switchCase = switchCase; +exports.switchStatement = switchStatement; +exports.symbolTypeAnnotation = symbolTypeAnnotation; +exports.taggedTemplateExpression = taggedTemplateExpression; +exports.templateElement = templateElement; +exports.templateLiteral = templateLiteral; +exports.thisExpression = thisExpression; +exports.thisTypeAnnotation = thisTypeAnnotation; +exports.throwStatement = throwStatement; +exports.topicReference = topicReference; +exports.tryStatement = tryStatement; +exports.tSAnyKeyword = exports.tsAnyKeyword = tsAnyKeyword; +exports.tSArrayType = exports.tsArrayType = tsArrayType; +exports.tSAsExpression = exports.tsAsExpression = tsAsExpression; +exports.tSBigIntKeyword = exports.tsBigIntKeyword = tsBigIntKeyword; +exports.tSBooleanKeyword = exports.tsBooleanKeyword = tsBooleanKeyword; +exports.tSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = tsCallSignatureDeclaration; +exports.tSConditionalType = exports.tsConditionalType = tsConditionalType; +exports.tSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = tsConstructSignatureDeclaration; +exports.tSConstructorType = exports.tsConstructorType = tsConstructorType; +exports.tSDeclareFunction = exports.tsDeclareFunction = tsDeclareFunction; +exports.tSDeclareMethod = exports.tsDeclareMethod = tsDeclareMethod; +exports.tSEnumDeclaration = exports.tsEnumDeclaration = tsEnumDeclaration; +exports.tSEnumMember = exports.tsEnumMember = tsEnumMember; +exports.tSExportAssignment = exports.tsExportAssignment = tsExportAssignment; +exports.tSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = tsExpressionWithTypeArguments; +exports.tSExternalModuleReference = exports.tsExternalModuleReference = tsExternalModuleReference; +exports.tSFunctionType = exports.tsFunctionType = tsFunctionType; +exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = tsImportEqualsDeclaration; +exports.tSImportType = exports.tsImportType = tsImportType; +exports.tSIndexSignature = exports.tsIndexSignature = tsIndexSignature; +exports.tSIndexedAccessType = exports.tsIndexedAccessType = tsIndexedAccessType; +exports.tSInferType = exports.tsInferType = tsInferType; +exports.tSInstantiationExpression = exports.tsInstantiationExpression = tsInstantiationExpression; +exports.tSInterfaceBody = exports.tsInterfaceBody = tsInterfaceBody; +exports.tSInterfaceDeclaration = exports.tsInterfaceDeclaration = tsInterfaceDeclaration; +exports.tSIntersectionType = exports.tsIntersectionType = tsIntersectionType; +exports.tSIntrinsicKeyword = exports.tsIntrinsicKeyword = tsIntrinsicKeyword; +exports.tSLiteralType = exports.tsLiteralType = tsLiteralType; +exports.tSMappedType = exports.tsMappedType = tsMappedType; +exports.tSMethodSignature = exports.tsMethodSignature = tsMethodSignature; +exports.tSModuleBlock = exports.tsModuleBlock = tsModuleBlock; +exports.tSModuleDeclaration = exports.tsModuleDeclaration = tsModuleDeclaration; +exports.tSNamedTupleMember = exports.tsNamedTupleMember = tsNamedTupleMember; +exports.tSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = tsNamespaceExportDeclaration; +exports.tSNeverKeyword = exports.tsNeverKeyword = tsNeverKeyword; +exports.tSNonNullExpression = exports.tsNonNullExpression = tsNonNullExpression; +exports.tSNullKeyword = exports.tsNullKeyword = tsNullKeyword; +exports.tSNumberKeyword = exports.tsNumberKeyword = tsNumberKeyword; +exports.tSObjectKeyword = exports.tsObjectKeyword = tsObjectKeyword; +exports.tSOptionalType = exports.tsOptionalType = tsOptionalType; +exports.tSParameterProperty = exports.tsParameterProperty = tsParameterProperty; +exports.tSParenthesizedType = exports.tsParenthesizedType = tsParenthesizedType; +exports.tSPropertySignature = exports.tsPropertySignature = tsPropertySignature; +exports.tSQualifiedName = exports.tsQualifiedName = tsQualifiedName; +exports.tSRestType = exports.tsRestType = tsRestType; +exports.tSSatisfiesExpression = exports.tsSatisfiesExpression = tsSatisfiesExpression; +exports.tSStringKeyword = exports.tsStringKeyword = tsStringKeyword; +exports.tSSymbolKeyword = exports.tsSymbolKeyword = tsSymbolKeyword; +exports.tSThisType = exports.tsThisType = tsThisType; +exports.tSTupleType = exports.tsTupleType = tsTupleType; +exports.tSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = tsTypeAliasDeclaration; +exports.tSTypeAnnotation = exports.tsTypeAnnotation = tsTypeAnnotation; +exports.tSTypeAssertion = exports.tsTypeAssertion = tsTypeAssertion; +exports.tSTypeLiteral = exports.tsTypeLiteral = tsTypeLiteral; +exports.tSTypeOperator = exports.tsTypeOperator = tsTypeOperator; +exports.tSTypeParameter = exports.tsTypeParameter = tsTypeParameter; +exports.tSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = tsTypeParameterDeclaration; +exports.tSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = tsTypeParameterInstantiation; +exports.tSTypePredicate = exports.tsTypePredicate = tsTypePredicate; +exports.tSTypeQuery = exports.tsTypeQuery = tsTypeQuery; +exports.tSTypeReference = exports.tsTypeReference = tsTypeReference; +exports.tSUndefinedKeyword = exports.tsUndefinedKeyword = tsUndefinedKeyword; +exports.tSUnionType = exports.tsUnionType = tsUnionType; +exports.tSUnknownKeyword = exports.tsUnknownKeyword = tsUnknownKeyword; +exports.tSVoidKeyword = exports.tsVoidKeyword = tsVoidKeyword; +exports.tupleExpression = tupleExpression; +exports.tupleTypeAnnotation = tupleTypeAnnotation; +exports.typeAlias = typeAlias; +exports.typeAnnotation = typeAnnotation; +exports.typeCastExpression = typeCastExpression; +exports.typeParameter = typeParameter; +exports.typeParameterDeclaration = typeParameterDeclaration; +exports.typeParameterInstantiation = typeParameterInstantiation; +exports.typeofTypeAnnotation = typeofTypeAnnotation; +exports.unaryExpression = unaryExpression; +exports.unionTypeAnnotation = unionTypeAnnotation; +exports.updateExpression = updateExpression; +exports.v8IntrinsicIdentifier = v8IntrinsicIdentifier; +exports.variableDeclaration = variableDeclaration; +exports.variableDeclarator = variableDeclarator; +exports.variance = variance; +exports.voidTypeAnnotation = voidTypeAnnotation; +exports.whileStatement = whileStatement; +exports.withStatement = withStatement; +exports.yieldExpression = yieldExpression; +var _validateNode = __nccwpck_require__(4916); +var _deprecationWarning = __nccwpck_require__(7290); +function arrayExpression(elements = []) { + return (0, _validateNode.default)({ + type: "ArrayExpression", + elements + }); +} +function assignmentExpression(operator, left, right) { + return (0, _validateNode.default)({ + type: "AssignmentExpression", + operator, + left, + right + }); +} +function binaryExpression(operator, left, right) { + return (0, _validateNode.default)({ + type: "BinaryExpression", + operator, + left, + right + }); +} +function interpreterDirective(value) { + return (0, _validateNode.default)({ + type: "InterpreterDirective", + value + }); +} +function directive(value) { + return (0, _validateNode.default)({ + type: "Directive", + value + }); +} +function directiveLiteral(value) { + return (0, _validateNode.default)({ + type: "DirectiveLiteral", + value + }); +} +function blockStatement(body, directives = []) { + return (0, _validateNode.default)({ + type: "BlockStatement", + body, + directives + }); +} +function breakStatement(label = null) { + return (0, _validateNode.default)({ + type: "BreakStatement", + label + }); +} +function callExpression(callee, _arguments) { + return (0, _validateNode.default)({ + type: "CallExpression", + callee, + arguments: _arguments + }); +} +function catchClause(param = null, body) { + return (0, _validateNode.default)({ + type: "CatchClause", + param, + body + }); +} +function conditionalExpression(test, consequent, alternate) { + return (0, _validateNode.default)({ + type: "ConditionalExpression", + test, + consequent, + alternate + }); +} +function continueStatement(label = null) { + return (0, _validateNode.default)({ + type: "ContinueStatement", + label + }); +} +function debuggerStatement() { + return { + type: "DebuggerStatement" + }; +} +function doWhileStatement(test, body) { + return (0, _validateNode.default)({ + type: "DoWhileStatement", + test, + body + }); +} +function emptyStatement() { + return { + type: "EmptyStatement" + }; +} +function expressionStatement(expression) { + return (0, _validateNode.default)({ + type: "ExpressionStatement", + expression + }); +} +function file(program, comments = null, tokens = null) { + return (0, _validateNode.default)({ + type: "File", + program, + comments, + tokens + }); +} +function forInStatement(left, right, body) { + return (0, _validateNode.default)({ + type: "ForInStatement", + left, + right, + body + }); +} +function forStatement(init = null, test = null, update = null, body) { + return (0, _validateNode.default)({ + type: "ForStatement", + init, + test, + update, + body + }); +} +function functionDeclaration(id = null, params, body, generator = false, async = false) { + return (0, _validateNode.default)({ + type: "FunctionDeclaration", + id, + params, + body, + generator, + async + }); +} +function functionExpression(id = null, params, body, generator = false, async = false) { + return (0, _validateNode.default)({ + type: "FunctionExpression", + id, + params, + body, + generator, + async + }); +} +function identifier(name) { + return (0, _validateNode.default)({ + type: "Identifier", + name + }); +} +function ifStatement(test, consequent, alternate = null) { + return (0, _validateNode.default)({ + type: "IfStatement", + test, + consequent, + alternate + }); +} +function labeledStatement(label, body) { + return (0, _validateNode.default)({ + type: "LabeledStatement", + label, + body + }); +} +function stringLiteral(value) { + return (0, _validateNode.default)({ + type: "StringLiteral", + value + }); +} +function numericLiteral(value) { + return (0, _validateNode.default)({ + type: "NumericLiteral", + value + }); +} +function nullLiteral() { + return { + type: "NullLiteral" + }; +} +function booleanLiteral(value) { + return (0, _validateNode.default)({ + type: "BooleanLiteral", + value + }); +} +function regExpLiteral(pattern, flags = "") { + return (0, _validateNode.default)({ + type: "RegExpLiteral", + pattern, + flags + }); +} +function logicalExpression(operator, left, right) { + return (0, _validateNode.default)({ + type: "LogicalExpression", + operator, + left, + right + }); +} +function memberExpression(object, property, computed = false, optional = null) { + return (0, _validateNode.default)({ + type: "MemberExpression", + object, + property, + computed, + optional + }); +} +function newExpression(callee, _arguments) { + return (0, _validateNode.default)({ + type: "NewExpression", + callee, + arguments: _arguments + }); +} +function program(body, directives = [], sourceType = "script", interpreter = null) { + return (0, _validateNode.default)({ + type: "Program", + body, + directives, + sourceType, + interpreter, + sourceFile: null + }); +} +function objectExpression(properties) { + return (0, _validateNode.default)({ + type: "ObjectExpression", + properties + }); +} +function objectMethod(kind = "method", key, params, body, computed = false, generator = false, async = false) { + return (0, _validateNode.default)({ + type: "ObjectMethod", + kind, + key, + params, + body, + computed, + generator, + async + }); +} +function objectProperty(key, value, computed = false, shorthand = false, decorators = null) { + return (0, _validateNode.default)({ + type: "ObjectProperty", + key, + value, + computed, + shorthand, + decorators + }); +} +function restElement(argument) { + return (0, _validateNode.default)({ + type: "RestElement", + argument + }); +} +function returnStatement(argument = null) { + return (0, _validateNode.default)({ + type: "ReturnStatement", + argument + }); +} +function sequenceExpression(expressions) { + return (0, _validateNode.default)({ + type: "SequenceExpression", + expressions + }); +} +function parenthesizedExpression(expression) { + return (0, _validateNode.default)({ + type: "ParenthesizedExpression", + expression + }); +} +function switchCase(test = null, consequent) { + return (0, _validateNode.default)({ + type: "SwitchCase", + test, + consequent + }); +} +function switchStatement(discriminant, cases) { + return (0, _validateNode.default)({ + type: "SwitchStatement", + discriminant, + cases + }); +} +function thisExpression() { + return { + type: "ThisExpression" + }; +} +function throwStatement(argument) { + return (0, _validateNode.default)({ + type: "ThrowStatement", + argument + }); +} +function tryStatement(block, handler = null, finalizer = null) { + return (0, _validateNode.default)({ + type: "TryStatement", + block, + handler, + finalizer + }); +} +function unaryExpression(operator, argument, prefix = true) { + return (0, _validateNode.default)({ + type: "UnaryExpression", + operator, + argument, + prefix + }); +} +function updateExpression(operator, argument, prefix = false) { + return (0, _validateNode.default)({ + type: "UpdateExpression", + operator, + argument, + prefix + }); +} +function variableDeclaration(kind, declarations) { + return (0, _validateNode.default)({ + type: "VariableDeclaration", + kind, + declarations + }); +} +function variableDeclarator(id, init = null) { + return (0, _validateNode.default)({ + type: "VariableDeclarator", + id, + init + }); +} +function whileStatement(test, body) { + return (0, _validateNode.default)({ + type: "WhileStatement", + test, + body + }); +} +function withStatement(object, body) { + return (0, _validateNode.default)({ + type: "WithStatement", + object, + body + }); +} +function assignmentPattern(left, right) { + return (0, _validateNode.default)({ + type: "AssignmentPattern", + left, + right + }); +} +function arrayPattern(elements) { + return (0, _validateNode.default)({ + type: "ArrayPattern", + elements + }); +} +function arrowFunctionExpression(params, body, async = false) { + return (0, _validateNode.default)({ + type: "ArrowFunctionExpression", + params, + body, + async, + expression: null + }); +} +function classBody(body) { + return (0, _validateNode.default)({ + type: "ClassBody", + body + }); +} +function classExpression(id = null, superClass = null, body, decorators = null) { + return (0, _validateNode.default)({ + type: "ClassExpression", + id, + superClass, + body, + decorators + }); +} +function classDeclaration(id = null, superClass = null, body, decorators = null) { + return (0, _validateNode.default)({ + type: "ClassDeclaration", + id, + superClass, + body, + decorators + }); +} +function exportAllDeclaration(source) { + return (0, _validateNode.default)({ + type: "ExportAllDeclaration", + source + }); +} +function exportDefaultDeclaration(declaration) { + return (0, _validateNode.default)({ + type: "ExportDefaultDeclaration", + declaration + }); +} +function exportNamedDeclaration(declaration = null, specifiers = [], source = null) { + return (0, _validateNode.default)({ + type: "ExportNamedDeclaration", + declaration, + specifiers, + source + }); +} +function exportSpecifier(local, exported) { + return (0, _validateNode.default)({ + type: "ExportSpecifier", + local, + exported + }); +} +function forOfStatement(left, right, body, _await = false) { + return (0, _validateNode.default)({ + type: "ForOfStatement", + left, + right, + body, + await: _await + }); +} +function importDeclaration(specifiers, source) { + return (0, _validateNode.default)({ + type: "ImportDeclaration", + specifiers, + source + }); +} +function importDefaultSpecifier(local) { + return (0, _validateNode.default)({ + type: "ImportDefaultSpecifier", + local + }); +} +function importNamespaceSpecifier(local) { + return (0, _validateNode.default)({ + type: "ImportNamespaceSpecifier", + local + }); +} +function importSpecifier(local, imported) { + return (0, _validateNode.default)({ + type: "ImportSpecifier", + local, + imported + }); +} +function metaProperty(meta, property) { + return (0, _validateNode.default)({ + type: "MetaProperty", + meta, + property + }); +} +function classMethod(kind = "method", key, params, body, computed = false, _static = false, generator = false, async = false) { + return (0, _validateNode.default)({ + type: "ClassMethod", + kind, + key, + params, + body, + computed, + static: _static, + generator, + async + }); +} +function objectPattern(properties) { + return (0, _validateNode.default)({ + type: "ObjectPattern", + properties + }); +} +function spreadElement(argument) { + return (0, _validateNode.default)({ + type: "SpreadElement", + argument + }); +} +function _super() { + return { + type: "Super" + }; +} +function taggedTemplateExpression(tag, quasi) { + return (0, _validateNode.default)({ + type: "TaggedTemplateExpression", + tag, + quasi + }); +} +function templateElement(value, tail = false) { + return (0, _validateNode.default)({ + type: "TemplateElement", + value, + tail + }); +} +function templateLiteral(quasis, expressions) { + return (0, _validateNode.default)({ + type: "TemplateLiteral", + quasis, + expressions + }); +} +function yieldExpression(argument = null, delegate = false) { + return (0, _validateNode.default)({ + type: "YieldExpression", + argument, + delegate + }); +} +function awaitExpression(argument) { + return (0, _validateNode.default)({ + type: "AwaitExpression", + argument + }); +} +function _import() { + return { + type: "Import" + }; +} +function bigIntLiteral(value) { + return (0, _validateNode.default)({ + type: "BigIntLiteral", + value + }); +} +function exportNamespaceSpecifier(exported) { + return (0, _validateNode.default)({ + type: "ExportNamespaceSpecifier", + exported + }); +} +function optionalMemberExpression(object, property, computed = false, optional) { + return (0, _validateNode.default)({ + type: "OptionalMemberExpression", + object, + property, + computed, + optional + }); +} +function optionalCallExpression(callee, _arguments, optional) { + return (0, _validateNode.default)({ + type: "OptionalCallExpression", + callee, + arguments: _arguments, + optional + }); +} +function classProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) { + return (0, _validateNode.default)({ + type: "ClassProperty", + key, + value, + typeAnnotation, + decorators, + computed, + static: _static + }); +} +function classAccessorProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) { + return (0, _validateNode.default)({ + type: "ClassAccessorProperty", + key, + value, + typeAnnotation, + decorators, + computed, + static: _static + }); +} +function classPrivateProperty(key, value = null, decorators = null, _static = false) { + return (0, _validateNode.default)({ + type: "ClassPrivateProperty", + key, + value, + decorators, + static: _static + }); +} +function classPrivateMethod(kind = "method", key, params, body, _static = false) { + return (0, _validateNode.default)({ + type: "ClassPrivateMethod", + kind, + key, + params, + body, + static: _static + }); +} +function privateName(id) { + return (0, _validateNode.default)({ + type: "PrivateName", + id + }); +} +function staticBlock(body) { + return (0, _validateNode.default)({ + type: "StaticBlock", + body + }); +} +function anyTypeAnnotation() { + return { + type: "AnyTypeAnnotation" + }; +} +function arrayTypeAnnotation(elementType) { + return (0, _validateNode.default)({ + type: "ArrayTypeAnnotation", + elementType + }); +} +function booleanTypeAnnotation() { + return { + type: "BooleanTypeAnnotation" + }; +} +function booleanLiteralTypeAnnotation(value) { + return (0, _validateNode.default)({ + type: "BooleanLiteralTypeAnnotation", + value + }); +} +function nullLiteralTypeAnnotation() { + return { + type: "NullLiteralTypeAnnotation" + }; +} +function classImplements(id, typeParameters = null) { + return (0, _validateNode.default)({ + type: "ClassImplements", + id, + typeParameters + }); +} +function declareClass(id, typeParameters = null, _extends = null, body) { + return (0, _validateNode.default)({ + type: "DeclareClass", + id, + typeParameters, + extends: _extends, + body + }); +} +function declareFunction(id) { + return (0, _validateNode.default)({ + type: "DeclareFunction", + id + }); +} +function declareInterface(id, typeParameters = null, _extends = null, body) { + return (0, _validateNode.default)({ + type: "DeclareInterface", + id, + typeParameters, + extends: _extends, + body + }); +} +function declareModule(id, body, kind = null) { + return (0, _validateNode.default)({ + type: "DeclareModule", + id, + body, + kind + }); +} +function declareModuleExports(typeAnnotation) { + return (0, _validateNode.default)({ + type: "DeclareModuleExports", + typeAnnotation + }); +} +function declareTypeAlias(id, typeParameters = null, right) { + return (0, _validateNode.default)({ + type: "DeclareTypeAlias", + id, + typeParameters, + right + }); +} +function declareOpaqueType(id, typeParameters = null, supertype = null) { + return (0, _validateNode.default)({ + type: "DeclareOpaqueType", + id, + typeParameters, + supertype + }); +} +function declareVariable(id) { + return (0, _validateNode.default)({ + type: "DeclareVariable", + id + }); +} +function declareExportDeclaration(declaration = null, specifiers = null, source = null) { + return (0, _validateNode.default)({ + type: "DeclareExportDeclaration", + declaration, + specifiers, + source + }); +} +function declareExportAllDeclaration(source) { + return (0, _validateNode.default)({ + type: "DeclareExportAllDeclaration", + source + }); +} +function declaredPredicate(value) { + return (0, _validateNode.default)({ + type: "DeclaredPredicate", + value + }); +} +function existsTypeAnnotation() { + return { + type: "ExistsTypeAnnotation" + }; +} +function functionTypeAnnotation(typeParameters = null, params, rest = null, returnType) { + return (0, _validateNode.default)({ + type: "FunctionTypeAnnotation", + typeParameters, + params, + rest, + returnType + }); +} +function functionTypeParam(name = null, typeAnnotation) { + return (0, _validateNode.default)({ + type: "FunctionTypeParam", + name, + typeAnnotation + }); +} +function genericTypeAnnotation(id, typeParameters = null) { + return (0, _validateNode.default)({ + type: "GenericTypeAnnotation", + id, + typeParameters + }); +} +function inferredPredicate() { + return { + type: "InferredPredicate" + }; +} +function interfaceExtends(id, typeParameters = null) { + return (0, _validateNode.default)({ + type: "InterfaceExtends", + id, + typeParameters + }); +} +function interfaceDeclaration(id, typeParameters = null, _extends = null, body) { + return (0, _validateNode.default)({ + type: "InterfaceDeclaration", + id, + typeParameters, + extends: _extends, + body + }); +} +function interfaceTypeAnnotation(_extends = null, body) { + return (0, _validateNode.default)({ + type: "InterfaceTypeAnnotation", + extends: _extends, + body + }); +} +function intersectionTypeAnnotation(types) { + return (0, _validateNode.default)({ + type: "IntersectionTypeAnnotation", + types + }); +} +function mixedTypeAnnotation() { + return { + type: "MixedTypeAnnotation" + }; +} +function emptyTypeAnnotation() { + return { + type: "EmptyTypeAnnotation" + }; +} +function nullableTypeAnnotation(typeAnnotation) { + return (0, _validateNode.default)({ + type: "NullableTypeAnnotation", + typeAnnotation + }); +} +function numberLiteralTypeAnnotation(value) { + return (0, _validateNode.default)({ + type: "NumberLiteralTypeAnnotation", + value + }); +} +function numberTypeAnnotation() { + return { + type: "NumberTypeAnnotation" + }; +} +function objectTypeAnnotation(properties, indexers = [], callProperties = [], internalSlots = [], exact = false) { + return (0, _validateNode.default)({ + type: "ObjectTypeAnnotation", + properties, + indexers, + callProperties, + internalSlots, + exact + }); +} +function objectTypeInternalSlot(id, value, optional, _static, method) { + return (0, _validateNode.default)({ + type: "ObjectTypeInternalSlot", + id, + value, + optional, + static: _static, + method + }); +} +function objectTypeCallProperty(value) { + return (0, _validateNode.default)({ + type: "ObjectTypeCallProperty", + value, + static: null + }); +} +function objectTypeIndexer(id = null, key, value, variance = null) { + return (0, _validateNode.default)({ + type: "ObjectTypeIndexer", + id, + key, + value, + variance, + static: null + }); +} +function objectTypeProperty(key, value, variance = null) { + return (0, _validateNode.default)({ + type: "ObjectTypeProperty", + key, + value, + variance, + kind: null, + method: null, + optional: null, + proto: null, + static: null + }); +} +function objectTypeSpreadProperty(argument) { + return (0, _validateNode.default)({ + type: "ObjectTypeSpreadProperty", + argument + }); +} +function opaqueType(id, typeParameters = null, supertype = null, impltype) { + return (0, _validateNode.default)({ + type: "OpaqueType", + id, + typeParameters, + supertype, + impltype + }); +} +function qualifiedTypeIdentifier(id, qualification) { + return (0, _validateNode.default)({ + type: "QualifiedTypeIdentifier", + id, + qualification + }); +} +function stringLiteralTypeAnnotation(value) { + return (0, _validateNode.default)({ + type: "StringLiteralTypeAnnotation", + value + }); +} +function stringTypeAnnotation() { + return { + type: "StringTypeAnnotation" + }; +} +function symbolTypeAnnotation() { + return { + type: "SymbolTypeAnnotation" + }; +} +function thisTypeAnnotation() { + return { + type: "ThisTypeAnnotation" + }; +} +function tupleTypeAnnotation(types) { + return (0, _validateNode.default)({ + type: "TupleTypeAnnotation", + types + }); +} +function typeofTypeAnnotation(argument) { + return (0, _validateNode.default)({ + type: "TypeofTypeAnnotation", + argument + }); +} +function typeAlias(id, typeParameters = null, right) { + return (0, _validateNode.default)({ + type: "TypeAlias", + id, + typeParameters, + right + }); +} +function typeAnnotation(typeAnnotation) { + return (0, _validateNode.default)({ + type: "TypeAnnotation", + typeAnnotation + }); +} +function typeCastExpression(expression, typeAnnotation) { + return (0, _validateNode.default)({ + type: "TypeCastExpression", + expression, + typeAnnotation + }); +} +function typeParameter(bound = null, _default = null, variance = null) { + return (0, _validateNode.default)({ + type: "TypeParameter", + bound, + default: _default, + variance, + name: null + }); +} +function typeParameterDeclaration(params) { + return (0, _validateNode.default)({ + type: "TypeParameterDeclaration", + params + }); +} +function typeParameterInstantiation(params) { + return (0, _validateNode.default)({ + type: "TypeParameterInstantiation", + params + }); +} +function unionTypeAnnotation(types) { + return (0, _validateNode.default)({ + type: "UnionTypeAnnotation", + types + }); +} +function variance(kind) { + return (0, _validateNode.default)({ + type: "Variance", + kind + }); +} +function voidTypeAnnotation() { + return { + type: "VoidTypeAnnotation" + }; +} +function enumDeclaration(id, body) { + return (0, _validateNode.default)({ + type: "EnumDeclaration", + id, + body + }); +} +function enumBooleanBody(members) { + return (0, _validateNode.default)({ + type: "EnumBooleanBody", + members, + explicitType: null, + hasUnknownMembers: null + }); +} +function enumNumberBody(members) { + return (0, _validateNode.default)({ + type: "EnumNumberBody", + members, + explicitType: null, + hasUnknownMembers: null + }); +} +function enumStringBody(members) { + return (0, _validateNode.default)({ + type: "EnumStringBody", + members, + explicitType: null, + hasUnknownMembers: null + }); +} +function enumSymbolBody(members) { + return (0, _validateNode.default)({ + type: "EnumSymbolBody", + members, + hasUnknownMembers: null + }); +} +function enumBooleanMember(id) { + return (0, _validateNode.default)({ + type: "EnumBooleanMember", + id, + init: null + }); +} +function enumNumberMember(id, init) { + return (0, _validateNode.default)({ + type: "EnumNumberMember", + id, + init + }); +} +function enumStringMember(id, init) { + return (0, _validateNode.default)({ + type: "EnumStringMember", + id, + init + }); +} +function enumDefaultedMember(id) { + return (0, _validateNode.default)({ + type: "EnumDefaultedMember", + id + }); +} +function indexedAccessType(objectType, indexType) { + return (0, _validateNode.default)({ + type: "IndexedAccessType", + objectType, + indexType + }); +} +function optionalIndexedAccessType(objectType, indexType) { + return (0, _validateNode.default)({ + type: "OptionalIndexedAccessType", + objectType, + indexType, + optional: null + }); +} +function jsxAttribute(name, value = null) { + return (0, _validateNode.default)({ + type: "JSXAttribute", + name, + value + }); +} +function jsxClosingElement(name) { + return (0, _validateNode.default)({ + type: "JSXClosingElement", + name + }); +} +function jsxElement(openingElement, closingElement = null, children, selfClosing = null) { + return (0, _validateNode.default)({ + type: "JSXElement", + openingElement, + closingElement, + children, + selfClosing + }); +} +function jsxEmptyExpression() { + return { + type: "JSXEmptyExpression" + }; +} +function jsxExpressionContainer(expression) { + return (0, _validateNode.default)({ + type: "JSXExpressionContainer", + expression + }); +} +function jsxSpreadChild(expression) { + return (0, _validateNode.default)({ + type: "JSXSpreadChild", + expression + }); +} +function jsxIdentifier(name) { + return (0, _validateNode.default)({ + type: "JSXIdentifier", + name + }); +} +function jsxMemberExpression(object, property) { + return (0, _validateNode.default)({ + type: "JSXMemberExpression", + object, + property + }); +} +function jsxNamespacedName(namespace, name) { + return (0, _validateNode.default)({ + type: "JSXNamespacedName", + namespace, + name + }); +} +function jsxOpeningElement(name, attributes, selfClosing = false) { + return (0, _validateNode.default)({ + type: "JSXOpeningElement", + name, + attributes, + selfClosing + }); +} +function jsxSpreadAttribute(argument) { + return (0, _validateNode.default)({ + type: "JSXSpreadAttribute", + argument + }); +} +function jsxText(value) { + return (0, _validateNode.default)({ + type: "JSXText", + value + }); +} +function jsxFragment(openingFragment, closingFragment, children) { + return (0, _validateNode.default)({ + type: "JSXFragment", + openingFragment, + closingFragment, + children + }); +} +function jsxOpeningFragment() { + return { + type: "JSXOpeningFragment" + }; +} +function jsxClosingFragment() { + return { + type: "JSXClosingFragment" + }; +} +function noop() { + return { + type: "Noop" + }; +} +function placeholder(expectedNode, name) { + return (0, _validateNode.default)({ + type: "Placeholder", + expectedNode, + name + }); +} +function v8IntrinsicIdentifier(name) { + return (0, _validateNode.default)({ + type: "V8IntrinsicIdentifier", + name + }); +} +function argumentPlaceholder() { + return { + type: "ArgumentPlaceholder" + }; +} +function bindExpression(object, callee) { + return (0, _validateNode.default)({ + type: "BindExpression", + object, + callee + }); +} +function importAttribute(key, value) { + return (0, _validateNode.default)({ + type: "ImportAttribute", + key, + value + }); +} +function decorator(expression) { + return (0, _validateNode.default)({ + type: "Decorator", + expression + }); +} +function doExpression(body, async = false) { + return (0, _validateNode.default)({ + type: "DoExpression", + body, + async + }); +} +function exportDefaultSpecifier(exported) { + return (0, _validateNode.default)({ + type: "ExportDefaultSpecifier", + exported + }); +} +function recordExpression(properties) { + return (0, _validateNode.default)({ + type: "RecordExpression", + properties + }); +} +function tupleExpression(elements = []) { + return (0, _validateNode.default)({ + type: "TupleExpression", + elements + }); +} +function decimalLiteral(value) { + return (0, _validateNode.default)({ + type: "DecimalLiteral", + value + }); +} +function moduleExpression(body) { + return (0, _validateNode.default)({ + type: "ModuleExpression", + body + }); +} +function topicReference() { + return { + type: "TopicReference" + }; +} +function pipelineTopicExpression(expression) { + return (0, _validateNode.default)({ + type: "PipelineTopicExpression", + expression + }); +} +function pipelineBareFunction(callee) { + return (0, _validateNode.default)({ + type: "PipelineBareFunction", + callee + }); +} +function pipelinePrimaryTopicReference() { + return { + type: "PipelinePrimaryTopicReference" + }; +} +function tsParameterProperty(parameter) { + return (0, _validateNode.default)({ + type: "TSParameterProperty", + parameter + }); +} +function tsDeclareFunction(id = null, typeParameters = null, params, returnType = null) { + return (0, _validateNode.default)({ + type: "TSDeclareFunction", + id, + typeParameters, + params, + returnType + }); +} +function tsDeclareMethod(decorators = null, key, typeParameters = null, params, returnType = null) { + return (0, _validateNode.default)({ + type: "TSDeclareMethod", + decorators, + key, + typeParameters, + params, + returnType + }); +} +function tsQualifiedName(left, right) { + return (0, _validateNode.default)({ + type: "TSQualifiedName", + left, + right + }); +} +function tsCallSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) { + return (0, _validateNode.default)({ + type: "TSCallSignatureDeclaration", + typeParameters, + parameters, + typeAnnotation + }); +} +function tsConstructSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) { + return (0, _validateNode.default)({ + type: "TSConstructSignatureDeclaration", + typeParameters, + parameters, + typeAnnotation + }); +} +function tsPropertySignature(key, typeAnnotation = null, initializer = null) { + return (0, _validateNode.default)({ + type: "TSPropertySignature", + key, + typeAnnotation, + initializer, + kind: null + }); +} +function tsMethodSignature(key, typeParameters = null, parameters, typeAnnotation = null) { + return (0, _validateNode.default)({ + type: "TSMethodSignature", + key, + typeParameters, + parameters, + typeAnnotation, + kind: null + }); +} +function tsIndexSignature(parameters, typeAnnotation = null) { + return (0, _validateNode.default)({ + type: "TSIndexSignature", + parameters, + typeAnnotation + }); +} +function tsAnyKeyword() { + return { + type: "TSAnyKeyword" + }; +} +function tsBooleanKeyword() { + return { + type: "TSBooleanKeyword" + }; +} +function tsBigIntKeyword() { + return { + type: "TSBigIntKeyword" + }; +} +function tsIntrinsicKeyword() { + return { + type: "TSIntrinsicKeyword" + }; +} +function tsNeverKeyword() { + return { + type: "TSNeverKeyword" + }; +} +function tsNullKeyword() { + return { + type: "TSNullKeyword" + }; +} +function tsNumberKeyword() { + return { + type: "TSNumberKeyword" + }; +} +function tsObjectKeyword() { + return { + type: "TSObjectKeyword" + }; +} +function tsStringKeyword() { + return { + type: "TSStringKeyword" + }; +} +function tsSymbolKeyword() { + return { + type: "TSSymbolKeyword" + }; +} +function tsUndefinedKeyword() { + return { + type: "TSUndefinedKeyword" + }; +} +function tsUnknownKeyword() { + return { + type: "TSUnknownKeyword" + }; +} +function tsVoidKeyword() { + return { + type: "TSVoidKeyword" + }; +} +function tsThisType() { + return { + type: "TSThisType" + }; +} +function tsFunctionType(typeParameters = null, parameters, typeAnnotation = null) { + return (0, _validateNode.default)({ + type: "TSFunctionType", + typeParameters, + parameters, + typeAnnotation + }); +} +function tsConstructorType(typeParameters = null, parameters, typeAnnotation = null) { + return (0, _validateNode.default)({ + type: "TSConstructorType", + typeParameters, + parameters, + typeAnnotation + }); +} +function tsTypeReference(typeName, typeParameters = null) { + return (0, _validateNode.default)({ + type: "TSTypeReference", + typeName, + typeParameters + }); +} +function tsTypePredicate(parameterName, typeAnnotation = null, asserts = null) { + return (0, _validateNode.default)({ + type: "TSTypePredicate", + parameterName, + typeAnnotation, + asserts + }); +} +function tsTypeQuery(exprName, typeParameters = null) { + return (0, _validateNode.default)({ + type: "TSTypeQuery", + exprName, + typeParameters + }); +} +function tsTypeLiteral(members) { + return (0, _validateNode.default)({ + type: "TSTypeLiteral", + members + }); +} +function tsArrayType(elementType) { + return (0, _validateNode.default)({ + type: "TSArrayType", + elementType + }); +} +function tsTupleType(elementTypes) { + return (0, _validateNode.default)({ + type: "TSTupleType", + elementTypes + }); +} +function tsOptionalType(typeAnnotation) { + return (0, _validateNode.default)({ + type: "TSOptionalType", + typeAnnotation + }); +} +function tsRestType(typeAnnotation) { + return (0, _validateNode.default)({ + type: "TSRestType", + typeAnnotation + }); +} +function tsNamedTupleMember(label, elementType, optional = false) { + return (0, _validateNode.default)({ + type: "TSNamedTupleMember", + label, + elementType, + optional + }); +} +function tsUnionType(types) { + return (0, _validateNode.default)({ + type: "TSUnionType", + types + }); +} +function tsIntersectionType(types) { + return (0, _validateNode.default)({ + type: "TSIntersectionType", + types + }); +} +function tsConditionalType(checkType, extendsType, trueType, falseType) { + return (0, _validateNode.default)({ + type: "TSConditionalType", + checkType, + extendsType, + trueType, + falseType + }); +} +function tsInferType(typeParameter) { + return (0, _validateNode.default)({ + type: "TSInferType", + typeParameter + }); +} +function tsParenthesizedType(typeAnnotation) { + return (0, _validateNode.default)({ + type: "TSParenthesizedType", + typeAnnotation + }); +} +function tsTypeOperator(typeAnnotation) { + return (0, _validateNode.default)({ + type: "TSTypeOperator", + typeAnnotation, + operator: null + }); +} +function tsIndexedAccessType(objectType, indexType) { + return (0, _validateNode.default)({ + type: "TSIndexedAccessType", + objectType, + indexType + }); +} +function tsMappedType(typeParameter, typeAnnotation = null, nameType = null) { + return (0, _validateNode.default)({ + type: "TSMappedType", + typeParameter, + typeAnnotation, + nameType + }); +} +function tsLiteralType(literal) { + return (0, _validateNode.default)({ + type: "TSLiteralType", + literal + }); +} +function tsExpressionWithTypeArguments(expression, typeParameters = null) { + return (0, _validateNode.default)({ + type: "TSExpressionWithTypeArguments", + expression, + typeParameters + }); +} +function tsInterfaceDeclaration(id, typeParameters = null, _extends = null, body) { + return (0, _validateNode.default)({ + type: "TSInterfaceDeclaration", + id, + typeParameters, + extends: _extends, + body + }); +} +function tsInterfaceBody(body) { + return (0, _validateNode.default)({ + type: "TSInterfaceBody", + body + }); +} +function tsTypeAliasDeclaration(id, typeParameters = null, typeAnnotation) { + return (0, _validateNode.default)({ + type: "TSTypeAliasDeclaration", + id, + typeParameters, + typeAnnotation + }); +} +function tsInstantiationExpression(expression, typeParameters = null) { + return (0, _validateNode.default)({ + type: "TSInstantiationExpression", + expression, + typeParameters + }); +} +function tsAsExpression(expression, typeAnnotation) { + return (0, _validateNode.default)({ + type: "TSAsExpression", + expression, + typeAnnotation + }); +} +function tsSatisfiesExpression(expression, typeAnnotation) { + return (0, _validateNode.default)({ + type: "TSSatisfiesExpression", + expression, + typeAnnotation + }); +} +function tsTypeAssertion(typeAnnotation, expression) { + return (0, _validateNode.default)({ + type: "TSTypeAssertion", + typeAnnotation, + expression + }); +} +function tsEnumDeclaration(id, members) { + return (0, _validateNode.default)({ + type: "TSEnumDeclaration", + id, + members + }); +} +function tsEnumMember(id, initializer = null) { + return (0, _validateNode.default)({ + type: "TSEnumMember", + id, + initializer + }); +} +function tsModuleDeclaration(id, body) { + return (0, _validateNode.default)({ + type: "TSModuleDeclaration", + id, + body + }); +} +function tsModuleBlock(body) { + return (0, _validateNode.default)({ + type: "TSModuleBlock", + body + }); +} +function tsImportType(argument, qualifier = null, typeParameters = null) { + return (0, _validateNode.default)({ + type: "TSImportType", + argument, + qualifier, + typeParameters + }); +} +function tsImportEqualsDeclaration(id, moduleReference) { + return (0, _validateNode.default)({ + type: "TSImportEqualsDeclaration", + id, + moduleReference, + isExport: null + }); +} +function tsExternalModuleReference(expression) { + return (0, _validateNode.default)({ + type: "TSExternalModuleReference", + expression + }); +} +function tsNonNullExpression(expression) { + return (0, _validateNode.default)({ + type: "TSNonNullExpression", + expression + }); +} +function tsExportAssignment(expression) { + return (0, _validateNode.default)({ + type: "TSExportAssignment", + expression + }); +} +function tsNamespaceExportDeclaration(id) { + return (0, _validateNode.default)({ + type: "TSNamespaceExportDeclaration", + id + }); +} +function tsTypeAnnotation(typeAnnotation) { + return (0, _validateNode.default)({ + type: "TSTypeAnnotation", + typeAnnotation + }); +} +function tsTypeParameterInstantiation(params) { + return (0, _validateNode.default)({ + type: "TSTypeParameterInstantiation", + params + }); +} +function tsTypeParameterDeclaration(params) { + return (0, _validateNode.default)({ + type: "TSTypeParameterDeclaration", + params + }); +} +function tsTypeParameter(constraint = null, _default = null, name) { + return (0, _validateNode.default)({ + type: "TSTypeParameter", + constraint, + default: _default, + name + }); +} +function NumberLiteral(value) { + (0, _deprecationWarning.default)("NumberLiteral", "NumericLiteral", "The node type "); + return numericLiteral(value); +} +function RegexLiteral(pattern, flags = "") { + (0, _deprecationWarning.default)("RegexLiteral", "RegExpLiteral", "The node type "); + return regExpLiteral(pattern, flags); +} +function RestProperty(argument) { + (0, _deprecationWarning.default)("RestProperty", "RestElement", "The node type "); + return restElement(argument); +} +function SpreadProperty(argument) { + (0, _deprecationWarning.default)("SpreadProperty", "SpreadElement", "The node type "); + return spreadElement(argument); +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 3686: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "AnyTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.anyTypeAnnotation; + } +})); +Object.defineProperty(exports, "ArgumentPlaceholder", ({ + enumerable: true, + get: function () { + return _index.argumentPlaceholder; + } +})); +Object.defineProperty(exports, "ArrayExpression", ({ + enumerable: true, + get: function () { + return _index.arrayExpression; + } +})); +Object.defineProperty(exports, "ArrayPattern", ({ + enumerable: true, + get: function () { + return _index.arrayPattern; + } +})); +Object.defineProperty(exports, "ArrayTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.arrayTypeAnnotation; + } +})); +Object.defineProperty(exports, "ArrowFunctionExpression", ({ + enumerable: true, + get: function () { + return _index.arrowFunctionExpression; + } +})); +Object.defineProperty(exports, "AssignmentExpression", ({ + enumerable: true, + get: function () { + return _index.assignmentExpression; + } +})); +Object.defineProperty(exports, "AssignmentPattern", ({ + enumerable: true, + get: function () { + return _index.assignmentPattern; + } +})); +Object.defineProperty(exports, "AwaitExpression", ({ + enumerable: true, + get: function () { + return _index.awaitExpression; + } +})); +Object.defineProperty(exports, "BigIntLiteral", ({ + enumerable: true, + get: function () { + return _index.bigIntLiteral; + } +})); +Object.defineProperty(exports, "BinaryExpression", ({ + enumerable: true, + get: function () { + return _index.binaryExpression; + } +})); +Object.defineProperty(exports, "BindExpression", ({ + enumerable: true, + get: function () { + return _index.bindExpression; + } +})); +Object.defineProperty(exports, "BlockStatement", ({ + enumerable: true, + get: function () { + return _index.blockStatement; + } +})); +Object.defineProperty(exports, "BooleanLiteral", ({ + enumerable: true, + get: function () { + return _index.booleanLiteral; + } +})); +Object.defineProperty(exports, "BooleanLiteralTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.booleanLiteralTypeAnnotation; + } +})); +Object.defineProperty(exports, "BooleanTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.booleanTypeAnnotation; + } +})); +Object.defineProperty(exports, "BreakStatement", ({ + enumerable: true, + get: function () { + return _index.breakStatement; + } +})); +Object.defineProperty(exports, "CallExpression", ({ + enumerable: true, + get: function () { + return _index.callExpression; + } +})); +Object.defineProperty(exports, "CatchClause", ({ + enumerable: true, + get: function () { + return _index.catchClause; + } +})); +Object.defineProperty(exports, "ClassAccessorProperty", ({ + enumerable: true, + get: function () { + return _index.classAccessorProperty; + } +})); +Object.defineProperty(exports, "ClassBody", ({ + enumerable: true, + get: function () { + return _index.classBody; + } +})); +Object.defineProperty(exports, "ClassDeclaration", ({ + enumerable: true, + get: function () { + return _index.classDeclaration; + } +})); +Object.defineProperty(exports, "ClassExpression", ({ + enumerable: true, + get: function () { + return _index.classExpression; + } +})); +Object.defineProperty(exports, "ClassImplements", ({ + enumerable: true, + get: function () { + return _index.classImplements; + } +})); +Object.defineProperty(exports, "ClassMethod", ({ + enumerable: true, + get: function () { + return _index.classMethod; + } +})); +Object.defineProperty(exports, "ClassPrivateMethod", ({ + enumerable: true, + get: function () { + return _index.classPrivateMethod; + } +})); +Object.defineProperty(exports, "ClassPrivateProperty", ({ + enumerable: true, + get: function () { + return _index.classPrivateProperty; + } +})); +Object.defineProperty(exports, "ClassProperty", ({ + enumerable: true, + get: function () { + return _index.classProperty; + } +})); +Object.defineProperty(exports, "ConditionalExpression", ({ + enumerable: true, + get: function () { + return _index.conditionalExpression; + } +})); +Object.defineProperty(exports, "ContinueStatement", ({ + enumerable: true, + get: function () { + return _index.continueStatement; + } +})); +Object.defineProperty(exports, "DebuggerStatement", ({ + enumerable: true, + get: function () { + return _index.debuggerStatement; + } +})); +Object.defineProperty(exports, "DecimalLiteral", ({ + enumerable: true, + get: function () { + return _index.decimalLiteral; + } +})); +Object.defineProperty(exports, "DeclareClass", ({ + enumerable: true, + get: function () { + return _index.declareClass; + } +})); +Object.defineProperty(exports, "DeclareExportAllDeclaration", ({ + enumerable: true, + get: function () { + return _index.declareExportAllDeclaration; + } +})); +Object.defineProperty(exports, "DeclareExportDeclaration", ({ + enumerable: true, + get: function () { + return _index.declareExportDeclaration; + } +})); +Object.defineProperty(exports, "DeclareFunction", ({ + enumerable: true, + get: function () { + return _index.declareFunction; + } +})); +Object.defineProperty(exports, "DeclareInterface", ({ + enumerable: true, + get: function () { + return _index.declareInterface; + } +})); +Object.defineProperty(exports, "DeclareModule", ({ + enumerable: true, + get: function () { + return _index.declareModule; + } +})); +Object.defineProperty(exports, "DeclareModuleExports", ({ + enumerable: true, + get: function () { + return _index.declareModuleExports; + } +})); +Object.defineProperty(exports, "DeclareOpaqueType", ({ + enumerable: true, + get: function () { + return _index.declareOpaqueType; + } +})); +Object.defineProperty(exports, "DeclareTypeAlias", ({ + enumerable: true, + get: function () { + return _index.declareTypeAlias; + } +})); +Object.defineProperty(exports, "DeclareVariable", ({ + enumerable: true, + get: function () { + return _index.declareVariable; + } +})); +Object.defineProperty(exports, "DeclaredPredicate", ({ + enumerable: true, + get: function () { + return _index.declaredPredicate; + } +})); +Object.defineProperty(exports, "Decorator", ({ + enumerable: true, + get: function () { + return _index.decorator; + } +})); +Object.defineProperty(exports, "Directive", ({ + enumerable: true, + get: function () { + return _index.directive; + } +})); +Object.defineProperty(exports, "DirectiveLiteral", ({ + enumerable: true, + get: function () { + return _index.directiveLiteral; + } +})); +Object.defineProperty(exports, "DoExpression", ({ + enumerable: true, + get: function () { + return _index.doExpression; + } +})); +Object.defineProperty(exports, "DoWhileStatement", ({ + enumerable: true, + get: function () { + return _index.doWhileStatement; + } +})); +Object.defineProperty(exports, "EmptyStatement", ({ + enumerable: true, + get: function () { + return _index.emptyStatement; + } +})); +Object.defineProperty(exports, "EmptyTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.emptyTypeAnnotation; + } +})); +Object.defineProperty(exports, "EnumBooleanBody", ({ + enumerable: true, + get: function () { + return _index.enumBooleanBody; + } +})); +Object.defineProperty(exports, "EnumBooleanMember", ({ + enumerable: true, + get: function () { + return _index.enumBooleanMember; + } +})); +Object.defineProperty(exports, "EnumDeclaration", ({ + enumerable: true, + get: function () { + return _index.enumDeclaration; + } +})); +Object.defineProperty(exports, "EnumDefaultedMember", ({ + enumerable: true, + get: function () { + return _index.enumDefaultedMember; + } +})); +Object.defineProperty(exports, "EnumNumberBody", ({ + enumerable: true, + get: function () { + return _index.enumNumberBody; + } +})); +Object.defineProperty(exports, "EnumNumberMember", ({ + enumerable: true, + get: function () { + return _index.enumNumberMember; + } +})); +Object.defineProperty(exports, "EnumStringBody", ({ + enumerable: true, + get: function () { + return _index.enumStringBody; + } +})); +Object.defineProperty(exports, "EnumStringMember", ({ + enumerable: true, + get: function () { + return _index.enumStringMember; + } +})); +Object.defineProperty(exports, "EnumSymbolBody", ({ + enumerable: true, + get: function () { + return _index.enumSymbolBody; + } +})); +Object.defineProperty(exports, "ExistsTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.existsTypeAnnotation; + } +})); +Object.defineProperty(exports, "ExportAllDeclaration", ({ + enumerable: true, + get: function () { + return _index.exportAllDeclaration; + } +})); +Object.defineProperty(exports, "ExportDefaultDeclaration", ({ + enumerable: true, + get: function () { + return _index.exportDefaultDeclaration; + } +})); +Object.defineProperty(exports, "ExportDefaultSpecifier", ({ + enumerable: true, + get: function () { + return _index.exportDefaultSpecifier; + } +})); +Object.defineProperty(exports, "ExportNamedDeclaration", ({ + enumerable: true, + get: function () { + return _index.exportNamedDeclaration; + } +})); +Object.defineProperty(exports, "ExportNamespaceSpecifier", ({ + enumerable: true, + get: function () { + return _index.exportNamespaceSpecifier; + } +})); +Object.defineProperty(exports, "ExportSpecifier", ({ + enumerable: true, + get: function () { + return _index.exportSpecifier; + } +})); +Object.defineProperty(exports, "ExpressionStatement", ({ + enumerable: true, + get: function () { + return _index.expressionStatement; + } +})); +Object.defineProperty(exports, "File", ({ + enumerable: true, + get: function () { + return _index.file; + } +})); +Object.defineProperty(exports, "ForInStatement", ({ + enumerable: true, + get: function () { + return _index.forInStatement; + } +})); +Object.defineProperty(exports, "ForOfStatement", ({ + enumerable: true, + get: function () { + return _index.forOfStatement; + } +})); +Object.defineProperty(exports, "ForStatement", ({ + enumerable: true, + get: function () { + return _index.forStatement; + } +})); +Object.defineProperty(exports, "FunctionDeclaration", ({ + enumerable: true, + get: function () { + return _index.functionDeclaration; + } +})); +Object.defineProperty(exports, "FunctionExpression", ({ + enumerable: true, + get: function () { + return _index.functionExpression; + } +})); +Object.defineProperty(exports, "FunctionTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.functionTypeAnnotation; + } +})); +Object.defineProperty(exports, "FunctionTypeParam", ({ + enumerable: true, + get: function () { + return _index.functionTypeParam; + } +})); +Object.defineProperty(exports, "GenericTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.genericTypeAnnotation; + } +})); +Object.defineProperty(exports, "Identifier", ({ + enumerable: true, + get: function () { + return _index.identifier; + } +})); +Object.defineProperty(exports, "IfStatement", ({ + enumerable: true, + get: function () { + return _index.ifStatement; + } +})); +Object.defineProperty(exports, "Import", ({ + enumerable: true, + get: function () { + return _index.import; + } +})); +Object.defineProperty(exports, "ImportAttribute", ({ + enumerable: true, + get: function () { + return _index.importAttribute; + } +})); +Object.defineProperty(exports, "ImportDeclaration", ({ + enumerable: true, + get: function () { + return _index.importDeclaration; + } +})); +Object.defineProperty(exports, "ImportDefaultSpecifier", ({ + enumerable: true, + get: function () { + return _index.importDefaultSpecifier; + } +})); +Object.defineProperty(exports, "ImportNamespaceSpecifier", ({ + enumerable: true, + get: function () { + return _index.importNamespaceSpecifier; + } +})); +Object.defineProperty(exports, "ImportSpecifier", ({ + enumerable: true, + get: function () { + return _index.importSpecifier; + } +})); +Object.defineProperty(exports, "IndexedAccessType", ({ + enumerable: true, + get: function () { + return _index.indexedAccessType; + } +})); +Object.defineProperty(exports, "InferredPredicate", ({ + enumerable: true, + get: function () { + return _index.inferredPredicate; + } +})); +Object.defineProperty(exports, "InterfaceDeclaration", ({ + enumerable: true, + get: function () { + return _index.interfaceDeclaration; + } +})); +Object.defineProperty(exports, "InterfaceExtends", ({ + enumerable: true, + get: function () { + return _index.interfaceExtends; + } +})); +Object.defineProperty(exports, "InterfaceTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.interfaceTypeAnnotation; + } +})); +Object.defineProperty(exports, "InterpreterDirective", ({ + enumerable: true, + get: function () { + return _index.interpreterDirective; + } +})); +Object.defineProperty(exports, "IntersectionTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.intersectionTypeAnnotation; + } +})); +Object.defineProperty(exports, "JSXAttribute", ({ + enumerable: true, + get: function () { + return _index.jsxAttribute; + } +})); +Object.defineProperty(exports, "JSXClosingElement", ({ + enumerable: true, + get: function () { + return _index.jsxClosingElement; + } +})); +Object.defineProperty(exports, "JSXClosingFragment", ({ + enumerable: true, + get: function () { + return _index.jsxClosingFragment; + } +})); +Object.defineProperty(exports, "JSXElement", ({ + enumerable: true, + get: function () { + return _index.jsxElement; + } +})); +Object.defineProperty(exports, "JSXEmptyExpression", ({ + enumerable: true, + get: function () { + return _index.jsxEmptyExpression; + } +})); +Object.defineProperty(exports, "JSXExpressionContainer", ({ + enumerable: true, + get: function () { + return _index.jsxExpressionContainer; + } +})); +Object.defineProperty(exports, "JSXFragment", ({ + enumerable: true, + get: function () { + return _index.jsxFragment; + } +})); +Object.defineProperty(exports, "JSXIdentifier", ({ + enumerable: true, + get: function () { + return _index.jsxIdentifier; + } +})); +Object.defineProperty(exports, "JSXMemberExpression", ({ + enumerable: true, + get: function () { + return _index.jsxMemberExpression; + } +})); +Object.defineProperty(exports, "JSXNamespacedName", ({ + enumerable: true, + get: function () { + return _index.jsxNamespacedName; + } +})); +Object.defineProperty(exports, "JSXOpeningElement", ({ + enumerable: true, + get: function () { + return _index.jsxOpeningElement; + } +})); +Object.defineProperty(exports, "JSXOpeningFragment", ({ + enumerable: true, + get: function () { + return _index.jsxOpeningFragment; + } +})); +Object.defineProperty(exports, "JSXSpreadAttribute", ({ + enumerable: true, + get: function () { + return _index.jsxSpreadAttribute; + } +})); +Object.defineProperty(exports, "JSXSpreadChild", ({ + enumerable: true, + get: function () { + return _index.jsxSpreadChild; + } +})); +Object.defineProperty(exports, "JSXText", ({ + enumerable: true, + get: function () { + return _index.jsxText; + } +})); +Object.defineProperty(exports, "LabeledStatement", ({ + enumerable: true, + get: function () { + return _index.labeledStatement; + } +})); +Object.defineProperty(exports, "LogicalExpression", ({ + enumerable: true, + get: function () { + return _index.logicalExpression; + } +})); +Object.defineProperty(exports, "MemberExpression", ({ + enumerable: true, + get: function () { + return _index.memberExpression; + } +})); +Object.defineProperty(exports, "MetaProperty", ({ + enumerable: true, + get: function () { + return _index.metaProperty; + } +})); +Object.defineProperty(exports, "MixedTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.mixedTypeAnnotation; + } +})); +Object.defineProperty(exports, "ModuleExpression", ({ + enumerable: true, + get: function () { + return _index.moduleExpression; + } +})); +Object.defineProperty(exports, "NewExpression", ({ + enumerable: true, + get: function () { + return _index.newExpression; + } +})); +Object.defineProperty(exports, "Noop", ({ + enumerable: true, + get: function () { + return _index.noop; + } +})); +Object.defineProperty(exports, "NullLiteral", ({ + enumerable: true, + get: function () { + return _index.nullLiteral; + } +})); +Object.defineProperty(exports, "NullLiteralTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.nullLiteralTypeAnnotation; + } +})); +Object.defineProperty(exports, "NullableTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.nullableTypeAnnotation; + } +})); +Object.defineProperty(exports, "NumberLiteral", ({ + enumerable: true, + get: function () { + return _index.numberLiteral; + } +})); +Object.defineProperty(exports, "NumberLiteralTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.numberLiteralTypeAnnotation; + } +})); +Object.defineProperty(exports, "NumberTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.numberTypeAnnotation; + } +})); +Object.defineProperty(exports, "NumericLiteral", ({ + enumerable: true, + get: function () { + return _index.numericLiteral; + } +})); +Object.defineProperty(exports, "ObjectExpression", ({ + enumerable: true, + get: function () { + return _index.objectExpression; + } +})); +Object.defineProperty(exports, "ObjectMethod", ({ + enumerable: true, + get: function () { + return _index.objectMethod; + } +})); +Object.defineProperty(exports, "ObjectPattern", ({ + enumerable: true, + get: function () { + return _index.objectPattern; + } +})); +Object.defineProperty(exports, "ObjectProperty", ({ + enumerable: true, + get: function () { + return _index.objectProperty; + } +})); +Object.defineProperty(exports, "ObjectTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.objectTypeAnnotation; + } +})); +Object.defineProperty(exports, "ObjectTypeCallProperty", ({ + enumerable: true, + get: function () { + return _index.objectTypeCallProperty; + } +})); +Object.defineProperty(exports, "ObjectTypeIndexer", ({ + enumerable: true, + get: function () { + return _index.objectTypeIndexer; + } +})); +Object.defineProperty(exports, "ObjectTypeInternalSlot", ({ + enumerable: true, + get: function () { + return _index.objectTypeInternalSlot; + } +})); +Object.defineProperty(exports, "ObjectTypeProperty", ({ + enumerable: true, + get: function () { + return _index.objectTypeProperty; + } +})); +Object.defineProperty(exports, "ObjectTypeSpreadProperty", ({ + enumerable: true, + get: function () { + return _index.objectTypeSpreadProperty; + } +})); +Object.defineProperty(exports, "OpaqueType", ({ + enumerable: true, + get: function () { + return _index.opaqueType; + } +})); +Object.defineProperty(exports, "OptionalCallExpression", ({ + enumerable: true, + get: function () { + return _index.optionalCallExpression; + } +})); +Object.defineProperty(exports, "OptionalIndexedAccessType", ({ + enumerable: true, + get: function () { + return _index.optionalIndexedAccessType; + } +})); +Object.defineProperty(exports, "OptionalMemberExpression", ({ + enumerable: true, + get: function () { + return _index.optionalMemberExpression; + } +})); +Object.defineProperty(exports, "ParenthesizedExpression", ({ + enumerable: true, + get: function () { + return _index.parenthesizedExpression; + } +})); +Object.defineProperty(exports, "PipelineBareFunction", ({ + enumerable: true, + get: function () { + return _index.pipelineBareFunction; + } +})); +Object.defineProperty(exports, "PipelinePrimaryTopicReference", ({ + enumerable: true, + get: function () { + return _index.pipelinePrimaryTopicReference; + } +})); +Object.defineProperty(exports, "PipelineTopicExpression", ({ + enumerable: true, + get: function () { + return _index.pipelineTopicExpression; + } +})); +Object.defineProperty(exports, "Placeholder", ({ + enumerable: true, + get: function () { + return _index.placeholder; + } +})); +Object.defineProperty(exports, "PrivateName", ({ + enumerable: true, + get: function () { + return _index.privateName; + } +})); +Object.defineProperty(exports, "Program", ({ + enumerable: true, + get: function () { + return _index.program; + } +})); +Object.defineProperty(exports, "QualifiedTypeIdentifier", ({ + enumerable: true, + get: function () { + return _index.qualifiedTypeIdentifier; + } +})); +Object.defineProperty(exports, "RecordExpression", ({ + enumerable: true, + get: function () { + return _index.recordExpression; + } +})); +Object.defineProperty(exports, "RegExpLiteral", ({ + enumerable: true, + get: function () { + return _index.regExpLiteral; + } +})); +Object.defineProperty(exports, "RegexLiteral", ({ + enumerable: true, + get: function () { + return _index.regexLiteral; + } +})); +Object.defineProperty(exports, "RestElement", ({ + enumerable: true, + get: function () { + return _index.restElement; + } +})); +Object.defineProperty(exports, "RestProperty", ({ + enumerable: true, + get: function () { + return _index.restProperty; + } +})); +Object.defineProperty(exports, "ReturnStatement", ({ + enumerable: true, + get: function () { + return _index.returnStatement; + } +})); +Object.defineProperty(exports, "SequenceExpression", ({ + enumerable: true, + get: function () { + return _index.sequenceExpression; + } +})); +Object.defineProperty(exports, "SpreadElement", ({ + enumerable: true, + get: function () { + return _index.spreadElement; + } +})); +Object.defineProperty(exports, "SpreadProperty", ({ + enumerable: true, + get: function () { + return _index.spreadProperty; + } +})); +Object.defineProperty(exports, "StaticBlock", ({ + enumerable: true, + get: function () { + return _index.staticBlock; + } +})); +Object.defineProperty(exports, "StringLiteral", ({ + enumerable: true, + get: function () { + return _index.stringLiteral; + } +})); +Object.defineProperty(exports, "StringLiteralTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.stringLiteralTypeAnnotation; + } +})); +Object.defineProperty(exports, "StringTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.stringTypeAnnotation; + } +})); +Object.defineProperty(exports, "Super", ({ + enumerable: true, + get: function () { + return _index.super; + } +})); +Object.defineProperty(exports, "SwitchCase", ({ + enumerable: true, + get: function () { + return _index.switchCase; + } +})); +Object.defineProperty(exports, "SwitchStatement", ({ + enumerable: true, + get: function () { + return _index.switchStatement; + } +})); +Object.defineProperty(exports, "SymbolTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.symbolTypeAnnotation; + } +})); +Object.defineProperty(exports, "TSAnyKeyword", ({ + enumerable: true, + get: function () { + return _index.tsAnyKeyword; + } +})); +Object.defineProperty(exports, "TSArrayType", ({ + enumerable: true, + get: function () { + return _index.tsArrayType; + } +})); +Object.defineProperty(exports, "TSAsExpression", ({ + enumerable: true, + get: function () { + return _index.tsAsExpression; + } +})); +Object.defineProperty(exports, "TSBigIntKeyword", ({ + enumerable: true, + get: function () { + return _index.tsBigIntKeyword; + } +})); +Object.defineProperty(exports, "TSBooleanKeyword", ({ + enumerable: true, + get: function () { + return _index.tsBooleanKeyword; + } +})); +Object.defineProperty(exports, "TSCallSignatureDeclaration", ({ + enumerable: true, + get: function () { + return _index.tsCallSignatureDeclaration; + } +})); +Object.defineProperty(exports, "TSConditionalType", ({ + enumerable: true, + get: function () { + return _index.tsConditionalType; + } +})); +Object.defineProperty(exports, "TSConstructSignatureDeclaration", ({ + enumerable: true, + get: function () { + return _index.tsConstructSignatureDeclaration; + } +})); +Object.defineProperty(exports, "TSConstructorType", ({ + enumerable: true, + get: function () { + return _index.tsConstructorType; + } +})); +Object.defineProperty(exports, "TSDeclareFunction", ({ + enumerable: true, + get: function () { + return _index.tsDeclareFunction; + } +})); +Object.defineProperty(exports, "TSDeclareMethod", ({ + enumerable: true, + get: function () { + return _index.tsDeclareMethod; + } +})); +Object.defineProperty(exports, "TSEnumDeclaration", ({ + enumerable: true, + get: function () { + return _index.tsEnumDeclaration; + } +})); +Object.defineProperty(exports, "TSEnumMember", ({ + enumerable: true, + get: function () { + return _index.tsEnumMember; + } +})); +Object.defineProperty(exports, "TSExportAssignment", ({ + enumerable: true, + get: function () { + return _index.tsExportAssignment; + } +})); +Object.defineProperty(exports, "TSExpressionWithTypeArguments", ({ + enumerable: true, + get: function () { + return _index.tsExpressionWithTypeArguments; + } +})); +Object.defineProperty(exports, "TSExternalModuleReference", ({ + enumerable: true, + get: function () { + return _index.tsExternalModuleReference; + } +})); +Object.defineProperty(exports, "TSFunctionType", ({ + enumerable: true, + get: function () { + return _index.tsFunctionType; + } +})); +Object.defineProperty(exports, "TSImportEqualsDeclaration", ({ + enumerable: true, + get: function () { + return _index.tsImportEqualsDeclaration; + } +})); +Object.defineProperty(exports, "TSImportType", ({ + enumerable: true, + get: function () { + return _index.tsImportType; + } +})); +Object.defineProperty(exports, "TSIndexSignature", ({ + enumerable: true, + get: function () { + return _index.tsIndexSignature; + } +})); +Object.defineProperty(exports, "TSIndexedAccessType", ({ + enumerable: true, + get: function () { + return _index.tsIndexedAccessType; + } +})); +Object.defineProperty(exports, "TSInferType", ({ + enumerable: true, + get: function () { + return _index.tsInferType; + } +})); +Object.defineProperty(exports, "TSInstantiationExpression", ({ + enumerable: true, + get: function () { + return _index.tsInstantiationExpression; + } +})); +Object.defineProperty(exports, "TSInterfaceBody", ({ + enumerable: true, + get: function () { + return _index.tsInterfaceBody; + } +})); +Object.defineProperty(exports, "TSInterfaceDeclaration", ({ + enumerable: true, + get: function () { + return _index.tsInterfaceDeclaration; + } +})); +Object.defineProperty(exports, "TSIntersectionType", ({ + enumerable: true, + get: function () { + return _index.tsIntersectionType; + } +})); +Object.defineProperty(exports, "TSIntrinsicKeyword", ({ + enumerable: true, + get: function () { + return _index.tsIntrinsicKeyword; + } +})); +Object.defineProperty(exports, "TSLiteralType", ({ + enumerable: true, + get: function () { + return _index.tsLiteralType; + } +})); +Object.defineProperty(exports, "TSMappedType", ({ + enumerable: true, + get: function () { + return _index.tsMappedType; + } +})); +Object.defineProperty(exports, "TSMethodSignature", ({ + enumerable: true, + get: function () { + return _index.tsMethodSignature; + } +})); +Object.defineProperty(exports, "TSModuleBlock", ({ + enumerable: true, + get: function () { + return _index.tsModuleBlock; + } +})); +Object.defineProperty(exports, "TSModuleDeclaration", ({ + enumerable: true, + get: function () { + return _index.tsModuleDeclaration; + } +})); +Object.defineProperty(exports, "TSNamedTupleMember", ({ + enumerable: true, + get: function () { + return _index.tsNamedTupleMember; + } +})); +Object.defineProperty(exports, "TSNamespaceExportDeclaration", ({ + enumerable: true, + get: function () { + return _index.tsNamespaceExportDeclaration; + } +})); +Object.defineProperty(exports, "TSNeverKeyword", ({ + enumerable: true, + get: function () { + return _index.tsNeverKeyword; + } +})); +Object.defineProperty(exports, "TSNonNullExpression", ({ + enumerable: true, + get: function () { + return _index.tsNonNullExpression; + } +})); +Object.defineProperty(exports, "TSNullKeyword", ({ + enumerable: true, + get: function () { + return _index.tsNullKeyword; + } +})); +Object.defineProperty(exports, "TSNumberKeyword", ({ + enumerable: true, + get: function () { + return _index.tsNumberKeyword; + } +})); +Object.defineProperty(exports, "TSObjectKeyword", ({ + enumerable: true, + get: function () { + return _index.tsObjectKeyword; + } +})); +Object.defineProperty(exports, "TSOptionalType", ({ + enumerable: true, + get: function () { + return _index.tsOptionalType; + } +})); +Object.defineProperty(exports, "TSParameterProperty", ({ + enumerable: true, + get: function () { + return _index.tsParameterProperty; + } +})); +Object.defineProperty(exports, "TSParenthesizedType", ({ + enumerable: true, + get: function () { + return _index.tsParenthesizedType; + } +})); +Object.defineProperty(exports, "TSPropertySignature", ({ + enumerable: true, + get: function () { + return _index.tsPropertySignature; + } +})); +Object.defineProperty(exports, "TSQualifiedName", ({ + enumerable: true, + get: function () { + return _index.tsQualifiedName; + } +})); +Object.defineProperty(exports, "TSRestType", ({ + enumerable: true, + get: function () { + return _index.tsRestType; + } +})); +Object.defineProperty(exports, "TSSatisfiesExpression", ({ + enumerable: true, + get: function () { + return _index.tsSatisfiesExpression; + } +})); +Object.defineProperty(exports, "TSStringKeyword", ({ + enumerable: true, + get: function () { + return _index.tsStringKeyword; + } +})); +Object.defineProperty(exports, "TSSymbolKeyword", ({ + enumerable: true, + get: function () { + return _index.tsSymbolKeyword; + } +})); +Object.defineProperty(exports, "TSThisType", ({ + enumerable: true, + get: function () { + return _index.tsThisType; + } +})); +Object.defineProperty(exports, "TSTupleType", ({ + enumerable: true, + get: function () { + return _index.tsTupleType; + } +})); +Object.defineProperty(exports, "TSTypeAliasDeclaration", ({ + enumerable: true, + get: function () { + return _index.tsTypeAliasDeclaration; + } +})); +Object.defineProperty(exports, "TSTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.tsTypeAnnotation; + } +})); +Object.defineProperty(exports, "TSTypeAssertion", ({ + enumerable: true, + get: function () { + return _index.tsTypeAssertion; + } +})); +Object.defineProperty(exports, "TSTypeLiteral", ({ + enumerable: true, + get: function () { + return _index.tsTypeLiteral; + } +})); +Object.defineProperty(exports, "TSTypeOperator", ({ + enumerable: true, + get: function () { + return _index.tsTypeOperator; + } +})); +Object.defineProperty(exports, "TSTypeParameter", ({ + enumerable: true, + get: function () { + return _index.tsTypeParameter; + } +})); +Object.defineProperty(exports, "TSTypeParameterDeclaration", ({ + enumerable: true, + get: function () { + return _index.tsTypeParameterDeclaration; + } +})); +Object.defineProperty(exports, "TSTypeParameterInstantiation", ({ + enumerable: true, + get: function () { + return _index.tsTypeParameterInstantiation; + } +})); +Object.defineProperty(exports, "TSTypePredicate", ({ + enumerable: true, + get: function () { + return _index.tsTypePredicate; + } +})); +Object.defineProperty(exports, "TSTypeQuery", ({ + enumerable: true, + get: function () { + return _index.tsTypeQuery; + } +})); +Object.defineProperty(exports, "TSTypeReference", ({ + enumerable: true, + get: function () { + return _index.tsTypeReference; + } +})); +Object.defineProperty(exports, "TSUndefinedKeyword", ({ + enumerable: true, + get: function () { + return _index.tsUndefinedKeyword; + } +})); +Object.defineProperty(exports, "TSUnionType", ({ + enumerable: true, + get: function () { + return _index.tsUnionType; + } +})); +Object.defineProperty(exports, "TSUnknownKeyword", ({ + enumerable: true, + get: function () { + return _index.tsUnknownKeyword; + } +})); +Object.defineProperty(exports, "TSVoidKeyword", ({ + enumerable: true, + get: function () { + return _index.tsVoidKeyword; + } +})); +Object.defineProperty(exports, "TaggedTemplateExpression", ({ + enumerable: true, + get: function () { + return _index.taggedTemplateExpression; + } +})); +Object.defineProperty(exports, "TemplateElement", ({ + enumerable: true, + get: function () { + return _index.templateElement; + } +})); +Object.defineProperty(exports, "TemplateLiteral", ({ + enumerable: true, + get: function () { + return _index.templateLiteral; + } +})); +Object.defineProperty(exports, "ThisExpression", ({ + enumerable: true, + get: function () { + return _index.thisExpression; + } +})); +Object.defineProperty(exports, "ThisTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.thisTypeAnnotation; + } +})); +Object.defineProperty(exports, "ThrowStatement", ({ + enumerable: true, + get: function () { + return _index.throwStatement; + } +})); +Object.defineProperty(exports, "TopicReference", ({ + enumerable: true, + get: function () { + return _index.topicReference; + } +})); +Object.defineProperty(exports, "TryStatement", ({ + enumerable: true, + get: function () { + return _index.tryStatement; + } +})); +Object.defineProperty(exports, "TupleExpression", ({ + enumerable: true, + get: function () { + return _index.tupleExpression; + } +})); +Object.defineProperty(exports, "TupleTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.tupleTypeAnnotation; + } +})); +Object.defineProperty(exports, "TypeAlias", ({ + enumerable: true, + get: function () { + return _index.typeAlias; + } +})); +Object.defineProperty(exports, "TypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.typeAnnotation; + } +})); +Object.defineProperty(exports, "TypeCastExpression", ({ + enumerable: true, + get: function () { + return _index.typeCastExpression; + } +})); +Object.defineProperty(exports, "TypeParameter", ({ + enumerable: true, + get: function () { + return _index.typeParameter; + } +})); +Object.defineProperty(exports, "TypeParameterDeclaration", ({ + enumerable: true, + get: function () { + return _index.typeParameterDeclaration; + } +})); +Object.defineProperty(exports, "TypeParameterInstantiation", ({ + enumerable: true, + get: function () { + return _index.typeParameterInstantiation; + } +})); +Object.defineProperty(exports, "TypeofTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.typeofTypeAnnotation; + } +})); +Object.defineProperty(exports, "UnaryExpression", ({ + enumerable: true, + get: function () { + return _index.unaryExpression; + } +})); +Object.defineProperty(exports, "UnionTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.unionTypeAnnotation; + } +})); +Object.defineProperty(exports, "UpdateExpression", ({ + enumerable: true, + get: function () { + return _index.updateExpression; + } +})); +Object.defineProperty(exports, "V8IntrinsicIdentifier", ({ + enumerable: true, + get: function () { + return _index.v8IntrinsicIdentifier; + } +})); +Object.defineProperty(exports, "VariableDeclaration", ({ + enumerable: true, + get: function () { + return _index.variableDeclaration; + } +})); +Object.defineProperty(exports, "VariableDeclarator", ({ + enumerable: true, + get: function () { + return _index.variableDeclarator; + } +})); +Object.defineProperty(exports, "Variance", ({ + enumerable: true, + get: function () { + return _index.variance; + } +})); +Object.defineProperty(exports, "VoidTypeAnnotation", ({ + enumerable: true, + get: function () { + return _index.voidTypeAnnotation; + } +})); +Object.defineProperty(exports, "WhileStatement", ({ + enumerable: true, + get: function () { + return _index.whileStatement; + } +})); +Object.defineProperty(exports, "WithStatement", ({ + enumerable: true, + get: function () { + return _index.withStatement; + } +})); +Object.defineProperty(exports, "YieldExpression", ({ + enumerable: true, + get: function () { + return _index.yieldExpression; + } +})); +var _index = __nccwpck_require__(4485); + +//# sourceMappingURL=uppercase.js.map + + +/***/ }), + +/***/ 194: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = buildChildren; +var _index = __nccwpck_require__(2538); +var _cleanJSXElementLiteralChild = __nccwpck_require__(4022); +function buildChildren(node) { + const elements = []; + for (let i = 0; i < node.children.length; i++) { + let child = node.children[i]; + if ((0, _index.isJSXText)(child)) { + (0, _cleanJSXElementLiteralChild.default)(child, elements); + continue; + } + if ((0, _index.isJSXExpressionContainer)(child)) child = child.expression; + if ((0, _index.isJSXEmptyExpression)(child)) continue; + elements.push(child); + } + return elements; +} + +//# sourceMappingURL=buildChildren.js.map + + +/***/ }), + +/***/ 7972: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = createTSUnionType; +var _index = __nccwpck_require__(4485); +var _removeTypeDuplicates = __nccwpck_require__(4210); +var _index2 = __nccwpck_require__(2538); +function createTSUnionType(typeAnnotations) { + const types = typeAnnotations.map(type => { + return (0, _index2.isTSTypeAnnotation)(type) ? type.typeAnnotation : type; + }); + const flattened = (0, _removeTypeDuplicates.default)(types); + if (flattened.length === 1) { + return flattened[0]; + } else { + return (0, _index.tsUnionType)(flattened); + } +} + +//# sourceMappingURL=createTSUnionType.js.map + + +/***/ }), + +/***/ 4916: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = validateNode; +var _validate = __nccwpck_require__(826); +var _index = __nccwpck_require__(7012); +function validateNode(node) { + const keys = _index.BUILDER_KEYS[node.type]; + for (const key of keys) { + (0, _validate.default)(node, key, node[key]); + } + return node; +} + +//# sourceMappingURL=validateNode.js.map + + +/***/ }), + +/***/ 4564: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = clone; +var _cloneNode = __nccwpck_require__(7649); +function clone(node) { + return (0, _cloneNode.default)(node, false); +} + +//# sourceMappingURL=clone.js.map + + +/***/ }), + +/***/ 6655: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = cloneDeep; +var _cloneNode = __nccwpck_require__(7649); +function cloneDeep(node) { + return (0, _cloneNode.default)(node); +} + +//# sourceMappingURL=cloneDeep.js.map + + +/***/ }), + +/***/ 1846: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = cloneDeepWithoutLoc; +var _cloneNode = __nccwpck_require__(7649); +function cloneDeepWithoutLoc(node) { + return (0, _cloneNode.default)(node, true, true); +} + +//# sourceMappingURL=cloneDeepWithoutLoc.js.map + + +/***/ }), + +/***/ 7649: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = cloneNode; +var _index = __nccwpck_require__(8774); +var _index2 = __nccwpck_require__(2538); +const has = Function.call.bind(Object.prototype.hasOwnProperty); +function cloneIfNode(obj, deep, withoutLoc, commentsCache) { + if (obj && typeof obj.type === "string") { + return cloneNodeInternal(obj, deep, withoutLoc, commentsCache); + } + return obj; +} +function cloneIfNodeOrArray(obj, deep, withoutLoc, commentsCache) { + if (Array.isArray(obj)) { + return obj.map(node => cloneIfNode(node, deep, withoutLoc, commentsCache)); + } + return cloneIfNode(obj, deep, withoutLoc, commentsCache); +} +function cloneNode(node, deep = true, withoutLoc = false) { + return cloneNodeInternal(node, deep, withoutLoc, new Map()); +} +function cloneNodeInternal(node, deep = true, withoutLoc = false, commentsCache) { + if (!node) return node; + const { + type + } = node; + const newNode = { + type: node.type + }; + if ((0, _index2.isIdentifier)(node)) { + newNode.name = node.name; + if (has(node, "optional") && typeof node.optional === "boolean") { + newNode.optional = node.optional; + } + if (has(node, "typeAnnotation")) { + newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true, withoutLoc, commentsCache) : node.typeAnnotation; + } + } else if (!has(_index.NODE_FIELDS, type)) { + throw new Error(`Unknown node type: "${type}"`); + } else { + for (const field of Object.keys(_index.NODE_FIELDS[type])) { + if (has(node, field)) { + if (deep) { + newNode[field] = (0, _index2.isFile)(node) && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc, commentsCache) : cloneIfNodeOrArray(node[field], true, withoutLoc, commentsCache); + } else { + newNode[field] = node[field]; + } + } + } + } + if (has(node, "loc")) { + if (withoutLoc) { + newNode.loc = null; + } else { + newNode.loc = node.loc; + } + } + if (has(node, "leadingComments")) { + newNode.leadingComments = maybeCloneComments(node.leadingComments, deep, withoutLoc, commentsCache); + } + if (has(node, "innerComments")) { + newNode.innerComments = maybeCloneComments(node.innerComments, deep, withoutLoc, commentsCache); + } + if (has(node, "trailingComments")) { + newNode.trailingComments = maybeCloneComments(node.trailingComments, deep, withoutLoc, commentsCache); + } + if (has(node, "extra")) { + newNode.extra = Object.assign({}, node.extra); + } + return newNode; +} +function maybeCloneComments(comments, deep, withoutLoc, commentsCache) { + if (!comments || !deep) { + return comments; + } + return comments.map(comment => { + const cache = commentsCache.get(comment); + if (cache) return cache; + const { + type, + value, + loc + } = comment; + const ret = { + type, + value, + loc + }; + if (withoutLoc) { + ret.loc = null; + } + commentsCache.set(comment, ret); + return ret; + }); +} + +//# sourceMappingURL=cloneNode.js.map + + +/***/ }), + +/***/ 9542: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = cloneWithoutLoc; +var _cloneNode = __nccwpck_require__(7649); +function cloneWithoutLoc(node) { + return (0, _cloneNode.default)(node, false, true); +} + +//# sourceMappingURL=cloneWithoutLoc.js.map + + +/***/ }), + +/***/ 9574: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = addComment; +var _addComments = __nccwpck_require__(9866); +function addComment(node, type, content, line) { + return (0, _addComments.default)(node, type, [{ + type: line ? "CommentLine" : "CommentBlock", + value: content + }]); +} + +//# sourceMappingURL=addComment.js.map + + +/***/ }), + +/***/ 9866: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = addComments; +function addComments(node, type, comments) { + if (!comments || !node) return node; + const key = `${type}Comments`; + if (node[key]) { + if (type === "leading") { + node[key] = comments.concat(node[key]); + } else { + node[key].push(...comments); + } + } else { + node[key] = comments; + } + return node; +} + +//# sourceMappingURL=addComments.js.map + + +/***/ }), + +/***/ 7209: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = inheritInnerComments; +var _inherit = __nccwpck_require__(8559); +function inheritInnerComments(child, parent) { + (0, _inherit.default)("innerComments", child, parent); +} + +//# sourceMappingURL=inheritInnerComments.js.map + + +/***/ }), + +/***/ 6129: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = inheritLeadingComments; +var _inherit = __nccwpck_require__(8559); +function inheritLeadingComments(child, parent) { + (0, _inherit.default)("leadingComments", child, parent); +} + +//# sourceMappingURL=inheritLeadingComments.js.map + + +/***/ }), + +/***/ 4700: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = inheritTrailingComments; +var _inherit = __nccwpck_require__(8559); +function inheritTrailingComments(child, parent) { + (0, _inherit.default)("trailingComments", child, parent); +} + +//# sourceMappingURL=inheritTrailingComments.js.map + + +/***/ }), + +/***/ 899: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = inheritsComments; +var _inheritTrailingComments = __nccwpck_require__(4700); +var _inheritLeadingComments = __nccwpck_require__(6129); +var _inheritInnerComments = __nccwpck_require__(7209); +function inheritsComments(child, parent) { + (0, _inheritTrailingComments.default)(child, parent); + (0, _inheritLeadingComments.default)(child, parent); + (0, _inheritInnerComments.default)(child, parent); + return child; +} + +//# sourceMappingURL=inheritsComments.js.map + + +/***/ }), + +/***/ 6575: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = removeComments; +var _index = __nccwpck_require__(7297); +function removeComments(node) { + _index.COMMENT_KEYS.forEach(key => { + node[key] = null; + }); + return node; +} + +//# sourceMappingURL=removeComments.js.map + + +/***/ }), + +/***/ 1253: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.WHILE_TYPES = exports.USERWHITESPACABLE_TYPES = exports.UNARYLIKE_TYPES = exports.TYPESCRIPT_TYPES = exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.TSENTITYNAME_TYPES = exports.TSBASETYPE_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.STANDARDIZED_TYPES = exports.SCOPABLE_TYPES = exports.PUREISH_TYPES = exports.PROPERTY_TYPES = exports.PRIVATE_TYPES = exports.PATTERN_TYPES = exports.PATTERNLIKE_TYPES = exports.OBJECTMEMBER_TYPES = exports.MODULESPECIFIER_TYPES = exports.MODULEDECLARATION_TYPES = exports.MISCELLANEOUS_TYPES = exports.METHOD_TYPES = exports.LVAL_TYPES = exports.LOOP_TYPES = exports.LITERAL_TYPES = exports.JSX_TYPES = exports.IMPORTOREXPORTDECLARATION_TYPES = exports.IMMUTABLE_TYPES = exports.FUNCTION_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FOR_TYPES = exports.FORXSTATEMENT_TYPES = exports.FLOW_TYPES = exports.FLOWTYPE_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.EXPRESSION_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.DECLARATION_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.CLASS_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.BINARY_TYPES = exports.ACCESSOR_TYPES = void 0; +var _index = __nccwpck_require__(8774); +const STANDARDIZED_TYPES = _index.FLIPPED_ALIAS_KEYS["Standardized"]; +exports.STANDARDIZED_TYPES = STANDARDIZED_TYPES; +const EXPRESSION_TYPES = _index.FLIPPED_ALIAS_KEYS["Expression"]; +exports.EXPRESSION_TYPES = EXPRESSION_TYPES; +const BINARY_TYPES = _index.FLIPPED_ALIAS_KEYS["Binary"]; +exports.BINARY_TYPES = BINARY_TYPES; +const SCOPABLE_TYPES = _index.FLIPPED_ALIAS_KEYS["Scopable"]; +exports.SCOPABLE_TYPES = SCOPABLE_TYPES; +const BLOCKPARENT_TYPES = _index.FLIPPED_ALIAS_KEYS["BlockParent"]; +exports.BLOCKPARENT_TYPES = BLOCKPARENT_TYPES; +const BLOCK_TYPES = _index.FLIPPED_ALIAS_KEYS["Block"]; +exports.BLOCK_TYPES = BLOCK_TYPES; +const STATEMENT_TYPES = _index.FLIPPED_ALIAS_KEYS["Statement"]; +exports.STATEMENT_TYPES = STATEMENT_TYPES; +const TERMINATORLESS_TYPES = _index.FLIPPED_ALIAS_KEYS["Terminatorless"]; +exports.TERMINATORLESS_TYPES = TERMINATORLESS_TYPES; +const COMPLETIONSTATEMENT_TYPES = _index.FLIPPED_ALIAS_KEYS["CompletionStatement"]; +exports.COMPLETIONSTATEMENT_TYPES = COMPLETIONSTATEMENT_TYPES; +const CONDITIONAL_TYPES = _index.FLIPPED_ALIAS_KEYS["Conditional"]; +exports.CONDITIONAL_TYPES = CONDITIONAL_TYPES; +const LOOP_TYPES = _index.FLIPPED_ALIAS_KEYS["Loop"]; +exports.LOOP_TYPES = LOOP_TYPES; +const WHILE_TYPES = _index.FLIPPED_ALIAS_KEYS["While"]; +exports.WHILE_TYPES = WHILE_TYPES; +const EXPRESSIONWRAPPER_TYPES = _index.FLIPPED_ALIAS_KEYS["ExpressionWrapper"]; +exports.EXPRESSIONWRAPPER_TYPES = EXPRESSIONWRAPPER_TYPES; +const FOR_TYPES = _index.FLIPPED_ALIAS_KEYS["For"]; +exports.FOR_TYPES = FOR_TYPES; +const FORXSTATEMENT_TYPES = _index.FLIPPED_ALIAS_KEYS["ForXStatement"]; +exports.FORXSTATEMENT_TYPES = FORXSTATEMENT_TYPES; +const FUNCTION_TYPES = _index.FLIPPED_ALIAS_KEYS["Function"]; +exports.FUNCTION_TYPES = FUNCTION_TYPES; +const FUNCTIONPARENT_TYPES = _index.FLIPPED_ALIAS_KEYS["FunctionParent"]; +exports.FUNCTIONPARENT_TYPES = FUNCTIONPARENT_TYPES; +const PUREISH_TYPES = _index.FLIPPED_ALIAS_KEYS["Pureish"]; +exports.PUREISH_TYPES = PUREISH_TYPES; +const DECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["Declaration"]; +exports.DECLARATION_TYPES = DECLARATION_TYPES; +const PATTERNLIKE_TYPES = _index.FLIPPED_ALIAS_KEYS["PatternLike"]; +exports.PATTERNLIKE_TYPES = PATTERNLIKE_TYPES; +const LVAL_TYPES = _index.FLIPPED_ALIAS_KEYS["LVal"]; +exports.LVAL_TYPES = LVAL_TYPES; +const TSENTITYNAME_TYPES = _index.FLIPPED_ALIAS_KEYS["TSEntityName"]; +exports.TSENTITYNAME_TYPES = TSENTITYNAME_TYPES; +const LITERAL_TYPES = _index.FLIPPED_ALIAS_KEYS["Literal"]; +exports.LITERAL_TYPES = LITERAL_TYPES; +const IMMUTABLE_TYPES = _index.FLIPPED_ALIAS_KEYS["Immutable"]; +exports.IMMUTABLE_TYPES = IMMUTABLE_TYPES; +const USERWHITESPACABLE_TYPES = _index.FLIPPED_ALIAS_KEYS["UserWhitespacable"]; +exports.USERWHITESPACABLE_TYPES = USERWHITESPACABLE_TYPES; +const METHOD_TYPES = _index.FLIPPED_ALIAS_KEYS["Method"]; +exports.METHOD_TYPES = METHOD_TYPES; +const OBJECTMEMBER_TYPES = _index.FLIPPED_ALIAS_KEYS["ObjectMember"]; +exports.OBJECTMEMBER_TYPES = OBJECTMEMBER_TYPES; +const PROPERTY_TYPES = _index.FLIPPED_ALIAS_KEYS["Property"]; +exports.PROPERTY_TYPES = PROPERTY_TYPES; +const UNARYLIKE_TYPES = _index.FLIPPED_ALIAS_KEYS["UnaryLike"]; +exports.UNARYLIKE_TYPES = UNARYLIKE_TYPES; +const PATTERN_TYPES = _index.FLIPPED_ALIAS_KEYS["Pattern"]; +exports.PATTERN_TYPES = PATTERN_TYPES; +const CLASS_TYPES = _index.FLIPPED_ALIAS_KEYS["Class"]; +exports.CLASS_TYPES = CLASS_TYPES; +const IMPORTOREXPORTDECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["ImportOrExportDeclaration"]; +exports.IMPORTOREXPORTDECLARATION_TYPES = IMPORTOREXPORTDECLARATION_TYPES; +const EXPORTDECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["ExportDeclaration"]; +exports.EXPORTDECLARATION_TYPES = EXPORTDECLARATION_TYPES; +const MODULESPECIFIER_TYPES = _index.FLIPPED_ALIAS_KEYS["ModuleSpecifier"]; +exports.MODULESPECIFIER_TYPES = MODULESPECIFIER_TYPES; +const ACCESSOR_TYPES = _index.FLIPPED_ALIAS_KEYS["Accessor"]; +exports.ACCESSOR_TYPES = ACCESSOR_TYPES; +const PRIVATE_TYPES = _index.FLIPPED_ALIAS_KEYS["Private"]; +exports.PRIVATE_TYPES = PRIVATE_TYPES; +const FLOW_TYPES = _index.FLIPPED_ALIAS_KEYS["Flow"]; +exports.FLOW_TYPES = FLOW_TYPES; +const FLOWTYPE_TYPES = _index.FLIPPED_ALIAS_KEYS["FlowType"]; +exports.FLOWTYPE_TYPES = FLOWTYPE_TYPES; +const FLOWBASEANNOTATION_TYPES = _index.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"]; +exports.FLOWBASEANNOTATION_TYPES = FLOWBASEANNOTATION_TYPES; +const FLOWDECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["FlowDeclaration"]; +exports.FLOWDECLARATION_TYPES = FLOWDECLARATION_TYPES; +const FLOWPREDICATE_TYPES = _index.FLIPPED_ALIAS_KEYS["FlowPredicate"]; +exports.FLOWPREDICATE_TYPES = FLOWPREDICATE_TYPES; +const ENUMBODY_TYPES = _index.FLIPPED_ALIAS_KEYS["EnumBody"]; +exports.ENUMBODY_TYPES = ENUMBODY_TYPES; +const ENUMMEMBER_TYPES = _index.FLIPPED_ALIAS_KEYS["EnumMember"]; +exports.ENUMMEMBER_TYPES = ENUMMEMBER_TYPES; +const JSX_TYPES = _index.FLIPPED_ALIAS_KEYS["JSX"]; +exports.JSX_TYPES = JSX_TYPES; +const MISCELLANEOUS_TYPES = _index.FLIPPED_ALIAS_KEYS["Miscellaneous"]; +exports.MISCELLANEOUS_TYPES = MISCELLANEOUS_TYPES; +const TYPESCRIPT_TYPES = _index.FLIPPED_ALIAS_KEYS["TypeScript"]; +exports.TYPESCRIPT_TYPES = TYPESCRIPT_TYPES; +const TSTYPEELEMENT_TYPES = _index.FLIPPED_ALIAS_KEYS["TSTypeElement"]; +exports.TSTYPEELEMENT_TYPES = TSTYPEELEMENT_TYPES; +const TSTYPE_TYPES = _index.FLIPPED_ALIAS_KEYS["TSType"]; +exports.TSTYPE_TYPES = TSTYPE_TYPES; +const TSBASETYPE_TYPES = _index.FLIPPED_ALIAS_KEYS["TSBaseType"]; +exports.TSBASETYPE_TYPES = TSBASETYPE_TYPES; +const MODULEDECLARATION_TYPES = IMPORTOREXPORTDECLARATION_TYPES; +exports.MODULEDECLARATION_TYPES = MODULEDECLARATION_TYPES; + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 7297: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.UPDATE_OPERATORS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.STATEMENT_OR_BLOCK_KEYS = exports.NUMBER_UNARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.NOT_LOCAL_BINDING = exports.LOGICAL_OPERATORS = exports.INHERIT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.EQUALITY_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.COMMENT_KEYS = exports.BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.BLOCK_SCOPED_SYMBOL = exports.BINARY_OPERATORS = exports.ASSIGNMENT_OPERATORS = void 0; +const STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; +exports.STATEMENT_OR_BLOCK_KEYS = STATEMENT_OR_BLOCK_KEYS; +const FLATTENABLE_KEYS = ["body", "expressions"]; +exports.FLATTENABLE_KEYS = FLATTENABLE_KEYS; +const FOR_INIT_KEYS = ["left", "init"]; +exports.FOR_INIT_KEYS = FOR_INIT_KEYS; +const COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; +exports.COMMENT_KEYS = COMMENT_KEYS; +const LOGICAL_OPERATORS = ["||", "&&", "??"]; +exports.LOGICAL_OPERATORS = LOGICAL_OPERATORS; +const UPDATE_OPERATORS = ["++", "--"]; +exports.UPDATE_OPERATORS = UPDATE_OPERATORS; +const BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; +exports.BOOLEAN_NUMBER_BINARY_OPERATORS = BOOLEAN_NUMBER_BINARY_OPERATORS; +const EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; +exports.EQUALITY_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS; +const COMPARISON_BINARY_OPERATORS = [...EQUALITY_BINARY_OPERATORS, "in", "instanceof"]; +exports.COMPARISON_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS; +const BOOLEAN_BINARY_OPERATORS = [...COMPARISON_BINARY_OPERATORS, ...BOOLEAN_NUMBER_BINARY_OPERATORS]; +exports.BOOLEAN_BINARY_OPERATORS = BOOLEAN_BINARY_OPERATORS; +const NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; +exports.NUMBER_BINARY_OPERATORS = NUMBER_BINARY_OPERATORS; +const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS, "|>"]; +exports.BINARY_OPERATORS = BINARY_OPERATORS; +const ASSIGNMENT_OPERATORS = ["=", "+=", ...NUMBER_BINARY_OPERATORS.map(op => op + "="), ...LOGICAL_OPERATORS.map(op => op + "=")]; +exports.ASSIGNMENT_OPERATORS = ASSIGNMENT_OPERATORS; +const BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; +exports.BOOLEAN_UNARY_OPERATORS = BOOLEAN_UNARY_OPERATORS; +const NUMBER_UNARY_OPERATORS = ["+", "-", "~"]; +exports.NUMBER_UNARY_OPERATORS = NUMBER_UNARY_OPERATORS; +const STRING_UNARY_OPERATORS = ["typeof"]; +exports.STRING_UNARY_OPERATORS = STRING_UNARY_OPERATORS; +const UNARY_OPERATORS = ["void", "throw", ...BOOLEAN_UNARY_OPERATORS, ...NUMBER_UNARY_OPERATORS, ...STRING_UNARY_OPERATORS]; +exports.UNARY_OPERATORS = UNARY_OPERATORS; +const INHERIT_KEYS = { + optional: ["typeAnnotation", "typeParameters", "returnType"], + force: ["start", "loc", "end"] +}; +exports.INHERIT_KEYS = INHERIT_KEYS; +const BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); +exports.BLOCK_SCOPED_SYMBOL = BLOCK_SCOPED_SYMBOL; +const NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); +exports.NOT_LOCAL_BINDING = NOT_LOCAL_BINDING; + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 1823: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = ensureBlock; +var _toBlock = __nccwpck_require__(8332); +function ensureBlock(node, key = "body") { + const result = (0, _toBlock.default)(node[key], node); + node[key] = result; + return result; +} + +//# sourceMappingURL=ensureBlock.js.map + + +/***/ }), + +/***/ 8652: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = gatherSequenceExpressions; +var _getBindingIdentifiers = __nccwpck_require__(5940); +var _index = __nccwpck_require__(2538); +var _index2 = __nccwpck_require__(4485); +var _cloneNode = __nccwpck_require__(7649); +function gatherSequenceExpressions(nodes, scope, declars) { + const exprs = []; + let ensureLastUndefined = true; + for (const node of nodes) { + if (!(0, _index.isEmptyStatement)(node)) { + ensureLastUndefined = false; + } + if ((0, _index.isExpression)(node)) { + exprs.push(node); + } else if ((0, _index.isExpressionStatement)(node)) { + exprs.push(node.expression); + } else if ((0, _index.isVariableDeclaration)(node)) { + if (node.kind !== "var") return; + for (const declar of node.declarations) { + const bindings = (0, _getBindingIdentifiers.default)(declar); + for (const key of Object.keys(bindings)) { + declars.push({ + kind: node.kind, + id: (0, _cloneNode.default)(bindings[key]) + }); + } + if (declar.init) { + exprs.push((0, _index2.assignmentExpression)("=", declar.id, declar.init)); + } + } + ensureLastUndefined = true; + } else if ((0, _index.isIfStatement)(node)) { + const consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode(); + const alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode(); + if (!consequent || !alternate) return; + exprs.push((0, _index2.conditionalExpression)(node.test, consequent, alternate)); + } else if ((0, _index.isBlockStatement)(node)) { + const body = gatherSequenceExpressions(node.body, scope, declars); + if (!body) return; + exprs.push(body); + } else if ((0, _index.isEmptyStatement)(node)) { + if (nodes.indexOf(node) === 0) { + ensureLastUndefined = true; + } + } else { + return; + } + } + if (ensureLastUndefined) { + exprs.push(scope.buildUndefinedNode()); + } + if (exprs.length === 1) { + return exprs[0]; + } else { + return (0, _index2.sequenceExpression)(exprs); + } +} + +//# sourceMappingURL=gatherSequenceExpressions.js.map + + +/***/ }), + +/***/ 5219: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = toBindingIdentifierName; +var _toIdentifier = __nccwpck_require__(2143); +function toBindingIdentifierName(name) { + name = (0, _toIdentifier.default)(name); + if (name === "eval" || name === "arguments") name = "_" + name; + return name; +} + +//# sourceMappingURL=toBindingIdentifierName.js.map + + +/***/ }), + +/***/ 8332: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = toBlock; +var _index = __nccwpck_require__(2538); +var _index2 = __nccwpck_require__(4485); +function toBlock(node, parent) { + if ((0, _index.isBlockStatement)(node)) { + return node; + } + let blockNodes = []; + if ((0, _index.isEmptyStatement)(node)) { + blockNodes = []; + } else { + if (!(0, _index.isStatement)(node)) { + if ((0, _index.isFunction)(parent)) { + node = (0, _index2.returnStatement)(node); + } else { + node = (0, _index2.expressionStatement)(node); + } + } + blockNodes = [node]; + } + return (0, _index2.blockStatement)(blockNodes); +} + +//# sourceMappingURL=toBlock.js.map + + +/***/ }), + +/***/ 4457: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = toComputedKey; +var _index = __nccwpck_require__(2538); +var _index2 = __nccwpck_require__(4485); +function toComputedKey(node, key = node.key || node.property) { + if (!node.computed && (0, _index.isIdentifier)(key)) key = (0, _index2.stringLiteral)(key.name); + return key; +} + +//# sourceMappingURL=toComputedKey.js.map + + +/***/ }), + +/***/ 5293: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _index = __nccwpck_require__(2538); +var _default = toExpression; +exports.default = _default; +function toExpression(node) { + if ((0, _index.isExpressionStatement)(node)) { + node = node.expression; + } + if ((0, _index.isExpression)(node)) { + return node; + } + if ((0, _index.isClass)(node)) { + node.type = "ClassExpression"; + } else if ((0, _index.isFunction)(node)) { + node.type = "FunctionExpression"; + } + if (!(0, _index.isExpression)(node)) { + throw new Error(`cannot turn ${node.type} to an expression`); + } + return node; +} + +//# sourceMappingURL=toExpression.js.map + + +/***/ }), + +/***/ 2143: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = toIdentifier; +var _isValidIdentifier = __nccwpck_require__(5178); +var _helperValidatorIdentifier = __nccwpck_require__(6607); +function toIdentifier(input) { + input = input + ""; + let name = ""; + for (const c of input) { + name += (0, _helperValidatorIdentifier.isIdentifierChar)(c.codePointAt(0)) ? c : "-"; + } + name = name.replace(/^[-0-9]+/, ""); + name = name.replace(/[-\s]+(.)?/g, function (match, c) { + return c ? c.toUpperCase() : ""; + }); + if (!(0, _isValidIdentifier.default)(name)) { + name = `_${name}`; + } + return name || "_"; +} + +//# sourceMappingURL=toIdentifier.js.map + + +/***/ }), + +/***/ 5923: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = toKeyAlias; +var _index = __nccwpck_require__(2538); +var _cloneNode = __nccwpck_require__(7649); +var _removePropertiesDeep = __nccwpck_require__(2286); +function toKeyAlias(node, key = node.key) { + let alias; + if (node.kind === "method") { + return toKeyAlias.increment() + ""; + } else if ((0, _index.isIdentifier)(key)) { + alias = key.name; + } else if ((0, _index.isStringLiteral)(key)) { + alias = JSON.stringify(key.value); + } else { + alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneNode.default)(key))); + } + if (node.computed) { + alias = `[${alias}]`; + } + if (node.static) { + alias = `static:${alias}`; + } + return alias; +} +toKeyAlias.uid = 0; +toKeyAlias.increment = function () { + if (toKeyAlias.uid >= Number.MAX_SAFE_INTEGER) { + return toKeyAlias.uid = 0; + } else { + return toKeyAlias.uid++; + } +}; + +//# sourceMappingURL=toKeyAlias.js.map + + +/***/ }), + +/***/ 5943: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = toSequenceExpression; +var _gatherSequenceExpressions = __nccwpck_require__(8652); +function toSequenceExpression(nodes, scope) { + if (!(nodes != null && nodes.length)) return; + const declars = []; + const result = (0, _gatherSequenceExpressions.default)(nodes, scope, declars); + if (!result) return; + for (const declar of declars) { + scope.push(declar); + } + return result; +} + +//# sourceMappingURL=toSequenceExpression.js.map + + +/***/ }), + +/***/ 7994: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _index = __nccwpck_require__(2538); +var _index2 = __nccwpck_require__(4485); +var _default = toStatement; +exports.default = _default; +function toStatement(node, ignore) { + if ((0, _index.isStatement)(node)) { + return node; + } + let mustHaveId = false; + let newType; + if ((0, _index.isClass)(node)) { + mustHaveId = true; + newType = "ClassDeclaration"; + } else if ((0, _index.isFunction)(node)) { + mustHaveId = true; + newType = "FunctionDeclaration"; + } else if ((0, _index.isAssignmentExpression)(node)) { + return (0, _index2.expressionStatement)(node); + } + if (mustHaveId && !node.id) { + newType = false; + } + if (!newType) { + if (ignore) { + return false; + } else { + throw new Error(`cannot turn ${node.type} to a statement`); + } + } + node.type = newType; + return node; +} + +//# sourceMappingURL=toStatement.js.map + + +/***/ }), + +/***/ 32: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _isValidIdentifier = __nccwpck_require__(5178); +var _index = __nccwpck_require__(4485); +var _default = valueToNode; +exports.default = _default; +const objectToString = Function.call.bind(Object.prototype.toString); +function isRegExp(value) { + return objectToString(value) === "[object RegExp]"; +} +function isPlainObject(value) { + if (typeof value !== "object" || value === null || Object.prototype.toString.call(value) !== "[object Object]") { + return false; + } + const proto = Object.getPrototypeOf(value); + return proto === null || Object.getPrototypeOf(proto) === null; +} +function valueToNode(value) { + if (value === undefined) { + return (0, _index.identifier)("undefined"); + } + if (value === true || value === false) { + return (0, _index.booleanLiteral)(value); + } + if (value === null) { + return (0, _index.nullLiteral)(); + } + if (typeof value === "string") { + return (0, _index.stringLiteral)(value); + } + if (typeof value === "number") { + let result; + if (Number.isFinite(value)) { + result = (0, _index.numericLiteral)(Math.abs(value)); + } else { + let numerator; + if (Number.isNaN(value)) { + numerator = (0, _index.numericLiteral)(0); + } else { + numerator = (0, _index.numericLiteral)(1); + } + result = (0, _index.binaryExpression)("/", numerator, (0, _index.numericLiteral)(0)); + } + if (value < 0 || Object.is(value, -0)) { + result = (0, _index.unaryExpression)("-", result); + } + return result; + } + if (isRegExp(value)) { + const pattern = value.source; + const flags = value.toString().match(/\/([a-z]+|)$/)[1]; + return (0, _index.regExpLiteral)(pattern, flags); + } + if (Array.isArray(value)) { + return (0, _index.arrayExpression)(value.map(valueToNode)); + } + if (isPlainObject(value)) { + const props = []; + for (const key of Object.keys(value)) { + let nodeKey; + if ((0, _isValidIdentifier.default)(key)) { + nodeKey = (0, _index.identifier)(key); + } else { + nodeKey = (0, _index.stringLiteral)(key); + } + props.push((0, _index.objectProperty)(nodeKey, valueToNode(value[key]))); + } + return (0, _index.objectExpression)(props); + } + throw new Error("don't know how to turn this value into a node"); +} + +//# sourceMappingURL=valueToNode.js.map + + +/***/ }), + +/***/ 8655: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.patternLikeCommon = exports.functionTypeAnnotationCommon = exports.functionDeclarationCommon = exports.functionCommon = exports.classMethodOrPropertyCommon = exports.classMethodOrDeclareMethodCommon = void 0; +var _is = __nccwpck_require__(9242); +var _isValidIdentifier = __nccwpck_require__(5178); +var _helperValidatorIdentifier = __nccwpck_require__(6607); +var _helperStringParser = __nccwpck_require__(1133); +var _index = __nccwpck_require__(7297); +var _utils = __nccwpck_require__(799); +const defineType = (0, _utils.defineAliasedType)("Standardized"); +defineType("ArrayExpression", { + fields: { + elements: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "Expression", "SpreadElement"))), + default: !process.env.BABEL_TYPES_8_BREAKING ? [] : undefined + } + }, + visitor: ["elements"], + aliases: ["Expression"] +}); +defineType("AssignmentExpression", { + fields: { + operator: { + validate: function () { + if (!process.env.BABEL_TYPES_8_BREAKING) { + return (0, _utils.assertValueType)("string"); + } + const identifier = (0, _utils.assertOneOf)(..._index.ASSIGNMENT_OPERATORS); + const pattern = (0, _utils.assertOneOf)("="); + return function (node, key, val) { + const validator = (0, _is.default)("Pattern", node.left) ? pattern : identifier; + validator(node, key, val); + }; + }() + }, + left: { + validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") + }, + right: { + validate: (0, _utils.assertNodeType)("Expression") + } + }, + builder: ["operator", "left", "right"], + visitor: ["left", "right"], + aliases: ["Expression"] +}); +defineType("BinaryExpression", { + builder: ["operator", "left", "right"], + fields: { + operator: { + validate: (0, _utils.assertOneOf)(..._index.BINARY_OPERATORS) + }, + left: { + validate: function () { + const expression = (0, _utils.assertNodeType)("Expression"); + const inOp = (0, _utils.assertNodeType)("Expression", "PrivateName"); + const validator = Object.assign(function (node, key, val) { + const validator = node.operator === "in" ? inOp : expression; + validator(node, key, val); + }, { + oneOfNodeTypes: ["Expression", "PrivateName"] + }); + return validator; + }() + }, + right: { + validate: (0, _utils.assertNodeType)("Expression") + } + }, + visitor: ["left", "right"], + aliases: ["Binary", "Expression"] +}); +defineType("InterpreterDirective", { + builder: ["value"], + fields: { + value: { + validate: (0, _utils.assertValueType)("string") + } + } +}); +defineType("Directive", { + visitor: ["value"], + fields: { + value: { + validate: (0, _utils.assertNodeType)("DirectiveLiteral") + } + } +}); +defineType("DirectiveLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _utils.assertValueType)("string") + } + } +}); +defineType("BlockStatement", { + builder: ["body", "directives"], + visitor: ["directives", "body"], + fields: { + directives: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))), + default: [] + }, + body: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "Block", "Statement"] +}); +defineType("BreakStatement", { + visitor: ["label"], + fields: { + label: { + validate: (0, _utils.assertNodeType)("Identifier"), + optional: true + } + }, + aliases: ["Statement", "Terminatorless", "CompletionStatement"] +}); +defineType("CallExpression", { + visitor: ["callee", "arguments", "typeParameters", "typeArguments"], + builder: ["callee", "arguments"], + aliases: ["Expression"], + fields: Object.assign({ + callee: { + validate: (0, _utils.assertNodeType)("Expression", "Super", "V8IntrinsicIdentifier") + }, + arguments: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName", "ArgumentPlaceholder"))) + } + }, !process.env.BABEL_TYPES_8_BREAKING ? { + optional: { + validate: (0, _utils.assertOneOf)(true, false), + optional: true + } + } : {}, { + typeArguments: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"), + optional: true + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"), + optional: true + } + }) +}); +defineType("CatchClause", { + visitor: ["param", "body"], + fields: { + param: { + validate: (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern"), + optional: true + }, + body: { + validate: (0, _utils.assertNodeType)("BlockStatement") + } + }, + aliases: ["Scopable", "BlockParent"] +}); +defineType("ConditionalExpression", { + visitor: ["test", "consequent", "alternate"], + fields: { + test: { + validate: (0, _utils.assertNodeType)("Expression") + }, + consequent: { + validate: (0, _utils.assertNodeType)("Expression") + }, + alternate: { + validate: (0, _utils.assertNodeType)("Expression") + } + }, + aliases: ["Expression", "Conditional"] +}); +defineType("ContinueStatement", { + visitor: ["label"], + fields: { + label: { + validate: (0, _utils.assertNodeType)("Identifier"), + optional: true + } + }, + aliases: ["Statement", "Terminatorless", "CompletionStatement"] +}); +defineType("DebuggerStatement", { + aliases: ["Statement"] +}); +defineType("DoWhileStatement", { + visitor: ["test", "body"], + fields: { + test: { + validate: (0, _utils.assertNodeType)("Expression") + }, + body: { + validate: (0, _utils.assertNodeType)("Statement") + } + }, + aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"] +}); +defineType("EmptyStatement", { + aliases: ["Statement"] +}); +defineType("ExpressionStatement", { + visitor: ["expression"], + fields: { + expression: { + validate: (0, _utils.assertNodeType)("Expression") + } + }, + aliases: ["Statement", "ExpressionWrapper"] +}); +defineType("File", { + builder: ["program", "comments", "tokens"], + visitor: ["program"], + fields: { + program: { + validate: (0, _utils.assertNodeType)("Program") + }, + comments: { + validate: !process.env.BABEL_TYPES_8_BREAKING ? Object.assign(() => {}, { + each: { + oneOfNodeTypes: ["CommentBlock", "CommentLine"] + } + }) : (0, _utils.assertEach)((0, _utils.assertNodeType)("CommentBlock", "CommentLine")), + optional: true + }, + tokens: { + validate: (0, _utils.assertEach)(Object.assign(() => {}, { + type: "any" + })), + optional: true + } + } +}); +defineType("ForInStatement", { + visitor: ["left", "right", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("VariableDeclaration", "LVal") : (0, _utils.assertNodeType)("VariableDeclaration", "Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") + }, + right: { + validate: (0, _utils.assertNodeType)("Expression") + }, + body: { + validate: (0, _utils.assertNodeType)("Statement") + } + } +}); +defineType("ForStatement", { + visitor: ["init", "test", "update", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"], + fields: { + init: { + validate: (0, _utils.assertNodeType)("VariableDeclaration", "Expression"), + optional: true + }, + test: { + validate: (0, _utils.assertNodeType)("Expression"), + optional: true + }, + update: { + validate: (0, _utils.assertNodeType)("Expression"), + optional: true + }, + body: { + validate: (0, _utils.assertNodeType)("Statement") + } + } +}); +const functionCommon = () => ({ + params: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement"))) + }, + generator: { + default: false + }, + async: { + default: false + } +}); +exports.functionCommon = functionCommon; +const functionTypeAnnotationCommon = () => ({ + returnType: { + validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), + optional: true + } +}); +exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon; +const functionDeclarationCommon = () => Object.assign({}, functionCommon(), { + declare: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + id: { + validate: (0, _utils.assertNodeType)("Identifier"), + optional: true + } +}); +exports.functionDeclarationCommon = functionDeclarationCommon; +defineType("FunctionDeclaration", { + builder: ["id", "params", "body", "generator", "async"], + visitor: ["id", "params", "body", "returnType", "typeParameters"], + fields: Object.assign({}, functionDeclarationCommon(), functionTypeAnnotationCommon(), { + body: { + validate: (0, _utils.assertNodeType)("BlockStatement") + }, + predicate: { + validate: (0, _utils.assertNodeType)("DeclaredPredicate", "InferredPredicate"), + optional: true + } + }), + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"], + validate: function () { + if (!process.env.BABEL_TYPES_8_BREAKING) return () => {}; + const identifier = (0, _utils.assertNodeType)("Identifier"); + return function (parent, key, node) { + if (!(0, _is.default)("ExportDefaultDeclaration", parent)) { + identifier(node, "id", node.id); + } + }; + }() +}); +defineType("FunctionExpression", { + inherits: "FunctionDeclaration", + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], + fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), { + id: { + validate: (0, _utils.assertNodeType)("Identifier"), + optional: true + }, + body: { + validate: (0, _utils.assertNodeType)("BlockStatement") + }, + predicate: { + validate: (0, _utils.assertNodeType)("DeclaredPredicate", "InferredPredicate"), + optional: true + } + }) +}); +const patternLikeCommon = () => ({ + typeAnnotation: { + validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + optional: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + } +}); +exports.patternLikeCommon = patternLikeCommon; +defineType("Identifier", { + builder: ["name"], + visitor: ["typeAnnotation", "decorators"], + aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"], + fields: Object.assign({}, patternLikeCommon(), { + name: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + if (!(0, _isValidIdentifier.default)(val, false)) { + throw new TypeError(`"${val}" is not a valid identifier name`); + } + }, { + type: "string" + })) + } + }), + validate(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + const match = /\.(\w+)$/.exec(key); + if (!match) return; + const [, parentKey] = match; + const nonComp = { + computed: false + }; + if (parentKey === "property") { + if ((0, _is.default)("MemberExpression", parent, nonComp)) return; + if ((0, _is.default)("OptionalMemberExpression", parent, nonComp)) return; + } else if (parentKey === "key") { + if ((0, _is.default)("Property", parent, nonComp)) return; + if ((0, _is.default)("Method", parent, nonComp)) return; + } else if (parentKey === "exported") { + if ((0, _is.default)("ExportSpecifier", parent)) return; + } else if (parentKey === "imported") { + if ((0, _is.default)("ImportSpecifier", parent, { + imported: node + })) return; + } else if (parentKey === "meta") { + if ((0, _is.default)("MetaProperty", parent, { + meta: node + })) return; + } + if (((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name, false)) && node.name !== "this") { + throw new TypeError(`"${node.name}" is not a valid identifier`); + } + } +}); +defineType("IfStatement", { + visitor: ["test", "consequent", "alternate"], + aliases: ["Statement", "Conditional"], + fields: { + test: { + validate: (0, _utils.assertNodeType)("Expression") + }, + consequent: { + validate: (0, _utils.assertNodeType)("Statement") + }, + alternate: { + optional: true, + validate: (0, _utils.assertNodeType)("Statement") + } + } +}); +defineType("LabeledStatement", { + visitor: ["label", "body"], + aliases: ["Statement"], + fields: { + label: { + validate: (0, _utils.assertNodeType)("Identifier") + }, + body: { + validate: (0, _utils.assertNodeType)("Statement") + } + } +}); +defineType("StringLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _utils.assertValueType)("string") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); +defineType("NumericLiteral", { + builder: ["value"], + deprecatedAlias: "NumberLiteral", + fields: { + value: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("number"), Object.assign(function (node, key, val) { + if (1 / val < 0 || !Number.isFinite(val)) { + const error = new Error("NumericLiterals must be non-negative finite numbers. " + `You can use t.valueToNode(${val}) instead.`); + {} + } + }, { + type: "number" + })) + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); +defineType("NullLiteral", { + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); +defineType("BooleanLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _utils.assertValueType)("boolean") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); +defineType("RegExpLiteral", { + builder: ["pattern", "flags"], + deprecatedAlias: "RegexLiteral", + aliases: ["Expression", "Pureish", "Literal"], + fields: { + pattern: { + validate: (0, _utils.assertValueType)("string") + }, + flags: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + const invalid = /[^gimsuy]/.exec(val); + if (invalid) { + throw new TypeError(`"${invalid[0]}" is not a valid RegExp flag`); + } + }, { + type: "string" + })), + default: "" + } + } +}); +defineType("LogicalExpression", { + builder: ["operator", "left", "right"], + visitor: ["left", "right"], + aliases: ["Binary", "Expression"], + fields: { + operator: { + validate: (0, _utils.assertOneOf)(..._index.LOGICAL_OPERATORS) + }, + left: { + validate: (0, _utils.assertNodeType)("Expression") + }, + right: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +defineType("MemberExpression", { + builder: ["object", "property", "computed", ...(!process.env.BABEL_TYPES_8_BREAKING ? ["optional"] : [])], + visitor: ["object", "property"], + aliases: ["Expression", "LVal"], + fields: Object.assign({ + object: { + validate: (0, _utils.assertNodeType)("Expression", "Super") + }, + property: { + validate: function () { + const normal = (0, _utils.assertNodeType)("Identifier", "PrivateName"); + const computed = (0, _utils.assertNodeType)("Expression"); + const validator = function (node, key, val) { + const validator = node.computed ? computed : normal; + validator(node, key, val); + }; + validator.oneOfNodeTypes = ["Expression", "Identifier", "PrivateName"]; + return validator; + }() + }, + computed: { + default: false + } + }, !process.env.BABEL_TYPES_8_BREAKING ? { + optional: { + validate: (0, _utils.assertOneOf)(true, false), + optional: true + } + } : {}) +}); +defineType("NewExpression", { + inherits: "CallExpression" +}); +defineType("Program", { + visitor: ["directives", "body"], + builder: ["body", "directives", "sourceType", "interpreter"], + fields: { + sourceFile: { + validate: (0, _utils.assertValueType)("string") + }, + sourceType: { + validate: (0, _utils.assertOneOf)("script", "module"), + default: "script" + }, + interpreter: { + validate: (0, _utils.assertNodeType)("InterpreterDirective"), + default: null, + optional: true + }, + directives: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))), + default: [] + }, + body: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "Block"] +}); +defineType("ObjectExpression", { + visitor: ["properties"], + aliases: ["Expression"], + fields: { + properties: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadElement"))) + } + } +}); +defineType("ObjectMethod", { + builder: ["kind", "key", "params", "body", "computed", "generator", "async"], + fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), { + kind: Object.assign({ + validate: (0, _utils.assertOneOf)("method", "get", "set") + }, !process.env.BABEL_TYPES_8_BREAKING ? { + default: "method" + } : {}), + computed: { + default: false + }, + key: { + validate: function () { + const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral"); + const computed = (0, _utils.assertNodeType)("Expression"); + const validator = function (node, key, val) { + const validator = node.computed ? computed : normal; + validator(node, key, val); + }; + validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral"]; + return validator; + }() + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + }, + body: { + validate: (0, _utils.assertNodeType)("BlockStatement") + } + }), + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"] +}); +defineType("ObjectProperty", { + builder: ["key", "value", "computed", "shorthand", ...(!process.env.BABEL_TYPES_8_BREAKING ? ["decorators"] : [])], + fields: { + computed: { + default: false + }, + key: { + validate: function () { + const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "DecimalLiteral", "PrivateName"); + const computed = (0, _utils.assertNodeType)("Expression"); + const validator = Object.assign(function (node, key, val) { + const validator = node.computed ? computed : normal; + validator(node, key, val); + }, { + oneOfNodeTypes: ["Expression", "Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "DecimalLiteral", "PrivateName"] + }); + return validator; + }() + }, + value: { + validate: (0, _utils.assertNodeType)("Expression", "PatternLike") + }, + shorthand: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("boolean"), Object.assign(function (node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + if (val && node.computed) { + throw new TypeError("Property shorthand of ObjectProperty cannot be true if computed is true"); + } + }, { + type: "boolean" + }), function (node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + if (val && !(0, _is.default)("Identifier", node.key)) { + throw new TypeError("Property shorthand of ObjectProperty cannot be true if key is not an Identifier"); + } + }), + default: false + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + } + }, + visitor: ["key", "value", "decorators"], + aliases: ["UserWhitespacable", "Property", "ObjectMember"], + validate: function () { + const pattern = (0, _utils.assertNodeType)("Identifier", "Pattern", "TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion"); + const expression = (0, _utils.assertNodeType)("Expression"); + return function (parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + const validator = (0, _is.default)("ObjectPattern", parent) ? pattern : expression; + validator(node, "value", node.value); + }; + }() +}); +defineType("RestElement", { + visitor: ["argument", "typeAnnotation"], + builder: ["argument"], + aliases: ["LVal", "PatternLike"], + deprecatedAlias: "RestProperty", + fields: Object.assign({}, patternLikeCommon(), { + argument: { + validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") + } + }), + validate(parent, key) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + const match = /(\w+)\[(\d+)\]/.exec(key); + if (!match) throw new Error("Internal Babel error: malformed key."); + const [, listKey, index] = match; + if (parent[listKey].length > +index + 1) { + throw new TypeError(`RestElement must be last element of ${listKey}`); + } + } +}); +defineType("ReturnStatement", { + visitor: ["argument"], + aliases: ["Statement", "Terminatorless", "CompletionStatement"], + fields: { + argument: { + validate: (0, _utils.assertNodeType)("Expression"), + optional: true + } + } +}); +defineType("SequenceExpression", { + visitor: ["expressions"], + fields: { + expressions: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression"))) + } + }, + aliases: ["Expression"] +}); +defineType("ParenthesizedExpression", { + visitor: ["expression"], + aliases: ["Expression", "ExpressionWrapper"], + fields: { + expression: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +defineType("SwitchCase", { + visitor: ["test", "consequent"], + fields: { + test: { + validate: (0, _utils.assertNodeType)("Expression"), + optional: true + }, + consequent: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement"))) + } + } +}); +defineType("SwitchStatement", { + visitor: ["discriminant", "cases"], + aliases: ["Statement", "BlockParent", "Scopable"], + fields: { + discriminant: { + validate: (0, _utils.assertNodeType)("Expression") + }, + cases: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("SwitchCase"))) + } + } +}); +defineType("ThisExpression", { + aliases: ["Expression"] +}); +defineType("ThrowStatement", { + visitor: ["argument"], + aliases: ["Statement", "Terminatorless", "CompletionStatement"], + fields: { + argument: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +defineType("TryStatement", { + visitor: ["block", "handler", "finalizer"], + aliases: ["Statement"], + fields: { + block: { + validate: (0, _utils.chain)((0, _utils.assertNodeType)("BlockStatement"), Object.assign(function (node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + if (!node.handler && !node.finalizer) { + throw new TypeError("TryStatement expects either a handler or finalizer, or both"); + } + }, { + oneOfNodeTypes: ["BlockStatement"] + })) + }, + handler: { + optional: true, + validate: (0, _utils.assertNodeType)("CatchClause") + }, + finalizer: { + optional: true, + validate: (0, _utils.assertNodeType)("BlockStatement") + } + } +}); +defineType("UnaryExpression", { + builder: ["operator", "argument", "prefix"], + fields: { + prefix: { + default: true + }, + argument: { + validate: (0, _utils.assertNodeType)("Expression") + }, + operator: { + validate: (0, _utils.assertOneOf)(..._index.UNARY_OPERATORS) + } + }, + visitor: ["argument"], + aliases: ["UnaryLike", "Expression"] +}); +defineType("UpdateExpression", { + builder: ["operator", "argument", "prefix"], + fields: { + prefix: { + default: false + }, + argument: { + validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("Expression") : (0, _utils.assertNodeType)("Identifier", "MemberExpression") + }, + operator: { + validate: (0, _utils.assertOneOf)(..._index.UPDATE_OPERATORS) + } + }, + visitor: ["argument"], + aliases: ["Expression"] +}); +defineType("VariableDeclaration", { + builder: ["kind", "declarations"], + visitor: ["declarations"], + aliases: ["Statement", "Declaration"], + fields: { + declare: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + kind: { + validate: (0, _utils.assertOneOf)("var", "let", "const", "using", "await using") + }, + declarations: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("VariableDeclarator"))) + } + }, + validate(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + if (!(0, _is.default)("ForXStatement", parent, { + left: node + })) return; + if (node.declarations.length !== 1) { + throw new TypeError(`Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`); + } + } +}); +defineType("VariableDeclarator", { + visitor: ["id", "init"], + fields: { + id: { + validate: function () { + if (!process.env.BABEL_TYPES_8_BREAKING) { + return (0, _utils.assertNodeType)("LVal"); + } + const normal = (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern"); + const without = (0, _utils.assertNodeType)("Identifier"); + return function (node, key, val) { + const validator = node.init ? normal : without; + validator(node, key, val); + }; + }() + }, + definite: { + optional: true, + validate: (0, _utils.assertValueType)("boolean") + }, + init: { + optional: true, + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +defineType("WhileStatement", { + visitor: ["test", "body"], + aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"], + fields: { + test: { + validate: (0, _utils.assertNodeType)("Expression") + }, + body: { + validate: (0, _utils.assertNodeType)("Statement") + } + } +}); +defineType("WithStatement", { + visitor: ["object", "body"], + aliases: ["Statement"], + fields: { + object: { + validate: (0, _utils.assertNodeType)("Expression") + }, + body: { + validate: (0, _utils.assertNodeType)("Statement") + } + } +}); +defineType("AssignmentPattern", { + visitor: ["left", "right", "decorators"], + builder: ["left", "right"], + aliases: ["Pattern", "PatternLike", "LVal"], + fields: Object.assign({}, patternLikeCommon(), { + left: { + validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") + }, + right: { + validate: (0, _utils.assertNodeType)("Expression") + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + } + }) +}); +defineType("ArrayPattern", { + visitor: ["elements", "typeAnnotation"], + builder: ["elements"], + aliases: ["Pattern", "PatternLike", "LVal"], + fields: Object.assign({}, patternLikeCommon(), { + elements: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "PatternLike", "LVal"))) + } + }) +}); +defineType("ArrowFunctionExpression", { + builder: ["params", "body", "async"], + visitor: ["params", "body", "returnType", "typeParameters"], + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], + fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), { + expression: { + validate: (0, _utils.assertValueType)("boolean") + }, + body: { + validate: (0, _utils.assertNodeType)("BlockStatement", "Expression") + }, + predicate: { + validate: (0, _utils.assertNodeType)("DeclaredPredicate", "InferredPredicate"), + optional: true + } + }) +}); +defineType("ClassBody", { + visitor: ["body"], + fields: { + body: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassPrivateProperty", "ClassAccessorProperty", "TSDeclareMethod", "TSIndexSignature", "StaticBlock"))) + } + } +}); +defineType("ClassExpression", { + builder: ["id", "superClass", "body", "decorators"], + visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"], + aliases: ["Scopable", "Class", "Expression"], + fields: { + id: { + validate: (0, _utils.assertNodeType)("Identifier"), + optional: true + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), + optional: true + }, + body: { + validate: (0, _utils.assertNodeType)("ClassBody") + }, + superClass: { + optional: true, + validate: (0, _utils.assertNodeType)("Expression") + }, + superTypeParameters: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true + }, + implements: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSExpressionWithTypeArguments", "ClassImplements"))), + optional: true + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + }, + mixins: { + validate: (0, _utils.assertNodeType)("InterfaceExtends"), + optional: true + } + } +}); +defineType("ClassDeclaration", { + inherits: "ClassExpression", + aliases: ["Scopable", "Class", "Statement", "Declaration"], + fields: { + id: { + validate: (0, _utils.assertNodeType)("Identifier"), + optional: true + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), + optional: true + }, + body: { + validate: (0, _utils.assertNodeType)("ClassBody") + }, + superClass: { + optional: true, + validate: (0, _utils.assertNodeType)("Expression") + }, + superTypeParameters: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true + }, + implements: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSExpressionWithTypeArguments", "ClassImplements"))), + optional: true + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + }, + mixins: { + validate: (0, _utils.assertNodeType)("InterfaceExtends"), + optional: true + }, + declare: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + abstract: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + } + }, + validate: function () { + const identifier = (0, _utils.assertNodeType)("Identifier"); + return function (parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + if (!(0, _is.default)("ExportDefaultDeclaration", parent)) { + identifier(node, "id", node.id); + } + }; + }() +}); +defineType("ExportAllDeclaration", { + builder: ["source"], + visitor: ["source", "attributes", "assertions"], + aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"], + fields: { + source: { + validate: (0, _utils.assertNodeType)("StringLiteral") + }, + exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value")), + attributes: { + optional: true, + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportAttribute"))) + }, + assertions: { + optional: true, + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportAttribute"))) + } + } +}); +defineType("ExportDefaultDeclaration", { + visitor: ["declaration"], + aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"], + fields: { + declaration: { + validate: (0, _utils.assertNodeType)("TSDeclareFunction", "FunctionDeclaration", "ClassDeclaration", "Expression") + }, + exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("value")) + } +}); +defineType("ExportNamedDeclaration", { + builder: ["declaration", "specifiers", "source"], + visitor: ["declaration", "specifiers", "source", "attributes", "assertions"], + aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"], + fields: { + declaration: { + optional: true, + validate: (0, _utils.chain)((0, _utils.assertNodeType)("Declaration"), Object.assign(function (node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + if (val && node.specifiers.length) { + throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration"); + } + }, { + oneOfNodeTypes: ["Declaration"] + }), function (node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + if (val && node.source) { + throw new TypeError("Cannot export a declaration from a source"); + } + }) + }, + attributes: { + optional: true, + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportAttribute"))) + }, + assertions: { + optional: true, + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportAttribute"))) + }, + specifiers: { + default: [], + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)(function () { + const sourced = (0, _utils.assertNodeType)("ExportSpecifier", "ExportDefaultSpecifier", "ExportNamespaceSpecifier"); + const sourceless = (0, _utils.assertNodeType)("ExportSpecifier"); + if (!process.env.BABEL_TYPES_8_BREAKING) return sourced; + return function (node, key, val) { + const validator = node.source ? sourced : sourceless; + validator(node, key, val); + }; + }())) + }, + source: { + validate: (0, _utils.assertNodeType)("StringLiteral"), + optional: true + }, + exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value")) + } +}); +defineType("ExportSpecifier", { + visitor: ["local", "exported"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _utils.assertNodeType)("Identifier") + }, + exported: { + validate: (0, _utils.assertNodeType)("Identifier", "StringLiteral") + }, + exportKind: { + validate: (0, _utils.assertOneOf)("type", "value"), + optional: true + } + } +}); +defineType("ForOfStatement", { + visitor: ["left", "right", "body"], + builder: ["left", "right", "body", "await"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: function () { + if (!process.env.BABEL_TYPES_8_BREAKING) { + return (0, _utils.assertNodeType)("VariableDeclaration", "LVal"); + } + const declaration = (0, _utils.assertNodeType)("VariableDeclaration"); + const lval = (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression"); + return function (node, key, val) { + if ((0, _is.default)("VariableDeclaration", val)) { + declaration(node, key, val); + } else { + lval(node, key, val); + } + }; + }() + }, + right: { + validate: (0, _utils.assertNodeType)("Expression") + }, + body: { + validate: (0, _utils.assertNodeType)("Statement") + }, + await: { + default: false + } + } +}); +defineType("ImportDeclaration", { + builder: ["specifiers", "source"], + visitor: ["specifiers", "source", "attributes", "assertions"], + aliases: ["Statement", "Declaration", "ImportOrExportDeclaration"], + fields: { + attributes: { + optional: true, + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportAttribute"))) + }, + assertions: { + optional: true, + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportAttribute"))) + }, + module: { + optional: true, + validate: (0, _utils.assertValueType)("boolean") + }, + specifiers: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier"))) + }, + source: { + validate: (0, _utils.assertNodeType)("StringLiteral") + }, + importKind: { + validate: (0, _utils.assertOneOf)("type", "typeof", "value"), + optional: true + } + } +}); +defineType("ImportDefaultSpecifier", { + visitor: ["local"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _utils.assertNodeType)("Identifier") + } + } +}); +defineType("ImportNamespaceSpecifier", { + visitor: ["local"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _utils.assertNodeType)("Identifier") + } + } +}); +defineType("ImportSpecifier", { + visitor: ["local", "imported"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _utils.assertNodeType)("Identifier") + }, + imported: { + validate: (0, _utils.assertNodeType)("Identifier", "StringLiteral") + }, + importKind: { + validate: (0, _utils.assertOneOf)("type", "typeof", "value"), + optional: true + } + } +}); +defineType("MetaProperty", { + visitor: ["meta", "property"], + aliases: ["Expression"], + fields: { + meta: { + validate: (0, _utils.chain)((0, _utils.assertNodeType)("Identifier"), Object.assign(function (node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + let property; + switch (val.name) { + case "function": + property = "sent"; + break; + case "new": + property = "target"; + break; + case "import": + property = "meta"; + break; + } + if (!(0, _is.default)("Identifier", node.property, { + name: property + })) { + throw new TypeError("Unrecognised MetaProperty"); + } + }, { + oneOfNodeTypes: ["Identifier"] + })) + }, + property: { + validate: (0, _utils.assertNodeType)("Identifier") + } + } +}); +const classMethodOrPropertyCommon = () => ({ + abstract: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + accessibility: { + validate: (0, _utils.assertOneOf)("public", "private", "protected"), + optional: true + }, + static: { + default: false + }, + override: { + default: false + }, + computed: { + default: false + }, + optional: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + key: { + validate: (0, _utils.chain)(function () { + const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); + const computed = (0, _utils.assertNodeType)("Expression"); + return function (node, key, val) { + const validator = node.computed ? computed : normal; + validator(node, key, val); + }; + }(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "Expression")) + } +}); +exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon; +const classMethodOrDeclareMethodCommon = () => Object.assign({}, functionCommon(), classMethodOrPropertyCommon(), { + params: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement", "TSParameterProperty"))) + }, + kind: { + validate: (0, _utils.assertOneOf)("get", "set", "method", "constructor"), + default: "method" + }, + access: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("public", "private", "protected")), + optional: true + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + } +}); +exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon; +defineType("ClassMethod", { + aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"], + builder: ["kind", "key", "params", "body", "computed", "static", "generator", "async"], + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + fields: Object.assign({}, classMethodOrDeclareMethodCommon(), functionTypeAnnotationCommon(), { + body: { + validate: (0, _utils.assertNodeType)("BlockStatement") + } + }) +}); +defineType("ObjectPattern", { + visitor: ["properties", "typeAnnotation", "decorators"], + builder: ["properties"], + aliases: ["Pattern", "PatternLike", "LVal"], + fields: Object.assign({}, patternLikeCommon(), { + properties: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("RestElement", "ObjectProperty"))) + } + }) +}); +defineType("SpreadElement", { + visitor: ["argument"], + aliases: ["UnaryLike"], + deprecatedAlias: "SpreadProperty", + fields: { + argument: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +defineType("Super", { + aliases: ["Expression"] +}); +defineType("TaggedTemplateExpression", { + visitor: ["tag", "quasi", "typeParameters"], + builder: ["tag", "quasi"], + aliases: ["Expression"], + fields: { + tag: { + validate: (0, _utils.assertNodeType)("Expression") + }, + quasi: { + validate: (0, _utils.assertNodeType)("TemplateLiteral") + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true + } + } +}); +defineType("TemplateElement", { + builder: ["value", "tail"], + fields: { + value: { + validate: (0, _utils.chain)((0, _utils.assertShape)({ + raw: { + validate: (0, _utils.assertValueType)("string") + }, + cooked: { + validate: (0, _utils.assertValueType)("string"), + optional: true + } + }), function templateElementCookedValidator(node) { + const raw = node.value.raw; + let unterminatedCalled = false; + const error = () => { + throw new Error("Internal @babel/types error."); + }; + const { + str, + firstInvalidLoc + } = (0, _helperStringParser.readStringContents)("template", raw, 0, 0, 0, { + unterminated() { + unterminatedCalled = true; + }, + strictNumericEscape: error, + invalidEscapeSequence: error, + numericSeparatorInEscapeSequence: error, + unexpectedNumericSeparator: error, + invalidDigit: error, + invalidCodePoint: error + }); + if (!unterminatedCalled) throw new Error("Invalid raw"); + node.value.cooked = firstInvalidLoc ? null : str; + }) + }, + tail: { + default: false + } + } +}); +defineType("TemplateLiteral", { + visitor: ["quasis", "expressions"], + aliases: ["Expression", "Literal"], + fields: { + quasis: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TemplateElement"))) + }, + expressions: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "TSType")), function (node, key, val) { + if (node.quasis.length !== val.length + 1) { + throw new TypeError(`Number of ${node.type} quasis should be exactly one more than the number of expressions.\nExpected ${val.length + 1} quasis but got ${node.quasis.length}`); + } + }) + } + } +}); +defineType("YieldExpression", { + builder: ["argument", "delegate"], + visitor: ["argument"], + aliases: ["Expression", "Terminatorless"], + fields: { + delegate: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("boolean"), Object.assign(function (node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + if (val && !node.argument) { + throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument"); + } + }, { + type: "boolean" + })), + default: false + }, + argument: { + optional: true, + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +defineType("AwaitExpression", { + builder: ["argument"], + visitor: ["argument"], + aliases: ["Expression", "Terminatorless"], + fields: { + argument: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +defineType("Import", { + aliases: ["Expression"] +}); +defineType("BigIntLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _utils.assertValueType)("string") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); +defineType("ExportNamespaceSpecifier", { + visitor: ["exported"], + aliases: ["ModuleSpecifier"], + fields: { + exported: { + validate: (0, _utils.assertNodeType)("Identifier") + } + } +}); +defineType("OptionalMemberExpression", { + builder: ["object", "property", "computed", "optional"], + visitor: ["object", "property"], + aliases: ["Expression"], + fields: { + object: { + validate: (0, _utils.assertNodeType)("Expression") + }, + property: { + validate: function () { + const normal = (0, _utils.assertNodeType)("Identifier"); + const computed = (0, _utils.assertNodeType)("Expression"); + const validator = Object.assign(function (node, key, val) { + const validator = node.computed ? computed : normal; + validator(node, key, val); + }, { + oneOfNodeTypes: ["Expression", "Identifier"] + }); + return validator; + }() + }, + computed: { + default: false + }, + optional: { + validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertValueType)("boolean") : (0, _utils.chain)((0, _utils.assertValueType)("boolean"), (0, _utils.assertOptionalChainStart)()) + } + } +}); +defineType("OptionalCallExpression", { + visitor: ["callee", "arguments", "typeParameters", "typeArguments"], + builder: ["callee", "arguments", "optional"], + aliases: ["Expression"], + fields: { + callee: { + validate: (0, _utils.assertNodeType)("Expression") + }, + arguments: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName", "ArgumentPlaceholder"))) + }, + optional: { + validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertValueType)("boolean") : (0, _utils.chain)((0, _utils.assertValueType)("boolean"), (0, _utils.assertOptionalChainStart)()) + }, + typeArguments: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"), + optional: true + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"), + optional: true + } + } +}); +defineType("ClassProperty", { + visitor: ["key", "value", "typeAnnotation", "decorators"], + builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"], + aliases: ["Property"], + fields: Object.assign({}, classMethodOrPropertyCommon(), { + value: { + validate: (0, _utils.assertNodeType)("Expression"), + optional: true + }, + definite: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + typeAnnotation: { + validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + }, + readonly: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + declare: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + variance: { + validate: (0, _utils.assertNodeType)("Variance"), + optional: true + } + }) +}); +defineType("ClassAccessorProperty", { + visitor: ["key", "value", "typeAnnotation", "decorators"], + builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"], + aliases: ["Property", "Accessor"], + fields: Object.assign({}, classMethodOrPropertyCommon(), { + key: { + validate: (0, _utils.chain)(function () { + const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "PrivateName"); + const computed = (0, _utils.assertNodeType)("Expression"); + return function (node, key, val) { + const validator = node.computed ? computed : normal; + validator(node, key, val); + }; + }(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "Expression", "PrivateName")) + }, + value: { + validate: (0, _utils.assertNodeType)("Expression"), + optional: true + }, + definite: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + typeAnnotation: { + validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + }, + readonly: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + declare: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + variance: { + validate: (0, _utils.assertNodeType)("Variance"), + optional: true + } + }) +}); +defineType("ClassPrivateProperty", { + visitor: ["key", "value", "decorators", "typeAnnotation"], + builder: ["key", "value", "decorators", "static"], + aliases: ["Property", "Private"], + fields: { + key: { + validate: (0, _utils.assertNodeType)("PrivateName") + }, + value: { + validate: (0, _utils.assertNodeType)("Expression"), + optional: true + }, + typeAnnotation: { + validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + }, + static: { + validate: (0, _utils.assertValueType)("boolean"), + default: false + }, + readonly: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + definite: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + variance: { + validate: (0, _utils.assertNodeType)("Variance"), + optional: true + } + } +}); +defineType("ClassPrivateMethod", { + builder: ["kind", "key", "params", "body", "static"], + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method", "Private"], + fields: Object.assign({}, classMethodOrDeclareMethodCommon(), functionTypeAnnotationCommon(), { + kind: { + validate: (0, _utils.assertOneOf)("get", "set", "method"), + default: "method" + }, + key: { + validate: (0, _utils.assertNodeType)("PrivateName") + }, + body: { + validate: (0, _utils.assertNodeType)("BlockStatement") + } + }) +}); +defineType("PrivateName", { + visitor: ["id"], + aliases: ["Private"], + fields: { + id: { + validate: (0, _utils.assertNodeType)("Identifier") + } + } +}); +defineType("StaticBlock", { + visitor: ["body"], + fields: { + body: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "FunctionParent"] +}); + +//# sourceMappingURL=core.js.map + + +/***/ }), + +/***/ 3127: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.DEPRECATED_ALIASES = void 0; +const DEPRECATED_ALIASES = { + ModuleDeclaration: "ImportOrExportDeclaration" +}; +exports.DEPRECATED_ALIASES = DEPRECATED_ALIASES; + +//# sourceMappingURL=deprecated-aliases.js.map + + +/***/ }), + +/***/ 9555: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var _utils = __nccwpck_require__(799); +(0, _utils.default)("ArgumentPlaceholder", {}); +(0, _utils.default)("BindExpression", { + visitor: ["object", "callee"], + aliases: ["Expression"], + fields: !process.env.BABEL_TYPES_8_BREAKING ? { + object: { + validate: Object.assign(() => {}, { + oneOfNodeTypes: ["Expression"] + }) + }, + callee: { + validate: Object.assign(() => {}, { + oneOfNodeTypes: ["Expression"] + }) + } + } : { + object: { + validate: (0, _utils.assertNodeType)("Expression") + }, + callee: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +(0, _utils.default)("ImportAttribute", { + visitor: ["key", "value"], + fields: { + key: { + validate: (0, _utils.assertNodeType)("Identifier", "StringLiteral") + }, + value: { + validate: (0, _utils.assertNodeType)("StringLiteral") + } + } +}); +(0, _utils.default)("Decorator", { + visitor: ["expression"], + fields: { + expression: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +(0, _utils.default)("DoExpression", { + visitor: ["body"], + builder: ["body", "async"], + aliases: ["Expression"], + fields: { + body: { + validate: (0, _utils.assertNodeType)("BlockStatement") + }, + async: { + validate: (0, _utils.assertValueType)("boolean"), + default: false + } + } +}); +(0, _utils.default)("ExportDefaultSpecifier", { + visitor: ["exported"], + aliases: ["ModuleSpecifier"], + fields: { + exported: { + validate: (0, _utils.assertNodeType)("Identifier") + } + } +}); +(0, _utils.default)("RecordExpression", { + visitor: ["properties"], + aliases: ["Expression"], + fields: { + properties: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ObjectProperty", "SpreadElement"))) + } + } +}); +(0, _utils.default)("TupleExpression", { + fields: { + elements: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement"))), + default: [] + } + }, + visitor: ["elements"], + aliases: ["Expression"] +}); +(0, _utils.default)("DecimalLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _utils.assertValueType)("string") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); +(0, _utils.default)("ModuleExpression", { + visitor: ["body"], + fields: { + body: { + validate: (0, _utils.assertNodeType)("Program") + } + }, + aliases: ["Expression"] +}); +(0, _utils.default)("TopicReference", { + aliases: ["Expression"] +}); +(0, _utils.default)("PipelineTopicExpression", { + builder: ["expression"], + visitor: ["expression"], + fields: { + expression: { + validate: (0, _utils.assertNodeType)("Expression") + } + }, + aliases: ["Expression"] +}); +(0, _utils.default)("PipelineBareFunction", { + builder: ["callee"], + visitor: ["callee"], + fields: { + callee: { + validate: (0, _utils.assertNodeType)("Expression") + } + }, + aliases: ["Expression"] +}); +(0, _utils.default)("PipelinePrimaryTopicReference", { + aliases: ["Expression"] +}); + +//# sourceMappingURL=experimental.js.map + + +/***/ }), + +/***/ 9271: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var _utils = __nccwpck_require__(799); +const defineType = (0, _utils.defineAliasedType)("Flow"); +const defineInterfaceishType = name => { + const isDeclareClass = name === "DeclareClass"; + defineType(name, { + builder: ["id", "typeParameters", "extends", "body"], + visitor: ["id", "typeParameters", "extends", ...(isDeclareClass ? ["mixins", "implements"] : []), "body"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: Object.assign({ + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")) + }, isDeclareClass ? { + mixins: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")), + implements: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ClassImplements")) + } : {}, { + body: (0, _utils.validateType)("ObjectTypeAnnotation") + }) + }); +}; +defineType("AnyTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("ArrayTypeAnnotation", { + visitor: ["elementType"], + aliases: ["FlowType"], + fields: { + elementType: (0, _utils.validateType)("FlowType") + } +}); +defineType("BooleanTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("BooleanLiteralTypeAnnotation", { + builder: ["value"], + aliases: ["FlowType"], + fields: { + value: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("NullLiteralTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("ClassImplements", { + visitor: ["id", "typeParameters"], + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation") + } +}); +defineInterfaceishType("DeclareClass"); +defineType("DeclareFunction", { + visitor: ["id"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: (0, _utils.validateType)("Identifier"), + predicate: (0, _utils.validateOptionalType)("DeclaredPredicate") + } +}); +defineInterfaceishType("DeclareInterface"); +defineType("DeclareModule", { + builder: ["id", "body", "kind"], + visitor: ["id", "body"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: (0, _utils.validateType)(["Identifier", "StringLiteral"]), + body: (0, _utils.validateType)("BlockStatement"), + kind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("CommonJS", "ES")) + } +}); +defineType("DeclareModuleExports", { + visitor: ["typeAnnotation"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + typeAnnotation: (0, _utils.validateType)("TypeAnnotation") + } +}); +defineType("DeclareTypeAlias", { + visitor: ["id", "typeParameters", "right"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + right: (0, _utils.validateType)("FlowType") + } +}); +defineType("DeclareOpaqueType", { + visitor: ["id", "typeParameters", "supertype"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + supertype: (0, _utils.validateOptionalType)("FlowType"), + impltype: (0, _utils.validateOptionalType)("FlowType") + } +}); +defineType("DeclareVariable", { + visitor: ["id"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: (0, _utils.validateType)("Identifier") + } +}); +defineType("DeclareExportDeclaration", { + visitor: ["declaration", "specifiers", "source"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + declaration: (0, _utils.validateOptionalType)("Flow"), + specifiers: (0, _utils.validateOptional)((0, _utils.arrayOfType)(["ExportSpecifier", "ExportNamespaceSpecifier"])), + source: (0, _utils.validateOptionalType)("StringLiteral"), + default: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("DeclareExportAllDeclaration", { + visitor: ["source"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + source: (0, _utils.validateType)("StringLiteral"), + exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value")) + } +}); +defineType("DeclaredPredicate", { + visitor: ["value"], + aliases: ["FlowPredicate"], + fields: { + value: (0, _utils.validateType)("Flow") + } +}); +defineType("ExistsTypeAnnotation", { + aliases: ["FlowType"] +}); +defineType("FunctionTypeAnnotation", { + visitor: ["typeParameters", "params", "rest", "returnType"], + aliases: ["FlowType"], + fields: { + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + params: (0, _utils.validate)((0, _utils.arrayOfType)("FunctionTypeParam")), + rest: (0, _utils.validateOptionalType)("FunctionTypeParam"), + this: (0, _utils.validateOptionalType)("FunctionTypeParam"), + returnType: (0, _utils.validateType)("FlowType") + } +}); +defineType("FunctionTypeParam", { + visitor: ["name", "typeAnnotation"], + fields: { + name: (0, _utils.validateOptionalType)("Identifier"), + typeAnnotation: (0, _utils.validateType)("FlowType"), + optional: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("GenericTypeAnnotation", { + visitor: ["id", "typeParameters"], + aliases: ["FlowType"], + fields: { + id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation") + } +}); +defineType("InferredPredicate", { + aliases: ["FlowPredicate"] +}); +defineType("InterfaceExtends", { + visitor: ["id", "typeParameters"], + fields: { + id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation") + } +}); +defineInterfaceishType("InterfaceDeclaration"); +defineType("InterfaceTypeAnnotation", { + visitor: ["extends", "body"], + aliases: ["FlowType"], + fields: { + extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")), + body: (0, _utils.validateType)("ObjectTypeAnnotation") + } +}); +defineType("IntersectionTypeAnnotation", { + visitor: ["types"], + aliases: ["FlowType"], + fields: { + types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType")) + } +}); +defineType("MixedTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("EmptyTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("NullableTypeAnnotation", { + visitor: ["typeAnnotation"], + aliases: ["FlowType"], + fields: { + typeAnnotation: (0, _utils.validateType)("FlowType") + } +}); +defineType("NumberLiteralTypeAnnotation", { + builder: ["value"], + aliases: ["FlowType"], + fields: { + value: (0, _utils.validate)((0, _utils.assertValueType)("number")) + } +}); +defineType("NumberTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("ObjectTypeAnnotation", { + visitor: ["properties", "indexers", "callProperties", "internalSlots"], + aliases: ["FlowType"], + builder: ["properties", "indexers", "callProperties", "internalSlots", "exact"], + fields: { + properties: (0, _utils.validate)((0, _utils.arrayOfType)(["ObjectTypeProperty", "ObjectTypeSpreadProperty"])), + indexers: { + validate: (0, _utils.arrayOfType)("ObjectTypeIndexer"), + optional: true, + default: [] + }, + callProperties: { + validate: (0, _utils.arrayOfType)("ObjectTypeCallProperty"), + optional: true, + default: [] + }, + internalSlots: { + validate: (0, _utils.arrayOfType)("ObjectTypeInternalSlot"), + optional: true, + default: [] + }, + exact: { + validate: (0, _utils.assertValueType)("boolean"), + default: false + }, + inexact: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("ObjectTypeInternalSlot", { + visitor: ["id", "value", "optional", "static", "method"], + aliases: ["UserWhitespacable"], + fields: { + id: (0, _utils.validateType)("Identifier"), + value: (0, _utils.validateType)("FlowType"), + optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + method: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("ObjectTypeCallProperty", { + visitor: ["value"], + aliases: ["UserWhitespacable"], + fields: { + value: (0, _utils.validateType)("FlowType"), + static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("ObjectTypeIndexer", { + visitor: ["id", "key", "value", "variance"], + aliases: ["UserWhitespacable"], + fields: { + id: (0, _utils.validateOptionalType)("Identifier"), + key: (0, _utils.validateType)("FlowType"), + value: (0, _utils.validateType)("FlowType"), + static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + variance: (0, _utils.validateOptionalType)("Variance") + } +}); +defineType("ObjectTypeProperty", { + visitor: ["key", "value", "variance"], + aliases: ["UserWhitespacable"], + fields: { + key: (0, _utils.validateType)(["Identifier", "StringLiteral"]), + value: (0, _utils.validateType)("FlowType"), + kind: (0, _utils.validate)((0, _utils.assertOneOf)("init", "get", "set")), + static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + proto: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + variance: (0, _utils.validateOptionalType)("Variance"), + method: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("ObjectTypeSpreadProperty", { + visitor: ["argument"], + aliases: ["UserWhitespacable"], + fields: { + argument: (0, _utils.validateType)("FlowType") + } +}); +defineType("OpaqueType", { + visitor: ["id", "typeParameters", "supertype", "impltype"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + supertype: (0, _utils.validateOptionalType)("FlowType"), + impltype: (0, _utils.validateType)("FlowType") + } +}); +defineType("QualifiedTypeIdentifier", { + visitor: ["id", "qualification"], + fields: { + id: (0, _utils.validateType)("Identifier"), + qualification: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]) + } +}); +defineType("StringLiteralTypeAnnotation", { + builder: ["value"], + aliases: ["FlowType"], + fields: { + value: (0, _utils.validate)((0, _utils.assertValueType)("string")) + } +}); +defineType("StringTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("SymbolTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("ThisTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("TupleTypeAnnotation", { + visitor: ["types"], + aliases: ["FlowType"], + fields: { + types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType")) + } +}); +defineType("TypeofTypeAnnotation", { + visitor: ["argument"], + aliases: ["FlowType"], + fields: { + argument: (0, _utils.validateType)("FlowType") + } +}); +defineType("TypeAlias", { + visitor: ["id", "typeParameters", "right"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + right: (0, _utils.validateType)("FlowType") + } +}); +defineType("TypeAnnotation", { + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: (0, _utils.validateType)("FlowType") + } +}); +defineType("TypeCastExpression", { + visitor: ["expression", "typeAnnotation"], + aliases: ["ExpressionWrapper", "Expression"], + fields: { + expression: (0, _utils.validateType)("Expression"), + typeAnnotation: (0, _utils.validateType)("TypeAnnotation") + } +}); +defineType("TypeParameter", { + visitor: ["bound", "default", "variance"], + fields: { + name: (0, _utils.validate)((0, _utils.assertValueType)("string")), + bound: (0, _utils.validateOptionalType)("TypeAnnotation"), + default: (0, _utils.validateOptionalType)("FlowType"), + variance: (0, _utils.validateOptionalType)("Variance") + } +}); +defineType("TypeParameterDeclaration", { + visitor: ["params"], + fields: { + params: (0, _utils.validate)((0, _utils.arrayOfType)("TypeParameter")) + } +}); +defineType("TypeParameterInstantiation", { + visitor: ["params"], + fields: { + params: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType")) + } +}); +defineType("UnionTypeAnnotation", { + visitor: ["types"], + aliases: ["FlowType"], + fields: { + types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType")) + } +}); +defineType("Variance", { + builder: ["kind"], + fields: { + kind: (0, _utils.validate)((0, _utils.assertOneOf)("minus", "plus")) + } +}); +defineType("VoidTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] +}); +defineType("EnumDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "body"], + fields: { + id: (0, _utils.validateType)("Identifier"), + body: (0, _utils.validateType)(["EnumBooleanBody", "EnumNumberBody", "EnumStringBody", "EnumSymbolBody"]) + } +}); +defineType("EnumBooleanBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicitType: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + members: (0, _utils.validateArrayOfType)("EnumBooleanMember"), + hasUnknownMembers: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("EnumNumberBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicitType: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + members: (0, _utils.validateArrayOfType)("EnumNumberMember"), + hasUnknownMembers: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("EnumStringBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicitType: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + members: (0, _utils.validateArrayOfType)(["EnumStringMember", "EnumDefaultedMember"]), + hasUnknownMembers: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("EnumSymbolBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + members: (0, _utils.validateArrayOfType)("EnumDefaultedMember"), + hasUnknownMembers: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } +}); +defineType("EnumBooleanMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: (0, _utils.validateType)("Identifier"), + init: (0, _utils.validateType)("BooleanLiteral") + } +}); +defineType("EnumNumberMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: (0, _utils.validateType)("Identifier"), + init: (0, _utils.validateType)("NumericLiteral") + } +}); +defineType("EnumStringMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: (0, _utils.validateType)("Identifier"), + init: (0, _utils.validateType)("StringLiteral") + } +}); +defineType("EnumDefaultedMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: (0, _utils.validateType)("Identifier") + } +}); +defineType("IndexedAccessType", { + visitor: ["objectType", "indexType"], + aliases: ["FlowType"], + fields: { + objectType: (0, _utils.validateType)("FlowType"), + indexType: (0, _utils.validateType)("FlowType") + } +}); +defineType("OptionalIndexedAccessType", { + visitor: ["objectType", "indexType"], + aliases: ["FlowType"], + fields: { + objectType: (0, _utils.validateType)("FlowType"), + indexType: (0, _utils.validateType)("FlowType"), + optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } +}); + +//# sourceMappingURL=flow.js.map + + +/***/ }), + +/***/ 8774: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "ALIAS_KEYS", ({ + enumerable: true, + get: function () { + return _utils.ALIAS_KEYS; + } +})); +Object.defineProperty(exports, "BUILDER_KEYS", ({ + enumerable: true, + get: function () { + return _utils.BUILDER_KEYS; + } +})); +Object.defineProperty(exports, "DEPRECATED_ALIASES", ({ + enumerable: true, + get: function () { + return _deprecatedAliases.DEPRECATED_ALIASES; + } +})); +Object.defineProperty(exports, "DEPRECATED_KEYS", ({ + enumerable: true, + get: function () { + return _utils.DEPRECATED_KEYS; + } +})); +Object.defineProperty(exports, "FLIPPED_ALIAS_KEYS", ({ + enumerable: true, + get: function () { + return _utils.FLIPPED_ALIAS_KEYS; + } +})); +Object.defineProperty(exports, "NODE_FIELDS", ({ + enumerable: true, + get: function () { + return _utils.NODE_FIELDS; + } +})); +Object.defineProperty(exports, "NODE_PARENT_VALIDATIONS", ({ + enumerable: true, + get: function () { + return _utils.NODE_PARENT_VALIDATIONS; + } +})); +Object.defineProperty(exports, "PLACEHOLDERS", ({ + enumerable: true, + get: function () { + return _placeholders.PLACEHOLDERS; + } +})); +Object.defineProperty(exports, "PLACEHOLDERS_ALIAS", ({ + enumerable: true, + get: function () { + return _placeholders.PLACEHOLDERS_ALIAS; + } +})); +Object.defineProperty(exports, "PLACEHOLDERS_FLIPPED_ALIAS", ({ + enumerable: true, + get: function () { + return _placeholders.PLACEHOLDERS_FLIPPED_ALIAS; + } +})); +exports.TYPES = void 0; +Object.defineProperty(exports, "VISITOR_KEYS", ({ + enumerable: true, + get: function () { + return _utils.VISITOR_KEYS; + } +})); +var _toFastProperties = __nccwpck_require__(9049); +__nccwpck_require__(8655); +__nccwpck_require__(9271); +__nccwpck_require__(1543); +__nccwpck_require__(8770); +__nccwpck_require__(9555); +__nccwpck_require__(8354); +var _utils = __nccwpck_require__(799); +var _placeholders = __nccwpck_require__(7); +var _deprecatedAliases = __nccwpck_require__(3127); +Object.keys(_deprecatedAliases.DEPRECATED_ALIASES).forEach(deprecatedAlias => { + _utils.FLIPPED_ALIAS_KEYS[deprecatedAlias] = _utils.FLIPPED_ALIAS_KEYS[_deprecatedAliases.DEPRECATED_ALIASES[deprecatedAlias]]; +}); +_toFastProperties(_utils.VISITOR_KEYS); +_toFastProperties(_utils.ALIAS_KEYS); +_toFastProperties(_utils.FLIPPED_ALIAS_KEYS); +_toFastProperties(_utils.NODE_FIELDS); +_toFastProperties(_utils.BUILDER_KEYS); +_toFastProperties(_utils.DEPRECATED_KEYS); +_toFastProperties(_placeholders.PLACEHOLDERS_ALIAS); +_toFastProperties(_placeholders.PLACEHOLDERS_FLIPPED_ALIAS); +const TYPES = [].concat(Object.keys(_utils.VISITOR_KEYS), Object.keys(_utils.FLIPPED_ALIAS_KEYS), Object.keys(_utils.DEPRECATED_KEYS)); +exports.TYPES = TYPES; + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 1543: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var _utils = __nccwpck_require__(799); +const defineType = (0, _utils.defineAliasedType)("JSX"); +defineType("JSXAttribute", { + visitor: ["name", "value"], + aliases: ["Immutable"], + fields: { + name: { + validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXNamespacedName") + }, + value: { + optional: true, + validate: (0, _utils.assertNodeType)("JSXElement", "JSXFragment", "StringLiteral", "JSXExpressionContainer") + } + } +}); +defineType("JSXClosingElement", { + visitor: ["name"], + aliases: ["Immutable"], + fields: { + name: { + validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName") + } + } +}); +defineType("JSXElement", { + builder: ["openingElement", "closingElement", "children", "selfClosing"], + visitor: ["openingElement", "children", "closingElement"], + aliases: ["Immutable", "Expression"], + fields: Object.assign({ + openingElement: { + validate: (0, _utils.assertNodeType)("JSXOpeningElement") + }, + closingElement: { + optional: true, + validate: (0, _utils.assertNodeType)("JSXClosingElement") + }, + children: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment"))) + } + }, { + selfClosing: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + } + }) +}); +defineType("JSXEmptyExpression", {}); +defineType("JSXExpressionContainer", { + visitor: ["expression"], + aliases: ["Immutable"], + fields: { + expression: { + validate: (0, _utils.assertNodeType)("Expression", "JSXEmptyExpression") + } + } +}); +defineType("JSXSpreadChild", { + visitor: ["expression"], + aliases: ["Immutable"], + fields: { + expression: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +defineType("JSXIdentifier", { + builder: ["name"], + fields: { + name: { + validate: (0, _utils.assertValueType)("string") + } + } +}); +defineType("JSXMemberExpression", { + visitor: ["object", "property"], + fields: { + object: { + validate: (0, _utils.assertNodeType)("JSXMemberExpression", "JSXIdentifier") + }, + property: { + validate: (0, _utils.assertNodeType)("JSXIdentifier") + } + } +}); +defineType("JSXNamespacedName", { + visitor: ["namespace", "name"], + fields: { + namespace: { + validate: (0, _utils.assertNodeType)("JSXIdentifier") + }, + name: { + validate: (0, _utils.assertNodeType)("JSXIdentifier") + } + } +}); +defineType("JSXOpeningElement", { + builder: ["name", "attributes", "selfClosing"], + visitor: ["name", "attributes"], + aliases: ["Immutable"], + fields: { + name: { + validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName") + }, + selfClosing: { + default: false + }, + attributes: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXAttribute", "JSXSpreadAttribute"))) + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true + } + } +}); +defineType("JSXSpreadAttribute", { + visitor: ["argument"], + fields: { + argument: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +defineType("JSXText", { + aliases: ["Immutable"], + builder: ["value"], + fields: { + value: { + validate: (0, _utils.assertValueType)("string") + } + } +}); +defineType("JSXFragment", { + builder: ["openingFragment", "closingFragment", "children"], + visitor: ["openingFragment", "children", "closingFragment"], + aliases: ["Immutable", "Expression"], + fields: { + openingFragment: { + validate: (0, _utils.assertNodeType)("JSXOpeningFragment") + }, + closingFragment: { + validate: (0, _utils.assertNodeType)("JSXClosingFragment") + }, + children: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment"))) + } + } +}); +defineType("JSXOpeningFragment", { + aliases: ["Immutable"] +}); +defineType("JSXClosingFragment", { + aliases: ["Immutable"] +}); + +//# sourceMappingURL=jsx.js.map + + +/***/ }), + +/***/ 8770: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var _utils = __nccwpck_require__(799); +var _placeholders = __nccwpck_require__(7); +const defineType = (0, _utils.defineAliasedType)("Miscellaneous"); +{ + defineType("Noop", { + visitor: [] + }); +} +defineType("Placeholder", { + visitor: [], + builder: ["expectedNode", "name"], + fields: { + name: { + validate: (0, _utils.assertNodeType)("Identifier") + }, + expectedNode: { + validate: (0, _utils.assertOneOf)(..._placeholders.PLACEHOLDERS) + } + } +}); +defineType("V8IntrinsicIdentifier", { + builder: ["name"], + fields: { + name: { + validate: (0, _utils.assertValueType)("string") + } + } +}); + +//# sourceMappingURL=misc.js.map + + +/***/ }), + +/***/ 7: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.PLACEHOLDERS_FLIPPED_ALIAS = exports.PLACEHOLDERS_ALIAS = exports.PLACEHOLDERS = void 0; +var _utils = __nccwpck_require__(799); +const PLACEHOLDERS = ["Identifier", "StringLiteral", "Expression", "Statement", "Declaration", "BlockStatement", "ClassBody", "Pattern"]; +exports.PLACEHOLDERS = PLACEHOLDERS; +const PLACEHOLDERS_ALIAS = { + Declaration: ["Statement"], + Pattern: ["PatternLike", "LVal"] +}; +exports.PLACEHOLDERS_ALIAS = PLACEHOLDERS_ALIAS; +for (const type of PLACEHOLDERS) { + const alias = _utils.ALIAS_KEYS[type]; + if (alias != null && alias.length) PLACEHOLDERS_ALIAS[type] = alias; +} +const PLACEHOLDERS_FLIPPED_ALIAS = {}; +exports.PLACEHOLDERS_FLIPPED_ALIAS = PLACEHOLDERS_FLIPPED_ALIAS; +Object.keys(PLACEHOLDERS_ALIAS).forEach(type => { + PLACEHOLDERS_ALIAS[type].forEach(alias => { + if (!Object.hasOwnProperty.call(PLACEHOLDERS_FLIPPED_ALIAS, alias)) { + PLACEHOLDERS_FLIPPED_ALIAS[alias] = []; + } + PLACEHOLDERS_FLIPPED_ALIAS[alias].push(type); + }); +}); + +//# sourceMappingURL=placeholders.js.map + + +/***/ }), + +/***/ 8354: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var _utils = __nccwpck_require__(799); +var _core = __nccwpck_require__(8655); +var _is = __nccwpck_require__(9242); +const defineType = (0, _utils.defineAliasedType)("TypeScript"); +const bool = (0, _utils.assertValueType)("boolean"); +const tSFunctionTypeAnnotationCommon = () => ({ + returnType: { + validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"), + optional: true + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"), + optional: true + } +}); +defineType("TSParameterProperty", { + aliases: ["LVal"], + visitor: ["parameter"], + fields: { + accessibility: { + validate: (0, _utils.assertOneOf)("public", "private", "protected"), + optional: true + }, + readonly: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + parameter: { + validate: (0, _utils.assertNodeType)("Identifier", "AssignmentPattern") + }, + override: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + decorators: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), + optional: true + } + } +}); +defineType("TSDeclareFunction", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "typeParameters", "params", "returnType"], + fields: Object.assign({}, (0, _core.functionDeclarationCommon)(), tSFunctionTypeAnnotationCommon()) +}); +defineType("TSDeclareMethod", { + visitor: ["decorators", "key", "typeParameters", "params", "returnType"], + fields: Object.assign({}, (0, _core.classMethodOrDeclareMethodCommon)(), tSFunctionTypeAnnotationCommon()) +}); +defineType("TSQualifiedName", { + aliases: ["TSEntityName"], + visitor: ["left", "right"], + fields: { + left: (0, _utils.validateType)("TSEntityName"), + right: (0, _utils.validateType)("Identifier") + } +}); +const signatureDeclarationCommon = () => ({ + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"), + ["parameters"]: (0, _utils.validateArrayOfType)(["ArrayPattern", "Identifier", "ObjectPattern", "RestElement"]), + ["typeAnnotation"]: (0, _utils.validateOptionalType)("TSTypeAnnotation") +}); +const callConstructSignatureDeclaration = { + aliases: ["TSTypeElement"], + visitor: ["typeParameters", "parameters", "typeAnnotation"], + fields: signatureDeclarationCommon() +}; +defineType("TSCallSignatureDeclaration", callConstructSignatureDeclaration); +defineType("TSConstructSignatureDeclaration", callConstructSignatureDeclaration); +const namedTypeElementCommon = () => ({ + key: (0, _utils.validateType)("Expression"), + computed: { + default: false + }, + optional: (0, _utils.validateOptional)(bool) +}); +defineType("TSPropertySignature", { + aliases: ["TSTypeElement"], + visitor: ["key", "typeAnnotation", "initializer"], + fields: Object.assign({}, namedTypeElementCommon(), { + readonly: (0, _utils.validateOptional)(bool), + typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"), + initializer: (0, _utils.validateOptionalType)("Expression"), + kind: { + validate: (0, _utils.assertOneOf)("get", "set") + } + }) +}); +defineType("TSMethodSignature", { + aliases: ["TSTypeElement"], + visitor: ["key", "typeParameters", "parameters", "typeAnnotation"], + fields: Object.assign({}, signatureDeclarationCommon(), namedTypeElementCommon(), { + kind: { + validate: (0, _utils.assertOneOf)("method", "get", "set") + } + }) +}); +defineType("TSIndexSignature", { + aliases: ["TSTypeElement"], + visitor: ["parameters", "typeAnnotation"], + fields: { + readonly: (0, _utils.validateOptional)(bool), + static: (0, _utils.validateOptional)(bool), + parameters: (0, _utils.validateArrayOfType)("Identifier"), + typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation") + } +}); +const tsKeywordTypes = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "TSIntrinsicKeyword", "TSNeverKeyword", "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSUndefinedKeyword", "TSUnknownKeyword", "TSVoidKeyword"]; +for (const type of tsKeywordTypes) { + defineType(type, { + aliases: ["TSType", "TSBaseType"], + visitor: [], + fields: {} + }); +} +defineType("TSThisType", { + aliases: ["TSType", "TSBaseType"], + visitor: [], + fields: {} +}); +const fnOrCtrBase = { + aliases: ["TSType"], + visitor: ["typeParameters", "parameters", "typeAnnotation"] +}; +defineType("TSFunctionType", Object.assign({}, fnOrCtrBase, { + fields: signatureDeclarationCommon() +})); +defineType("TSConstructorType", Object.assign({}, fnOrCtrBase, { + fields: Object.assign({}, signatureDeclarationCommon(), { + abstract: (0, _utils.validateOptional)(bool) + }) +})); +defineType("TSTypeReference", { + aliases: ["TSType"], + visitor: ["typeName", "typeParameters"], + fields: { + typeName: (0, _utils.validateType)("TSEntityName"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation") + } +}); +defineType("TSTypePredicate", { + aliases: ["TSType"], + visitor: ["parameterName", "typeAnnotation"], + builder: ["parameterName", "typeAnnotation", "asserts"], + fields: { + parameterName: (0, _utils.validateType)(["Identifier", "TSThisType"]), + typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"), + asserts: (0, _utils.validateOptional)(bool) + } +}); +defineType("TSTypeQuery", { + aliases: ["TSType"], + visitor: ["exprName", "typeParameters"], + fields: { + exprName: (0, _utils.validateType)(["TSEntityName", "TSImportType"]), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation") + } +}); +defineType("TSTypeLiteral", { + aliases: ["TSType"], + visitor: ["members"], + fields: { + members: (0, _utils.validateArrayOfType)("TSTypeElement") + } +}); +defineType("TSArrayType", { + aliases: ["TSType"], + visitor: ["elementType"], + fields: { + elementType: (0, _utils.validateType)("TSType") + } +}); +defineType("TSTupleType", { + aliases: ["TSType"], + visitor: ["elementTypes"], + fields: { + elementTypes: (0, _utils.validateArrayOfType)(["TSType", "TSNamedTupleMember"]) + } +}); +defineType("TSOptionalType", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: (0, _utils.validateType)("TSType") + } +}); +defineType("TSRestType", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: (0, _utils.validateType)("TSType") + } +}); +defineType("TSNamedTupleMember", { + visitor: ["label", "elementType"], + builder: ["label", "elementType", "optional"], + fields: { + label: (0, _utils.validateType)("Identifier"), + optional: { + validate: bool, + default: false + }, + elementType: (0, _utils.validateType)("TSType") + } +}); +const unionOrIntersection = { + aliases: ["TSType"], + visitor: ["types"], + fields: { + types: (0, _utils.validateArrayOfType)("TSType") + } +}; +defineType("TSUnionType", unionOrIntersection); +defineType("TSIntersectionType", unionOrIntersection); +defineType("TSConditionalType", { + aliases: ["TSType"], + visitor: ["checkType", "extendsType", "trueType", "falseType"], + fields: { + checkType: (0, _utils.validateType)("TSType"), + extendsType: (0, _utils.validateType)("TSType"), + trueType: (0, _utils.validateType)("TSType"), + falseType: (0, _utils.validateType)("TSType") + } +}); +defineType("TSInferType", { + aliases: ["TSType"], + visitor: ["typeParameter"], + fields: { + typeParameter: (0, _utils.validateType)("TSTypeParameter") + } +}); +defineType("TSParenthesizedType", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: (0, _utils.validateType)("TSType") + } +}); +defineType("TSTypeOperator", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + operator: (0, _utils.validate)((0, _utils.assertValueType)("string")), + typeAnnotation: (0, _utils.validateType)("TSType") + } +}); +defineType("TSIndexedAccessType", { + aliases: ["TSType"], + visitor: ["objectType", "indexType"], + fields: { + objectType: (0, _utils.validateType)("TSType"), + indexType: (0, _utils.validateType)("TSType") + } +}); +defineType("TSMappedType", { + aliases: ["TSType"], + visitor: ["typeParameter", "typeAnnotation", "nameType"], + fields: { + readonly: (0, _utils.validateOptional)((0, _utils.assertOneOf)(true, false, "+", "-")), + typeParameter: (0, _utils.validateType)("TSTypeParameter"), + optional: (0, _utils.validateOptional)((0, _utils.assertOneOf)(true, false, "+", "-")), + typeAnnotation: (0, _utils.validateOptionalType)("TSType"), + nameType: (0, _utils.validateOptionalType)("TSType") + } +}); +defineType("TSLiteralType", { + aliases: ["TSType", "TSBaseType"], + visitor: ["literal"], + fields: { + literal: { + validate: function () { + const unaryExpression = (0, _utils.assertNodeType)("NumericLiteral", "BigIntLiteral"); + const unaryOperator = (0, _utils.assertOneOf)("-"); + const literal = (0, _utils.assertNodeType)("NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral", "TemplateLiteral"); + function validator(parent, key, node) { + if ((0, _is.default)("UnaryExpression", node)) { + unaryOperator(node, "operator", node.operator); + unaryExpression(node, "argument", node.argument); + } else { + literal(parent, key, node); + } + } + validator.oneOfNodeTypes = ["NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral", "TemplateLiteral", "UnaryExpression"]; + return validator; + }() + } + } +}); +defineType("TSExpressionWithTypeArguments", { + aliases: ["TSType"], + visitor: ["expression", "typeParameters"], + fields: { + expression: (0, _utils.validateType)("TSEntityName"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation") + } +}); +defineType("TSInterfaceDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "typeParameters", "extends", "body"], + fields: { + declare: (0, _utils.validateOptional)(bool), + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"), + extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("TSExpressionWithTypeArguments")), + body: (0, _utils.validateType)("TSInterfaceBody") + } +}); +defineType("TSInterfaceBody", { + visitor: ["body"], + fields: { + body: (0, _utils.validateArrayOfType)("TSTypeElement") + } +}); +defineType("TSTypeAliasDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "typeParameters", "typeAnnotation"], + fields: { + declare: (0, _utils.validateOptional)(bool), + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"), + typeAnnotation: (0, _utils.validateType)("TSType") + } +}); +defineType("TSInstantiationExpression", { + aliases: ["Expression"], + visitor: ["expression", "typeParameters"], + fields: { + expression: (0, _utils.validateType)("Expression"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation") + } +}); +const TSTypeExpression = { + aliases: ["Expression", "LVal", "PatternLike"], + visitor: ["expression", "typeAnnotation"], + fields: { + expression: (0, _utils.validateType)("Expression"), + typeAnnotation: (0, _utils.validateType)("TSType") + } +}; +defineType("TSAsExpression", TSTypeExpression); +defineType("TSSatisfiesExpression", TSTypeExpression); +defineType("TSTypeAssertion", { + aliases: ["Expression", "LVal", "PatternLike"], + visitor: ["typeAnnotation", "expression"], + fields: { + typeAnnotation: (0, _utils.validateType)("TSType"), + expression: (0, _utils.validateType)("Expression") + } +}); +defineType("TSEnumDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "members"], + fields: { + declare: (0, _utils.validateOptional)(bool), + const: (0, _utils.validateOptional)(bool), + id: (0, _utils.validateType)("Identifier"), + members: (0, _utils.validateArrayOfType)("TSEnumMember"), + initializer: (0, _utils.validateOptionalType)("Expression") + } +}); +defineType("TSEnumMember", { + visitor: ["id", "initializer"], + fields: { + id: (0, _utils.validateType)(["Identifier", "StringLiteral"]), + initializer: (0, _utils.validateOptionalType)("Expression") + } +}); +defineType("TSModuleDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "body"], + fields: { + declare: (0, _utils.validateOptional)(bool), + global: (0, _utils.validateOptional)(bool), + id: (0, _utils.validateType)(["Identifier", "StringLiteral"]), + body: (0, _utils.validateType)(["TSModuleBlock", "TSModuleDeclaration"]) + } +}); +defineType("TSModuleBlock", { + aliases: ["Scopable", "Block", "BlockParent", "FunctionParent"], + visitor: ["body"], + fields: { + body: (0, _utils.validateArrayOfType)("Statement") + } +}); +defineType("TSImportType", { + aliases: ["TSType"], + visitor: ["argument", "qualifier", "typeParameters"], + fields: { + argument: (0, _utils.validateType)("StringLiteral"), + qualifier: (0, _utils.validateOptionalType)("TSEntityName"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation") + } +}); +defineType("TSImportEqualsDeclaration", { + aliases: ["Statement"], + visitor: ["id", "moduleReference"], + fields: { + isExport: (0, _utils.validate)(bool), + id: (0, _utils.validateType)("Identifier"), + moduleReference: (0, _utils.validateType)(["TSEntityName", "TSExternalModuleReference"]), + importKind: { + validate: (0, _utils.assertOneOf)("type", "value"), + optional: true + } + } +}); +defineType("TSExternalModuleReference", { + visitor: ["expression"], + fields: { + expression: (0, _utils.validateType)("StringLiteral") + } +}); +defineType("TSNonNullExpression", { + aliases: ["Expression", "LVal", "PatternLike"], + visitor: ["expression"], + fields: { + expression: (0, _utils.validateType)("Expression") + } +}); +defineType("TSExportAssignment", { + aliases: ["Statement"], + visitor: ["expression"], + fields: { + expression: (0, _utils.validateType)("Expression") + } +}); +defineType("TSNamespaceExportDeclaration", { + aliases: ["Statement"], + visitor: ["id"], + fields: { + id: (0, _utils.validateType)("Identifier") + } +}); +defineType("TSTypeAnnotation", { + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: { + validate: (0, _utils.assertNodeType)("TSType") + } + } +}); +defineType("TSTypeParameterInstantiation", { + visitor: ["params"], + fields: { + params: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSType"))) + } + } +}); +defineType("TSTypeParameterDeclaration", { + visitor: ["params"], + fields: { + params: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSTypeParameter"))) + } + } +}); +defineType("TSTypeParameter", { + builder: ["constraint", "default", "name"], + visitor: ["constraint", "default"], + fields: { + name: { + validate: (0, _utils.assertValueType)("string") + }, + in: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + out: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + const: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, + constraint: { + validate: (0, _utils.assertNodeType)("TSType"), + optional: true + }, + default: { + validate: (0, _utils.assertNodeType)("TSType"), + optional: true + } + } +}); + +//# sourceMappingURL=typescript.js.map + + +/***/ }), + +/***/ 799: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.VISITOR_KEYS = exports.NODE_PARENT_VALIDATIONS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.ALIAS_KEYS = void 0; +exports.arrayOf = arrayOf; +exports.arrayOfType = arrayOfType; +exports.assertEach = assertEach; +exports.assertNodeOrValueType = assertNodeOrValueType; +exports.assertNodeType = assertNodeType; +exports.assertOneOf = assertOneOf; +exports.assertOptionalChainStart = assertOptionalChainStart; +exports.assertShape = assertShape; +exports.assertValueType = assertValueType; +exports.chain = chain; +exports.default = defineType; +exports.defineAliasedType = defineAliasedType; +exports.typeIs = typeIs; +exports.validate = validate; +exports.validateArrayOfType = validateArrayOfType; +exports.validateOptional = validateOptional; +exports.validateOptionalType = validateOptionalType; +exports.validateType = validateType; +var _is = __nccwpck_require__(9242); +var _validate = __nccwpck_require__(826); +const VISITOR_KEYS = {}; +exports.VISITOR_KEYS = VISITOR_KEYS; +const ALIAS_KEYS = {}; +exports.ALIAS_KEYS = ALIAS_KEYS; +const FLIPPED_ALIAS_KEYS = {}; +exports.FLIPPED_ALIAS_KEYS = FLIPPED_ALIAS_KEYS; +const NODE_FIELDS = {}; +exports.NODE_FIELDS = NODE_FIELDS; +const BUILDER_KEYS = {}; +exports.BUILDER_KEYS = BUILDER_KEYS; +const DEPRECATED_KEYS = {}; +exports.DEPRECATED_KEYS = DEPRECATED_KEYS; +const NODE_PARENT_VALIDATIONS = {}; +exports.NODE_PARENT_VALIDATIONS = NODE_PARENT_VALIDATIONS; +function getType(val) { + if (Array.isArray(val)) { + return "array"; + } else if (val === null) { + return "null"; + } else { + return typeof val; + } +} +function validate(validate) { + return { + validate + }; +} +function typeIs(typeName) { + return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType(...typeName); +} +function validateType(typeName) { + return validate(typeIs(typeName)); +} +function validateOptional(validate) { + return { + validate, + optional: true + }; +} +function validateOptionalType(typeName) { + return { + validate: typeIs(typeName), + optional: true + }; +} +function arrayOf(elementType) { + return chain(assertValueType("array"), assertEach(elementType)); +} +function arrayOfType(typeName) { + return arrayOf(typeIs(typeName)); +} +function validateArrayOfType(typeName) { + return validate(arrayOfType(typeName)); +} +function assertEach(callback) { + function validator(node, key, val) { + if (!Array.isArray(val)) return; + for (let i = 0; i < val.length; i++) { + const subkey = `${key}[${i}]`; + const v = val[i]; + callback(node, subkey, v); + if (process.env.BABEL_TYPES_8_BREAKING) (0, _validate.validateChild)(node, subkey, v); + } + } + validator.each = callback; + return validator; +} +function assertOneOf(...values) { + function validate(node, key, val) { + if (values.indexOf(val) < 0) { + throw new TypeError(`Property ${key} expected value to be one of ${JSON.stringify(values)} but got ${JSON.stringify(val)}`); + } + } + validate.oneOf = values; + return validate; +} +function assertNodeType(...types) { + function validate(node, key, val) { + for (const type of types) { + if ((0, _is.default)(type, val)) { + (0, _validate.validateChild)(node, key, val); + return; + } + } + throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`); + } + validate.oneOfNodeTypes = types; + return validate; +} +function assertNodeOrValueType(...types) { + function validate(node, key, val) { + for (const type of types) { + if (getType(val) === type || (0, _is.default)(type, val)) { + (0, _validate.validateChild)(node, key, val); + return; + } + } + throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`); + } + validate.oneOfNodeOrValueTypes = types; + return validate; +} +function assertValueType(type) { + function validate(node, key, val) { + const valid = getType(val) === type; + if (!valid) { + throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`); + } + } + validate.type = type; + return validate; +} +function assertShape(shape) { + function validate(node, key, val) { + const errors = []; + for (const property of Object.keys(shape)) { + try { + (0, _validate.validateField)(node, property, val[property], shape[property]); + } catch (error) { + if (error instanceof TypeError) { + errors.push(error.message); + continue; + } + throw error; + } + } + if (errors.length) { + throw new TypeError(`Property ${key} of ${node.type} expected to have the following:\n${errors.join("\n")}`); + } + } + validate.shapeOf = shape; + return validate; +} +function assertOptionalChainStart() { + function validate(node) { + var _current; + let current = node; + while (node) { + const { + type + } = current; + if (type === "OptionalCallExpression") { + if (current.optional) return; + current = current.callee; + continue; + } + if (type === "OptionalMemberExpression") { + if (current.optional) return; + current = current.object; + continue; + } + break; + } + throw new TypeError(`Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${(_current = current) == null ? void 0 : _current.type}`); + } + return validate; +} +function chain(...fns) { + function validate(...args) { + for (const fn of fns) { + fn(...args); + } + } + validate.chainOf = fns; + if (fns.length >= 2 && "type" in fns[0] && fns[0].type === "array" && !("each" in fns[1])) { + throw new Error(`An assertValueType("array") validator can only be followed by an assertEach(...) validator.`); + } + return validate; +} +const validTypeOpts = ["aliases", "builder", "deprecatedAlias", "fields", "inherits", "visitor", "validate"]; +const validFieldKeys = ["default", "optional", "deprecated", "validate"]; +const store = {}; +function defineAliasedType(...aliases) { + return (type, opts = {}) => { + let defined = opts.aliases; + if (!defined) { + var _store$opts$inherits$, _defined; + if (opts.inherits) defined = (_store$opts$inherits$ = store[opts.inherits].aliases) == null ? void 0 : _store$opts$inherits$.slice(); + (_defined = defined) != null ? _defined : defined = []; + opts.aliases = defined; + } + const additional = aliases.filter(a => !defined.includes(a)); + defined.unshift(...additional); + defineType(type, opts); + }; +} +function defineType(type, opts = {}) { + const inherits = opts.inherits && store[opts.inherits] || {}; + let fields = opts.fields; + if (!fields) { + fields = {}; + if (inherits.fields) { + const keys = Object.getOwnPropertyNames(inherits.fields); + for (const key of keys) { + const field = inherits.fields[key]; + const def = field.default; + if (Array.isArray(def) ? def.length > 0 : def && typeof def === "object") { + throw new Error("field defaults can only be primitives or empty arrays currently"); + } + fields[key] = { + default: Array.isArray(def) ? [] : def, + optional: field.optional, + deprecated: field.deprecated, + validate: field.validate + }; + } + } + } + const visitor = opts.visitor || inherits.visitor || []; + const aliases = opts.aliases || inherits.aliases || []; + const builder = opts.builder || inherits.builder || opts.visitor || []; + for (const k of Object.keys(opts)) { + if (validTypeOpts.indexOf(k) === -1) { + throw new Error(`Unknown type option "${k}" on ${type}`); + } + } + if (opts.deprecatedAlias) { + DEPRECATED_KEYS[opts.deprecatedAlias] = type; + } + for (const key of visitor.concat(builder)) { + fields[key] = fields[key] || {}; + } + for (const key of Object.keys(fields)) { + const field = fields[key]; + if (field.default !== undefined && builder.indexOf(key) === -1) { + field.optional = true; + } + if (field.default === undefined) { + field.default = null; + } else if (!field.validate && field.default != null) { + field.validate = assertValueType(getType(field.default)); + } + for (const k of Object.keys(field)) { + if (validFieldKeys.indexOf(k) === -1) { + throw new Error(`Unknown field key "${k}" on ${type}.${key}`); + } + } + } + VISITOR_KEYS[type] = opts.visitor = visitor; + BUILDER_KEYS[type] = opts.builder = builder; + NODE_FIELDS[type] = opts.fields = fields; + ALIAS_KEYS[type] = opts.aliases = aliases; + aliases.forEach(alias => { + FLIPPED_ALIAS_KEYS[alias] = FLIPPED_ALIAS_KEYS[alias] || []; + FLIPPED_ALIAS_KEYS[alias].push(type); + }); + if (opts.validate) { + NODE_PARENT_VALIDATIONS[type] = opts.validate; + } + store[type] = opts; +} + +//# sourceMappingURL=utils.js.map + + +/***/ }), + +/***/ 7012: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +var _exportNames = { + react: true, + assertNode: true, + createTypeAnnotationBasedOnTypeof: true, + createUnionTypeAnnotation: true, + createFlowUnionType: true, + createTSUnionType: true, + cloneNode: true, + clone: true, + cloneDeep: true, + cloneDeepWithoutLoc: true, + cloneWithoutLoc: true, + addComment: true, + addComments: true, + inheritInnerComments: true, + inheritLeadingComments: true, + inheritsComments: true, + inheritTrailingComments: true, + removeComments: true, + ensureBlock: true, + toBindingIdentifierName: true, + toBlock: true, + toComputedKey: true, + toExpression: true, + toIdentifier: true, + toKeyAlias: true, + toSequenceExpression: true, + toStatement: true, + valueToNode: true, + appendToMemberExpression: true, + inherits: true, + prependToMemberExpression: true, + removeProperties: true, + removePropertiesDeep: true, + removeTypeDuplicates: true, + getBindingIdentifiers: true, + getOuterBindingIdentifiers: true, + traverse: true, + traverseFast: true, + shallowEqual: true, + is: true, + isBinding: true, + isBlockScoped: true, + isImmutable: true, + isLet: true, + isNode: true, + isNodesEquivalent: true, + isPlaceholderType: true, + isReferenced: true, + isScope: true, + isSpecifierDefault: true, + isType: true, + isValidES3Identifier: true, + isValidIdentifier: true, + isVar: true, + matchesPattern: true, + validate: true, + buildMatchMemberExpression: true, + __internal__deprecationWarning: true +}; +Object.defineProperty(exports, "__internal__deprecationWarning", ({ + enumerable: true, + get: function () { + return _deprecationWarning.default; + } +})); +Object.defineProperty(exports, "addComment", ({ + enumerable: true, + get: function () { + return _addComment.default; + } +})); +Object.defineProperty(exports, "addComments", ({ + enumerable: true, + get: function () { + return _addComments.default; + } +})); +Object.defineProperty(exports, "appendToMemberExpression", ({ + enumerable: true, + get: function () { + return _appendToMemberExpression.default; + } +})); +Object.defineProperty(exports, "assertNode", ({ + enumerable: true, + get: function () { + return _assertNode.default; + } +})); +Object.defineProperty(exports, "buildMatchMemberExpression", ({ + enumerable: true, + get: function () { + return _buildMatchMemberExpression.default; + } +})); +Object.defineProperty(exports, "clone", ({ + enumerable: true, + get: function () { + return _clone.default; + } +})); +Object.defineProperty(exports, "cloneDeep", ({ + enumerable: true, + get: function () { + return _cloneDeep.default; + } +})); +Object.defineProperty(exports, "cloneDeepWithoutLoc", ({ + enumerable: true, + get: function () { + return _cloneDeepWithoutLoc.default; + } +})); +Object.defineProperty(exports, "cloneNode", ({ + enumerable: true, + get: function () { + return _cloneNode.default; + } +})); +Object.defineProperty(exports, "cloneWithoutLoc", ({ + enumerable: true, + get: function () { + return _cloneWithoutLoc.default; + } +})); +Object.defineProperty(exports, "createFlowUnionType", ({ + enumerable: true, + get: function () { + return _createFlowUnionType.default; + } +})); +Object.defineProperty(exports, "createTSUnionType", ({ + enumerable: true, + get: function () { + return _createTSUnionType.default; + } +})); +Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", ({ + enumerable: true, + get: function () { + return _createTypeAnnotationBasedOnTypeof.default; + } +})); +Object.defineProperty(exports, "createUnionTypeAnnotation", ({ + enumerable: true, + get: function () { + return _createFlowUnionType.default; + } +})); +Object.defineProperty(exports, "ensureBlock", ({ + enumerable: true, + get: function () { + return _ensureBlock.default; + } +})); +Object.defineProperty(exports, "getBindingIdentifiers", ({ + enumerable: true, + get: function () { + return _getBindingIdentifiers.default; + } +})); +Object.defineProperty(exports, "getOuterBindingIdentifiers", ({ + enumerable: true, + get: function () { + return _getOuterBindingIdentifiers.default; + } +})); +Object.defineProperty(exports, "inheritInnerComments", ({ + enumerable: true, + get: function () { + return _inheritInnerComments.default; + } +})); +Object.defineProperty(exports, "inheritLeadingComments", ({ + enumerable: true, + get: function () { + return _inheritLeadingComments.default; + } +})); +Object.defineProperty(exports, "inheritTrailingComments", ({ + enumerable: true, + get: function () { + return _inheritTrailingComments.default; + } +})); +Object.defineProperty(exports, "inherits", ({ + enumerable: true, + get: function () { + return _inherits.default; + } +})); +Object.defineProperty(exports, "inheritsComments", ({ + enumerable: true, + get: function () { + return _inheritsComments.default; + } +})); +Object.defineProperty(exports, "is", ({ + enumerable: true, + get: function () { + return _is.default; + } +})); +Object.defineProperty(exports, "isBinding", ({ + enumerable: true, + get: function () { + return _isBinding.default; + } +})); +Object.defineProperty(exports, "isBlockScoped", ({ + enumerable: true, + get: function () { + return _isBlockScoped.default; + } +})); +Object.defineProperty(exports, "isImmutable", ({ + enumerable: true, + get: function () { + return _isImmutable.default; + } +})); +Object.defineProperty(exports, "isLet", ({ + enumerable: true, + get: function () { + return _isLet.default; + } +})); +Object.defineProperty(exports, "isNode", ({ + enumerable: true, + get: function () { + return _isNode.default; + } +})); +Object.defineProperty(exports, "isNodesEquivalent", ({ + enumerable: true, + get: function () { + return _isNodesEquivalent.default; + } +})); +Object.defineProperty(exports, "isPlaceholderType", ({ + enumerable: true, + get: function () { + return _isPlaceholderType.default; + } +})); +Object.defineProperty(exports, "isReferenced", ({ + enumerable: true, + get: function () { + return _isReferenced.default; + } +})); +Object.defineProperty(exports, "isScope", ({ + enumerable: true, + get: function () { + return _isScope.default; + } +})); +Object.defineProperty(exports, "isSpecifierDefault", ({ + enumerable: true, + get: function () { + return _isSpecifierDefault.default; + } +})); +Object.defineProperty(exports, "isType", ({ + enumerable: true, + get: function () { + return _isType.default; + } +})); +Object.defineProperty(exports, "isValidES3Identifier", ({ + enumerable: true, + get: function () { + return _isValidES3Identifier.default; + } +})); +Object.defineProperty(exports, "isValidIdentifier", ({ + enumerable: true, + get: function () { + return _isValidIdentifier.default; + } +})); +Object.defineProperty(exports, "isVar", ({ + enumerable: true, + get: function () { + return _isVar.default; + } +})); +Object.defineProperty(exports, "matchesPattern", ({ + enumerable: true, + get: function () { + return _matchesPattern.default; + } +})); +Object.defineProperty(exports, "prependToMemberExpression", ({ + enumerable: true, + get: function () { + return _prependToMemberExpression.default; + } +})); +exports.react = void 0; +Object.defineProperty(exports, "removeComments", ({ + enumerable: true, + get: function () { + return _removeComments.default; + } +})); +Object.defineProperty(exports, "removeProperties", ({ + enumerable: true, + get: function () { + return _removeProperties.default; + } +})); +Object.defineProperty(exports, "removePropertiesDeep", ({ + enumerable: true, + get: function () { + return _removePropertiesDeep.default; + } +})); +Object.defineProperty(exports, "removeTypeDuplicates", ({ + enumerable: true, + get: function () { + return _removeTypeDuplicates.default; + } +})); +Object.defineProperty(exports, "shallowEqual", ({ + enumerable: true, + get: function () { + return _shallowEqual.default; + } +})); +Object.defineProperty(exports, "toBindingIdentifierName", ({ + enumerable: true, + get: function () { + return _toBindingIdentifierName.default; + } +})); +Object.defineProperty(exports, "toBlock", ({ + enumerable: true, + get: function () { + return _toBlock.default; + } +})); +Object.defineProperty(exports, "toComputedKey", ({ + enumerable: true, + get: function () { + return _toComputedKey.default; + } +})); +Object.defineProperty(exports, "toExpression", ({ + enumerable: true, + get: function () { + return _toExpression.default; + } +})); +Object.defineProperty(exports, "toIdentifier", ({ + enumerable: true, + get: function () { + return _toIdentifier.default; + } +})); +Object.defineProperty(exports, "toKeyAlias", ({ + enumerable: true, + get: function () { + return _toKeyAlias.default; + } +})); +Object.defineProperty(exports, "toSequenceExpression", ({ + enumerable: true, + get: function () { + return _toSequenceExpression.default; + } +})); +Object.defineProperty(exports, "toStatement", ({ + enumerable: true, + get: function () { + return _toStatement.default; + } +})); +Object.defineProperty(exports, "traverse", ({ + enumerable: true, + get: function () { + return _traverse.default; + } +})); +Object.defineProperty(exports, "traverseFast", ({ + enumerable: true, + get: function () { + return _traverseFast.default; + } +})); +Object.defineProperty(exports, "validate", ({ + enumerable: true, + get: function () { + return _validate.default; + } +})); +Object.defineProperty(exports, "valueToNode", ({ + enumerable: true, + get: function () { + return _valueToNode.default; + } +})); +var _isReactComponent = __nccwpck_require__(6739); +var _isCompatTag = __nccwpck_require__(1102); +var _buildChildren = __nccwpck_require__(194); +var _assertNode = __nccwpck_require__(5508); +var _index = __nccwpck_require__(412); +Object.keys(_index).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _index[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _index[key]; + } + }); +}); +var _createTypeAnnotationBasedOnTypeof = __nccwpck_require__(4241); +var _createFlowUnionType = __nccwpck_require__(3672); +var _createTSUnionType = __nccwpck_require__(7972); +var _index2 = __nccwpck_require__(4485); +Object.keys(_index2).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _index2[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _index2[key]; + } + }); +}); +var _uppercase = __nccwpck_require__(3686); +Object.keys(_uppercase).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _uppercase[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _uppercase[key]; + } + }); +}); +var _cloneNode = __nccwpck_require__(7649); +var _clone = __nccwpck_require__(4564); +var _cloneDeep = __nccwpck_require__(6655); +var _cloneDeepWithoutLoc = __nccwpck_require__(1846); +var _cloneWithoutLoc = __nccwpck_require__(9542); +var _addComment = __nccwpck_require__(9574); +var _addComments = __nccwpck_require__(9866); +var _inheritInnerComments = __nccwpck_require__(7209); +var _inheritLeadingComments = __nccwpck_require__(6129); +var _inheritsComments = __nccwpck_require__(899); +var _inheritTrailingComments = __nccwpck_require__(4700); +var _removeComments = __nccwpck_require__(6575); +var _index3 = __nccwpck_require__(1253); +Object.keys(_index3).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _index3[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _index3[key]; + } + }); +}); +var _index4 = __nccwpck_require__(7297); +Object.keys(_index4).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _index4[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _index4[key]; + } + }); +}); +var _ensureBlock = __nccwpck_require__(1823); +var _toBindingIdentifierName = __nccwpck_require__(5219); +var _toBlock = __nccwpck_require__(8332); +var _toComputedKey = __nccwpck_require__(4457); +var _toExpression = __nccwpck_require__(5293); +var _toIdentifier = __nccwpck_require__(2143); +var _toKeyAlias = __nccwpck_require__(5923); +var _toSequenceExpression = __nccwpck_require__(5943); +var _toStatement = __nccwpck_require__(7994); +var _valueToNode = __nccwpck_require__(32); +var _index5 = __nccwpck_require__(8774); +Object.keys(_index5).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _index5[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _index5[key]; + } + }); +}); +var _appendToMemberExpression = __nccwpck_require__(7136); +var _inherits = __nccwpck_require__(5268); +var _prependToMemberExpression = __nccwpck_require__(7942); +var _removeProperties = __nccwpck_require__(5705); +var _removePropertiesDeep = __nccwpck_require__(2286); +var _removeTypeDuplicates = __nccwpck_require__(1537); +var _getBindingIdentifiers = __nccwpck_require__(5940); +var _getOuterBindingIdentifiers = __nccwpck_require__(2875); +var _traverse = __nccwpck_require__(6630); +Object.keys(_traverse).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _traverse[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _traverse[key]; + } + }); +}); +var _traverseFast = __nccwpck_require__(9170); +var _shallowEqual = __nccwpck_require__(2708); +var _is = __nccwpck_require__(9242); +var _isBinding = __nccwpck_require__(1232); +var _isBlockScoped = __nccwpck_require__(7676); +var _isImmutable = __nccwpck_require__(7839); +var _isLet = __nccwpck_require__(672); +var _isNode = __nccwpck_require__(8582); +var _isNodesEquivalent = __nccwpck_require__(3498); +var _isPlaceholderType = __nccwpck_require__(7789); +var _isReferenced = __nccwpck_require__(6732); +var _isScope = __nccwpck_require__(8449); +var _isSpecifierDefault = __nccwpck_require__(8845); +var _isType = __nccwpck_require__(6907); +var _isValidES3Identifier = __nccwpck_require__(8679); +var _isValidIdentifier = __nccwpck_require__(5178); +var _isVar = __nccwpck_require__(5444); +var _matchesPattern = __nccwpck_require__(1011); +var _validate = __nccwpck_require__(826); +var _buildMatchMemberExpression = __nccwpck_require__(6770); +var _index6 = __nccwpck_require__(2538); +Object.keys(_index6).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _index6[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _index6[key]; + } + }); +}); +var _deprecationWarning = __nccwpck_require__(7290); +const react = { + isReactComponent: _isReactComponent.default, + isCompatTag: _isCompatTag.default, + buildChildren: _buildChildren.default +}; +exports.react = react; + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 7136: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = appendToMemberExpression; +var _index = __nccwpck_require__(4485); +function appendToMemberExpression(member, append, computed = false) { + member.object = (0, _index.memberExpression)(member.object, member.property, member.computed); + member.property = append; + member.computed = !!computed; + return member; +} + +//# sourceMappingURL=appendToMemberExpression.js.map + + +/***/ }), + +/***/ 1537: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = removeTypeDuplicates; +var _index = __nccwpck_require__(2538); +function getQualifiedName(node) { + return (0, _index.isIdentifier)(node) ? node.name : `${node.id.name}.${getQualifiedName(node.qualification)}`; +} +function removeTypeDuplicates(nodesIn) { + const nodes = Array.from(nodesIn); + const generics = new Map(); + const bases = new Map(); + const typeGroups = new Set(); + const types = []; + for (let i = 0; i < nodes.length; i++) { + const node = nodes[i]; + if (!node) continue; + if (types.indexOf(node) >= 0) { + continue; + } + if ((0, _index.isAnyTypeAnnotation)(node)) { + return [node]; + } + if ((0, _index.isFlowBaseAnnotation)(node)) { + bases.set(node.type, node); + continue; + } + if ((0, _index.isUnionTypeAnnotation)(node)) { + if (!typeGroups.has(node.types)) { + nodes.push(...node.types); + typeGroups.add(node.types); + } + continue; + } + if ((0, _index.isGenericTypeAnnotation)(node)) { + const name = getQualifiedName(node.id); + if (generics.has(name)) { + let existing = generics.get(name); + if (existing.typeParameters) { + if (node.typeParameters) { + existing.typeParameters.params.push(...node.typeParameters.params); + existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params); + } + } else { + existing = node.typeParameters; + } + } else { + generics.set(name, node); + } + continue; + } + types.push(node); + } + for (const [, baseType] of bases) { + types.push(baseType); + } + for (const [, genericName] of generics) { + types.push(genericName); + } + return types; +} + +//# sourceMappingURL=removeTypeDuplicates.js.map + + +/***/ }), + +/***/ 5268: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = inherits; +var _index = __nccwpck_require__(7297); +var _inheritsComments = __nccwpck_require__(899); +function inherits(child, parent) { + if (!child || !parent) return child; + for (const key of _index.INHERIT_KEYS.optional) { + if (child[key] == null) { + child[key] = parent[key]; + } + } + for (const key of Object.keys(parent)) { + if (key[0] === "_" && key !== "__clone") { + child[key] = parent[key]; + } + } + for (const key of _index.INHERIT_KEYS.force) { + child[key] = parent[key]; + } + (0, _inheritsComments.default)(child, parent); + return child; +} + +//# sourceMappingURL=inherits.js.map + + +/***/ }), + +/***/ 7942: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = prependToMemberExpression; +var _index = __nccwpck_require__(4485); +var _index2 = __nccwpck_require__(7012); +function prependToMemberExpression(member, prepend) { + if ((0, _index2.isSuper)(member.object)) { + throw new Error("Cannot prepend node to super property access (`super.foo`)."); + } + member.object = (0, _index.memberExpression)(prepend, member.object); + return member; +} + +//# sourceMappingURL=prependToMemberExpression.js.map + + +/***/ }), + +/***/ 5705: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = removeProperties; +var _index = __nccwpck_require__(7297); +const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; +const CLEAR_KEYS_PLUS_COMMENTS = [..._index.COMMENT_KEYS, "comments", ...CLEAR_KEYS]; +function removeProperties(node, opts = {}) { + const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; + for (const key of map) { + if (node[key] != null) node[key] = undefined; + } + for (const key of Object.keys(node)) { + if (key[0] === "_" && node[key] != null) node[key] = undefined; + } + const symbols = Object.getOwnPropertySymbols(node); + for (const sym of symbols) { + node[sym] = null; + } +} + +//# sourceMappingURL=removeProperties.js.map + + +/***/ }), + +/***/ 2286: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = removePropertiesDeep; +var _traverseFast = __nccwpck_require__(9170); +var _removeProperties = __nccwpck_require__(5705); +function removePropertiesDeep(tree, opts) { + (0, _traverseFast.default)(tree, _removeProperties.default, opts); + return tree; +} + +//# sourceMappingURL=removePropertiesDeep.js.map + + +/***/ }), + +/***/ 4210: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = removeTypeDuplicates; +var _index = __nccwpck_require__(2538); +function getQualifiedName(node) { + return (0, _index.isIdentifier)(node) ? node.name : `${node.right.name}.${getQualifiedName(node.left)}`; +} +function removeTypeDuplicates(nodesIn) { + const nodes = Array.from(nodesIn); + const generics = new Map(); + const bases = new Map(); + const typeGroups = new Set(); + const types = []; + for (let i = 0; i < nodes.length; i++) { + const node = nodes[i]; + if (!node) continue; + if (types.indexOf(node) >= 0) { + continue; + } + if ((0, _index.isTSAnyKeyword)(node)) { + return [node]; + } + if ((0, _index.isTSBaseType)(node)) { + bases.set(node.type, node); + continue; + } + if ((0, _index.isTSUnionType)(node)) { + if (!typeGroups.has(node.types)) { + nodes.push(...node.types); + typeGroups.add(node.types); + } + continue; + } + if ((0, _index.isTSTypeReference)(node) && node.typeParameters) { + const name = getQualifiedName(node.typeName); + if (generics.has(name)) { + let existing = generics.get(name); + if (existing.typeParameters) { + if (node.typeParameters) { + existing.typeParameters.params.push(...node.typeParameters.params); + existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params); + } + } else { + existing = node.typeParameters; + } + } else { + generics.set(name, node); + } + continue; + } + types.push(node); + } + for (const [, baseType] of bases) { + types.push(baseType); + } + for (const [, genericName] of generics) { + types.push(genericName); + } + return types; +} + +//# sourceMappingURL=removeTypeDuplicates.js.map + + +/***/ }), + +/***/ 5940: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = getBindingIdentifiers; +var _index = __nccwpck_require__(2538); +function getBindingIdentifiers(node, duplicates, outerOnly) { + const search = [].concat(node); + const ids = Object.create(null); + while (search.length) { + const id = search.shift(); + if (!id) continue; + const keys = getBindingIdentifiers.keys[id.type]; + if ((0, _index.isIdentifier)(id)) { + if (duplicates) { + const _ids = ids[id.name] = ids[id.name] || []; + _ids.push(id); + } else { + ids[id.name] = id; + } + continue; + } + if ((0, _index.isExportDeclaration)(id) && !(0, _index.isExportAllDeclaration)(id)) { + if ((0, _index.isDeclaration)(id.declaration)) { + search.push(id.declaration); + } + continue; + } + if (outerOnly) { + if ((0, _index.isFunctionDeclaration)(id)) { + search.push(id.id); + continue; + } + if ((0, _index.isFunctionExpression)(id)) { + continue; + } + } + if (keys) { + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const nodes = id[key]; + if (nodes) { + Array.isArray(nodes) ? search.push(...nodes) : search.push(nodes); + } + } + } + } + return ids; +} +getBindingIdentifiers.keys = { + DeclareClass: ["id"], + DeclareFunction: ["id"], + DeclareModule: ["id"], + DeclareVariable: ["id"], + DeclareInterface: ["id"], + DeclareTypeAlias: ["id"], + DeclareOpaqueType: ["id"], + InterfaceDeclaration: ["id"], + TypeAlias: ["id"], + OpaqueType: ["id"], + CatchClause: ["param"], + LabeledStatement: ["label"], + UnaryExpression: ["argument"], + AssignmentExpression: ["left"], + ImportSpecifier: ["local"], + ImportNamespaceSpecifier: ["local"], + ImportDefaultSpecifier: ["local"], + ImportDeclaration: ["specifiers"], + ExportSpecifier: ["exported"], + ExportNamespaceSpecifier: ["exported"], + ExportDefaultSpecifier: ["exported"], + FunctionDeclaration: ["id", "params"], + FunctionExpression: ["id", "params"], + ArrowFunctionExpression: ["params"], + ObjectMethod: ["params"], + ClassMethod: ["params"], + ClassPrivateMethod: ["params"], + ForInStatement: ["left"], + ForOfStatement: ["left"], + ClassDeclaration: ["id"], + ClassExpression: ["id"], + RestElement: ["argument"], + UpdateExpression: ["argument"], + ObjectProperty: ["value"], + AssignmentPattern: ["left"], + ArrayPattern: ["elements"], + ObjectPattern: ["properties"], + VariableDeclaration: ["declarations"], + VariableDeclarator: ["id"] +}; + +//# sourceMappingURL=getBindingIdentifiers.js.map + + +/***/ }), + +/***/ 2875: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _getBindingIdentifiers = __nccwpck_require__(5940); +var _default = getOuterBindingIdentifiers; +exports.default = _default; +function getOuterBindingIdentifiers(node, duplicates) { + return (0, _getBindingIdentifiers.default)(node, duplicates, true); +} + +//# sourceMappingURL=getOuterBindingIdentifiers.js.map + + +/***/ }), + +/***/ 6630: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = traverse; +var _index = __nccwpck_require__(8774); +function traverse(node, handlers, state) { + if (typeof handlers === "function") { + handlers = { + enter: handlers + }; + } + const { + enter, + exit + } = handlers; + traverseSimpleImpl(node, enter, exit, state, []); +} +function traverseSimpleImpl(node, enter, exit, state, ancestors) { + const keys = _index.VISITOR_KEYS[node.type]; + if (!keys) return; + if (enter) enter(node, ancestors, state); + for (const key of keys) { + const subNode = node[key]; + if (Array.isArray(subNode)) { + for (let i = 0; i < subNode.length; i++) { + const child = subNode[i]; + if (!child) continue; + ancestors.push({ + node, + key, + index: i + }); + traverseSimpleImpl(child, enter, exit, state, ancestors); + ancestors.pop(); + } + } else if (subNode) { + ancestors.push({ + node, + key + }); + traverseSimpleImpl(subNode, enter, exit, state, ancestors); + ancestors.pop(); + } + } + if (exit) exit(node, ancestors, state); +} + +//# sourceMappingURL=traverse.js.map + + +/***/ }), + +/***/ 9170: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = traverseFast; +var _index = __nccwpck_require__(8774); +function traverseFast(node, enter, opts) { + if (!node) return; + const keys = _index.VISITOR_KEYS[node.type]; + if (!keys) return; + opts = opts || {}; + enter(node, opts); + for (const key of keys) { + const subNode = node[key]; + if (Array.isArray(subNode)) { + for (const node of subNode) { + traverseFast(node, enter, opts); + } + } else { + traverseFast(subNode, enter, opts); + } + } +} + +//# sourceMappingURL=traverseFast.js.map + + +/***/ }), + +/***/ 7290: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = deprecationWarning; +const warnings = new Set(); +function deprecationWarning(oldName, newName, prefix = "") { + if (warnings.has(oldName)) return; + warnings.add(oldName); + const { + internal, + trace + } = captureShortStackTrace(1, 2); + if (internal) { + return; + } + console.warn(`${prefix}\`${oldName}\` has been deprecated, please migrate to \`${newName}\`\n${trace}`); +} +function captureShortStackTrace(skip, length) { + const { + stackTraceLimit, + prepareStackTrace + } = Error; + let stackTrace; + Error.stackTraceLimit = 1 + skip + length; + Error.prepareStackTrace = function (err, stack) { + stackTrace = stack; + }; + new Error().stack; + Error.stackTraceLimit = stackTraceLimit; + Error.prepareStackTrace = prepareStackTrace; + if (!stackTrace) return { + internal: false, + trace: "" + }; + const shortStackTrace = stackTrace.slice(1 + skip, 1 + skip + length); + return { + internal: /[\\/]@babel[\\/]/.test(shortStackTrace[1].getFileName()), + trace: shortStackTrace.map(frame => ` at ${frame}`).join("\n") + }; +} + +//# sourceMappingURL=deprecationWarning.js.map + + +/***/ }), + +/***/ 8559: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = inherit; +function inherit(key, child, parent) { + if (child && parent) { + child[key] = Array.from(new Set([].concat(child[key], parent[key]).filter(Boolean))); + } +} + +//# sourceMappingURL=inherit.js.map + + +/***/ }), + +/***/ 4022: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = cleanJSXElementLiteralChild; +var _index = __nccwpck_require__(4485); +var _index2 = __nccwpck_require__(7012); +function cleanJSXElementLiteralChild(child, args) { + const lines = child.value.split(/\r\n|\n|\r/); + let lastNonEmptyLine = 0; + for (let i = 0; i < lines.length; i++) { + if (lines[i].match(/[^ \t]/)) { + lastNonEmptyLine = i; + } + } + let str = ""; + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + const isFirstLine = i === 0; + const isLastLine = i === lines.length - 1; + const isLastNonEmptyLine = i === lastNonEmptyLine; + let trimmedLine = line.replace(/\t/g, " "); + if (!isFirstLine) { + trimmedLine = trimmedLine.replace(/^[ ]+/, ""); + } + if (!isLastLine) { + trimmedLine = trimmedLine.replace(/[ ]+$/, ""); + } + if (trimmedLine) { + if (!isLastNonEmptyLine) { + trimmedLine += " "; + } + str += trimmedLine; + } + } + if (str) args.push((0, _index2.inherits)((0, _index.stringLiteral)(str), child)); +} + +//# sourceMappingURL=cleanJSXElementLiteralChild.js.map + + +/***/ }), + +/***/ 2708: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = shallowEqual; +function shallowEqual(actual, expected) { + const keys = Object.keys(expected); + for (const key of keys) { + if (actual[key] !== expected[key]) { + return false; + } + } + return true; +} + +//# sourceMappingURL=shallowEqual.js.map + + +/***/ }), + +/***/ 6770: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = buildMatchMemberExpression; +var _matchesPattern = __nccwpck_require__(1011); +function buildMatchMemberExpression(match, allowPartial) { + const parts = match.split("."); + return member => (0, _matchesPattern.default)(member, parts, allowPartial); +} + +//# sourceMappingURL=buildMatchMemberExpression.js.map + + +/***/ }), + +/***/ 2538: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isAccessor = isAccessor; +exports.isAnyTypeAnnotation = isAnyTypeAnnotation; +exports.isArgumentPlaceholder = isArgumentPlaceholder; +exports.isArrayExpression = isArrayExpression; +exports.isArrayPattern = isArrayPattern; +exports.isArrayTypeAnnotation = isArrayTypeAnnotation; +exports.isArrowFunctionExpression = isArrowFunctionExpression; +exports.isAssignmentExpression = isAssignmentExpression; +exports.isAssignmentPattern = isAssignmentPattern; +exports.isAwaitExpression = isAwaitExpression; +exports.isBigIntLiteral = isBigIntLiteral; +exports.isBinary = isBinary; +exports.isBinaryExpression = isBinaryExpression; +exports.isBindExpression = isBindExpression; +exports.isBlock = isBlock; +exports.isBlockParent = isBlockParent; +exports.isBlockStatement = isBlockStatement; +exports.isBooleanLiteral = isBooleanLiteral; +exports.isBooleanLiteralTypeAnnotation = isBooleanLiteralTypeAnnotation; +exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation; +exports.isBreakStatement = isBreakStatement; +exports.isCallExpression = isCallExpression; +exports.isCatchClause = isCatchClause; +exports.isClass = isClass; +exports.isClassAccessorProperty = isClassAccessorProperty; +exports.isClassBody = isClassBody; +exports.isClassDeclaration = isClassDeclaration; +exports.isClassExpression = isClassExpression; +exports.isClassImplements = isClassImplements; +exports.isClassMethod = isClassMethod; +exports.isClassPrivateMethod = isClassPrivateMethod; +exports.isClassPrivateProperty = isClassPrivateProperty; +exports.isClassProperty = isClassProperty; +exports.isCompletionStatement = isCompletionStatement; +exports.isConditional = isConditional; +exports.isConditionalExpression = isConditionalExpression; +exports.isContinueStatement = isContinueStatement; +exports.isDebuggerStatement = isDebuggerStatement; +exports.isDecimalLiteral = isDecimalLiteral; +exports.isDeclaration = isDeclaration; +exports.isDeclareClass = isDeclareClass; +exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration; +exports.isDeclareExportDeclaration = isDeclareExportDeclaration; +exports.isDeclareFunction = isDeclareFunction; +exports.isDeclareInterface = isDeclareInterface; +exports.isDeclareModule = isDeclareModule; +exports.isDeclareModuleExports = isDeclareModuleExports; +exports.isDeclareOpaqueType = isDeclareOpaqueType; +exports.isDeclareTypeAlias = isDeclareTypeAlias; +exports.isDeclareVariable = isDeclareVariable; +exports.isDeclaredPredicate = isDeclaredPredicate; +exports.isDecorator = isDecorator; +exports.isDirective = isDirective; +exports.isDirectiveLiteral = isDirectiveLiteral; +exports.isDoExpression = isDoExpression; +exports.isDoWhileStatement = isDoWhileStatement; +exports.isEmptyStatement = isEmptyStatement; +exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation; +exports.isEnumBody = isEnumBody; +exports.isEnumBooleanBody = isEnumBooleanBody; +exports.isEnumBooleanMember = isEnumBooleanMember; +exports.isEnumDeclaration = isEnumDeclaration; +exports.isEnumDefaultedMember = isEnumDefaultedMember; +exports.isEnumMember = isEnumMember; +exports.isEnumNumberBody = isEnumNumberBody; +exports.isEnumNumberMember = isEnumNumberMember; +exports.isEnumStringBody = isEnumStringBody; +exports.isEnumStringMember = isEnumStringMember; +exports.isEnumSymbolBody = isEnumSymbolBody; +exports.isExistsTypeAnnotation = isExistsTypeAnnotation; +exports.isExportAllDeclaration = isExportAllDeclaration; +exports.isExportDeclaration = isExportDeclaration; +exports.isExportDefaultDeclaration = isExportDefaultDeclaration; +exports.isExportDefaultSpecifier = isExportDefaultSpecifier; +exports.isExportNamedDeclaration = isExportNamedDeclaration; +exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier; +exports.isExportSpecifier = isExportSpecifier; +exports.isExpression = isExpression; +exports.isExpressionStatement = isExpressionStatement; +exports.isExpressionWrapper = isExpressionWrapper; +exports.isFile = isFile; +exports.isFlow = isFlow; +exports.isFlowBaseAnnotation = isFlowBaseAnnotation; +exports.isFlowDeclaration = isFlowDeclaration; +exports.isFlowPredicate = isFlowPredicate; +exports.isFlowType = isFlowType; +exports.isFor = isFor; +exports.isForInStatement = isForInStatement; +exports.isForOfStatement = isForOfStatement; +exports.isForStatement = isForStatement; +exports.isForXStatement = isForXStatement; +exports.isFunction = isFunction; +exports.isFunctionDeclaration = isFunctionDeclaration; +exports.isFunctionExpression = isFunctionExpression; +exports.isFunctionParent = isFunctionParent; +exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation; +exports.isFunctionTypeParam = isFunctionTypeParam; +exports.isGenericTypeAnnotation = isGenericTypeAnnotation; +exports.isIdentifier = isIdentifier; +exports.isIfStatement = isIfStatement; +exports.isImmutable = isImmutable; +exports.isImport = isImport; +exports.isImportAttribute = isImportAttribute; +exports.isImportDeclaration = isImportDeclaration; +exports.isImportDefaultSpecifier = isImportDefaultSpecifier; +exports.isImportNamespaceSpecifier = isImportNamespaceSpecifier; +exports.isImportOrExportDeclaration = isImportOrExportDeclaration; +exports.isImportSpecifier = isImportSpecifier; +exports.isIndexedAccessType = isIndexedAccessType; +exports.isInferredPredicate = isInferredPredicate; +exports.isInterfaceDeclaration = isInterfaceDeclaration; +exports.isInterfaceExtends = isInterfaceExtends; +exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation; +exports.isInterpreterDirective = isInterpreterDirective; +exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation; +exports.isJSX = isJSX; +exports.isJSXAttribute = isJSXAttribute; +exports.isJSXClosingElement = isJSXClosingElement; +exports.isJSXClosingFragment = isJSXClosingFragment; +exports.isJSXElement = isJSXElement; +exports.isJSXEmptyExpression = isJSXEmptyExpression; +exports.isJSXExpressionContainer = isJSXExpressionContainer; +exports.isJSXFragment = isJSXFragment; +exports.isJSXIdentifier = isJSXIdentifier; +exports.isJSXMemberExpression = isJSXMemberExpression; +exports.isJSXNamespacedName = isJSXNamespacedName; +exports.isJSXOpeningElement = isJSXOpeningElement; +exports.isJSXOpeningFragment = isJSXOpeningFragment; +exports.isJSXSpreadAttribute = isJSXSpreadAttribute; +exports.isJSXSpreadChild = isJSXSpreadChild; +exports.isJSXText = isJSXText; +exports.isLVal = isLVal; +exports.isLabeledStatement = isLabeledStatement; +exports.isLiteral = isLiteral; +exports.isLogicalExpression = isLogicalExpression; +exports.isLoop = isLoop; +exports.isMemberExpression = isMemberExpression; +exports.isMetaProperty = isMetaProperty; +exports.isMethod = isMethod; +exports.isMiscellaneous = isMiscellaneous; +exports.isMixedTypeAnnotation = isMixedTypeAnnotation; +exports.isModuleDeclaration = isModuleDeclaration; +exports.isModuleExpression = isModuleExpression; +exports.isModuleSpecifier = isModuleSpecifier; +exports.isNewExpression = isNewExpression; +exports.isNoop = isNoop; +exports.isNullLiteral = isNullLiteral; +exports.isNullLiteralTypeAnnotation = isNullLiteralTypeAnnotation; +exports.isNullableTypeAnnotation = isNullableTypeAnnotation; +exports.isNumberLiteral = isNumberLiteral; +exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation; +exports.isNumberTypeAnnotation = isNumberTypeAnnotation; +exports.isNumericLiteral = isNumericLiteral; +exports.isObjectExpression = isObjectExpression; +exports.isObjectMember = isObjectMember; +exports.isObjectMethod = isObjectMethod; +exports.isObjectPattern = isObjectPattern; +exports.isObjectProperty = isObjectProperty; +exports.isObjectTypeAnnotation = isObjectTypeAnnotation; +exports.isObjectTypeCallProperty = isObjectTypeCallProperty; +exports.isObjectTypeIndexer = isObjectTypeIndexer; +exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot; +exports.isObjectTypeProperty = isObjectTypeProperty; +exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty; +exports.isOpaqueType = isOpaqueType; +exports.isOptionalCallExpression = isOptionalCallExpression; +exports.isOptionalIndexedAccessType = isOptionalIndexedAccessType; +exports.isOptionalMemberExpression = isOptionalMemberExpression; +exports.isParenthesizedExpression = isParenthesizedExpression; +exports.isPattern = isPattern; +exports.isPatternLike = isPatternLike; +exports.isPipelineBareFunction = isPipelineBareFunction; +exports.isPipelinePrimaryTopicReference = isPipelinePrimaryTopicReference; +exports.isPipelineTopicExpression = isPipelineTopicExpression; +exports.isPlaceholder = isPlaceholder; +exports.isPrivate = isPrivate; +exports.isPrivateName = isPrivateName; +exports.isProgram = isProgram; +exports.isProperty = isProperty; +exports.isPureish = isPureish; +exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier; +exports.isRecordExpression = isRecordExpression; +exports.isRegExpLiteral = isRegExpLiteral; +exports.isRegexLiteral = isRegexLiteral; +exports.isRestElement = isRestElement; +exports.isRestProperty = isRestProperty; +exports.isReturnStatement = isReturnStatement; +exports.isScopable = isScopable; +exports.isSequenceExpression = isSequenceExpression; +exports.isSpreadElement = isSpreadElement; +exports.isSpreadProperty = isSpreadProperty; +exports.isStandardized = isStandardized; +exports.isStatement = isStatement; +exports.isStaticBlock = isStaticBlock; +exports.isStringLiteral = isStringLiteral; +exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation; +exports.isStringTypeAnnotation = isStringTypeAnnotation; +exports.isSuper = isSuper; +exports.isSwitchCase = isSwitchCase; +exports.isSwitchStatement = isSwitchStatement; +exports.isSymbolTypeAnnotation = isSymbolTypeAnnotation; +exports.isTSAnyKeyword = isTSAnyKeyword; +exports.isTSArrayType = isTSArrayType; +exports.isTSAsExpression = isTSAsExpression; +exports.isTSBaseType = isTSBaseType; +exports.isTSBigIntKeyword = isTSBigIntKeyword; +exports.isTSBooleanKeyword = isTSBooleanKeyword; +exports.isTSCallSignatureDeclaration = isTSCallSignatureDeclaration; +exports.isTSConditionalType = isTSConditionalType; +exports.isTSConstructSignatureDeclaration = isTSConstructSignatureDeclaration; +exports.isTSConstructorType = isTSConstructorType; +exports.isTSDeclareFunction = isTSDeclareFunction; +exports.isTSDeclareMethod = isTSDeclareMethod; +exports.isTSEntityName = isTSEntityName; +exports.isTSEnumDeclaration = isTSEnumDeclaration; +exports.isTSEnumMember = isTSEnumMember; +exports.isTSExportAssignment = isTSExportAssignment; +exports.isTSExpressionWithTypeArguments = isTSExpressionWithTypeArguments; +exports.isTSExternalModuleReference = isTSExternalModuleReference; +exports.isTSFunctionType = isTSFunctionType; +exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration; +exports.isTSImportType = isTSImportType; +exports.isTSIndexSignature = isTSIndexSignature; +exports.isTSIndexedAccessType = isTSIndexedAccessType; +exports.isTSInferType = isTSInferType; +exports.isTSInstantiationExpression = isTSInstantiationExpression; +exports.isTSInterfaceBody = isTSInterfaceBody; +exports.isTSInterfaceDeclaration = isTSInterfaceDeclaration; +exports.isTSIntersectionType = isTSIntersectionType; +exports.isTSIntrinsicKeyword = isTSIntrinsicKeyword; +exports.isTSLiteralType = isTSLiteralType; +exports.isTSMappedType = isTSMappedType; +exports.isTSMethodSignature = isTSMethodSignature; +exports.isTSModuleBlock = isTSModuleBlock; +exports.isTSModuleDeclaration = isTSModuleDeclaration; +exports.isTSNamedTupleMember = isTSNamedTupleMember; +exports.isTSNamespaceExportDeclaration = isTSNamespaceExportDeclaration; +exports.isTSNeverKeyword = isTSNeverKeyword; +exports.isTSNonNullExpression = isTSNonNullExpression; +exports.isTSNullKeyword = isTSNullKeyword; +exports.isTSNumberKeyword = isTSNumberKeyword; +exports.isTSObjectKeyword = isTSObjectKeyword; +exports.isTSOptionalType = isTSOptionalType; +exports.isTSParameterProperty = isTSParameterProperty; +exports.isTSParenthesizedType = isTSParenthesizedType; +exports.isTSPropertySignature = isTSPropertySignature; +exports.isTSQualifiedName = isTSQualifiedName; +exports.isTSRestType = isTSRestType; +exports.isTSSatisfiesExpression = isTSSatisfiesExpression; +exports.isTSStringKeyword = isTSStringKeyword; +exports.isTSSymbolKeyword = isTSSymbolKeyword; +exports.isTSThisType = isTSThisType; +exports.isTSTupleType = isTSTupleType; +exports.isTSType = isTSType; +exports.isTSTypeAliasDeclaration = isTSTypeAliasDeclaration; +exports.isTSTypeAnnotation = isTSTypeAnnotation; +exports.isTSTypeAssertion = isTSTypeAssertion; +exports.isTSTypeElement = isTSTypeElement; +exports.isTSTypeLiteral = isTSTypeLiteral; +exports.isTSTypeOperator = isTSTypeOperator; +exports.isTSTypeParameter = isTSTypeParameter; +exports.isTSTypeParameterDeclaration = isTSTypeParameterDeclaration; +exports.isTSTypeParameterInstantiation = isTSTypeParameterInstantiation; +exports.isTSTypePredicate = isTSTypePredicate; +exports.isTSTypeQuery = isTSTypeQuery; +exports.isTSTypeReference = isTSTypeReference; +exports.isTSUndefinedKeyword = isTSUndefinedKeyword; +exports.isTSUnionType = isTSUnionType; +exports.isTSUnknownKeyword = isTSUnknownKeyword; +exports.isTSVoidKeyword = isTSVoidKeyword; +exports.isTaggedTemplateExpression = isTaggedTemplateExpression; +exports.isTemplateElement = isTemplateElement; +exports.isTemplateLiteral = isTemplateLiteral; +exports.isTerminatorless = isTerminatorless; +exports.isThisExpression = isThisExpression; +exports.isThisTypeAnnotation = isThisTypeAnnotation; +exports.isThrowStatement = isThrowStatement; +exports.isTopicReference = isTopicReference; +exports.isTryStatement = isTryStatement; +exports.isTupleExpression = isTupleExpression; +exports.isTupleTypeAnnotation = isTupleTypeAnnotation; +exports.isTypeAlias = isTypeAlias; +exports.isTypeAnnotation = isTypeAnnotation; +exports.isTypeCastExpression = isTypeCastExpression; +exports.isTypeParameter = isTypeParameter; +exports.isTypeParameterDeclaration = isTypeParameterDeclaration; +exports.isTypeParameterInstantiation = isTypeParameterInstantiation; +exports.isTypeScript = isTypeScript; +exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation; +exports.isUnaryExpression = isUnaryExpression; +exports.isUnaryLike = isUnaryLike; +exports.isUnionTypeAnnotation = isUnionTypeAnnotation; +exports.isUpdateExpression = isUpdateExpression; +exports.isUserWhitespacable = isUserWhitespacable; +exports.isV8IntrinsicIdentifier = isV8IntrinsicIdentifier; +exports.isVariableDeclaration = isVariableDeclaration; +exports.isVariableDeclarator = isVariableDeclarator; +exports.isVariance = isVariance; +exports.isVoidTypeAnnotation = isVoidTypeAnnotation; +exports.isWhile = isWhile; +exports.isWhileStatement = isWhileStatement; +exports.isWithStatement = isWithStatement; +exports.isYieldExpression = isYieldExpression; +var _shallowEqual = __nccwpck_require__(2708); +var _deprecationWarning = __nccwpck_require__(7290); +function isArrayExpression(node, opts) { + if (!node) return false; + if (node.type !== "ArrayExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isAssignmentExpression(node, opts) { + if (!node) return false; + if (node.type !== "AssignmentExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBinaryExpression(node, opts) { + if (!node) return false; + if (node.type !== "BinaryExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isInterpreterDirective(node, opts) { + if (!node) return false; + if (node.type !== "InterpreterDirective") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDirective(node, opts) { + if (!node) return false; + if (node.type !== "Directive") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDirectiveLiteral(node, opts) { + if (!node) return false; + if (node.type !== "DirectiveLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBlockStatement(node, opts) { + if (!node) return false; + if (node.type !== "BlockStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBreakStatement(node, opts) { + if (!node) return false; + if (node.type !== "BreakStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isCallExpression(node, opts) { + if (!node) return false; + if (node.type !== "CallExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isCatchClause(node, opts) { + if (!node) return false; + if (node.type !== "CatchClause") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isConditionalExpression(node, opts) { + if (!node) return false; + if (node.type !== "ConditionalExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isContinueStatement(node, opts) { + if (!node) return false; + if (node.type !== "ContinueStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDebuggerStatement(node, opts) { + if (!node) return false; + if (node.type !== "DebuggerStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDoWhileStatement(node, opts) { + if (!node) return false; + if (node.type !== "DoWhileStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEmptyStatement(node, opts) { + if (!node) return false; + if (node.type !== "EmptyStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExpressionStatement(node, opts) { + if (!node) return false; + if (node.type !== "ExpressionStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFile(node, opts) { + if (!node) return false; + if (node.type !== "File") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isForInStatement(node, opts) { + if (!node) return false; + if (node.type !== "ForInStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isForStatement(node, opts) { + if (!node) return false; + if (node.type !== "ForStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFunctionDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "FunctionDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFunctionExpression(node, opts) { + if (!node) return false; + if (node.type !== "FunctionExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isIdentifier(node, opts) { + if (!node) return false; + if (node.type !== "Identifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isIfStatement(node, opts) { + if (!node) return false; + if (node.type !== "IfStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isLabeledStatement(node, opts) { + if (!node) return false; + if (node.type !== "LabeledStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isStringLiteral(node, opts) { + if (!node) return false; + if (node.type !== "StringLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isNumericLiteral(node, opts) { + if (!node) return false; + if (node.type !== "NumericLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isNullLiteral(node, opts) { + if (!node) return false; + if (node.type !== "NullLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBooleanLiteral(node, opts) { + if (!node) return false; + if (node.type !== "BooleanLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isRegExpLiteral(node, opts) { + if (!node) return false; + if (node.type !== "RegExpLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isLogicalExpression(node, opts) { + if (!node) return false; + if (node.type !== "LogicalExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isMemberExpression(node, opts) { + if (!node) return false; + if (node.type !== "MemberExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isNewExpression(node, opts) { + if (!node) return false; + if (node.type !== "NewExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isProgram(node, opts) { + if (!node) return false; + if (node.type !== "Program") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectExpression(node, opts) { + if (!node) return false; + if (node.type !== "ObjectExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectMethod(node, opts) { + if (!node) return false; + if (node.type !== "ObjectMethod") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectProperty(node, opts) { + if (!node) return false; + if (node.type !== "ObjectProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isRestElement(node, opts) { + if (!node) return false; + if (node.type !== "RestElement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isReturnStatement(node, opts) { + if (!node) return false; + if (node.type !== "ReturnStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isSequenceExpression(node, opts) { + if (!node) return false; + if (node.type !== "SequenceExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isParenthesizedExpression(node, opts) { + if (!node) return false; + if (node.type !== "ParenthesizedExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isSwitchCase(node, opts) { + if (!node) return false; + if (node.type !== "SwitchCase") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isSwitchStatement(node, opts) { + if (!node) return false; + if (node.type !== "SwitchStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isThisExpression(node, opts) { + if (!node) return false; + if (node.type !== "ThisExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isThrowStatement(node, opts) { + if (!node) return false; + if (node.type !== "ThrowStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTryStatement(node, opts) { + if (!node) return false; + if (node.type !== "TryStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isUnaryExpression(node, opts) { + if (!node) return false; + if (node.type !== "UnaryExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isUpdateExpression(node, opts) { + if (!node) return false; + if (node.type !== "UpdateExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isVariableDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "VariableDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isVariableDeclarator(node, opts) { + if (!node) return false; + if (node.type !== "VariableDeclarator") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isWhileStatement(node, opts) { + if (!node) return false; + if (node.type !== "WhileStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isWithStatement(node, opts) { + if (!node) return false; + if (node.type !== "WithStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isAssignmentPattern(node, opts) { + if (!node) return false; + if (node.type !== "AssignmentPattern") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isArrayPattern(node, opts) { + if (!node) return false; + if (node.type !== "ArrayPattern") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isArrowFunctionExpression(node, opts) { + if (!node) return false; + if (node.type !== "ArrowFunctionExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClassBody(node, opts) { + if (!node) return false; + if (node.type !== "ClassBody") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClassExpression(node, opts) { + if (!node) return false; + if (node.type !== "ClassExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClassDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "ClassDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExportAllDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "ExportAllDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExportDefaultDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "ExportDefaultDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExportNamedDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "ExportNamedDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExportSpecifier(node, opts) { + if (!node) return false; + if (node.type !== "ExportSpecifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isForOfStatement(node, opts) { + if (!node) return false; + if (node.type !== "ForOfStatement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isImportDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "ImportDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isImportDefaultSpecifier(node, opts) { + if (!node) return false; + if (node.type !== "ImportDefaultSpecifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isImportNamespaceSpecifier(node, opts) { + if (!node) return false; + if (node.type !== "ImportNamespaceSpecifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isImportSpecifier(node, opts) { + if (!node) return false; + if (node.type !== "ImportSpecifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isMetaProperty(node, opts) { + if (!node) return false; + if (node.type !== "MetaProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClassMethod(node, opts) { + if (!node) return false; + if (node.type !== "ClassMethod") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectPattern(node, opts) { + if (!node) return false; + if (node.type !== "ObjectPattern") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isSpreadElement(node, opts) { + if (!node) return false; + if (node.type !== "SpreadElement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isSuper(node, opts) { + if (!node) return false; + if (node.type !== "Super") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTaggedTemplateExpression(node, opts) { + if (!node) return false; + if (node.type !== "TaggedTemplateExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTemplateElement(node, opts) { + if (!node) return false; + if (node.type !== "TemplateElement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTemplateLiteral(node, opts) { + if (!node) return false; + if (node.type !== "TemplateLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isYieldExpression(node, opts) { + if (!node) return false; + if (node.type !== "YieldExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isAwaitExpression(node, opts) { + if (!node) return false; + if (node.type !== "AwaitExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isImport(node, opts) { + if (!node) return false; + if (node.type !== "Import") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBigIntLiteral(node, opts) { + if (!node) return false; + if (node.type !== "BigIntLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExportNamespaceSpecifier(node, opts) { + if (!node) return false; + if (node.type !== "ExportNamespaceSpecifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isOptionalMemberExpression(node, opts) { + if (!node) return false; + if (node.type !== "OptionalMemberExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isOptionalCallExpression(node, opts) { + if (!node) return false; + if (node.type !== "OptionalCallExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClassProperty(node, opts) { + if (!node) return false; + if (node.type !== "ClassProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClassAccessorProperty(node, opts) { + if (!node) return false; + if (node.type !== "ClassAccessorProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClassPrivateProperty(node, opts) { + if (!node) return false; + if (node.type !== "ClassPrivateProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClassPrivateMethod(node, opts) { + if (!node) return false; + if (node.type !== "ClassPrivateMethod") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isPrivateName(node, opts) { + if (!node) return false; + if (node.type !== "PrivateName") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isStaticBlock(node, opts) { + if (!node) return false; + if (node.type !== "StaticBlock") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isAnyTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "AnyTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isArrayTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "ArrayTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBooleanTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "BooleanTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBooleanLiteralTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "BooleanLiteralTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isNullLiteralTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "NullLiteralTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClassImplements(node, opts) { + if (!node) return false; + if (node.type !== "ClassImplements") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareClass(node, opts) { + if (!node) return false; + if (node.type !== "DeclareClass") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareFunction(node, opts) { + if (!node) return false; + if (node.type !== "DeclareFunction") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareInterface(node, opts) { + if (!node) return false; + if (node.type !== "DeclareInterface") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareModule(node, opts) { + if (!node) return false; + if (node.type !== "DeclareModule") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareModuleExports(node, opts) { + if (!node) return false; + if (node.type !== "DeclareModuleExports") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareTypeAlias(node, opts) { + if (!node) return false; + if (node.type !== "DeclareTypeAlias") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareOpaqueType(node, opts) { + if (!node) return false; + if (node.type !== "DeclareOpaqueType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareVariable(node, opts) { + if (!node) return false; + if (node.type !== "DeclareVariable") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareExportDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "DeclareExportDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclareExportAllDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "DeclareExportAllDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclaredPredicate(node, opts) { + if (!node) return false; + if (node.type !== "DeclaredPredicate") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExistsTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "ExistsTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFunctionTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "FunctionTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFunctionTypeParam(node, opts) { + if (!node) return false; + if (node.type !== "FunctionTypeParam") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isGenericTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "GenericTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isInferredPredicate(node, opts) { + if (!node) return false; + if (node.type !== "InferredPredicate") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isInterfaceExtends(node, opts) { + if (!node) return false; + if (node.type !== "InterfaceExtends") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isInterfaceDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "InterfaceDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isInterfaceTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "InterfaceTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isIntersectionTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "IntersectionTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isMixedTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "MixedTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEmptyTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "EmptyTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isNullableTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "NullableTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isNumberLiteralTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "NumberLiteralTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isNumberTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "NumberTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectTypeInternalSlot(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeInternalSlot") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectTypeCallProperty(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeCallProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectTypeIndexer(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeIndexer") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectTypeProperty(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectTypeSpreadProperty(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeSpreadProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isOpaqueType(node, opts) { + if (!node) return false; + if (node.type !== "OpaqueType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isQualifiedTypeIdentifier(node, opts) { + if (!node) return false; + if (node.type !== "QualifiedTypeIdentifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isStringLiteralTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "StringLiteralTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isStringTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "StringTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isSymbolTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "SymbolTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isThisTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "ThisTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTupleTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "TupleTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTypeofTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "TypeofTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTypeAlias(node, opts) { + if (!node) return false; + if (node.type !== "TypeAlias") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "TypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTypeCastExpression(node, opts) { + if (!node) return false; + if (node.type !== "TypeCastExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTypeParameter(node, opts) { + if (!node) return false; + if (node.type !== "TypeParameter") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTypeParameterDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TypeParameterDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTypeParameterInstantiation(node, opts) { + if (!node) return false; + if (node.type !== "TypeParameterInstantiation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isUnionTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "UnionTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isVariance(node, opts) { + if (!node) return false; + if (node.type !== "Variance") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isVoidTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "VoidTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "EnumDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumBooleanBody(node, opts) { + if (!node) return false; + if (node.type !== "EnumBooleanBody") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumNumberBody(node, opts) { + if (!node) return false; + if (node.type !== "EnumNumberBody") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumStringBody(node, opts) { + if (!node) return false; + if (node.type !== "EnumStringBody") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumSymbolBody(node, opts) { + if (!node) return false; + if (node.type !== "EnumSymbolBody") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumBooleanMember(node, opts) { + if (!node) return false; + if (node.type !== "EnumBooleanMember") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumNumberMember(node, opts) { + if (!node) return false; + if (node.type !== "EnumNumberMember") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumStringMember(node, opts) { + if (!node) return false; + if (node.type !== "EnumStringMember") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumDefaultedMember(node, opts) { + if (!node) return false; + if (node.type !== "EnumDefaultedMember") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isIndexedAccessType(node, opts) { + if (!node) return false; + if (node.type !== "IndexedAccessType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isOptionalIndexedAccessType(node, opts) { + if (!node) return false; + if (node.type !== "OptionalIndexedAccessType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXAttribute(node, opts) { + if (!node) return false; + if (node.type !== "JSXAttribute") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXClosingElement(node, opts) { + if (!node) return false; + if (node.type !== "JSXClosingElement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXElement(node, opts) { + if (!node) return false; + if (node.type !== "JSXElement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXEmptyExpression(node, opts) { + if (!node) return false; + if (node.type !== "JSXEmptyExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXExpressionContainer(node, opts) { + if (!node) return false; + if (node.type !== "JSXExpressionContainer") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXSpreadChild(node, opts) { + if (!node) return false; + if (node.type !== "JSXSpreadChild") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXIdentifier(node, opts) { + if (!node) return false; + if (node.type !== "JSXIdentifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXMemberExpression(node, opts) { + if (!node) return false; + if (node.type !== "JSXMemberExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXNamespacedName(node, opts) { + if (!node) return false; + if (node.type !== "JSXNamespacedName") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXOpeningElement(node, opts) { + if (!node) return false; + if (node.type !== "JSXOpeningElement") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXSpreadAttribute(node, opts) { + if (!node) return false; + if (node.type !== "JSXSpreadAttribute") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXText(node, opts) { + if (!node) return false; + if (node.type !== "JSXText") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXFragment(node, opts) { + if (!node) return false; + if (node.type !== "JSXFragment") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXOpeningFragment(node, opts) { + if (!node) return false; + if (node.type !== "JSXOpeningFragment") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSXClosingFragment(node, opts) { + if (!node) return false; + if (node.type !== "JSXClosingFragment") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isNoop(node, opts) { + if (!node) return false; + if (node.type !== "Noop") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isPlaceholder(node, opts) { + if (!node) return false; + if (node.type !== "Placeholder") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isV8IntrinsicIdentifier(node, opts) { + if (!node) return false; + if (node.type !== "V8IntrinsicIdentifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isArgumentPlaceholder(node, opts) { + if (!node) return false; + if (node.type !== "ArgumentPlaceholder") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBindExpression(node, opts) { + if (!node) return false; + if (node.type !== "BindExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isImportAttribute(node, opts) { + if (!node) return false; + if (node.type !== "ImportAttribute") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDecorator(node, opts) { + if (!node) return false; + if (node.type !== "Decorator") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDoExpression(node, opts) { + if (!node) return false; + if (node.type !== "DoExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExportDefaultSpecifier(node, opts) { + if (!node) return false; + if (node.type !== "ExportDefaultSpecifier") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isRecordExpression(node, opts) { + if (!node) return false; + if (node.type !== "RecordExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTupleExpression(node, opts) { + if (!node) return false; + if (node.type !== "TupleExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDecimalLiteral(node, opts) { + if (!node) return false; + if (node.type !== "DecimalLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isModuleExpression(node, opts) { + if (!node) return false; + if (node.type !== "ModuleExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTopicReference(node, opts) { + if (!node) return false; + if (node.type !== "TopicReference") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isPipelineTopicExpression(node, opts) { + if (!node) return false; + if (node.type !== "PipelineTopicExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isPipelineBareFunction(node, opts) { + if (!node) return false; + if (node.type !== "PipelineBareFunction") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isPipelinePrimaryTopicReference(node, opts) { + if (!node) return false; + if (node.type !== "PipelinePrimaryTopicReference") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSParameterProperty(node, opts) { + if (!node) return false; + if (node.type !== "TSParameterProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSDeclareFunction(node, opts) { + if (!node) return false; + if (node.type !== "TSDeclareFunction") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSDeclareMethod(node, opts) { + if (!node) return false; + if (node.type !== "TSDeclareMethod") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSQualifiedName(node, opts) { + if (!node) return false; + if (node.type !== "TSQualifiedName") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSCallSignatureDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSCallSignatureDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSConstructSignatureDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSConstructSignatureDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSPropertySignature(node, opts) { + if (!node) return false; + if (node.type !== "TSPropertySignature") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSMethodSignature(node, opts) { + if (!node) return false; + if (node.type !== "TSMethodSignature") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSIndexSignature(node, opts) { + if (!node) return false; + if (node.type !== "TSIndexSignature") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSAnyKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSAnyKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSBooleanKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSBooleanKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSBigIntKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSBigIntKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSIntrinsicKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSIntrinsicKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSNeverKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSNeverKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSNullKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSNullKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSNumberKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSNumberKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSObjectKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSObjectKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSStringKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSStringKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSSymbolKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSSymbolKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSUndefinedKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSUndefinedKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSUnknownKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSUnknownKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSVoidKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSVoidKeyword") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSThisType(node, opts) { + if (!node) return false; + if (node.type !== "TSThisType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSFunctionType(node, opts) { + if (!node) return false; + if (node.type !== "TSFunctionType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSConstructorType(node, opts) { + if (!node) return false; + if (node.type !== "TSConstructorType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeReference(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeReference") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypePredicate(node, opts) { + if (!node) return false; + if (node.type !== "TSTypePredicate") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeQuery(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeQuery") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeLiteral(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSArrayType(node, opts) { + if (!node) return false; + if (node.type !== "TSArrayType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTupleType(node, opts) { + if (!node) return false; + if (node.type !== "TSTupleType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSOptionalType(node, opts) { + if (!node) return false; + if (node.type !== "TSOptionalType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSRestType(node, opts) { + if (!node) return false; + if (node.type !== "TSRestType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSNamedTupleMember(node, opts) { + if (!node) return false; + if (node.type !== "TSNamedTupleMember") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSUnionType(node, opts) { + if (!node) return false; + if (node.type !== "TSUnionType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSIntersectionType(node, opts) { + if (!node) return false; + if (node.type !== "TSIntersectionType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSConditionalType(node, opts) { + if (!node) return false; + if (node.type !== "TSConditionalType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSInferType(node, opts) { + if (!node) return false; + if (node.type !== "TSInferType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSParenthesizedType(node, opts) { + if (!node) return false; + if (node.type !== "TSParenthesizedType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeOperator(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeOperator") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSIndexedAccessType(node, opts) { + if (!node) return false; + if (node.type !== "TSIndexedAccessType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSMappedType(node, opts) { + if (!node) return false; + if (node.type !== "TSMappedType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSLiteralType(node, opts) { + if (!node) return false; + if (node.type !== "TSLiteralType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSExpressionWithTypeArguments(node, opts) { + if (!node) return false; + if (node.type !== "TSExpressionWithTypeArguments") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSInterfaceDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSInterfaceDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSInterfaceBody(node, opts) { + if (!node) return false; + if (node.type !== "TSInterfaceBody") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeAliasDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeAliasDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSInstantiationExpression(node, opts) { + if (!node) return false; + if (node.type !== "TSInstantiationExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSAsExpression(node, opts) { + if (!node) return false; + if (node.type !== "TSAsExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSSatisfiesExpression(node, opts) { + if (!node) return false; + if (node.type !== "TSSatisfiesExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeAssertion(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeAssertion") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSEnumDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSEnumDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSEnumMember(node, opts) { + if (!node) return false; + if (node.type !== "TSEnumMember") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSModuleDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSModuleDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSModuleBlock(node, opts) { + if (!node) return false; + if (node.type !== "TSModuleBlock") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSImportType(node, opts) { + if (!node) return false; + if (node.type !== "TSImportType") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSImportEqualsDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSImportEqualsDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSExternalModuleReference(node, opts) { + if (!node) return false; + if (node.type !== "TSExternalModuleReference") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSNonNullExpression(node, opts) { + if (!node) return false; + if (node.type !== "TSNonNullExpression") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSExportAssignment(node, opts) { + if (!node) return false; + if (node.type !== "TSExportAssignment") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSNamespaceExportDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSNamespaceExportDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeAnnotation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeParameterInstantiation(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeParameterInstantiation") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeParameterDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeParameterDeclaration") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeParameter(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeParameter") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isStandardized(node, opts) { + if (!node) return false; + switch (node.type) { + case "ArrayExpression": + case "AssignmentExpression": + case "BinaryExpression": + case "InterpreterDirective": + case "Directive": + case "DirectiveLiteral": + case "BlockStatement": + case "BreakStatement": + case "CallExpression": + case "CatchClause": + case "ConditionalExpression": + case "ContinueStatement": + case "DebuggerStatement": + case "DoWhileStatement": + case "EmptyStatement": + case "ExpressionStatement": + case "File": + case "ForInStatement": + case "ForStatement": + case "FunctionDeclaration": + case "FunctionExpression": + case "Identifier": + case "IfStatement": + case "LabeledStatement": + case "StringLiteral": + case "NumericLiteral": + case "NullLiteral": + case "BooleanLiteral": + case "RegExpLiteral": + case "LogicalExpression": + case "MemberExpression": + case "NewExpression": + case "Program": + case "ObjectExpression": + case "ObjectMethod": + case "ObjectProperty": + case "RestElement": + case "ReturnStatement": + case "SequenceExpression": + case "ParenthesizedExpression": + case "SwitchCase": + case "SwitchStatement": + case "ThisExpression": + case "ThrowStatement": + case "TryStatement": + case "UnaryExpression": + case "UpdateExpression": + case "VariableDeclaration": + case "VariableDeclarator": + case "WhileStatement": + case "WithStatement": + case "AssignmentPattern": + case "ArrayPattern": + case "ArrowFunctionExpression": + case "ClassBody": + case "ClassExpression": + case "ClassDeclaration": + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + case "ExportSpecifier": + case "ForOfStatement": + case "ImportDeclaration": + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + case "MetaProperty": + case "ClassMethod": + case "ObjectPattern": + case "SpreadElement": + case "Super": + case "TaggedTemplateExpression": + case "TemplateElement": + case "TemplateLiteral": + case "YieldExpression": + case "AwaitExpression": + case "Import": + case "BigIntLiteral": + case "ExportNamespaceSpecifier": + case "OptionalMemberExpression": + case "OptionalCallExpression": + case "ClassProperty": + case "ClassAccessorProperty": + case "ClassPrivateProperty": + case "ClassPrivateMethod": + case "PrivateName": + case "StaticBlock": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Identifier": + case "StringLiteral": + case "BlockStatement": + case "ClassBody": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExpression(node, opts) { + if (!node) return false; + switch (node.type) { + case "ArrayExpression": + case "AssignmentExpression": + case "BinaryExpression": + case "CallExpression": + case "ConditionalExpression": + case "FunctionExpression": + case "Identifier": + case "StringLiteral": + case "NumericLiteral": + case "NullLiteral": + case "BooleanLiteral": + case "RegExpLiteral": + case "LogicalExpression": + case "MemberExpression": + case "NewExpression": + case "ObjectExpression": + case "SequenceExpression": + case "ParenthesizedExpression": + case "ThisExpression": + case "UnaryExpression": + case "UpdateExpression": + case "ArrowFunctionExpression": + case "ClassExpression": + case "MetaProperty": + case "Super": + case "TaggedTemplateExpression": + case "TemplateLiteral": + case "YieldExpression": + case "AwaitExpression": + case "Import": + case "BigIntLiteral": + case "OptionalMemberExpression": + case "OptionalCallExpression": + case "TypeCastExpression": + case "JSXElement": + case "JSXFragment": + case "BindExpression": + case "DoExpression": + case "RecordExpression": + case "TupleExpression": + case "DecimalLiteral": + case "ModuleExpression": + case "TopicReference": + case "PipelineTopicExpression": + case "PipelineBareFunction": + case "PipelinePrimaryTopicReference": + case "TSInstantiationExpression": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSNonNullExpression": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Expression": + case "Identifier": + case "StringLiteral": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBinary(node, opts) { + if (!node) return false; + switch (node.type) { + case "BinaryExpression": + case "LogicalExpression": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isScopable(node, opts) { + if (!node) return false; + switch (node.type) { + case "BlockStatement": + case "CatchClause": + case "DoWhileStatement": + case "ForInStatement": + case "ForStatement": + case "FunctionDeclaration": + case "FunctionExpression": + case "Program": + case "ObjectMethod": + case "SwitchStatement": + case "WhileStatement": + case "ArrowFunctionExpression": + case "ClassExpression": + case "ClassDeclaration": + case "ForOfStatement": + case "ClassMethod": + case "ClassPrivateMethod": + case "StaticBlock": + case "TSModuleBlock": + break; + case "Placeholder": + if (node.expectedNode === "BlockStatement") break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBlockParent(node, opts) { + if (!node) return false; + switch (node.type) { + case "BlockStatement": + case "CatchClause": + case "DoWhileStatement": + case "ForInStatement": + case "ForStatement": + case "FunctionDeclaration": + case "FunctionExpression": + case "Program": + case "ObjectMethod": + case "SwitchStatement": + case "WhileStatement": + case "ArrowFunctionExpression": + case "ForOfStatement": + case "ClassMethod": + case "ClassPrivateMethod": + case "StaticBlock": + case "TSModuleBlock": + break; + case "Placeholder": + if (node.expectedNode === "BlockStatement") break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isBlock(node, opts) { + if (!node) return false; + switch (node.type) { + case "BlockStatement": + case "Program": + case "TSModuleBlock": + break; + case "Placeholder": + if (node.expectedNode === "BlockStatement") break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isStatement(node, opts) { + if (!node) return false; + switch (node.type) { + case "BlockStatement": + case "BreakStatement": + case "ContinueStatement": + case "DebuggerStatement": + case "DoWhileStatement": + case "EmptyStatement": + case "ExpressionStatement": + case "ForInStatement": + case "ForStatement": + case "FunctionDeclaration": + case "IfStatement": + case "LabeledStatement": + case "ReturnStatement": + case "SwitchStatement": + case "ThrowStatement": + case "TryStatement": + case "VariableDeclaration": + case "WhileStatement": + case "WithStatement": + case "ClassDeclaration": + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + case "ForOfStatement": + case "ImportDeclaration": + case "DeclareClass": + case "DeclareFunction": + case "DeclareInterface": + case "DeclareModule": + case "DeclareModuleExports": + case "DeclareTypeAlias": + case "DeclareOpaqueType": + case "DeclareVariable": + case "DeclareExportDeclaration": + case "DeclareExportAllDeclaration": + case "InterfaceDeclaration": + case "OpaqueType": + case "TypeAlias": + case "EnumDeclaration": + case "TSDeclareFunction": + case "TSInterfaceDeclaration": + case "TSTypeAliasDeclaration": + case "TSEnumDeclaration": + case "TSModuleDeclaration": + case "TSImportEqualsDeclaration": + case "TSExportAssignment": + case "TSNamespaceExportDeclaration": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Statement": + case "Declaration": + case "BlockStatement": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTerminatorless(node, opts) { + if (!node) return false; + switch (node.type) { + case "BreakStatement": + case "ContinueStatement": + case "ReturnStatement": + case "ThrowStatement": + case "YieldExpression": + case "AwaitExpression": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isCompletionStatement(node, opts) { + if (!node) return false; + switch (node.type) { + case "BreakStatement": + case "ContinueStatement": + case "ReturnStatement": + case "ThrowStatement": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isConditional(node, opts) { + if (!node) return false; + switch (node.type) { + case "ConditionalExpression": + case "IfStatement": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isLoop(node, opts) { + if (!node) return false; + switch (node.type) { + case "DoWhileStatement": + case "ForInStatement": + case "ForStatement": + case "WhileStatement": + case "ForOfStatement": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isWhile(node, opts) { + if (!node) return false; + switch (node.type) { + case "DoWhileStatement": + case "WhileStatement": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExpressionWrapper(node, opts) { + if (!node) return false; + switch (node.type) { + case "ExpressionStatement": + case "ParenthesizedExpression": + case "TypeCastExpression": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFor(node, opts) { + if (!node) return false; + switch (node.type) { + case "ForInStatement": + case "ForStatement": + case "ForOfStatement": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isForXStatement(node, opts) { + if (!node) return false; + switch (node.type) { + case "ForInStatement": + case "ForOfStatement": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFunction(node, opts) { + if (!node) return false; + switch (node.type) { + case "FunctionDeclaration": + case "FunctionExpression": + case "ObjectMethod": + case "ArrowFunctionExpression": + case "ClassMethod": + case "ClassPrivateMethod": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFunctionParent(node, opts) { + if (!node) return false; + switch (node.type) { + case "FunctionDeclaration": + case "FunctionExpression": + case "ObjectMethod": + case "ArrowFunctionExpression": + case "ClassMethod": + case "ClassPrivateMethod": + case "StaticBlock": + case "TSModuleBlock": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isPureish(node, opts) { + if (!node) return false; + switch (node.type) { + case "FunctionDeclaration": + case "FunctionExpression": + case "StringLiteral": + case "NumericLiteral": + case "NullLiteral": + case "BooleanLiteral": + case "RegExpLiteral": + case "ArrowFunctionExpression": + case "BigIntLiteral": + case "DecimalLiteral": + break; + case "Placeholder": + if (node.expectedNode === "StringLiteral") break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isDeclaration(node, opts) { + if (!node) return false; + switch (node.type) { + case "FunctionDeclaration": + case "VariableDeclaration": + case "ClassDeclaration": + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + case "ImportDeclaration": + case "DeclareClass": + case "DeclareFunction": + case "DeclareInterface": + case "DeclareModule": + case "DeclareModuleExports": + case "DeclareTypeAlias": + case "DeclareOpaqueType": + case "DeclareVariable": + case "DeclareExportDeclaration": + case "DeclareExportAllDeclaration": + case "InterfaceDeclaration": + case "OpaqueType": + case "TypeAlias": + case "EnumDeclaration": + case "TSDeclareFunction": + case "TSInterfaceDeclaration": + case "TSTypeAliasDeclaration": + case "TSEnumDeclaration": + case "TSModuleDeclaration": + break; + case "Placeholder": + if (node.expectedNode === "Declaration") break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isPatternLike(node, opts) { + if (!node) return false; + switch (node.type) { + case "Identifier": + case "RestElement": + case "AssignmentPattern": + case "ArrayPattern": + case "ObjectPattern": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSNonNullExpression": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Pattern": + case "Identifier": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isLVal(node, opts) { + if (!node) return false; + switch (node.type) { + case "Identifier": + case "MemberExpression": + case "RestElement": + case "AssignmentPattern": + case "ArrayPattern": + case "ObjectPattern": + case "TSParameterProperty": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSNonNullExpression": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Pattern": + case "Identifier": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSEntityName(node, opts) { + if (!node) return false; + switch (node.type) { + case "Identifier": + case "TSQualifiedName": + break; + case "Placeholder": + if (node.expectedNode === "Identifier") break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isLiteral(node, opts) { + if (!node) return false; + switch (node.type) { + case "StringLiteral": + case "NumericLiteral": + case "NullLiteral": + case "BooleanLiteral": + case "RegExpLiteral": + case "TemplateLiteral": + case "BigIntLiteral": + case "DecimalLiteral": + break; + case "Placeholder": + if (node.expectedNode === "StringLiteral") break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isImmutable(node, opts) { + if (!node) return false; + switch (node.type) { + case "StringLiteral": + case "NumericLiteral": + case "NullLiteral": + case "BooleanLiteral": + case "BigIntLiteral": + case "JSXAttribute": + case "JSXClosingElement": + case "JSXElement": + case "JSXExpressionContainer": + case "JSXSpreadChild": + case "JSXOpeningElement": + case "JSXText": + case "JSXFragment": + case "JSXOpeningFragment": + case "JSXClosingFragment": + case "DecimalLiteral": + break; + case "Placeholder": + if (node.expectedNode === "StringLiteral") break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isUserWhitespacable(node, opts) { + if (!node) return false; + switch (node.type) { + case "ObjectMethod": + case "ObjectProperty": + case "ObjectTypeInternalSlot": + case "ObjectTypeCallProperty": + case "ObjectTypeIndexer": + case "ObjectTypeProperty": + case "ObjectTypeSpreadProperty": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isMethod(node, opts) { + if (!node) return false; + switch (node.type) { + case "ObjectMethod": + case "ClassMethod": + case "ClassPrivateMethod": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isObjectMember(node, opts) { + if (!node) return false; + switch (node.type) { + case "ObjectMethod": + case "ObjectProperty": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isProperty(node, opts) { + if (!node) return false; + switch (node.type) { + case "ObjectProperty": + case "ClassProperty": + case "ClassAccessorProperty": + case "ClassPrivateProperty": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isUnaryLike(node, opts) { + if (!node) return false; + switch (node.type) { + case "UnaryExpression": + case "SpreadElement": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isPattern(node, opts) { + if (!node) return false; + switch (node.type) { + case "AssignmentPattern": + case "ArrayPattern": + case "ObjectPattern": + break; + case "Placeholder": + if (node.expectedNode === "Pattern") break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isClass(node, opts) { + if (!node) return false; + switch (node.type) { + case "ClassExpression": + case "ClassDeclaration": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isImportOrExportDeclaration(node, opts) { + if (!node) return false; + switch (node.type) { + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + case "ImportDeclaration": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isExportDeclaration(node, opts) { + if (!node) return false; + switch (node.type) { + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isModuleSpecifier(node, opts) { + if (!node) return false; + switch (node.type) { + case "ExportSpecifier": + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + case "ExportNamespaceSpecifier": + case "ExportDefaultSpecifier": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isAccessor(node, opts) { + if (!node) return false; + switch (node.type) { + case "ClassAccessorProperty": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isPrivate(node, opts) { + if (!node) return false; + switch (node.type) { + case "ClassPrivateProperty": + case "ClassPrivateMethod": + case "PrivateName": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFlow(node, opts) { + if (!node) return false; + switch (node.type) { + case "AnyTypeAnnotation": + case "ArrayTypeAnnotation": + case "BooleanTypeAnnotation": + case "BooleanLiteralTypeAnnotation": + case "NullLiteralTypeAnnotation": + case "ClassImplements": + case "DeclareClass": + case "DeclareFunction": + case "DeclareInterface": + case "DeclareModule": + case "DeclareModuleExports": + case "DeclareTypeAlias": + case "DeclareOpaqueType": + case "DeclareVariable": + case "DeclareExportDeclaration": + case "DeclareExportAllDeclaration": + case "DeclaredPredicate": + case "ExistsTypeAnnotation": + case "FunctionTypeAnnotation": + case "FunctionTypeParam": + case "GenericTypeAnnotation": + case "InferredPredicate": + case "InterfaceExtends": + case "InterfaceDeclaration": + case "InterfaceTypeAnnotation": + case "IntersectionTypeAnnotation": + case "MixedTypeAnnotation": + case "EmptyTypeAnnotation": + case "NullableTypeAnnotation": + case "NumberLiteralTypeAnnotation": + case "NumberTypeAnnotation": + case "ObjectTypeAnnotation": + case "ObjectTypeInternalSlot": + case "ObjectTypeCallProperty": + case "ObjectTypeIndexer": + case "ObjectTypeProperty": + case "ObjectTypeSpreadProperty": + case "OpaqueType": + case "QualifiedTypeIdentifier": + case "StringLiteralTypeAnnotation": + case "StringTypeAnnotation": + case "SymbolTypeAnnotation": + case "ThisTypeAnnotation": + case "TupleTypeAnnotation": + case "TypeofTypeAnnotation": + case "TypeAlias": + case "TypeAnnotation": + case "TypeCastExpression": + case "TypeParameter": + case "TypeParameterDeclaration": + case "TypeParameterInstantiation": + case "UnionTypeAnnotation": + case "Variance": + case "VoidTypeAnnotation": + case "EnumDeclaration": + case "EnumBooleanBody": + case "EnumNumberBody": + case "EnumStringBody": + case "EnumSymbolBody": + case "EnumBooleanMember": + case "EnumNumberMember": + case "EnumStringMember": + case "EnumDefaultedMember": + case "IndexedAccessType": + case "OptionalIndexedAccessType": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFlowType(node, opts) { + if (!node) return false; + switch (node.type) { + case "AnyTypeAnnotation": + case "ArrayTypeAnnotation": + case "BooleanTypeAnnotation": + case "BooleanLiteralTypeAnnotation": + case "NullLiteralTypeAnnotation": + case "ExistsTypeAnnotation": + case "FunctionTypeAnnotation": + case "GenericTypeAnnotation": + case "InterfaceTypeAnnotation": + case "IntersectionTypeAnnotation": + case "MixedTypeAnnotation": + case "EmptyTypeAnnotation": + case "NullableTypeAnnotation": + case "NumberLiteralTypeAnnotation": + case "NumberTypeAnnotation": + case "ObjectTypeAnnotation": + case "StringLiteralTypeAnnotation": + case "StringTypeAnnotation": + case "SymbolTypeAnnotation": + case "ThisTypeAnnotation": + case "TupleTypeAnnotation": + case "TypeofTypeAnnotation": + case "UnionTypeAnnotation": + case "VoidTypeAnnotation": + case "IndexedAccessType": + case "OptionalIndexedAccessType": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFlowBaseAnnotation(node, opts) { + if (!node) return false; + switch (node.type) { + case "AnyTypeAnnotation": + case "BooleanTypeAnnotation": + case "NullLiteralTypeAnnotation": + case "MixedTypeAnnotation": + case "EmptyTypeAnnotation": + case "NumberTypeAnnotation": + case "StringTypeAnnotation": + case "SymbolTypeAnnotation": + case "ThisTypeAnnotation": + case "VoidTypeAnnotation": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFlowDeclaration(node, opts) { + if (!node) return false; + switch (node.type) { + case "DeclareClass": + case "DeclareFunction": + case "DeclareInterface": + case "DeclareModule": + case "DeclareModuleExports": + case "DeclareTypeAlias": + case "DeclareOpaqueType": + case "DeclareVariable": + case "DeclareExportDeclaration": + case "DeclareExportAllDeclaration": + case "InterfaceDeclaration": + case "OpaqueType": + case "TypeAlias": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isFlowPredicate(node, opts) { + if (!node) return false; + switch (node.type) { + case "DeclaredPredicate": + case "InferredPredicate": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumBody(node, opts) { + if (!node) return false; + switch (node.type) { + case "EnumBooleanBody": + case "EnumNumberBody": + case "EnumStringBody": + case "EnumSymbolBody": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isEnumMember(node, opts) { + if (!node) return false; + switch (node.type) { + case "EnumBooleanMember": + case "EnumNumberMember": + case "EnumStringMember": + case "EnumDefaultedMember": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isJSX(node, opts) { + if (!node) return false; + switch (node.type) { + case "JSXAttribute": + case "JSXClosingElement": + case "JSXElement": + case "JSXEmptyExpression": + case "JSXExpressionContainer": + case "JSXSpreadChild": + case "JSXIdentifier": + case "JSXMemberExpression": + case "JSXNamespacedName": + case "JSXOpeningElement": + case "JSXSpreadAttribute": + case "JSXText": + case "JSXFragment": + case "JSXOpeningFragment": + case "JSXClosingFragment": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isMiscellaneous(node, opts) { + if (!node) return false; + switch (node.type) { + case "Noop": + case "Placeholder": + case "V8IntrinsicIdentifier": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTypeScript(node, opts) { + if (!node) return false; + switch (node.type) { + case "TSParameterProperty": + case "TSDeclareFunction": + case "TSDeclareMethod": + case "TSQualifiedName": + case "TSCallSignatureDeclaration": + case "TSConstructSignatureDeclaration": + case "TSPropertySignature": + case "TSMethodSignature": + case "TSIndexSignature": + case "TSAnyKeyword": + case "TSBooleanKeyword": + case "TSBigIntKeyword": + case "TSIntrinsicKeyword": + case "TSNeverKeyword": + case "TSNullKeyword": + case "TSNumberKeyword": + case "TSObjectKeyword": + case "TSStringKeyword": + case "TSSymbolKeyword": + case "TSUndefinedKeyword": + case "TSUnknownKeyword": + case "TSVoidKeyword": + case "TSThisType": + case "TSFunctionType": + case "TSConstructorType": + case "TSTypeReference": + case "TSTypePredicate": + case "TSTypeQuery": + case "TSTypeLiteral": + case "TSArrayType": + case "TSTupleType": + case "TSOptionalType": + case "TSRestType": + case "TSNamedTupleMember": + case "TSUnionType": + case "TSIntersectionType": + case "TSConditionalType": + case "TSInferType": + case "TSParenthesizedType": + case "TSTypeOperator": + case "TSIndexedAccessType": + case "TSMappedType": + case "TSLiteralType": + case "TSExpressionWithTypeArguments": + case "TSInterfaceDeclaration": + case "TSInterfaceBody": + case "TSTypeAliasDeclaration": + case "TSInstantiationExpression": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSEnumDeclaration": + case "TSEnumMember": + case "TSModuleDeclaration": + case "TSModuleBlock": + case "TSImportType": + case "TSImportEqualsDeclaration": + case "TSExternalModuleReference": + case "TSNonNullExpression": + case "TSExportAssignment": + case "TSNamespaceExportDeclaration": + case "TSTypeAnnotation": + case "TSTypeParameterInstantiation": + case "TSTypeParameterDeclaration": + case "TSTypeParameter": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSTypeElement(node, opts) { + if (!node) return false; + switch (node.type) { + case "TSCallSignatureDeclaration": + case "TSConstructSignatureDeclaration": + case "TSPropertySignature": + case "TSMethodSignature": + case "TSIndexSignature": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSType(node, opts) { + if (!node) return false; + switch (node.type) { + case "TSAnyKeyword": + case "TSBooleanKeyword": + case "TSBigIntKeyword": + case "TSIntrinsicKeyword": + case "TSNeverKeyword": + case "TSNullKeyword": + case "TSNumberKeyword": + case "TSObjectKeyword": + case "TSStringKeyword": + case "TSSymbolKeyword": + case "TSUndefinedKeyword": + case "TSUnknownKeyword": + case "TSVoidKeyword": + case "TSThisType": + case "TSFunctionType": + case "TSConstructorType": + case "TSTypeReference": + case "TSTypePredicate": + case "TSTypeQuery": + case "TSTypeLiteral": + case "TSArrayType": + case "TSTupleType": + case "TSOptionalType": + case "TSRestType": + case "TSUnionType": + case "TSIntersectionType": + case "TSConditionalType": + case "TSInferType": + case "TSParenthesizedType": + case "TSTypeOperator": + case "TSIndexedAccessType": + case "TSMappedType": + case "TSLiteralType": + case "TSExpressionWithTypeArguments": + case "TSImportType": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isTSBaseType(node, opts) { + if (!node) return false; + switch (node.type) { + case "TSAnyKeyword": + case "TSBooleanKeyword": + case "TSBigIntKeyword": + case "TSIntrinsicKeyword": + case "TSNeverKeyword": + case "TSNullKeyword": + case "TSNumberKeyword": + case "TSObjectKeyword": + case "TSStringKeyword": + case "TSSymbolKeyword": + case "TSUndefinedKeyword": + case "TSUnknownKeyword": + case "TSVoidKeyword": + case "TSThisType": + case "TSLiteralType": + break; + default: + return false; + } + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isNumberLiteral(node, opts) { + (0, _deprecationWarning.default)("isNumberLiteral", "isNumericLiteral"); + if (!node) return false; + if (node.type !== "NumberLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isRegexLiteral(node, opts) { + (0, _deprecationWarning.default)("isRegexLiteral", "isRegExpLiteral"); + if (!node) return false; + if (node.type !== "RegexLiteral") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isRestProperty(node, opts) { + (0, _deprecationWarning.default)("isRestProperty", "isRestElement"); + if (!node) return false; + if (node.type !== "RestProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isSpreadProperty(node, opts) { + (0, _deprecationWarning.default)("isSpreadProperty", "isSpreadElement"); + if (!node) return false; + if (node.type !== "SpreadProperty") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} +function isModuleDeclaration(node, opts) { + (0, _deprecationWarning.default)("isModuleDeclaration", "isImportOrExportDeclaration"); + return isImportOrExportDeclaration(node, opts); +} + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 9242: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = is; +var _shallowEqual = __nccwpck_require__(2708); +var _isType = __nccwpck_require__(6907); +var _isPlaceholderType = __nccwpck_require__(7789); +var _index = __nccwpck_require__(8774); +function is(type, node, opts) { + if (!node) return false; + const matches = (0, _isType.default)(node.type, type); + if (!matches) { + if (!opts && node.type === "Placeholder" && type in _index.FLIPPED_ALIAS_KEYS) { + return (0, _isPlaceholderType.default)(node.expectedNode, type); + } + return false; + } + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } +} + +//# sourceMappingURL=is.js.map + + +/***/ }), + +/***/ 1232: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isBinding; +var _getBindingIdentifiers = __nccwpck_require__(5940); +function isBinding(node, parent, grandparent) { + if (grandparent && node.type === "Identifier" && parent.type === "ObjectProperty" && grandparent.type === "ObjectExpression") { + return false; + } + const keys = _getBindingIdentifiers.default.keys[parent.type]; + if (keys) { + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const val = parent[key]; + if (Array.isArray(val)) { + if (val.indexOf(node) >= 0) return true; + } else { + if (val === node) return true; + } + } + } + return false; +} + +//# sourceMappingURL=isBinding.js.map + + +/***/ }), + +/***/ 7676: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isBlockScoped; +var _index = __nccwpck_require__(2538); +var _isLet = __nccwpck_require__(672); +function isBlockScoped(node) { + return (0, _index.isFunctionDeclaration)(node) || (0, _index.isClassDeclaration)(node) || (0, _isLet.default)(node); +} + +//# sourceMappingURL=isBlockScoped.js.map + + +/***/ }), + +/***/ 7839: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isImmutable; +var _isType = __nccwpck_require__(6907); +var _index = __nccwpck_require__(2538); +function isImmutable(node) { + if ((0, _isType.default)(node.type, "Immutable")) return true; + if ((0, _index.isIdentifier)(node)) { + if (node.name === "undefined") { + return true; + } else { + return false; + } + } + return false; +} + +//# sourceMappingURL=isImmutable.js.map + + +/***/ }), + +/***/ 672: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isLet; +var _index = __nccwpck_require__(2538); +var _index2 = __nccwpck_require__(7297); +function isLet(node) { + return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[_index2.BLOCK_SCOPED_SYMBOL]); +} + +//# sourceMappingURL=isLet.js.map + + +/***/ }), + +/***/ 8582: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isNode; +var _index = __nccwpck_require__(8774); +function isNode(node) { + return !!(node && _index.VISITOR_KEYS[node.type]); +} + +//# sourceMappingURL=isNode.js.map + + +/***/ }), + +/***/ 3498: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isNodesEquivalent; +var _index = __nccwpck_require__(8774); +function isNodesEquivalent(a, b) { + if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) { + return a === b; + } + if (a.type !== b.type) { + return false; + } + const fields = Object.keys(_index.NODE_FIELDS[a.type] || a.type); + const visitorKeys = _index.VISITOR_KEYS[a.type]; + for (const field of fields) { + const val_a = a[field]; + const val_b = b[field]; + if (typeof val_a !== typeof val_b) { + return false; + } + if (val_a == null && val_b == null) { + continue; + } else if (val_a == null || val_b == null) { + return false; + } + if (Array.isArray(val_a)) { + if (!Array.isArray(val_b)) { + return false; + } + if (val_a.length !== val_b.length) { + return false; + } + for (let i = 0; i < val_a.length; i++) { + if (!isNodesEquivalent(val_a[i], val_b[i])) { + return false; + } + } + continue; + } + if (typeof val_a === "object" && !(visitorKeys != null && visitorKeys.includes(field))) { + for (const key of Object.keys(val_a)) { + if (val_a[key] !== val_b[key]) { + return false; + } + } + continue; + } + if (!isNodesEquivalent(val_a, val_b)) { + return false; + } + } + return true; +} + +//# sourceMappingURL=isNodesEquivalent.js.map + + +/***/ }), + +/***/ 7789: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isPlaceholderType; +var _index = __nccwpck_require__(8774); +function isPlaceholderType(placeholderType, targetType) { + if (placeholderType === targetType) return true; + const aliases = _index.PLACEHOLDERS_ALIAS[placeholderType]; + if (aliases) { + for (const alias of aliases) { + if (targetType === alias) return true; + } + } + return false; +} + +//# sourceMappingURL=isPlaceholderType.js.map + + +/***/ }), + +/***/ 6732: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isReferenced; +function isReferenced(node, parent, grandparent) { + switch (parent.type) { + case "MemberExpression": + case "OptionalMemberExpression": + if (parent.property === node) { + return !!parent.computed; + } + return parent.object === node; + case "JSXMemberExpression": + return parent.object === node; + case "VariableDeclarator": + return parent.init === node; + case "ArrowFunctionExpression": + return parent.body === node; + case "PrivateName": + return false; + case "ClassMethod": + case "ClassPrivateMethod": + case "ObjectMethod": + if (parent.key === node) { + return !!parent.computed; + } + return false; + case "ObjectProperty": + if (parent.key === node) { + return !!parent.computed; + } + return !grandparent || grandparent.type !== "ObjectPattern"; + case "ClassProperty": + case "ClassAccessorProperty": + if (parent.key === node) { + return !!parent.computed; + } + return true; + case "ClassPrivateProperty": + return parent.key !== node; + case "ClassDeclaration": + case "ClassExpression": + return parent.superClass === node; + case "AssignmentExpression": + return parent.right === node; + case "AssignmentPattern": + return parent.right === node; + case "LabeledStatement": + return false; + case "CatchClause": + return false; + case "RestElement": + return false; + case "BreakStatement": + case "ContinueStatement": + return false; + case "FunctionDeclaration": + case "FunctionExpression": + return false; + case "ExportNamespaceSpecifier": + case "ExportDefaultSpecifier": + return false; + case "ExportSpecifier": + if (grandparent != null && grandparent.source) { + return false; + } + return parent.local === node; + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + return false; + case "ImportAttribute": + return false; + case "JSXAttribute": + return false; + case "ObjectPattern": + case "ArrayPattern": + return false; + case "MetaProperty": + return false; + case "ObjectTypeProperty": + return parent.key !== node; + case "TSEnumMember": + return parent.id !== node; + case "TSPropertySignature": + if (parent.key === node) { + return !!parent.computed; + } + return true; + } + return true; +} + +//# sourceMappingURL=isReferenced.js.map + + +/***/ }), + +/***/ 8449: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isScope; +var _index = __nccwpck_require__(2538); +function isScope(node, parent) { + if ((0, _index.isBlockStatement)(node) && ((0, _index.isFunction)(parent) || (0, _index.isCatchClause)(parent))) { + return false; + } + if ((0, _index.isPattern)(node) && ((0, _index.isFunction)(parent) || (0, _index.isCatchClause)(parent))) { + return true; + } + return (0, _index.isScopable)(node); +} + +//# sourceMappingURL=isScope.js.map + + +/***/ }), + +/***/ 8845: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isSpecifierDefault; +var _index = __nccwpck_require__(2538); +function isSpecifierDefault(specifier) { + return (0, _index.isImportDefaultSpecifier)(specifier) || (0, _index.isIdentifier)(specifier.imported || specifier.exported, { + name: "default" + }); +} + +//# sourceMappingURL=isSpecifierDefault.js.map + + +/***/ }), + +/***/ 6907: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isType; +var _index = __nccwpck_require__(8774); +function isType(nodeType, targetType) { + if (nodeType === targetType) return true; + if (nodeType == null) return false; + if (_index.ALIAS_KEYS[targetType]) return false; + const aliases = _index.FLIPPED_ALIAS_KEYS[targetType]; + if (aliases) { + if (aliases[0] === nodeType) return true; + for (const alias of aliases) { + if (nodeType === alias) return true; + } + } + return false; +} + +//# sourceMappingURL=isType.js.map + + +/***/ }), + +/***/ 8679: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isValidES3Identifier; +var _isValidIdentifier = __nccwpck_require__(5178); +const RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]); +function isValidES3Identifier(name) { + return (0, _isValidIdentifier.default)(name) && !RESERVED_WORDS_ES3_ONLY.has(name); +} + +//# sourceMappingURL=isValidES3Identifier.js.map + + +/***/ }), + +/***/ 5178: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isValidIdentifier; +var _helperValidatorIdentifier = __nccwpck_require__(6607); +function isValidIdentifier(name, reserved = true) { + if (typeof name !== "string") return false; + if (reserved) { + if ((0, _helperValidatorIdentifier.isKeyword)(name) || (0, _helperValidatorIdentifier.isStrictReservedWord)(name, true)) { + return false; + } + } + return (0, _helperValidatorIdentifier.isIdentifierName)(name); +} + +//# sourceMappingURL=isValidIdentifier.js.map + + +/***/ }), + +/***/ 5444: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isVar; +var _index = __nccwpck_require__(2538); +var _index2 = __nccwpck_require__(7297); +function isVar(node) { + return (0, _index.isVariableDeclaration)(node, { + kind: "var" + }) && !node[_index2.BLOCK_SCOPED_SYMBOL]; +} + +//# sourceMappingURL=isVar.js.map + + +/***/ }), + +/***/ 1011: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = matchesPattern; +var _index = __nccwpck_require__(2538); +function matchesPattern(member, match, allowPartial) { + if (!(0, _index.isMemberExpression)(member)) return false; + const parts = Array.isArray(match) ? match : match.split("."); + const nodes = []; + let node; + for (node = member; (0, _index.isMemberExpression)(node); node = node.object) { + nodes.push(node.property); + } + nodes.push(node); + if (nodes.length < parts.length) return false; + if (!allowPartial && nodes.length > parts.length) return false; + for (let i = 0, j = nodes.length - 1; i < parts.length; i++, j--) { + const node = nodes[j]; + let value; + if ((0, _index.isIdentifier)(node)) { + value = node.name; + } else if ((0, _index.isStringLiteral)(node)) { + value = node.value; + } else if ((0, _index.isThisExpression)(node)) { + value = "this"; + } else { + return false; + } + if (parts[i] !== value) return false; + } + return true; +} + +//# sourceMappingURL=matchesPattern.js.map + + +/***/ }), + +/***/ 1102: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = isCompatTag; +function isCompatTag(tagName) { + return !!tagName && /^[a-z]/.test(tagName); +} + +//# sourceMappingURL=isCompatTag.js.map + + +/***/ }), + +/***/ 6739: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _buildMatchMemberExpression = __nccwpck_require__(6770); +const isReactComponent = (0, _buildMatchMemberExpression.default)("React.Component"); +var _default = isReactComponent; +exports.default = _default; + +//# sourceMappingURL=isReactComponent.js.map + + +/***/ }), + +/***/ 826: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = validate; +exports.validateChild = validateChild; +exports.validateField = validateField; +var _index = __nccwpck_require__(8774); +function validate(node, key, val) { + if (!node) return; + const fields = _index.NODE_FIELDS[node.type]; + if (!fields) return; + const field = fields[key]; + validateField(node, key, val, field); + validateChild(node, key, val); +} +function validateField(node, key, val, field) { + if (!(field != null && field.validate)) return; + if (field.optional && val == null) return; + field.validate(node, key, val); +} +function validateChild(node, key, val) { + if (val == null) return; + const validate = _index.NODE_PARENT_VALIDATIONS[val.type]; + if (!validate) return; + validate(node, key, val); +} + +//# sourceMappingURL=validate.js.map + + +/***/ }), + +/***/ 6898: +/***/ (function(module) { + +(function (global, factory) { + true ? module.exports = factory() : + 0; +})(this, (function () { 'use strict'; + + // Matches the scheme of a URL, eg "http://" + const schemeRegex = /^[\w+.-]+:\/\//; + /** + * Matches the parts of a URL: + * 1. Scheme, including ":", guaranteed. + * 2. User/password, including "@", optional. + * 3. Host, guaranteed. + * 4. Port, including ":", optional. + * 5. Path, including "/", optional. + * 6. Query, including "?", optional. + * 7. Hash, including "#", optional. + */ + const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; + /** + * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start + * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). + * + * 1. Host, optional. + * 2. Path, which may include "/", guaranteed. + * 3. Query, including "?", optional. + * 4. Hash, including "#", optional. + */ + const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; + var UrlType; + (function (UrlType) { + UrlType[UrlType["Empty"] = 1] = "Empty"; + UrlType[UrlType["Hash"] = 2] = "Hash"; + UrlType[UrlType["Query"] = 3] = "Query"; + UrlType[UrlType["RelativePath"] = 4] = "RelativePath"; + UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath"; + UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative"; + UrlType[UrlType["Absolute"] = 7] = "Absolute"; + })(UrlType || (UrlType = {})); + function isAbsoluteUrl(input) { + return schemeRegex.test(input); + } + function isSchemeRelativeUrl(input) { + return input.startsWith('//'); + } + function isAbsolutePath(input) { + return input.startsWith('/'); + } + function isFileUrl(input) { + return input.startsWith('file:'); + } + function isRelative(input) { + return /^[.?#]/.test(input); + } + function parseAbsoluteUrl(input) { + const match = urlRegex.exec(input); + return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || ''); + } + function parseFileUrl(input) { + const match = fileRegex.exec(input); + const path = match[2]; + return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || ''); + } + function makeUrl(scheme, user, host, port, path, query, hash) { + return { + scheme, + user, + host, + port, + path, + query, + hash, + type: UrlType.Absolute, + }; + } + function parseUrl(input) { + if (isSchemeRelativeUrl(input)) { + const url = parseAbsoluteUrl('http:' + input); + url.scheme = ''; + url.type = UrlType.SchemeRelative; + return url; + } + if (isAbsolutePath(input)) { + const url = parseAbsoluteUrl('http://foo.com' + input); + url.scheme = ''; + url.host = ''; + url.type = UrlType.AbsolutePath; + return url; + } + if (isFileUrl(input)) + return parseFileUrl(input); + if (isAbsoluteUrl(input)) + return parseAbsoluteUrl(input); + const url = parseAbsoluteUrl('http://foo.com/' + input); + url.scheme = ''; + url.host = ''; + url.type = input + ? input.startsWith('?') + ? UrlType.Query + : input.startsWith('#') + ? UrlType.Hash + : UrlType.RelativePath + : UrlType.Empty; + return url; + } + function stripPathFilename(path) { + // If a path ends with a parent directory "..", then it's a relative path with excess parent + // paths. It's not a file, so we can't strip it. + if (path.endsWith('/..')) + return path; + const index = path.lastIndexOf('/'); + return path.slice(0, index + 1); + } + function mergePaths(url, base) { + normalizePath(base, base.type); + // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative + // path). + if (url.path === '/') { + url.path = base.path; + } + else { + // Resolution happens relative to the base path's directory, not the file. + url.path = stripPathFilename(base.path) + url.path; + } + } + /** + * The path can have empty directories "//", unneeded parents "foo/..", or current directory + * "foo/.". We need to normalize to a standard representation. + */ + function normalizePath(url, type) { + const rel = type <= UrlType.RelativePath; + const pieces = url.path.split('/'); + // We need to preserve the first piece always, so that we output a leading slash. The item at + // pieces[0] is an empty string. + let pointer = 1; + // Positive is the number of real directories we've output, used for popping a parent directory. + // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo". + let positive = 0; + // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will + // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a + // real directory, we won't need to append, unless the other conditions happen again. + let addTrailingSlash = false; + for (let i = 1; i < pieces.length; i++) { + const piece = pieces[i]; + // An empty directory, could be a trailing slash, or just a double "//" in the path. + if (!piece) { + addTrailingSlash = true; + continue; + } + // If we encounter a real directory, then we don't need to append anymore. + addTrailingSlash = false; + // A current directory, which we can always drop. + if (piece === '.') + continue; + // A parent directory, we need to see if there are any real directories we can pop. Else, we + // have an excess of parents, and we'll need to keep the "..". + if (piece === '..') { + if (positive) { + addTrailingSlash = true; + positive--; + pointer--; + } + else if (rel) { + // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute + // URL, protocol relative URL, or an absolute path, we don't need to keep excess. + pieces[pointer++] = piece; + } + continue; + } + // We've encountered a real directory. Move it to the next insertion pointer, which accounts for + // any popped or dropped directories. + pieces[pointer++] = piece; + positive++; + } + let path = ''; + for (let i = 1; i < pointer; i++) { + path += '/' + pieces[i]; + } + if (!path || (addTrailingSlash && !path.endsWith('/..'))) { + path += '/'; + } + url.path = path; + } + /** + * Attempts to resolve `input` URL/path relative to `base`. + */ + function resolve(input, base) { + if (!input && !base) + return ''; + const url = parseUrl(input); + let inputType = url.type; + if (base && inputType !== UrlType.Absolute) { + const baseUrl = parseUrl(base); + const baseType = baseUrl.type; + switch (inputType) { + case UrlType.Empty: + url.hash = baseUrl.hash; + // fall through + case UrlType.Hash: + url.query = baseUrl.query; + // fall through + case UrlType.Query: + case UrlType.RelativePath: + mergePaths(url, baseUrl); + // fall through + case UrlType.AbsolutePath: + // The host, user, and port are joined, you can't copy one without the others. + url.user = baseUrl.user; + url.host = baseUrl.host; + url.port = baseUrl.port; + // fall through + case UrlType.SchemeRelative: + // The input doesn't have a schema at least, so we need to copy at least that over. + url.scheme = baseUrl.scheme; + } + if (baseType > inputType) + inputType = baseType; + } + normalizePath(url, inputType); + const queryHash = url.query + url.hash; + switch (inputType) { + // This is impossible, because of the empty checks at the start of the function. + // case UrlType.Empty: + case UrlType.Hash: + case UrlType.Query: + return queryHash; + case UrlType.RelativePath: { + // The first char is always a "/", and we need it to be relative. + const path = url.path.slice(1); + if (!path) + return queryHash || '.'; + if (isRelative(base || input) && !isRelative(path)) { + // If base started with a leading ".", or there is no base and input started with a ".", + // then we need to ensure that the relative path starts with a ".". We don't know if + // relative starts with a "..", though, so check before prepending. + return './' + path + queryHash; + } + return path + queryHash; + } + case UrlType.AbsolutePath: + return url.path + queryHash; + default: + return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash; + } + } + + return resolve; + +})); +//# sourceMappingURL=resolve-uri.umd.js.map + + +/***/ }), + +/***/ 3780: +/***/ (function(__unused_webpack_module, exports) { + +(function (global, factory) { + true ? factory(exports) : + 0; +})(this, (function (exports) { 'use strict'; + + /** + * Gets the index associated with `key` in the backing array, if it is already present. + */ + exports.get = void 0; + /** + * Puts `key` into the backing array, if it is not already present. Returns + * the index of the `key` in the backing array. + */ + exports.put = void 0; + /** + * Pops the last added item out of the SetArray. + */ + exports.pop = void 0; + /** + * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the + * index of the `key` in the backing array. + * + * This is designed to allow synchronizing a second array with the contents of the backing array, + * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, + * and there are never duplicates. + */ + class SetArray { + constructor() { + this._indexes = { __proto__: null }; + this.array = []; + } + } + (() => { + exports.get = (strarr, key) => strarr._indexes[key]; + exports.put = (strarr, key) => { + // The key may or may not be present. If it is present, it's a number. + const index = exports.get(strarr, key); + if (index !== undefined) + return index; + const { array, _indexes: indexes } = strarr; + return (indexes[key] = array.push(key) - 1); + }; + exports.pop = (strarr) => { + const { array, _indexes: indexes } = strarr; + if (array.length === 0) + return; + const last = array.pop(); + indexes[last] = undefined; + }; + })(); + + exports.SetArray = SetArray; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=set-array.umd.js.map + + +/***/ }), + +/***/ 7225: +/***/ (function(__unused_webpack_module, exports) { + +(function (global, factory) { + true ? factory(exports) : + 0; +})(this, (function (exports) { 'use strict'; + + const comma = ','.charCodeAt(0); + const semicolon = ';'.charCodeAt(0); + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + const intToChar = new Uint8Array(64); // 64 possible chars. + const charToInt = new Uint8Array(128); // z is 122 in ASCII + for (let i = 0; i < chars.length; i++) { + const c = chars.charCodeAt(i); + intToChar[i] = c; + charToInt[c] = i; + } + // Provide a fallback for older environments. + const td = typeof TextDecoder !== 'undefined' + ? /* #__PURE__ */ new TextDecoder() + : typeof Buffer !== 'undefined' + ? { + decode(buf) { + const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); + return out.toString(); + }, + } + : { + decode(buf) { + let out = ''; + for (let i = 0; i < buf.length; i++) { + out += String.fromCharCode(buf[i]); + } + return out; + }, + }; + function decode(mappings) { + const state = new Int32Array(5); + const decoded = []; + let index = 0; + do { + const semi = indexOf(mappings, index); + const line = []; + let sorted = true; + let lastCol = 0; + state[0] = 0; + for (let i = index; i < semi; i++) { + let seg; + i = decodeInteger(mappings, i, state, 0); // genColumn + const col = state[0]; + if (col < lastCol) + sorted = false; + lastCol = col; + if (hasMoreVlq(mappings, i, semi)) { + i = decodeInteger(mappings, i, state, 1); // sourcesIndex + i = decodeInteger(mappings, i, state, 2); // sourceLine + i = decodeInteger(mappings, i, state, 3); // sourceColumn + if (hasMoreVlq(mappings, i, semi)) { + i = decodeInteger(mappings, i, state, 4); // namesIndex + seg = [col, state[1], state[2], state[3], state[4]]; + } + else { + seg = [col, state[1], state[2], state[3]]; + } + } + else { + seg = [col]; + } + line.push(seg); + } + if (!sorted) + sort(line); + decoded.push(line); + index = semi + 1; + } while (index <= mappings.length); + return decoded; + } + function indexOf(mappings, index) { + const idx = mappings.indexOf(';', index); + return idx === -1 ? mappings.length : idx; + } + function decodeInteger(mappings, pos, state, j) { + let value = 0; + let shift = 0; + let integer = 0; + do { + const c = mappings.charCodeAt(pos++); + integer = charToInt[c]; + value |= (integer & 31) << shift; + shift += 5; + } while (integer & 32); + const shouldNegate = value & 1; + value >>>= 1; + if (shouldNegate) { + value = -0x80000000 | -value; + } + state[j] += value; + return pos; + } + function hasMoreVlq(mappings, i, length) { + if (i >= length) + return false; + return mappings.charCodeAt(i) !== comma; + } + function sort(line) { + line.sort(sortComparator); + } + function sortComparator(a, b) { + return a[0] - b[0]; + } + function encode(decoded) { + const state = new Int32Array(5); + const bufLength = 1024 * 16; + const subLength = bufLength - 36; + const buf = new Uint8Array(bufLength); + const sub = buf.subarray(0, subLength); + let pos = 0; + let out = ''; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + if (i > 0) { + if (pos === bufLength) { + out += td.decode(buf); + pos = 0; + } + buf[pos++] = semicolon; + } + if (line.length === 0) + continue; + state[0] = 0; + for (let j = 0; j < line.length; j++) { + const segment = line[j]; + // We can push up to 5 ints, each int can take at most 7 chars, and we + // may push a comma. + if (pos > subLength) { + out += td.decode(sub); + buf.copyWithin(0, subLength, pos); + pos -= subLength; + } + if (j > 0) + buf[pos++] = comma; + pos = encodeInteger(buf, pos, state, segment, 0); // genColumn + if (segment.length === 1) + continue; + pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex + pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine + pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn + if (segment.length === 4) + continue; + pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex + } + } + return out + td.decode(buf.subarray(0, pos)); + } + function encodeInteger(buf, pos, state, segment, j) { + const next = segment[j]; + let num = next - state[j]; + state[j] = next; + num = num < 0 ? (-num << 1) | 1 : num << 1; + do { + let clamped = num & 0b011111; + num >>>= 5; + if (num > 0) + clamped |= 0b100000; + buf[pos++] = intToChar[clamped]; + } while (num > 0); + return pos; + } + + exports.decode = decode; + exports.encode = encode; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=sourcemap-codec.umd.js.map + + +/***/ }), + +/***/ 4817: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +(function (global, factory) { + true ? factory(exports, __nccwpck_require__(7225), __nccwpck_require__(6898)) : + 0; +})(this, (function (exports, sourcemapCodec, resolveUri) { 'use strict'; + + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + + var resolveUri__default = /*#__PURE__*/_interopDefaultLegacy(resolveUri); + + function resolve(input, base) { + // The base is always treated as a directory, if it's not empty. + // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327 + // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401 + if (base && !base.endsWith('/')) + base += '/'; + return resolveUri__default["default"](input, base); + } + + /** + * Removes everything after the last "/", but leaves the slash. + */ + function stripFilename(path) { + if (!path) + return ''; + const index = path.lastIndexOf('/'); + return path.slice(0, index + 1); + } + + const COLUMN = 0; + const SOURCES_INDEX = 1; + const SOURCE_LINE = 2; + const SOURCE_COLUMN = 3; + const NAMES_INDEX = 4; + const REV_GENERATED_LINE = 1; + const REV_GENERATED_COLUMN = 2; + + function maybeSort(mappings, owned) { + const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); + if (unsortedIndex === mappings.length) + return mappings; + // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If + // not, we do not want to modify the consumer's input array. + if (!owned) + mappings = mappings.slice(); + for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { + mappings[i] = sortSegments(mappings[i], owned); + } + return mappings; + } + function nextUnsortedSegmentLine(mappings, start) { + for (let i = start; i < mappings.length; i++) { + if (!isSorted(mappings[i])) + return i; + } + return mappings.length; + } + function isSorted(line) { + for (let j = 1; j < line.length; j++) { + if (line[j][COLUMN] < line[j - 1][COLUMN]) { + return false; + } + } + return true; + } + function sortSegments(line, owned) { + if (!owned) + line = line.slice(); + return line.sort(sortComparator); + } + function sortComparator(a, b) { + return a[COLUMN] - b[COLUMN]; + } + + let found = false; + /** + * A binary search implementation that returns the index if a match is found. + * If no match is found, then the left-index (the index associated with the item that comes just + * before the desired index) is returned. To maintain proper sort order, a splice would happen at + * the next index: + * + * ```js + * const array = [1, 3]; + * const needle = 2; + * const index = binarySearch(array, needle, (item, needle) => item - needle); + * + * assert.equal(index, 0); + * array.splice(index + 1, 0, needle); + * assert.deepEqual(array, [1, 2, 3]); + * ``` + */ + function binarySearch(haystack, needle, low, high) { + while (low <= high) { + const mid = low + ((high - low) >> 1); + const cmp = haystack[mid][COLUMN] - needle; + if (cmp === 0) { + found = true; + return mid; + } + if (cmp < 0) { + low = mid + 1; + } + else { + high = mid - 1; + } + } + found = false; + return low - 1; + } + function upperBound(haystack, needle, index) { + for (let i = index + 1; i < haystack.length; index = i++) { + if (haystack[i][COLUMN] !== needle) + break; + } + return index; + } + function lowerBound(haystack, needle, index) { + for (let i = index - 1; i >= 0; index = i--) { + if (haystack[i][COLUMN] !== needle) + break; + } + return index; + } + function memoizedState() { + return { + lastKey: -1, + lastNeedle: -1, + lastIndex: -1, + }; + } + /** + * This overly complicated beast is just to record the last tested line/column and the resulting + * index, allowing us to skip a few tests if mappings are monotonically increasing. + */ + function memoizedBinarySearch(haystack, needle, state, key) { + const { lastKey, lastNeedle, lastIndex } = state; + let low = 0; + let high = haystack.length - 1; + if (key === lastKey) { + if (needle === lastNeedle) { + found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; + return lastIndex; + } + if (needle >= lastNeedle) { + // lastIndex may be -1 if the previous needle was not found. + low = lastIndex === -1 ? 0 : lastIndex; + } + else { + high = lastIndex; + } + } + state.lastKey = key; + state.lastNeedle = needle; + return (state.lastIndex = binarySearch(haystack, needle, low, high)); + } + + // Rebuilds the original source files, with mappings that are ordered by source line/column instead + // of generated line/column. + function buildBySources(decoded, memos) { + const sources = memos.map(buildNullArray); + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + if (seg.length === 1) + continue; + const sourceIndex = seg[SOURCES_INDEX]; + const sourceLine = seg[SOURCE_LINE]; + const sourceColumn = seg[SOURCE_COLUMN]; + const originalSource = sources[sourceIndex]; + const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = [])); + const memo = memos[sourceIndex]; + // The binary search either found a match, or it found the left-index just before where the + // segment should go. Either way, we want to insert after that. And there may be multiple + // generated segments associated with an original location, so there may need to move several + // indexes before we find where we need to insert. + const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine)); + insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]); + } + } + return sources; + } + function insert(array, index, value) { + for (let i = array.length; i > index; i--) { + array[i] = array[i - 1]; + } + array[index] = value; + } + // Null arrays allow us to use ordered index keys without actually allocating contiguous memory like + // a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations. + // Numeric properties on objects are magically sorted in ascending order by the engine regardless of + // the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending + // order when iterating with for-in. + function buildNullArray() { + return { __proto__: null }; + } + + const AnyMap = function (map, mapUrl) { + const parsed = typeof map === 'string' ? JSON.parse(map) : map; + if (!('sections' in parsed)) + return new TraceMap(parsed, mapUrl); + const mappings = []; + const sources = []; + const sourcesContent = []; + const names = []; + recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, 0, 0, Infinity, Infinity); + const joined = { + version: 3, + file: parsed.file, + names, + sources, + sourcesContent, + mappings, + }; + return exports.presortedDecodedMap(joined); + }; + function recurse(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { + const { sections } = input; + for (let i = 0; i < sections.length; i++) { + const { map, offset } = sections[i]; + let sl = stopLine; + let sc = stopColumn; + if (i + 1 < sections.length) { + const nextOffset = sections[i + 1].offset; + sl = Math.min(stopLine, lineOffset + nextOffset.line); + if (sl === stopLine) { + sc = Math.min(stopColumn, columnOffset + nextOffset.column); + } + else if (sl < stopLine) { + sc = columnOffset + nextOffset.column; + } + } + addSection(map, mapUrl, mappings, sources, sourcesContent, names, lineOffset + offset.line, columnOffset + offset.column, sl, sc); + } + } + function addSection(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { + if ('sections' in input) + return recurse(...arguments); + const map = new TraceMap(input, mapUrl); + const sourcesOffset = sources.length; + const namesOffset = names.length; + const decoded = exports.decodedMappings(map); + const { resolvedSources, sourcesContent: contents } = map; + append(sources, resolvedSources); + append(names, map.names); + if (contents) + append(sourcesContent, contents); + else + for (let i = 0; i < resolvedSources.length; i++) + sourcesContent.push(null); + for (let i = 0; i < decoded.length; i++) { + const lineI = lineOffset + i; + // We can only add so many lines before we step into the range that the next section's map + // controls. When we get to the last line, then we'll start checking the segments to see if + // they've crossed into the column range. But it may not have any columns that overstep, so we + // still need to check that we don't overstep lines, too. + if (lineI > stopLine) + return; + // The out line may already exist in mappings (if we're continuing the line started by a + // previous section). Or, we may have jumped ahead several lines to start this section. + const out = getLine(mappings, lineI); + // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the + // map can be multiple lines), it doesn't. + const cOffset = i === 0 ? columnOffset : 0; + const line = decoded[i]; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + const column = cOffset + seg[COLUMN]; + // If this segment steps into the column range that the next section's map controls, we need + // to stop early. + if (lineI === stopLine && column >= stopColumn) + return; + if (seg.length === 1) { + out.push([column]); + continue; + } + const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; + const sourceLine = seg[SOURCE_LINE]; + const sourceColumn = seg[SOURCE_COLUMN]; + out.push(seg.length === 4 + ? [column, sourcesIndex, sourceLine, sourceColumn] + : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]); + } + } + } + function append(arr, other) { + for (let i = 0; i < other.length; i++) + arr.push(other[i]); + } + function getLine(arr, index) { + for (let i = arr.length; i <= index; i++) + arr[i] = []; + return arr[index]; + } + + const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; + const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; + const LEAST_UPPER_BOUND = -1; + const GREATEST_LOWER_BOUND = 1; + /** + * Returns the encoded (VLQ string) form of the SourceMap's mappings field. + */ + exports.encodedMappings = void 0; + /** + * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. + */ + exports.decodedMappings = void 0; + /** + * A low-level API to find the segment associated with a generated line/column (think, from a + * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. + */ + exports.traceSegment = void 0; + /** + * A higher-level API to find the source/line/column associated with a generated line/column + * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in + * `source-map` library. + */ + exports.originalPositionFor = void 0; + /** + * Finds the generated line/column position of the provided source/line/column source position. + */ + exports.generatedPositionFor = void 0; + /** + * Finds all generated line/column positions of the provided source/line/column source position. + */ + exports.allGeneratedPositionsFor = void 0; + /** + * Iterates each mapping in generated position order. + */ + exports.eachMapping = void 0; + /** + * Retrieves the source content for a particular source, if its found. Returns null if not. + */ + exports.sourceContentFor = void 0; + /** + * A helper that skips sorting of the input map's mappings array, which can be expensive for larger + * maps. + */ + exports.presortedDecodedMap = void 0; + /** + * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ + exports.decodedMap = void 0; + /** + * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects + * a sourcemap, or to JSON.stringify. + */ + exports.encodedMap = void 0; + class TraceMap { + constructor(map, mapUrl) { + const isString = typeof map === 'string'; + if (!isString && map._decodedMemo) + return map; + const parsed = (isString ? JSON.parse(map) : map); + const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; + this.version = version; + this.file = file; + this.names = names; + this.sourceRoot = sourceRoot; + this.sources = sources; + this.sourcesContent = sourcesContent; + const from = resolve(sourceRoot || '', stripFilename(mapUrl)); + this.resolvedSources = sources.map((s) => resolve(s || '', from)); + const { mappings } = parsed; + if (typeof mappings === 'string') { + this._encoded = mappings; + this._decoded = undefined; + } + else { + this._encoded = undefined; + this._decoded = maybeSort(mappings, isString); + } + this._decodedMemo = memoizedState(); + this._bySources = undefined; + this._bySourceMemos = undefined; + } + } + (() => { + exports.encodedMappings = (map) => { + var _a; + return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = sourcemapCodec.encode(map._decoded))); + }; + exports.decodedMappings = (map) => { + return (map._decoded || (map._decoded = sourcemapCodec.decode(map._encoded))); + }; + exports.traceSegment = (map, line, column) => { + const decoded = exports.decodedMappings(map); + // It's common for parent source maps to have pointers to lines that have no + // mapping (like a "//# sourceMappingURL=") at the end of the child file. + if (line >= decoded.length) + return null; + const segments = decoded[line]; + const index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND); + return index === -1 ? null : segments[index]; + }; + exports.originalPositionFor = (map, { line, column, bias }) => { + line--; + if (line < 0) + throw new Error(LINE_GTR_ZERO); + if (column < 0) + throw new Error(COL_GTR_EQ_ZERO); + const decoded = exports.decodedMappings(map); + // It's common for parent source maps to have pointers to lines that have no + // mapping (like a "//# sourceMappingURL=") at the end of the child file. + if (line >= decoded.length) + return OMapping(null, null, null, null); + const segments = decoded[line]; + const index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); + if (index === -1) + return OMapping(null, null, null, null); + const segment = segments[index]; + if (segment.length === 1) + return OMapping(null, null, null, null); + const { names, resolvedSources } = map; + return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null); + }; + exports.allGeneratedPositionsFor = (map, { source, line, column, bias }) => { + // SourceMapConsumer uses LEAST_UPPER_BOUND for some reason, so we follow suit. + return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true); + }; + exports.generatedPositionFor = (map, { source, line, column, bias }) => { + return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false); + }; + exports.eachMapping = (map, cb) => { + const decoded = exports.decodedMappings(map); + const { names, resolvedSources } = map; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + for (let j = 0; j < line.length; j++) { + const seg = line[j]; + const generatedLine = i + 1; + const generatedColumn = seg[0]; + let source = null; + let originalLine = null; + let originalColumn = null; + let name = null; + if (seg.length !== 1) { + source = resolvedSources[seg[1]]; + originalLine = seg[2] + 1; + originalColumn = seg[3]; + } + if (seg.length === 5) + name = names[seg[4]]; + cb({ + generatedLine, + generatedColumn, + source, + originalLine, + originalColumn, + name, + }); + } + } + }; + exports.sourceContentFor = (map, source) => { + const { sources, resolvedSources, sourcesContent } = map; + if (sourcesContent == null) + return null; + let index = sources.indexOf(source); + if (index === -1) + index = resolvedSources.indexOf(source); + return index === -1 ? null : sourcesContent[index]; + }; + exports.presortedDecodedMap = (map, mapUrl) => { + const tracer = new TraceMap(clone(map, []), mapUrl); + tracer._decoded = map.mappings; + return tracer; + }; + exports.decodedMap = (map) => { + return clone(map, exports.decodedMappings(map)); + }; + exports.encodedMap = (map) => { + return clone(map, exports.encodedMappings(map)); + }; + function generatedPosition(map, source, line, column, bias, all) { + line--; + if (line < 0) + throw new Error(LINE_GTR_ZERO); + if (column < 0) + throw new Error(COL_GTR_EQ_ZERO); + const { sources, resolvedSources } = map; + let sourceIndex = sources.indexOf(source); + if (sourceIndex === -1) + sourceIndex = resolvedSources.indexOf(source); + if (sourceIndex === -1) + return all ? [] : GMapping(null, null); + const generated = (map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState))))); + const segments = generated[sourceIndex][line]; + if (segments == null) + return all ? [] : GMapping(null, null); + const memo = map._bySourceMemos[sourceIndex]; + if (all) + return sliceGeneratedPositions(segments, memo, line, column, bias); + const index = traceSegmentInternal(segments, memo, line, column, bias); + if (index === -1) + return GMapping(null, null); + const segment = segments[index]; + return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]); + } + })(); + function clone(map, mappings) { + return { + version: map.version, + file: map.file, + names: map.names, + sourceRoot: map.sourceRoot, + sources: map.sources, + sourcesContent: map.sourcesContent, + mappings, + }; + } + function OMapping(source, line, column, name) { + return { source, line, column, name }; + } + function GMapping(line, column) { + return { line, column }; + } + function traceSegmentInternal(segments, memo, line, column, bias) { + let index = memoizedBinarySearch(segments, column, memo, line); + if (found) { + index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); + } + else if (bias === LEAST_UPPER_BOUND) + index++; + if (index === -1 || index === segments.length) + return -1; + return index; + } + function sliceGeneratedPositions(segments, memo, line, column, bias) { + let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND); + // We ignored the bias when tracing the segment so that we're guarnateed to find the first (in + // insertion order) segment that matched. Even if we did respect the bias when tracing, we would + // still need to call `lowerBound()` to find the first segment, which is slower than just looking + // for the GREATEST_LOWER_BOUND to begin with. The only difference that matters for us is when the + // binary search didn't match, in which case GREATEST_LOWER_BOUND just needs to increment to + // match LEAST_UPPER_BOUND. + if (!found && bias === LEAST_UPPER_BOUND) + min++; + if (min === -1 || min === segments.length) + return []; + // We may have found the segment that started at an earlier column. If this is the case, then we + // need to slice all generated segments that match _that_ column, because all such segments span + // to our desired column. + const matchedColumn = found ? column : segments[min][COLUMN]; + // The binary search is not guaranteed to find the lower bound when a match wasn't found. + if (!found) + min = lowerBound(segments, matchedColumn, min); + const max = upperBound(segments, matchedColumn, min); + const result = []; + for (; min <= max; min++) { + const segment = segments[min]; + result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN])); + } + return result; + } + + exports.AnyMap = AnyMap; + exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND; + exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND; + exports.TraceMap = TraceMap; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=trace-mapping.umd.js.map + + +/***/ }), + +/***/ 4193: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +const VERSION = "3.1.0"; + +/** + * Some “list” response that can be paginated have a different response structure + * + * They have a `total_count` key in the response (search also has `incomplete_results`, + * /installation/repositories also has `repository_selection`), as well as a key with + * the list of the items which name varies from endpoint to endpoint. + * + * Octokit normalizes these responses so that paginated results are always returned following + * the same structure. One challenge is that if the list response has only one page, no Link + * header is provided, so this header alone is not sufficient to check wether a response is + * paginated or not. + * + * We check if a "total_count" key is present in the response data, but also make sure that + * a "url" property is not, as the "Get the combined status for a specific ref" endpoint would + * otherwise match: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + */ +function normalizePaginatedListResponse(response) { + // endpoints can respond with 204 if repository is empty + if (!response.data) { + return { ...response, + data: [] + }; + } + + const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); + if (!responseNeedsNormalization) return response; // keep the additional properties intact as there is currently no other way + // to retrieve the same information. + + const incompleteResults = response.data.incomplete_results; + const repositorySelection = response.data.repository_selection; + const totalCount = response.data.total_count; + delete response.data.incomplete_results; + delete response.data.repository_selection; + delete response.data.total_count; + const namespaceKey = Object.keys(response.data)[0]; + const data = response.data[namespaceKey]; + response.data = data; + + if (typeof incompleteResults !== "undefined") { + response.data.incomplete_results = incompleteResults; + } + + if (typeof repositorySelection !== "undefined") { + response.data.repository_selection = repositorySelection; + } + + response.data.total_count = totalCount; + return response; +} + +function iterator(octokit, route, parameters) { + const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters); + const requestMethod = typeof route === "function" ? route : octokit.request; + const method = options.method; + const headers = options.headers; + let url = options.url; + return { + [Symbol.asyncIterator]: () => ({ + async next() { + if (!url) return { + done: true + }; + + try { + const response = await requestMethod({ + method, + url, + headers + }); + const normalizedResponse = normalizePaginatedListResponse(response); // `response.headers.link` format: + // '; rel="next", ; rel="last"' + // sets `url` to undefined if "next" URL is not present or `link` header is not set + + url = ((normalizedResponse.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1]; + return { + value: normalizedResponse + }; + } catch (error) { + if (error.status !== 409) throw error; + url = ""; + return { + value: { + status: 200, + headers: {}, + data: [] + } + }; + } + } + + }) + }; +} + +function paginate(octokit, route, parameters, mapFn) { + if (typeof parameters === "function") { + mapFn = parameters; + parameters = undefined; + } + + return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn); +} + +function gather(octokit, results, iterator, mapFn) { + return iterator.next().then(result => { + if (result.done) { + return results; + } + + let earlyExit = false; + + function done() { + earlyExit = true; + } + + results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data); + + if (earlyExit) { + return results; + } + + return gather(octokit, results, iterator, mapFn); + }); +} + +const composePaginateRest = Object.assign(paginate, { + iterator +}); + +const paginatingEndpoints = ["GET /app/hook/deliveries", "GET /app/installations", "GET /applications/grants", "GET /authorizations", "GET /enterprises/{enterprise}/actions/permissions/organizations", "GET /enterprises/{enterprise}/actions/runner-groups", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners", "GET /enterprises/{enterprise}/actions/runners", "GET /enterprises/{enterprise}/audit-log", "GET /enterprises/{enterprise}/code-scanning/alerts", "GET /enterprises/{enterprise}/secret-scanning/alerts", "GET /enterprises/{enterprise}/settings/billing/advanced-security", "GET /events", "GET /gists", "GET /gists/public", "GET /gists/starred", "GET /gists/{gist_id}/comments", "GET /gists/{gist_id}/commits", "GET /gists/{gist_id}/forks", "GET /installation/repositories", "GET /issues", "GET /licenses", "GET /marketplace_listing/plans", "GET /marketplace_listing/plans/{plan_id}/accounts", "GET /marketplace_listing/stubbed/plans", "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts", "GET /networks/{owner}/{repo}/events", "GET /notifications", "GET /organizations", "GET /orgs/{org}/actions/cache/usage-by-repository", "GET /orgs/{org}/actions/permissions/repositories", "GET /orgs/{org}/actions/runner-groups", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners", "GET /orgs/{org}/actions/runners", "GET /orgs/{org}/actions/secrets", "GET /orgs/{org}/actions/secrets/{secret_name}/repositories", "GET /orgs/{org}/audit-log", "GET /orgs/{org}/blocks", "GET /orgs/{org}/code-scanning/alerts", "GET /orgs/{org}/codespaces", "GET /orgs/{org}/credential-authorizations", "GET /orgs/{org}/dependabot/secrets", "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories", "GET /orgs/{org}/events", "GET /orgs/{org}/external-groups", "GET /orgs/{org}/failed_invitations", "GET /orgs/{org}/hooks", "GET /orgs/{org}/hooks/{hook_id}/deliveries", "GET /orgs/{org}/installations", "GET /orgs/{org}/invitations", "GET /orgs/{org}/invitations/{invitation_id}/teams", "GET /orgs/{org}/issues", "GET /orgs/{org}/members", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", "GET /orgs/{org}/projects", "GET /orgs/{org}/public_members", "GET /orgs/{org}/repos", "GET /orgs/{org}/secret-scanning/alerts", "GET /orgs/{org}/settings/billing/advanced-security", "GET /orgs/{org}/team-sync/groups", "GET /orgs/{org}/teams", "GET /orgs/{org}/teams/{team_slug}/discussions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/invitations", "GET /orgs/{org}/teams/{team_slug}/members", "GET /orgs/{org}/teams/{team_slug}/projects", "GET /orgs/{org}/teams/{team_slug}/repos", "GET /orgs/{org}/teams/{team_slug}/teams", "GET /projects/columns/{column_id}/cards", "GET /projects/{project_id}/collaborators", "GET /projects/{project_id}/columns", "GET /repos/{owner}/{repo}/actions/artifacts", "GET /repos/{owner}/{repo}/actions/caches", "GET /repos/{owner}/{repo}/actions/runners", "GET /repos/{owner}/{repo}/actions/runs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs", "GET /repos/{owner}/{repo}/actions/secrets", "GET /repos/{owner}/{repo}/actions/workflows", "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs", "GET /repos/{owner}/{repo}/assignees", "GET /repos/{owner}/{repo}/branches", "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", "GET /repos/{owner}/{repo}/code-scanning/alerts", "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", "GET /repos/{owner}/{repo}/code-scanning/analyses", "GET /repos/{owner}/{repo}/codespaces", "GET /repos/{owner}/{repo}/codespaces/devcontainers", "GET /repos/{owner}/{repo}/codespaces/secrets", "GET /repos/{owner}/{repo}/collaborators", "GET /repos/{owner}/{repo}/comments", "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/commits", "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments", "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls", "GET /repos/{owner}/{repo}/commits/{ref}/check-runs", "GET /repos/{owner}/{repo}/commits/{ref}/check-suites", "GET /repos/{owner}/{repo}/commits/{ref}/status", "GET /repos/{owner}/{repo}/commits/{ref}/statuses", "GET /repos/{owner}/{repo}/contributors", "GET /repos/{owner}/{repo}/dependabot/secrets", "GET /repos/{owner}/{repo}/deployments", "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses", "GET /repos/{owner}/{repo}/environments", "GET /repos/{owner}/{repo}/events", "GET /repos/{owner}/{repo}/forks", "GET /repos/{owner}/{repo}/git/matching-refs/{ref}", "GET /repos/{owner}/{repo}/hooks", "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries", "GET /repos/{owner}/{repo}/invitations", "GET /repos/{owner}/{repo}/issues", "GET /repos/{owner}/{repo}/issues/comments", "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/issues/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/comments", "GET /repos/{owner}/{repo}/issues/{issue_number}/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/labels", "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions", "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline", "GET /repos/{owner}/{repo}/keys", "GET /repos/{owner}/{repo}/labels", "GET /repos/{owner}/{repo}/milestones", "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels", "GET /repos/{owner}/{repo}/notifications", "GET /repos/{owner}/{repo}/pages/builds", "GET /repos/{owner}/{repo}/projects", "GET /repos/{owner}/{repo}/pulls", "GET /repos/{owner}/{repo}/pulls/comments", "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments", "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", "GET /repos/{owner}/{repo}/pulls/{pull_number}/files", "GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments", "GET /repos/{owner}/{repo}/releases", "GET /repos/{owner}/{repo}/releases/{release_id}/assets", "GET /repos/{owner}/{repo}/releases/{release_id}/reactions", "GET /repos/{owner}/{repo}/secret-scanning/alerts", "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations", "GET /repos/{owner}/{repo}/stargazers", "GET /repos/{owner}/{repo}/subscribers", "GET /repos/{owner}/{repo}/tags", "GET /repos/{owner}/{repo}/teams", "GET /repos/{owner}/{repo}/topics", "GET /repositories", "GET /repositories/{repository_id}/environments/{environment_name}/secrets", "GET /search/code", "GET /search/commits", "GET /search/issues", "GET /search/labels", "GET /search/repositories", "GET /search/topics", "GET /search/users", "GET /teams/{team_id}/discussions", "GET /teams/{team_id}/discussions/{discussion_number}/comments", "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /teams/{team_id}/discussions/{discussion_number}/reactions", "GET /teams/{team_id}/invitations", "GET /teams/{team_id}/members", "GET /teams/{team_id}/projects", "GET /teams/{team_id}/repos", "GET /teams/{team_id}/teams", "GET /user/blocks", "GET /user/codespaces", "GET /user/codespaces/secrets", "GET /user/emails", "GET /user/followers", "GET /user/following", "GET /user/gpg_keys", "GET /user/installations", "GET /user/installations/{installation_id}/repositories", "GET /user/issues", "GET /user/keys", "GET /user/marketplace_purchases", "GET /user/marketplace_purchases/stubbed", "GET /user/memberships/orgs", "GET /user/migrations", "GET /user/migrations/{migration_id}/repositories", "GET /user/orgs", "GET /user/packages", "GET /user/packages/{package_type}/{package_name}/versions", "GET /user/public_emails", "GET /user/repos", "GET /user/repository_invitations", "GET /user/starred", "GET /user/subscriptions", "GET /user/teams", "GET /users", "GET /users/{username}/events", "GET /users/{username}/events/orgs/{org}", "GET /users/{username}/events/public", "GET /users/{username}/followers", "GET /users/{username}/following", "GET /users/{username}/gists", "GET /users/{username}/gpg_keys", "GET /users/{username}/keys", "GET /users/{username}/orgs", "GET /users/{username}/packages", "GET /users/{username}/projects", "GET /users/{username}/received_events", "GET /users/{username}/received_events/public", "GET /users/{username}/repos", "GET /users/{username}/starred", "GET /users/{username}/subscriptions"]; + +function isPaginatingEndpoint(arg) { + if (typeof arg === "string") { + return paginatingEndpoints.includes(arg); + } else { + return false; + } +} + +/** + * @param octokit Octokit instance + * @param options Options passed to Octokit constructor + */ + +function paginateRest(octokit) { + return { + paginate: Object.assign(paginate.bind(null, octokit), { + iterator: iterator.bind(null, octokit) + }) + }; +} +paginateRest.VERSION = VERSION; + +exports.composePaginateRest = composePaginateRest; +exports.isPaginatingEndpoint = isPaginatingEndpoint; +exports.paginateRest = paginateRest; +exports.paginatingEndpoints = paginatingEndpoints; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 3044: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + + if (enumerableOnly) { + symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + } + + keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +const Endpoints = { + actions: { + addCustomLabelsToSelfHostedRunnerForOrg: ["POST /orgs/{org}/actions/runners/{runner_id}/labels"], + addCustomLabelsToSelfHostedRunnerForRepo: ["POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + addSelectedRepoToOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], + approveWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve"], + cancelWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"], + createOrUpdateEnvironmentSecret: ["PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + createOrUpdateOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}"], + createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}"], + createRegistrationTokenForOrg: ["POST /orgs/{org}/actions/runners/registration-token"], + createRegistrationTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/registration-token"], + createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"], + createRemoveTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/remove-token"], + createWorkflowDispatch: ["POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"], + deleteActionsCacheById: ["DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}"], + deleteActionsCacheByKey: ["DELETE /repos/{owner}/{repo}/actions/caches{?key,ref}"], + deleteArtifact: ["DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + deleteEnvironmentSecret: ["DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"], + deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}"], + deleteSelfHostedRunnerFromOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}"], + deleteSelfHostedRunnerFromRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"], + deleteWorkflowRun: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}"], + deleteWorkflowRunLogs: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], + disableSelectedRepositoryGithubActionsOrganization: ["DELETE /orgs/{org}/actions/permissions/repositories/{repository_id}"], + disableWorkflow: ["PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable"], + downloadArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"], + downloadJobLogsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"], + downloadWorkflowRunAttemptLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs"], + downloadWorkflowRunLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], + enableSelectedRepositoryGithubActionsOrganization: ["PUT /orgs/{org}/actions/permissions/repositories/{repository_id}"], + enableWorkflow: ["PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable"], + getActionsCacheList: ["GET /repos/{owner}/{repo}/actions/caches"], + getActionsCacheUsage: ["GET /repos/{owner}/{repo}/actions/cache/usage"], + getActionsCacheUsageByRepoForOrg: ["GET /orgs/{org}/actions/cache/usage-by-repository"], + getActionsCacheUsageForEnterprise: ["GET /enterprises/{enterprise}/actions/cache/usage"], + getActionsCacheUsageForOrg: ["GET /orgs/{org}/actions/cache/usage"], + getAllowedActionsOrganization: ["GET /orgs/{org}/actions/permissions/selected-actions"], + getAllowedActionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/selected-actions"], + getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + getEnvironmentPublicKey: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key"], + getEnvironmentSecret: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + getGithubActionsDefaultWorkflowPermissionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/workflow"], + getGithubActionsDefaultWorkflowPermissionsOrganization: ["GET /orgs/{org}/actions/permissions/workflow"], + getGithubActionsDefaultWorkflowPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/workflow"], + getGithubActionsPermissionsOrganization: ["GET /orgs/{org}/actions/permissions"], + getGithubActionsPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions"], + getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"], + getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"], + getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"], + getPendingDeploymentsForRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"], + getRepoPermissions: ["GET /repos/{owner}/{repo}/actions/permissions", {}, { + renamed: ["actions", "getGithubActionsPermissionsRepository"] + }], + getRepoPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"], + getRepoSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{secret_name}"], + getReviewsForRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals"], + getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"], + getSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}"], + getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"], + getWorkflowAccessToRepository: ["GET /repos/{owner}/{repo}/actions/permissions/access"], + getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"], + getWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}"], + getWorkflowRunUsage: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"], + getWorkflowUsage: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing"], + listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"], + listEnvironmentSecrets: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets"], + listJobsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"], + listJobsForWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs"], + listLabelsForSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}/labels"], + listLabelsForSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + listOrgSecrets: ["GET /orgs/{org}/actions/secrets"], + listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"], listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"], listRunnerApplicationsForOrg: ["GET /orgs/{org}/actions/runners/downloads"], listRunnerApplicationsForRepo: ["GET /repos/{owner}/{repo}/actions/runners/downloads"], @@ -5036,2071 +47137,4704 @@ const Endpoints = { } }; -const VERSION = "5.16.2"; +const VERSION = "5.16.2"; + +function endpointsToMethods(octokit, endpointsMap) { + const newMethods = {}; + + for (const [scope, endpoints] of Object.entries(endpointsMap)) { + for (const [methodName, endpoint] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint; + const [method, url] = route.split(/ /); + const endpointDefaults = Object.assign({ + method, + url + }, defaults); + + if (!newMethods[scope]) { + newMethods[scope] = {}; + } + + const scopeMethods = newMethods[scope]; + + if (decorations) { + scopeMethods[methodName] = decorate(octokit, scope, methodName, endpointDefaults, decorations); + continue; + } + + scopeMethods[methodName] = octokit.request.defaults(endpointDefaults); + } + } + + return newMethods; +} + +function decorate(octokit, scope, methodName, defaults, decorations) { + const requestWithDefaults = octokit.request.defaults(defaults); + /* istanbul ignore next */ + + function withDecorations(...args) { + // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + let options = requestWithDefaults.endpoint.merge(...args); // There are currently no other decorations than `.mapToData` + + if (decorations.mapToData) { + options = Object.assign({}, options, { + data: options[decorations.mapToData], + [decorations.mapToData]: undefined + }); + return requestWithDefaults(options); + } + + if (decorations.renamed) { + const [newScope, newMethodName] = decorations.renamed; + octokit.log.warn(`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`); + } + + if (decorations.deprecated) { + octokit.log.warn(decorations.deprecated); + } + + if (decorations.renamedParameters) { + // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + const options = requestWithDefaults.endpoint.merge(...args); + + for (const [name, alias] of Object.entries(decorations.renamedParameters)) { + if (name in options) { + octokit.log.warn(`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`); + + if (!(alias in options)) { + options[alias] = options[name]; + } + + delete options[name]; + } + } + + return requestWithDefaults(options); + } // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + + + return requestWithDefaults(...args); + } + + return Object.assign(withDecorations, requestWithDefaults); +} + +function restEndpointMethods(octokit) { + const api = endpointsToMethods(octokit, Endpoints); + return { + rest: api + }; +} +restEndpointMethods.VERSION = VERSION; +function legacyRestEndpointMethods(octokit) { + const api = endpointsToMethods(octokit, Endpoints); + return _objectSpread2(_objectSpread2({}, api), {}, { + rest: api + }); +} +legacyRestEndpointMethods.VERSION = VERSION; + +exports.legacyRestEndpointMethods = legacyRestEndpointMethods; +exports.restEndpointMethods = restEndpointMethods; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 9968: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var BottleneckLight = _interopDefault(__nccwpck_require__(1174)); + +const VERSION = "4.1.0"; + +const noop = () => Promise.resolve(); // @ts-expect-error + + +function wrapRequest(state, request, options) { + return state.retryLimiter.schedule(doRequest, state, request, options); +} // @ts-expect-error + +async function doRequest(state, request, options) { + const isWrite = options.method !== "GET" && options.method !== "HEAD"; + const { + pathname + } = new URL(options.url, "http://github.test"); + const isSearch = options.method === "GET" && pathname.startsWith("/search/"); + const isGraphQL = pathname.startsWith("/graphql"); + const retryCount = ~~options.request.retryCount; + const jobOptions = retryCount > 0 ? { + priority: 0, + weight: 0 + } : {}; + + if (state.clustering) { + // Remove a job from Redis if it has not completed or failed within 60s + // Examples: Node process terminated, client disconnected, etc. + // @ts-expect-error + jobOptions.expiration = 1000 * 60; + } // Guarantee at least 1000ms between writes + // GraphQL can also trigger writes + + + if (isWrite || isGraphQL) { + await state.write.key(state.id).schedule(jobOptions, noop); + } // Guarantee at least 3000ms between requests that trigger notifications + + + if (isWrite && state.triggersNotification(pathname)) { + await state.notifications.key(state.id).schedule(jobOptions, noop); + } // Guarantee at least 2000ms between search requests + + + if (isSearch) { + await state.search.key(state.id).schedule(jobOptions, noop); + } + + const req = state.global.key(state.id).schedule(jobOptions, request, options); + + if (isGraphQL) { + const res = await req; + + if (res.data.errors != null && // @ts-expect-error + res.data.errors.some(error => error.type === "RATE_LIMITED")) { + const error = Object.assign(new Error("GraphQL Rate Limit Exceeded"), { + response: res, + data: res.data + }); + throw error; + } + } + + return req; +} + +var triggersNotificationPaths = ["/orgs/{org}/invitations", "/orgs/{org}/invitations/{invitation_id}", "/orgs/{org}/teams/{team_slug}/discussions", "/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", "/repos/{owner}/{repo}/collaborators/{username}", "/repos/{owner}/{repo}/commits/{commit_sha}/comments", "/repos/{owner}/{repo}/issues", "/repos/{owner}/{repo}/issues/{issue_number}/comments", "/repos/{owner}/{repo}/pulls", "/repos/{owner}/{repo}/pulls/{pull_number}/comments", "/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies", "/repos/{owner}/{repo}/pulls/{pull_number}/merge", "/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", "/repos/{owner}/{repo}/pulls/{pull_number}/reviews", "/repos/{owner}/{repo}/releases", "/teams/{team_id}/discussions", "/teams/{team_id}/discussions/{discussion_number}/comments"]; + +function routeMatcher(paths) { + // EXAMPLE. For the following paths: + + /* [ + "/orgs/{org}/invitations", + "/repos/{owner}/{repo}/collaborators/{username}" + ] */ + const regexes = paths.map(path => path.split("/").map(c => c.startsWith("{") ? "(?:.+?)" : c).join("/")); // 'regexes' would contain: + + /* [ + '/orgs/(?:.+?)/invitations', + '/repos/(?:.+?)/(?:.+?)/collaborators/(?:.+?)' + ] */ + + const regex = `^(?:${regexes.map(r => `(?:${r})`).join("|")})[^/]*$`; // 'regex' would contain: + + /* + ^(?:(?:\/orgs\/(?:.+?)\/invitations)|(?:\/repos\/(?:.+?)\/(?:.+?)\/collaborators\/(?:.+?)))[^\/]*$ + It may look scary, but paste it into https://www.debuggex.com/ + and it will make a lot more sense! + */ + + return new RegExp(regex, "i"); +} + +// @ts-expect-error + +const regex = routeMatcher(triggersNotificationPaths); +const triggersNotification = regex.test.bind(regex); +const groups = {}; // @ts-expect-error + +const createGroups = function (Bottleneck, common) { + groups.global = new Bottleneck.Group({ + id: "octokit-global", + maxConcurrent: 10, + ...common + }); + groups.search = new Bottleneck.Group({ + id: "octokit-search", + maxConcurrent: 1, + minTime: 2000, + ...common + }); + groups.write = new Bottleneck.Group({ + id: "octokit-write", + maxConcurrent: 1, + minTime: 1000, + ...common + }); + groups.notifications = new Bottleneck.Group({ + id: "octokit-notifications", + maxConcurrent: 1, + minTime: 3000, + ...common + }); +}; + +function throttling(octokit, octokitOptions) { + const { + enabled = true, + Bottleneck = BottleneckLight, + id = "no-id", + timeout = 1000 * 60 * 2, + // Redis TTL: 2 minutes + connection + } = octokitOptions.throttle || {}; + + if (!enabled) { + return {}; + } + + const common = { + connection, + timeout + }; + + if (groups.global == null) { + createGroups(Bottleneck, common); + } + + const state = Object.assign({ + clustering: connection != null, + triggersNotification, + minimumSecondaryRateRetryAfter: 5, + retryAfterBaseValue: 1000, + retryLimiter: new Bottleneck(), + id, + ...groups + }, octokitOptions.throttle); + const isUsingDeprecatedOnAbuseLimitHandler = typeof state.onAbuseLimit === "function" && state.onAbuseLimit; + + if (typeof (isUsingDeprecatedOnAbuseLimitHandler ? state.onAbuseLimit : state.onSecondaryRateLimit) !== "function" || typeof state.onRateLimit !== "function") { + throw new Error(`octokit/plugin-throttling error: + You must pass the onSecondaryRateLimit and onRateLimit error handlers. + See https://github.com/octokit/rest.js#throttling + + const octokit = new Octokit({ + throttle: { + onSecondaryRateLimit: (retryAfter, options) => {/* ... */}, + onRateLimit: (retryAfter, options) => {/* ... */} + } + }) + `); + } + + const events = {}; + const emitter = new Bottleneck.Events(events); // @ts-expect-error + + events.on("secondary-limit", isUsingDeprecatedOnAbuseLimitHandler ? function (...args) { + octokit.log.warn("[@octokit/plugin-throttling] `onAbuseLimit()` is deprecated and will be removed in a future release of `@octokit/plugin-throttling`, please use the `onSecondaryRateLimit` handler instead"); + return state.onAbuseLimit(...args); + } : state.onSecondaryRateLimit); // @ts-expect-error + + events.on("rate-limit", state.onRateLimit); // @ts-expect-error + + events.on("error", e => octokit.log.warn("Error in throttling-plugin limit handler", e)); // @ts-expect-error + + state.retryLimiter.on("failed", async function (error, info) { + const options = info.args[info.args.length - 1]; + const { + pathname + } = new URL(options.url, "http://github.test"); + const shouldRetryGraphQL = pathname.startsWith("/graphql") && error.status !== 401; + + if (!(shouldRetryGraphQL || error.status === 403)) { + return; + } + + const retryCount = ~~options.request.retryCount; + options.request.retryCount = retryCount; + const { + wantRetry, + retryAfter = 0 + } = await async function () { + if (/\bsecondary rate\b/i.test(error.message)) { + // The user has hit the secondary rate limit. (REST and GraphQL) + // https://docs.github.com/en/rest/overview/resources-in-the-rest-api#secondary-rate-limits + // The Retry-After header can sometimes be blank when hitting a secondary rate limit, + // but is always present after 2-3s, so make sure to set `retryAfter` to at least 5s by default. + const retryAfter = Math.max(~~error.response.headers["retry-after"], state.minimumSecondaryRateRetryAfter); + const wantRetry = await emitter.trigger("secondary-limit", retryAfter, options, octokit); + return { + wantRetry, + retryAfter + }; + } + + if (error.response.headers != null && error.response.headers["x-ratelimit-remaining"] === "0") { + // The user has used all their allowed calls for the current time period (REST and GraphQL) + // https://docs.github.com/en/rest/reference/rate-limit (REST) + // https://docs.github.com/en/graphql/overview/resource-limitations#rate-limit (GraphQL) + const rateLimitReset = new Date(~~error.response.headers["x-ratelimit-reset"] * 1000).getTime(); + const retryAfter = Math.max(Math.ceil((rateLimitReset - Date.now()) / 1000), 0); + const wantRetry = await emitter.trigger("rate-limit", retryAfter, options, octokit); + return { + wantRetry, + retryAfter + }; + } + + return {}; + }(); + + if (wantRetry) { + options.request.retryCount++; + return retryAfter * state.retryAfterBaseValue; + } + }); + octokit.hook.wrap("request", wrapRequest.bind(null, state)); + return {}; +} +throttling.VERSION = VERSION; +throttling.triggersNotification = triggersNotification; + +exports.throttling = throttling; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 2068: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/* module decorator */ module = __nccwpck_require__.nmd(module); + +const colorConvert = __nccwpck_require__(6931); + +const wrapAnsi16 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => function () { + const rgb = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + + // Bright color + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Fix humans + styles.color.grey = styles.color.gray; + + for (const groupName of Object.keys(styles)) { + const group = styles[groupName]; + + for (const styleName of Object.keys(group)) { + const style = group[styleName]; + + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + } + + const ansi2ansi = n => n; + const rgb2rgb = (r, g, b) => [r, g, b]; + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = { + ansi: wrapAnsi16(ansi2ansi, 0) + }; + styles.color.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 0) + }; + styles.color.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 0) + }; + + styles.bgColor.ansi = { + ansi: wrapAnsi16(ansi2ansi, 10) + }; + styles.bgColor.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 10) + }; + styles.bgColor.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 10) + }; + + for (let key of Object.keys(colorConvert)) { + if (typeof colorConvert[key] !== 'object') { + continue; + } + + const suite = colorConvert[key]; + + if (key === 'ansi16') { + key = 'ansi'; + } + + if ('ansi16' in suite) { + styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); + styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); + } + + if ('ansi256' in suite) { + styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); + styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); + } + + if ('rgb' in suite) { + styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); + styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); + } + } + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); + + +/***/ }), + +/***/ 3682: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var register = __nccwpck_require__(4670) +var addHook = __nccwpck_require__(5549) +var removeHook = __nccwpck_require__(6819) + +// bind with array of arguments: https://stackoverflow.com/a/21792913 +var bind = Function.bind +var bindable = bind.bind(bind) + +function bindApi (hook, state, name) { + var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state]) + hook.api = { remove: removeHookRef } + hook.remove = removeHookRef + + ;['before', 'error', 'after', 'wrap'].forEach(function (kind) { + var args = name ? [state, kind, name] : [state, kind] + hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args) + }) +} + +function HookSingular () { + var singularHookName = 'h' + var singularHookState = { + registry: {} + } + var singularHook = register.bind(null, singularHookState, singularHookName) + bindApi(singularHook, singularHookState, singularHookName) + return singularHook +} + +function HookCollection () { + var state = { + registry: {} + } + + var hook = register.bind(null, state) + bindApi(hook, state) + + return hook +} + +var collectionHookDeprecationMessageDisplayed = false +function Hook () { + if (!collectionHookDeprecationMessageDisplayed) { + console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4') + collectionHookDeprecationMessageDisplayed = true + } + return HookCollection() +} + +Hook.Singular = HookSingular.bind() +Hook.Collection = HookCollection.bind() + +module.exports = Hook +// expose constructors as a named property for TypeScript +module.exports.Hook = Hook +module.exports.Singular = Hook.Singular +module.exports.Collection = Hook.Collection + + +/***/ }), + +/***/ 5549: +/***/ ((module) => { + +module.exports = addHook; + +function addHook(state, kind, name, hook) { + var orig = hook; + if (!state.registry[name]) { + state.registry[name] = []; + } + + if (kind === "before") { + hook = function (method, options) { + return Promise.resolve() + .then(orig.bind(null, options)) + .then(method.bind(null, options)); + }; + } + + if (kind === "after") { + hook = function (method, options) { + var result; + return Promise.resolve() + .then(method.bind(null, options)) + .then(function (result_) { + result = result_; + return orig(result, options); + }) + .then(function () { + return result; + }); + }; + } + + if (kind === "error") { + hook = function (method, options) { + return Promise.resolve() + .then(method.bind(null, options)) + .catch(function (error) { + return orig(error, options); + }); + }; + } + + state.registry[name].push({ + hook: hook, + orig: orig, + }); +} + + +/***/ }), + +/***/ 4670: +/***/ ((module) => { + +module.exports = register; + +function register(state, name, method, options) { + if (typeof method !== "function") { + throw new Error("method for before hook must be a function"); + } + + if (!options) { + options = {}; + } + + if (Array.isArray(name)) { + return name.reverse().reduce(function (callback, name) { + return register.bind(null, state, name, callback, options); + }, method)(); + } + + return Promise.resolve().then(function () { + if (!state.registry[name]) { + return method(options); + } + + return state.registry[name].reduce(function (method, registered) { + return registered.hook.bind(null, method, options); + }, method)(); + }); +} + + +/***/ }), + +/***/ 6819: +/***/ ((module) => { + +module.exports = removeHook; + +function removeHook(state, name, method) { + if (!state.registry[name]) { + return; + } + + var index = state.registry[name] + .map(function (registered) { + return registered.orig; + }) + .indexOf(method); + + if (index === -1) { + return; + } + + state.registry[name].splice(index, 1); +} + + +/***/ }), + +/***/ 1174: +/***/ (function(module) { + +/** + * This file contains the Bottleneck library (MIT), compiled to ES2017, and without Clustering support. + * https://github.com/SGrondin/bottleneck + */ +(function (global, factory) { + true ? module.exports = factory() : + 0; +}(this, (function () { 'use strict'; + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function getCjsExportFromNamespace (n) { + return n && n['default'] || n; + } + + var load = function(received, defaults, onto = {}) { + var k, ref, v; + for (k in defaults) { + v = defaults[k]; + onto[k] = (ref = received[k]) != null ? ref : v; + } + return onto; + }; + + var overwrite = function(received, defaults, onto = {}) { + var k, v; + for (k in received) { + v = received[k]; + if (defaults[k] !== void 0) { + onto[k] = v; + } + } + return onto; + }; + + var parser = { + load: load, + overwrite: overwrite + }; + + var DLList; + + DLList = class DLList { + constructor(incr, decr) { + this.incr = incr; + this.decr = decr; + this._first = null; + this._last = null; + this.length = 0; + } + + push(value) { + var node; + this.length++; + if (typeof this.incr === "function") { + this.incr(); + } + node = { + value, + prev: this._last, + next: null + }; + if (this._last != null) { + this._last.next = node; + this._last = node; + } else { + this._first = this._last = node; + } + return void 0; + } + + shift() { + var value; + if (this._first == null) { + return; + } else { + this.length--; + if (typeof this.decr === "function") { + this.decr(); + } + } + value = this._first.value; + if ((this._first = this._first.next) != null) { + this._first.prev = null; + } else { + this._last = null; + } + return value; + } + + first() { + if (this._first != null) { + return this._first.value; + } + } + + getArray() { + var node, ref, results; + node = this._first; + results = []; + while (node != null) { + results.push((ref = node, node = node.next, ref.value)); + } + return results; + } + + forEachShift(cb) { + var node; + node = this.shift(); + while (node != null) { + (cb(node), node = this.shift()); + } + return void 0; + } + + debug() { + var node, ref, ref1, ref2, results; + node = this._first; + results = []; + while (node != null) { + results.push((ref = node, node = node.next, { + value: ref.value, + prev: (ref1 = ref.prev) != null ? ref1.value : void 0, + next: (ref2 = ref.next) != null ? ref2.value : void 0 + })); + } + return results; + } + + }; + + var DLList_1 = DLList; + + var Events; + + Events = class Events { + constructor(instance) { + this.instance = instance; + this._events = {}; + if ((this.instance.on != null) || (this.instance.once != null) || (this.instance.removeAllListeners != null)) { + throw new Error("An Emitter already exists for this object"); + } + this.instance.on = (name, cb) => { + return this._addListener(name, "many", cb); + }; + this.instance.once = (name, cb) => { + return this._addListener(name, "once", cb); + }; + this.instance.removeAllListeners = (name = null) => { + if (name != null) { + return delete this._events[name]; + } else { + return this._events = {}; + } + }; + } + + _addListener(name, status, cb) { + var base; + if ((base = this._events)[name] == null) { + base[name] = []; + } + this._events[name].push({cb, status}); + return this.instance; + } + + listenerCount(name) { + if (this._events[name] != null) { + return this._events[name].length; + } else { + return 0; + } + } + + async trigger(name, ...args) { + var e, promises; + try { + if (name !== "debug") { + this.trigger("debug", `Event triggered: ${name}`, args); + } + if (this._events[name] == null) { + return; + } + this._events[name] = this._events[name].filter(function(listener) { + return listener.status !== "none"; + }); + promises = this._events[name].map(async(listener) => { + var e, returned; + if (listener.status === "none") { + return; + } + if (listener.status === "once") { + listener.status = "none"; + } + try { + returned = typeof listener.cb === "function" ? listener.cb(...args) : void 0; + if (typeof (returned != null ? returned.then : void 0) === "function") { + return (await returned); + } else { + return returned; + } + } catch (error) { + e = error; + { + this.trigger("error", e); + } + return null; + } + }); + return ((await Promise.all(promises))).find(function(x) { + return x != null; + }); + } catch (error) { + e = error; + { + this.trigger("error", e); + } + return null; + } + } + + }; + + var Events_1 = Events; + + var DLList$1, Events$1, Queues; + + DLList$1 = DLList_1; + + Events$1 = Events_1; + + Queues = class Queues { + constructor(num_priorities) { + var i; + this.Events = new Events$1(this); + this._length = 0; + this._lists = (function() { + var j, ref, results; + results = []; + for (i = j = 1, ref = num_priorities; (1 <= ref ? j <= ref : j >= ref); i = 1 <= ref ? ++j : --j) { + results.push(new DLList$1((() => { + return this.incr(); + }), (() => { + return this.decr(); + }))); + } + return results; + }).call(this); + } + + incr() { + if (this._length++ === 0) { + return this.Events.trigger("leftzero"); + } + } + + decr() { + if (--this._length === 0) { + return this.Events.trigger("zero"); + } + } + + push(job) { + return this._lists[job.options.priority].push(job); + } + + queued(priority) { + if (priority != null) { + return this._lists[priority].length; + } else { + return this._length; + } + } + + shiftAll(fn) { + return this._lists.forEach(function(list) { + return list.forEachShift(fn); + }); + } + + getFirst(arr = this._lists) { + var j, len, list; + for (j = 0, len = arr.length; j < len; j++) { + list = arr[j]; + if (list.length > 0) { + return list; + } + } + return []; + } + + shiftLastFrom(priority) { + return this.getFirst(this._lists.slice(priority).reverse()).shift(); + } + + }; + + var Queues_1 = Queues; + + var BottleneckError; + + BottleneckError = class BottleneckError extends Error {}; + + var BottleneckError_1 = BottleneckError; + + var BottleneckError$1, DEFAULT_PRIORITY, Job, NUM_PRIORITIES, parser$1; + + NUM_PRIORITIES = 10; + + DEFAULT_PRIORITY = 5; + + parser$1 = parser; + + BottleneckError$1 = BottleneckError_1; + + Job = class Job { + constructor(task, args, options, jobDefaults, rejectOnDrop, Events, _states, Promise) { + this.task = task; + this.args = args; + this.rejectOnDrop = rejectOnDrop; + this.Events = Events; + this._states = _states; + this.Promise = Promise; + this.options = parser$1.load(options, jobDefaults); + this.options.priority = this._sanitizePriority(this.options.priority); + if (this.options.id === jobDefaults.id) { + this.options.id = `${this.options.id}-${this._randomIndex()}`; + } + this.promise = new this.Promise((_resolve, _reject) => { + this._resolve = _resolve; + this._reject = _reject; + }); + this.retryCount = 0; + } + + _sanitizePriority(priority) { + var sProperty; + sProperty = ~~priority !== priority ? DEFAULT_PRIORITY : priority; + if (sProperty < 0) { + return 0; + } else if (sProperty > NUM_PRIORITIES - 1) { + return NUM_PRIORITIES - 1; + } else { + return sProperty; + } + } + + _randomIndex() { + return Math.random().toString(36).slice(2); + } + + doDrop({error, message = "This job has been dropped by Bottleneck"} = {}) { + if (this._states.remove(this.options.id)) { + if (this.rejectOnDrop) { + this._reject(error != null ? error : new BottleneckError$1(message)); + } + this.Events.trigger("dropped", {args: this.args, options: this.options, task: this.task, promise: this.promise}); + return true; + } else { + return false; + } + } + + _assertStatus(expected) { + var status; + status = this._states.jobStatus(this.options.id); + if (!(status === expected || (expected === "DONE" && status === null))) { + throw new BottleneckError$1(`Invalid job status ${status}, expected ${expected}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`); + } + } + + doReceive() { + this._states.start(this.options.id); + return this.Events.trigger("received", {args: this.args, options: this.options}); + } + + doQueue(reachedHWM, blocked) { + this._assertStatus("RECEIVED"); + this._states.next(this.options.id); + return this.Events.trigger("queued", {args: this.args, options: this.options, reachedHWM, blocked}); + } + + doRun() { + if (this.retryCount === 0) { + this._assertStatus("QUEUED"); + this._states.next(this.options.id); + } else { + this._assertStatus("EXECUTING"); + } + return this.Events.trigger("scheduled", {args: this.args, options: this.options}); + } + + async doExecute(chained, clearGlobalState, run, free) { + var error, eventInfo, passed; + if (this.retryCount === 0) { + this._assertStatus("RUNNING"); + this._states.next(this.options.id); + } else { + this._assertStatus("EXECUTING"); + } + eventInfo = {args: this.args, options: this.options, retryCount: this.retryCount}; + this.Events.trigger("executing", eventInfo); + try { + passed = (await (chained != null ? chained.schedule(this.options, this.task, ...this.args) : this.task(...this.args))); + if (clearGlobalState()) { + this.doDone(eventInfo); + await free(this.options, eventInfo); + this._assertStatus("DONE"); + return this._resolve(passed); + } + } catch (error1) { + error = error1; + return this._onFailure(error, eventInfo, clearGlobalState, run, free); + } + } + + doExpire(clearGlobalState, run, free) { + var error, eventInfo; + if (this._states.jobStatus(this.options.id === "RUNNING")) { + this._states.next(this.options.id); + } + this._assertStatus("EXECUTING"); + eventInfo = {args: this.args, options: this.options, retryCount: this.retryCount}; + error = new BottleneckError$1(`This job timed out after ${this.options.expiration} ms.`); + return this._onFailure(error, eventInfo, clearGlobalState, run, free); + } + + async _onFailure(error, eventInfo, clearGlobalState, run, free) { + var retry, retryAfter; + if (clearGlobalState()) { + retry = (await this.Events.trigger("failed", error, eventInfo)); + if (retry != null) { + retryAfter = ~~retry; + this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo); + this.retryCount++; + return run(retryAfter); + } else { + this.doDone(eventInfo); + await free(this.options, eventInfo); + this._assertStatus("DONE"); + return this._reject(error); + } + } + } + + doDone(eventInfo) { + this._assertStatus("EXECUTING"); + this._states.next(this.options.id); + return this.Events.trigger("done", eventInfo); + } + + }; + + var Job_1 = Job; + + var BottleneckError$2, LocalDatastore, parser$2; + + parser$2 = parser; + + BottleneckError$2 = BottleneckError_1; + + LocalDatastore = class LocalDatastore { + constructor(instance, storeOptions, storeInstanceOptions) { + this.instance = instance; + this.storeOptions = storeOptions; + this.clientId = this.instance._randomIndex(); + parser$2.load(storeInstanceOptions, storeInstanceOptions, this); + this._nextRequest = this._lastReservoirRefresh = this._lastReservoirIncrease = Date.now(); + this._running = 0; + this._done = 0; + this._unblockTime = 0; + this.ready = this.Promise.resolve(); + this.clients = {}; + this._startHeartbeat(); + } + + _startHeartbeat() { + var base; + if ((this.heartbeat == null) && (((this.storeOptions.reservoirRefreshInterval != null) && (this.storeOptions.reservoirRefreshAmount != null)) || ((this.storeOptions.reservoirIncreaseInterval != null) && (this.storeOptions.reservoirIncreaseAmount != null)))) { + return typeof (base = (this.heartbeat = setInterval(() => { + var amount, incr, maximum, now, reservoir; + now = Date.now(); + if ((this.storeOptions.reservoirRefreshInterval != null) && now >= this._lastReservoirRefresh + this.storeOptions.reservoirRefreshInterval) { + this._lastReservoirRefresh = now; + this.storeOptions.reservoir = this.storeOptions.reservoirRefreshAmount; + this.instance._drainAll(this.computeCapacity()); + } + if ((this.storeOptions.reservoirIncreaseInterval != null) && now >= this._lastReservoirIncrease + this.storeOptions.reservoirIncreaseInterval) { + ({ + reservoirIncreaseAmount: amount, + reservoirIncreaseMaximum: maximum, + reservoir + } = this.storeOptions); + this._lastReservoirIncrease = now; + incr = maximum != null ? Math.min(amount, maximum - reservoir) : amount; + if (incr > 0) { + this.storeOptions.reservoir += incr; + return this.instance._drainAll(this.computeCapacity()); + } + } + }, this.heartbeatInterval))).unref === "function" ? base.unref() : void 0; + } else { + return clearInterval(this.heartbeat); + } + } + + async __publish__(message) { + await this.yieldLoop(); + return this.instance.Events.trigger("message", message.toString()); + } + + async __disconnect__(flush) { + await this.yieldLoop(); + clearInterval(this.heartbeat); + return this.Promise.resolve(); + } + + yieldLoop(t = 0) { + return new this.Promise(function(resolve, reject) { + return setTimeout(resolve, t); + }); + } + + computePenalty() { + var ref; + return (ref = this.storeOptions.penalty) != null ? ref : (15 * this.storeOptions.minTime) || 5000; + } + + async __updateSettings__(options) { + await this.yieldLoop(); + parser$2.overwrite(options, options, this.storeOptions); + this._startHeartbeat(); + this.instance._drainAll(this.computeCapacity()); + return true; + } + + async __running__() { + await this.yieldLoop(); + return this._running; + } + + async __queued__() { + await this.yieldLoop(); + return this.instance.queued(); + } + + async __done__() { + await this.yieldLoop(); + return this._done; + } + + async __groupCheck__(time) { + await this.yieldLoop(); + return (this._nextRequest + this.timeout) < time; + } + + computeCapacity() { + var maxConcurrent, reservoir; + ({maxConcurrent, reservoir} = this.storeOptions); + if ((maxConcurrent != null) && (reservoir != null)) { + return Math.min(maxConcurrent - this._running, reservoir); + } else if (maxConcurrent != null) { + return maxConcurrent - this._running; + } else if (reservoir != null) { + return reservoir; + } else { + return null; + } + } + + conditionsCheck(weight) { + var capacity; + capacity = this.computeCapacity(); + return (capacity == null) || weight <= capacity; + } + + async __incrementReservoir__(incr) { + var reservoir; + await this.yieldLoop(); + reservoir = this.storeOptions.reservoir += incr; + this.instance._drainAll(this.computeCapacity()); + return reservoir; + } + + async __currentReservoir__() { + await this.yieldLoop(); + return this.storeOptions.reservoir; + } + + isBlocked(now) { + return this._unblockTime >= now; + } + + check(weight, now) { + return this.conditionsCheck(weight) && (this._nextRequest - now) <= 0; + } + + async __check__(weight) { + var now; + await this.yieldLoop(); + now = Date.now(); + return this.check(weight, now); + } + + async __register__(index, weight, expiration) { + var now, wait; + await this.yieldLoop(); + now = Date.now(); + if (this.conditionsCheck(weight)) { + this._running += weight; + if (this.storeOptions.reservoir != null) { + this.storeOptions.reservoir -= weight; + } + wait = Math.max(this._nextRequest - now, 0); + this._nextRequest = now + wait + this.storeOptions.minTime; + return { + success: true, + wait, + reservoir: this.storeOptions.reservoir + }; + } else { + return { + success: false + }; + } + } + + strategyIsBlock() { + return this.storeOptions.strategy === 3; + } + + async __submit__(queueLength, weight) { + var blocked, now, reachedHWM; + await this.yieldLoop(); + if ((this.storeOptions.maxConcurrent != null) && weight > this.storeOptions.maxConcurrent) { + throw new BottleneckError$2(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${this.storeOptions.maxConcurrent}`); + } + now = Date.now(); + reachedHWM = (this.storeOptions.highWater != null) && queueLength === this.storeOptions.highWater && !this.check(weight, now); + blocked = this.strategyIsBlock() && (reachedHWM || this.isBlocked(now)); + if (blocked) { + this._unblockTime = now + this.computePenalty(); + this._nextRequest = this._unblockTime + this.storeOptions.minTime; + this.instance._dropAllQueued(); + } + return { + reachedHWM, + blocked, + strategy: this.storeOptions.strategy + }; + } + + async __free__(index, weight) { + await this.yieldLoop(); + this._running -= weight; + this._done += weight; + this.instance._drainAll(this.computeCapacity()); + return { + running: this._running + }; + } + + }; + + var LocalDatastore_1 = LocalDatastore; + + var BottleneckError$3, States; + + BottleneckError$3 = BottleneckError_1; + + States = class States { + constructor(status1) { + this.status = status1; + this._jobs = {}; + this.counts = this.status.map(function() { + return 0; + }); + } + + next(id) { + var current, next; + current = this._jobs[id]; + next = current + 1; + if ((current != null) && next < this.status.length) { + this.counts[current]--; + this.counts[next]++; + return this._jobs[id]++; + } else if (current != null) { + this.counts[current]--; + return delete this._jobs[id]; + } + } + + start(id) { + var initial; + initial = 0; + this._jobs[id] = initial; + return this.counts[initial]++; + } + + remove(id) { + var current; + current = this._jobs[id]; + if (current != null) { + this.counts[current]--; + delete this._jobs[id]; + } + return current != null; + } + + jobStatus(id) { + var ref; + return (ref = this.status[this._jobs[id]]) != null ? ref : null; + } + + statusJobs(status) { + var k, pos, ref, results, v; + if (status != null) { + pos = this.status.indexOf(status); + if (pos < 0) { + throw new BottleneckError$3(`status must be one of ${this.status.join(', ')}`); + } + ref = this._jobs; + results = []; + for (k in ref) { + v = ref[k]; + if (v === pos) { + results.push(k); + } + } + return results; + } else { + return Object.keys(this._jobs); + } + } + + statusCounts() { + return this.counts.reduce(((acc, v, i) => { + acc[this.status[i]] = v; + return acc; + }), {}); + } + + }; + + var States_1 = States; + + var DLList$2, Sync; + + DLList$2 = DLList_1; + + Sync = class Sync { + constructor(name, Promise) { + this.schedule = this.schedule.bind(this); + this.name = name; + this.Promise = Promise; + this._running = 0; + this._queue = new DLList$2(); + } + + isEmpty() { + return this._queue.length === 0; + } + + async _tryToRun() { + var args, cb, error, reject, resolve, returned, task; + if ((this._running < 1) && this._queue.length > 0) { + this._running++; + ({task, args, resolve, reject} = this._queue.shift()); + cb = (await (async function() { + try { + returned = (await task(...args)); + return function() { + return resolve(returned); + }; + } catch (error1) { + error = error1; + return function() { + return reject(error); + }; + } + })()); + this._running--; + this._tryToRun(); + return cb(); + } + } + + schedule(task, ...args) { + var promise, reject, resolve; + resolve = reject = null; + promise = new this.Promise(function(_resolve, _reject) { + resolve = _resolve; + return reject = _reject; + }); + this._queue.push({task, args, resolve, reject}); + this._tryToRun(); + return promise; + } + + }; + + var Sync_1 = Sync; + + var version = "2.19.5"; + var version$1 = { + version: version + }; + + var version$2 = /*#__PURE__*/Object.freeze({ + version: version, + default: version$1 + }); + + var require$$2 = () => console.log('You must import the full version of Bottleneck in order to use this feature.'); + + var require$$3 = () => console.log('You must import the full version of Bottleneck in order to use this feature.'); + + var require$$4 = () => console.log('You must import the full version of Bottleneck in order to use this feature.'); + + var Events$2, Group, IORedisConnection$1, RedisConnection$1, Scripts$1, parser$3; + + parser$3 = parser; + + Events$2 = Events_1; + + RedisConnection$1 = require$$2; + + IORedisConnection$1 = require$$3; + + Scripts$1 = require$$4; + + Group = (function() { + class Group { + constructor(limiterOptions = {}) { + this.deleteKey = this.deleteKey.bind(this); + this.limiterOptions = limiterOptions; + parser$3.load(this.limiterOptions, this.defaults, this); + this.Events = new Events$2(this); + this.instances = {}; + this.Bottleneck = Bottleneck_1; + this._startAutoCleanup(); + this.sharedConnection = this.connection != null; + if (this.connection == null) { + if (this.limiterOptions.datastore === "redis") { + this.connection = new RedisConnection$1(Object.assign({}, this.limiterOptions, {Events: this.Events})); + } else if (this.limiterOptions.datastore === "ioredis") { + this.connection = new IORedisConnection$1(Object.assign({}, this.limiterOptions, {Events: this.Events})); + } + } + } + + key(key = "") { + var ref; + return (ref = this.instances[key]) != null ? ref : (() => { + var limiter; + limiter = this.instances[key] = new this.Bottleneck(Object.assign(this.limiterOptions, { + id: `${this.id}-${key}`, + timeout: this.timeout, + connection: this.connection + })); + this.Events.trigger("created", limiter, key); + return limiter; + })(); + } + + async deleteKey(key = "") { + var deleted, instance; + instance = this.instances[key]; + if (this.connection) { + deleted = (await this.connection.__runCommand__(['del', ...Scripts$1.allKeys(`${this.id}-${key}`)])); + } + if (instance != null) { + delete this.instances[key]; + await instance.disconnect(); + } + return (instance != null) || deleted > 0; + } + + limiters() { + var k, ref, results, v; + ref = this.instances; + results = []; + for (k in ref) { + v = ref[k]; + results.push({ + key: k, + limiter: v + }); + } + return results; + } + + keys() { + return Object.keys(this.instances); + } + + async clusterKeys() { + var cursor, end, found, i, k, keys, len, next, start; + if (this.connection == null) { + return this.Promise.resolve(this.keys()); + } + keys = []; + cursor = null; + start = `b_${this.id}-`.length; + end = "_settings".length; + while (cursor !== 0) { + [next, found] = (await this.connection.__runCommand__(["scan", cursor != null ? cursor : 0, "match", `b_${this.id}-*_settings`, "count", 10000])); + cursor = ~~next; + for (i = 0, len = found.length; i < len; i++) { + k = found[i]; + keys.push(k.slice(start, -end)); + } + } + return keys; + } + + _startAutoCleanup() { + var base; + clearInterval(this.interval); + return typeof (base = (this.interval = setInterval(async() => { + var e, k, ref, results, time, v; + time = Date.now(); + ref = this.instances; + results = []; + for (k in ref) { + v = ref[k]; + try { + if ((await v._store.__groupCheck__(time))) { + results.push(this.deleteKey(k)); + } else { + results.push(void 0); + } + } catch (error) { + e = error; + results.push(v.Events.trigger("error", e)); + } + } + return results; + }, this.timeout / 2))).unref === "function" ? base.unref() : void 0; + } + + updateSettings(options = {}) { + parser$3.overwrite(options, this.defaults, this); + parser$3.overwrite(options, options, this.limiterOptions); + if (options.timeout != null) { + return this._startAutoCleanup(); + } + } + + disconnect(flush = true) { + var ref; + if (!this.sharedConnection) { + return (ref = this.connection) != null ? ref.disconnect(flush) : void 0; + } + } + + } + Group.prototype.defaults = { + timeout: 1000 * 60 * 5, + connection: null, + Promise: Promise, + id: "group-key" + }; + + return Group; + + }).call(commonjsGlobal); + + var Group_1 = Group; + + var Batcher, Events$3, parser$4; + + parser$4 = parser; + + Events$3 = Events_1; + + Batcher = (function() { + class Batcher { + constructor(options = {}) { + this.options = options; + parser$4.load(this.options, this.defaults, this); + this.Events = new Events$3(this); + this._arr = []; + this._resetPromise(); + this._lastFlush = Date.now(); + } + + _resetPromise() { + return this._promise = new this.Promise((res, rej) => { + return this._resolve = res; + }); + } + + _flush() { + clearTimeout(this._timeout); + this._lastFlush = Date.now(); + this._resolve(); + this.Events.trigger("batch", this._arr); + this._arr = []; + return this._resetPromise(); + } + + add(data) { + var ret; + this._arr.push(data); + ret = this._promise; + if (this._arr.length === this.maxSize) { + this._flush(); + } else if ((this.maxTime != null) && this._arr.length === 1) { + this._timeout = setTimeout(() => { + return this._flush(); + }, this.maxTime); + } + return ret; + } + + } + Batcher.prototype.defaults = { + maxTime: null, + maxSize: null, + Promise: Promise + }; + + return Batcher; + + }).call(commonjsGlobal); + + var Batcher_1 = Batcher; + + var require$$4$1 = () => console.log('You must import the full version of Bottleneck in order to use this feature.'); + + var require$$8 = getCjsExportFromNamespace(version$2); + + var Bottleneck, DEFAULT_PRIORITY$1, Events$4, Job$1, LocalDatastore$1, NUM_PRIORITIES$1, Queues$1, RedisDatastore$1, States$1, Sync$1, parser$5, + splice = [].splice; + + NUM_PRIORITIES$1 = 10; + + DEFAULT_PRIORITY$1 = 5; + + parser$5 = parser; + + Queues$1 = Queues_1; + + Job$1 = Job_1; + + LocalDatastore$1 = LocalDatastore_1; + + RedisDatastore$1 = require$$4$1; + + Events$4 = Events_1; + + States$1 = States_1; + + Sync$1 = Sync_1; + + Bottleneck = (function() { + class Bottleneck { + constructor(options = {}, ...invalid) { + var storeInstanceOptions, storeOptions; + this._addToQueue = this._addToQueue.bind(this); + this._validateOptions(options, invalid); + parser$5.load(options, this.instanceDefaults, this); + this._queues = new Queues$1(NUM_PRIORITIES$1); + this._scheduled = {}; + this._states = new States$1(["RECEIVED", "QUEUED", "RUNNING", "EXECUTING"].concat(this.trackDoneStatus ? ["DONE"] : [])); + this._limiter = null; + this.Events = new Events$4(this); + this._submitLock = new Sync$1("submit", this.Promise); + this._registerLock = new Sync$1("register", this.Promise); + storeOptions = parser$5.load(options, this.storeDefaults, {}); + this._store = (function() { + if (this.datastore === "redis" || this.datastore === "ioredis" || (this.connection != null)) { + storeInstanceOptions = parser$5.load(options, this.redisStoreDefaults, {}); + return new RedisDatastore$1(this, storeOptions, storeInstanceOptions); + } else if (this.datastore === "local") { + storeInstanceOptions = parser$5.load(options, this.localStoreDefaults, {}); + return new LocalDatastore$1(this, storeOptions, storeInstanceOptions); + } else { + throw new Bottleneck.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`); + } + }).call(this); + this._queues.on("leftzero", () => { + var ref; + return (ref = this._store.heartbeat) != null ? typeof ref.ref === "function" ? ref.ref() : void 0 : void 0; + }); + this._queues.on("zero", () => { + var ref; + return (ref = this._store.heartbeat) != null ? typeof ref.unref === "function" ? ref.unref() : void 0 : void 0; + }); + } + + _validateOptions(options, invalid) { + if (!((options != null) && typeof options === "object" && invalid.length === 0)) { + throw new Bottleneck.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1."); + } + } + + ready() { + return this._store.ready; + } + + clients() { + return this._store.clients; + } + + channel() { + return `b_${this.id}`; + } + + channel_client() { + return `b_${this.id}_${this._store.clientId}`; + } + + publish(message) { + return this._store.__publish__(message); + } + + disconnect(flush = true) { + return this._store.__disconnect__(flush); + } + + chain(_limiter) { + this._limiter = _limiter; + return this; + } + + queued(priority) { + return this._queues.queued(priority); + } + + clusterQueued() { + return this._store.__queued__(); + } + + empty() { + return this.queued() === 0 && this._submitLock.isEmpty(); + } + + running() { + return this._store.__running__(); + } + + done() { + return this._store.__done__(); + } + + jobStatus(id) { + return this._states.jobStatus(id); + } + + jobs(status) { + return this._states.statusJobs(status); + } + + counts() { + return this._states.statusCounts(); + } + + _randomIndex() { + return Math.random().toString(36).slice(2); + } + + check(weight = 1) { + return this._store.__check__(weight); + } + + _clearGlobalState(index) { + if (this._scheduled[index] != null) { + clearTimeout(this._scheduled[index].expiration); + delete this._scheduled[index]; + return true; + } else { + return false; + } + } + + async _free(index, job, options, eventInfo) { + var e, running; + try { + ({running} = (await this._store.__free__(index, options.weight))); + this.Events.trigger("debug", `Freed ${options.id}`, eventInfo); + if (running === 0 && this.empty()) { + return this.Events.trigger("idle"); + } + } catch (error1) { + e = error1; + return this.Events.trigger("error", e); + } + } + + _run(index, job, wait) { + var clearGlobalState, free, run; + job.doRun(); + clearGlobalState = this._clearGlobalState.bind(this, index); + run = this._run.bind(this, index, job); + free = this._free.bind(this, index, job); + return this._scheduled[index] = { + timeout: setTimeout(() => { + return job.doExecute(this._limiter, clearGlobalState, run, free); + }, wait), + expiration: job.options.expiration != null ? setTimeout(function() { + return job.doExpire(clearGlobalState, run, free); + }, wait + job.options.expiration) : void 0, + job: job + }; + } + + _drainOne(capacity) { + return this._registerLock.schedule(() => { + var args, index, next, options, queue; + if (this.queued() === 0) { + return this.Promise.resolve(null); + } + queue = this._queues.getFirst(); + ({options, args} = next = queue.first()); + if ((capacity != null) && options.weight > capacity) { + return this.Promise.resolve(null); + } + this.Events.trigger("debug", `Draining ${options.id}`, {args, options}); + index = this._randomIndex(); + return this._store.__register__(index, options.weight, options.expiration).then(({success, wait, reservoir}) => { + var empty; + this.Events.trigger("debug", `Drained ${options.id}`, {success, args, options}); + if (success) { + queue.shift(); + empty = this.empty(); + if (empty) { + this.Events.trigger("empty"); + } + if (reservoir === 0) { + this.Events.trigger("depleted", empty); + } + this._run(index, next, wait); + return this.Promise.resolve(options.weight); + } else { + return this.Promise.resolve(null); + } + }); + }); + } + + _drainAll(capacity, total = 0) { + return this._drainOne(capacity).then((drained) => { + var newCapacity; + if (drained != null) { + newCapacity = capacity != null ? capacity - drained : capacity; + return this._drainAll(newCapacity, total + drained); + } else { + return this.Promise.resolve(total); + } + }).catch((e) => { + return this.Events.trigger("error", e); + }); + } + + _dropAllQueued(message) { + return this._queues.shiftAll(function(job) { + return job.doDrop({message}); + }); + } + + stop(options = {}) { + var done, waitForExecuting; + options = parser$5.load(options, this.stopDefaults); + waitForExecuting = (at) => { + var finished; + finished = () => { + var counts; + counts = this._states.counts; + return (counts[0] + counts[1] + counts[2] + counts[3]) === at; + }; + return new this.Promise((resolve, reject) => { + if (finished()) { + return resolve(); + } else { + return this.on("done", () => { + if (finished()) { + this.removeAllListeners("done"); + return resolve(); + } + }); + } + }); + }; + done = options.dropWaitingJobs ? (this._run = function(index, next) { + return next.doDrop({ + message: options.dropErrorMessage + }); + }, this._drainOne = () => { + return this.Promise.resolve(null); + }, this._registerLock.schedule(() => { + return this._submitLock.schedule(() => { + var k, ref, v; + ref = this._scheduled; + for (k in ref) { + v = ref[k]; + if (this.jobStatus(v.job.options.id) === "RUNNING") { + clearTimeout(v.timeout); + clearTimeout(v.expiration); + v.job.doDrop({ + message: options.dropErrorMessage + }); + } + } + this._dropAllQueued(options.dropErrorMessage); + return waitForExecuting(0); + }); + })) : this.schedule({ + priority: NUM_PRIORITIES$1 - 1, + weight: 0 + }, () => { + return waitForExecuting(1); + }); + this._receive = function(job) { + return job._reject(new Bottleneck.prototype.BottleneckError(options.enqueueErrorMessage)); + }; + this.stop = () => { + return this.Promise.reject(new Bottleneck.prototype.BottleneckError("stop() has already been called")); + }; + return done; + } + + async _addToQueue(job) { + var args, blocked, error, options, reachedHWM, shifted, strategy; + ({args, options} = job); + try { + ({reachedHWM, blocked, strategy} = (await this._store.__submit__(this.queued(), options.weight))); + } catch (error1) { + error = error1; + this.Events.trigger("debug", `Could not queue ${options.id}`, {args, options, error}); + job.doDrop({error}); + return false; + } + if (blocked) { + job.doDrop(); + return true; + } else if (reachedHWM) { + shifted = strategy === Bottleneck.prototype.strategy.LEAK ? this._queues.shiftLastFrom(options.priority) : strategy === Bottleneck.prototype.strategy.OVERFLOW_PRIORITY ? this._queues.shiftLastFrom(options.priority + 1) : strategy === Bottleneck.prototype.strategy.OVERFLOW ? job : void 0; + if (shifted != null) { + shifted.doDrop(); + } + if ((shifted == null) || strategy === Bottleneck.prototype.strategy.OVERFLOW) { + if (shifted == null) { + job.doDrop(); + } + return reachedHWM; + } + } + job.doQueue(reachedHWM, blocked); + this._queues.push(job); + await this._drainAll(); + return reachedHWM; + } + + _receive(job) { + if (this._states.jobStatus(job.options.id) != null) { + job._reject(new Bottleneck.prototype.BottleneckError(`A job with the same id already exists (id=${job.options.id})`)); + return false; + } else { + job.doReceive(); + return this._submitLock.schedule(this._addToQueue, job); + } + } + + submit(...args) { + var cb, fn, job, options, ref, ref1, task; + if (typeof args[0] === "function") { + ref = args, [fn, ...args] = ref, [cb] = splice.call(args, -1); + options = parser$5.load({}, this.jobDefaults); + } else { + ref1 = args, [options, fn, ...args] = ref1, [cb] = splice.call(args, -1); + options = parser$5.load(options, this.jobDefaults); + } + task = (...args) => { + return new this.Promise(function(resolve, reject) { + return fn(...args, function(...args) { + return (args[0] != null ? reject : resolve)(args); + }); + }); + }; + job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise); + job.promise.then(function(args) { + return typeof cb === "function" ? cb(...args) : void 0; + }).catch(function(args) { + if (Array.isArray(args)) { + return typeof cb === "function" ? cb(...args) : void 0; + } else { + return typeof cb === "function" ? cb(args) : void 0; + } + }); + return this._receive(job); + } + + schedule(...args) { + var job, options, task; + if (typeof args[0] === "function") { + [task, ...args] = args; + options = {}; + } else { + [options, task, ...args] = args; + } + job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise); + this._receive(job); + return job.promise; + } + + wrap(fn) { + var schedule, wrapped; + schedule = this.schedule.bind(this); + wrapped = function(...args) { + return schedule(fn.bind(this), ...args); + }; + wrapped.withOptions = function(options, ...args) { + return schedule(options, fn, ...args); + }; + return wrapped; + } + + async updateSettings(options = {}) { + await this._store.__updateSettings__(parser$5.overwrite(options, this.storeDefaults)); + parser$5.overwrite(options, this.instanceDefaults, this); + return this; + } + + currentReservoir() { + return this._store.__currentReservoir__(); + } + + incrementReservoir(incr = 0) { + return this._store.__incrementReservoir__(incr); + } + + } + Bottleneck.default = Bottleneck; + + Bottleneck.Events = Events$4; + + Bottleneck.version = Bottleneck.prototype.version = require$$8.version; + + Bottleneck.strategy = Bottleneck.prototype.strategy = { + LEAK: 1, + OVERFLOW: 2, + OVERFLOW_PRIORITY: 4, + BLOCK: 3 + }; + + Bottleneck.BottleneckError = Bottleneck.prototype.BottleneckError = BottleneckError_1; + + Bottleneck.Group = Bottleneck.prototype.Group = Group_1; + + Bottleneck.RedisConnection = Bottleneck.prototype.RedisConnection = require$$2; + + Bottleneck.IORedisConnection = Bottleneck.prototype.IORedisConnection = require$$3; + + Bottleneck.Batcher = Bottleneck.prototype.Batcher = Batcher_1; + + Bottleneck.prototype.jobDefaults = { + priority: DEFAULT_PRIORITY$1, + weight: 1, + expiration: null, + id: "" + }; + + Bottleneck.prototype.storeDefaults = { + maxConcurrent: null, + minTime: 0, + highWater: null, + strategy: Bottleneck.prototype.strategy.LEAK, + penalty: null, + reservoir: null, + reservoirRefreshInterval: null, + reservoirRefreshAmount: null, + reservoirIncreaseInterval: null, + reservoirIncreaseAmount: null, + reservoirIncreaseMaximum: null + }; + + Bottleneck.prototype.localStoreDefaults = { + Promise: Promise, + timeout: null, + heartbeatInterval: 250 + }; + + Bottleneck.prototype.redisStoreDefaults = { + Promise: Promise, + timeout: null, + heartbeatInterval: 5000, + clientTimeout: 10000, + Redis: null, + clientOptions: {}, + clusterNodes: null, + clearDatastore: false, + connection: null + }; + + Bottleneck.prototype.instanceDefaults = { + datastore: "local", + connection: null, + id: "", + rejectOnDrop: true, + trackDoneStatus: false, + Promise: Promise + }; + + Bottleneck.prototype.stopDefaults = { + enqueueErrorMessage: "This limiter has been stopped and cannot accept new jobs.", + dropWaitingJobs: true, + dropErrorMessage: "This limiter has been stopped." + }; + + return Bottleneck; + + }).call(commonjsGlobal); + + var Bottleneck_1 = Bottleneck; + + var lib = Bottleneck_1; + + return lib; + +}))); + + +/***/ }), + +/***/ 8707: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const escapeStringRegexp = __nccwpck_require__(6920); +const ansiStyles = __nccwpck_require__(2068); +const stdoutColor = __nccwpck_require__(9318).stdout; + +const template = __nccwpck_require__(2138); + +const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); + +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; + +// `color-convert` models to exclude from the Chalk API due to conflicts and such +const skipModels = new Set(['gray']); + +const styles = Object.create(null); + +function applyOptions(obj, options) { + options = options || {}; + + // Detect level if not set manually + const scLevel = stdoutColor ? stdoutColor.level : 0; + obj.level = options.level === undefined ? scLevel : options.level; + obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; +} + +function Chalk(options) { + // We check for this.template here since calling `chalk.constructor()` + // by itself will have a `this` of a previously constructed chalk object + if (!this || !(this instanceof Chalk) || this.template) { + const chalk = {}; + applyOptions(chalk, options); + + chalk.template = function () { + const args = [].slice.call(arguments); + return chalkTag.apply(null, [chalk.template].concat(args)); + }; + + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + + chalk.template.constructor = Chalk; + + return chalk.template; + } + + applyOptions(this, options); +} + +// Use bright blue on Windows as the normal blue color is illegible +if (isSimpleWindowsTerm) { + ansiStyles.blue.open = '\u001B[94m'; +} + +for (const key of Object.keys(ansiStyles)) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + + styles[key] = { + get() { + const codes = ansiStyles[key]; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); + } + }; +} + +styles.visible = { + get() { + return build.call(this, this._styles || [], true, 'visible'); + } +}; + +ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); +for (const model of Object.keys(ansiStyles.color.ansi)) { + if (skipModels.has(model)) { + continue; + } + + styles[model] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.color.close, + closeRe: ansiStyles.color.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + }; +} + +ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); +for (const model of Object.keys(ansiStyles.bgColor.ansi)) { + if (skipModels.has(model)) { + continue; + } + + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.bgColor.close, + closeRe: ansiStyles.bgColor.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + }; +} + +const proto = Object.defineProperties(() => {}, styles); + +function build(_styles, _empty, key) { + const builder = function () { + return applyStyle.apply(builder, arguments); + }; + + builder._styles = _styles; + builder._empty = _empty; + + const self = this; + + Object.defineProperty(builder, 'level', { + enumerable: true, + get() { + return self.level; + }, + set(level) { + self.level = level; + } + }); + + Object.defineProperty(builder, 'enabled', { + enumerable: true, + get() { + return self.enabled; + }, + set(enabled) { + self.enabled = enabled; + } + }); + + // See below for fix regarding invisible grey/dim combination on Windows + builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; + + // `__proto__` is used because we must return a function, but there is + // no way to create a function with a different prototype + builder.__proto__ = proto; // eslint-disable-line no-proto + + return builder; +} + +function applyStyle() { + // Support varags, but simply cast to string in case there's only one arg + const args = arguments; + const argsLen = args.length; + let str = String(arguments[0]); + + if (argsLen === 0) { + return ''; + } + + if (argsLen > 1) { + // Don't slice `arguments`, it prevents V8 optimizations + for (let a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || this.level <= 0 || !str) { + return this._empty ? '' : str; + } -function endpointsToMethods(octokit, endpointsMap) { - const newMethods = {}; + // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, + // see https://github.com/chalk/chalk/issues/58 + // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. + const originalDim = ansiStyles.dim.open; + if (isSimpleWindowsTerm && this.hasGrey) { + ansiStyles.dim.open = ''; + } - for (const [scope, endpoints] of Object.entries(endpointsMap)) { - for (const [methodName, endpoint] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint; - const [method, url] = route.split(/ /); - const endpointDefaults = Object.assign({ - method, - url - }, defaults); + for (const code of this._styles.slice().reverse()) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; - if (!newMethods[scope]) { - newMethods[scope] = {}; - } + // Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS + // https://github.com/chalk/chalk/pull/92 + str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); + } - const scopeMethods = newMethods[scope]; + // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue + ansiStyles.dim.open = originalDim; - if (decorations) { - scopeMethods[methodName] = decorate(octokit, scope, methodName, endpointDefaults, decorations); - continue; - } + return str; +} - scopeMethods[methodName] = octokit.request.defaults(endpointDefaults); - } - } +function chalkTag(chalk, strings) { + if (!Array.isArray(strings)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return [].slice.call(arguments, 1).join(' '); + } - return newMethods; + const args = [].slice.call(arguments, 2); + const parts = [strings.raw[0]]; + + for (let i = 1; i < strings.length; i++) { + parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); + parts.push(String(strings.raw[i])); + } + + return template(chalk, parts.join('')); } -function decorate(octokit, scope, methodName, defaults, decorations) { - const requestWithDefaults = octokit.request.defaults(defaults); - /* istanbul ignore next */ +Object.defineProperties(Chalk.prototype, styles); - function withDecorations(...args) { - // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 - let options = requestWithDefaults.endpoint.merge(...args); // There are currently no other decorations than `.mapToData` +module.exports = Chalk(); // eslint-disable-line new-cap +module.exports.supportsColor = stdoutColor; +module.exports.default = module.exports; // For TypeScript - if (decorations.mapToData) { - options = Object.assign({}, options, { - data: options[decorations.mapToData], - [decorations.mapToData]: undefined - }); - return requestWithDefaults(options); - } - if (decorations.renamed) { - const [newScope, newMethodName] = decorations.renamed; - octokit.log.warn(`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`); - } +/***/ }), - if (decorations.deprecated) { - octokit.log.warn(decorations.deprecated); - } +/***/ 6920: +/***/ ((module) => { - if (decorations.renamedParameters) { - // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 - const options = requestWithDefaults.endpoint.merge(...args); +"use strict"; - for (const [name, alias] of Object.entries(decorations.renamedParameters)) { - if (name in options) { - octokit.log.warn(`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`); - if (!(alias in options)) { - options[alias] = options[name]; - } +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; - delete options[name]; - } - } +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } - return requestWithDefaults(options); - } // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + return str.replace(matchOperatorsRe, '\\$&'); +}; - return requestWithDefaults(...args); - } +/***/ }), - return Object.assign(withDecorations, requestWithDefaults); -} +/***/ 2138: +/***/ ((module) => { -function restEndpointMethods(octokit) { - const api = endpointsToMethods(octokit, Endpoints); - return { - rest: api - }; +"use strict"; + +const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; + +const ESCAPES = new Map([ + ['n', '\n'], + ['r', '\r'], + ['t', '\t'], + ['b', '\b'], + ['f', '\f'], + ['v', '\v'], + ['0', '\0'], + ['\\', '\\'], + ['e', '\u001B'], + ['a', '\u0007'] +]); + +function unescape(c) { + if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } + + return ESCAPES.get(c) || c; } -restEndpointMethods.VERSION = VERSION; -function legacyRestEndpointMethods(octokit) { - const api = endpointsToMethods(octokit, Endpoints); - return _objectSpread2(_objectSpread2({}, api), {}, { - rest: api - }); + +function parseArguments(name, args) { + const results = []; + const chunks = args.trim().split(/\s*,\s*/g); + let matches; + + for (const chunk of chunks) { + if (!isNaN(chunk)) { + results.push(Number(chunk)); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } + + return results; } -legacyRestEndpointMethods.VERSION = VERSION; -exports.legacyRestEndpointMethods = legacyRestEndpointMethods; -exports.restEndpointMethods = restEndpointMethods; -//# sourceMappingURL=index.js.map +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; + const results = []; + let matches; -/***/ }), + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; -/***/ 9968: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } -"use strict"; + return results; +} +function buildStyle(chalk, styles) { + const enabled = {}; -Object.defineProperty(exports, "__esModule", ({ value: true })); + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + let current = chalk; + for (const styleName of Object.keys(enabled)) { + if (Array.isArray(enabled[styleName])) { + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } -var BottleneckLight = _interopDefault(__nccwpck_require__(1174)); + if (enabled[styleName].length > 0) { + current = current[styleName].apply(current, enabled[styleName]); + } else { + current = current[styleName]; + } + } + } -const VERSION = "4.1.0"; + return current; +} -const noop = () => Promise.resolve(); // @ts-expect-error +module.exports = (chalk, tmp) => { + const styles = []; + const chunks = []; + let chunk = []; + + // eslint-disable-next-line max-params + tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { + if (escapeChar) { + chunk.push(unescape(escapeChar)); + } else if (style) { + const str = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); + styles.push({inverse, styles: parseStyle(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(chr); + } + }); -function wrapRequest(state, request, options) { - return state.retryLimiter.schedule(doRequest, state, request, options); -} // @ts-expect-error + chunks.push(chunk.join('')); -async function doRequest(state, request, options) { - const isWrite = options.method !== "GET" && options.method !== "HEAD"; - const { - pathname - } = new URL(options.url, "http://github.test"); - const isSearch = options.method === "GET" && pathname.startsWith("/search/"); - const isGraphQL = pathname.startsWith("/graphql"); - const retryCount = ~~options.request.retryCount; - const jobOptions = retryCount > 0 ? { - priority: 0, - weight: 0 - } : {}; + if (styles.length > 0) { + const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMsg); + } - if (state.clustering) { - // Remove a job from Redis if it has not completed or failed within 60s - // Examples: Node process terminated, client disconnected, etc. - // @ts-expect-error - jobOptions.expiration = 1000 * 60; - } // Guarantee at least 1000ms between writes - // GraphQL can also trigger writes + return chunks.join(''); +}; - if (isWrite || isGraphQL) { - await state.write.key(state.id).schedule(jobOptions, noop); - } // Guarantee at least 3000ms between requests that trigger notifications +/***/ }), +/***/ 7391: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (isWrite && state.triggersNotification(pathname)) { - await state.notifications.key(state.id).schedule(jobOptions, noop); - } // Guarantee at least 2000ms between search requests +/* MIT license */ +var cssKeywords = __nccwpck_require__(8510); +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) - if (isSearch) { - await state.search.key(state.id).schedule(jobOptions, noop); - } +var reverseKeywords = {}; +for (var key in cssKeywords) { + if (cssKeywords.hasOwnProperty(key)) { + reverseKeywords[cssKeywords[key]] = key; + } +} - const req = state.global.key(state.id).schedule(jobOptions, request, options); +var convert = module.exports = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; - if (isGraphQL) { - const res = await req; +// hide .channels and .labels properties +for (var model in convert) { + if (convert.hasOwnProperty(model)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } - if (res.data.errors != null && // @ts-expect-error - res.data.errors.some(error => error.type === "RATE_LIMITED")) { - const error = Object.assign(new Error("GraphQL Rate Limit Exceeded"), { - response: res, - data: res.data - }); - throw error; - } - } + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } - return req; -} + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } -var triggersNotificationPaths = ["/orgs/{org}/invitations", "/orgs/{org}/invitations/{invitation_id}", "/orgs/{org}/teams/{team_slug}/discussions", "/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", "/repos/{owner}/{repo}/collaborators/{username}", "/repos/{owner}/{repo}/commits/{commit_sha}/comments", "/repos/{owner}/{repo}/issues", "/repos/{owner}/{repo}/issues/{issue_number}/comments", "/repos/{owner}/{repo}/pulls", "/repos/{owner}/{repo}/pulls/{pull_number}/comments", "/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies", "/repos/{owner}/{repo}/pulls/{pull_number}/merge", "/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", "/repos/{owner}/{repo}/pulls/{pull_number}/reviews", "/repos/{owner}/{repo}/releases", "/teams/{team_id}/discussions", "/teams/{team_id}/discussions/{discussion_number}/comments"]; + var channels = convert[model].channels; + var labels = convert[model].labels; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); + } +} -function routeMatcher(paths) { - // EXAMPLE. For the following paths: +convert.rgb.hsl = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var delta = max - min; + var h; + var s; + var l; + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } - /* [ - "/orgs/{org}/invitations", - "/repos/{owner}/{repo}/collaborators/{username}" - ] */ - const regexes = paths.map(path => path.split("/").map(c => c.startsWith("{") ? "(?:.+?)" : c).join("/")); // 'regexes' would contain: + h = Math.min(h * 60, 360); - /* [ - '/orgs/(?:.+?)/invitations', - '/repos/(?:.+?)/(?:.+?)/collaborators/(?:.+?)' - ] */ + if (h < 0) { + h += 360; + } - const regex = `^(?:${regexes.map(r => `(?:${r})`).join("|")})[^/]*$`; // 'regex' would contain: + l = (min + max) / 2; - /* - ^(?:(?:\/orgs\/(?:.+?)\/invitations)|(?:\/repos\/(?:.+?)\/(?:.+?)\/collaborators\/(?:.+?)))[^\/]*$ - It may look scary, but paste it into https://www.debuggex.com/ - and it will make a lot more sense! - */ + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } - return new RegExp(regex, "i"); -} + return [h, s * 100, l * 100]; +}; -// @ts-expect-error +convert.rgb.hsv = function (rgb) { + var rdif; + var gdif; + var bdif; + var h; + var s; + + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var v = Math.max(r, g, b); + var diff = v - Math.min(r, g, b); + var diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; -const regex = routeMatcher(triggersNotificationPaths); -const triggersNotification = regex.test.bind(regex); -const groups = {}; // @ts-expect-error + if (diff === 0) { + h = s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } -const createGroups = function (Bottleneck, common) { - groups.global = new Bottleneck.Group({ - id: "octokit-global", - maxConcurrent: 10, - ...common - }); - groups.search = new Bottleneck.Group({ - id: "octokit-search", - maxConcurrent: 1, - minTime: 2000, - ...common - }); - groups.write = new Bottleneck.Group({ - id: "octokit-write", - maxConcurrent: 1, - minTime: 1000, - ...common - }); - groups.notifications = new Bottleneck.Group({ - id: "octokit-notifications", - maxConcurrent: 1, - minTime: 3000, - ...common - }); + return [ + h * 360, + s * 100, + v * 100 + ]; }; -function throttling(octokit, octokitOptions) { - const { - enabled = true, - Bottleneck = BottleneckLight, - id = "no-id", - timeout = 1000 * 60 * 2, - // Redis TTL: 2 minutes - connection - } = octokitOptions.throttle || {}; +convert.rgb.hwb = function (rgb) { + var r = rgb[0]; + var g = rgb[1]; + var b = rgb[2]; + var h = convert.rgb.hsl(rgb)[0]; + var w = 1 / 255 * Math.min(r, Math.min(g, b)); - if (!enabled) { - return {}; - } + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + + return [h, w * 100, b * 100]; +}; - const common = { - connection, - timeout - }; +convert.rgb.cmyk = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var c; + var m; + var y; + var k; + + k = Math.min(1 - r, 1 - g, 1 - b); + c = (1 - r - k) / (1 - k) || 0; + m = (1 - g - k) / (1 - k) || 0; + y = (1 - b - k) / (1 - k) || 0; + + return [c * 100, m * 100, y * 100, k * 100]; +}; - if (groups.global == null) { - createGroups(Bottleneck, common); - } +/** + * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + * */ +function comparativeDistance(x, y) { + return ( + Math.pow(x[0] - y[0], 2) + + Math.pow(x[1] - y[1], 2) + + Math.pow(x[2] - y[2], 2) + ); +} - const state = Object.assign({ - clustering: connection != null, - triggersNotification, - minimumSecondaryRateRetryAfter: 5, - retryAfterBaseValue: 1000, - retryLimiter: new Bottleneck(), - id, - ...groups - }, octokitOptions.throttle); - const isUsingDeprecatedOnAbuseLimitHandler = typeof state.onAbuseLimit === "function" && state.onAbuseLimit; +convert.rgb.keyword = function (rgb) { + var reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; + } - if (typeof (isUsingDeprecatedOnAbuseLimitHandler ? state.onAbuseLimit : state.onSecondaryRateLimit) !== "function" || typeof state.onRateLimit !== "function") { - throw new Error(`octokit/plugin-throttling error: - You must pass the onSecondaryRateLimit and onRateLimit error handlers. - See https://github.com/octokit/rest.js#throttling + var currentClosestDistance = Infinity; + var currentClosestKeyword; - const octokit = new Octokit({ - throttle: { - onSecondaryRateLimit: (retryAfter, options) => {/* ... */}, - onRateLimit: (retryAfter, options) => {/* ... */} - } - }) - `); - } + for (var keyword in cssKeywords) { + if (cssKeywords.hasOwnProperty(keyword)) { + var value = cssKeywords[keyword]; - const events = {}; - const emitter = new Bottleneck.Events(events); // @ts-expect-error + // Compute comparative distance + var distance = comparativeDistance(rgb, value); - events.on("secondary-limit", isUsingDeprecatedOnAbuseLimitHandler ? function (...args) { - octokit.log.warn("[@octokit/plugin-throttling] `onAbuseLimit()` is deprecated and will be removed in a future release of `@octokit/plugin-throttling`, please use the `onSecondaryRateLimit` handler instead"); - return state.onAbuseLimit(...args); - } : state.onSecondaryRateLimit); // @ts-expect-error + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + } - events.on("rate-limit", state.onRateLimit); // @ts-expect-error + return currentClosestKeyword; +}; - events.on("error", e => octokit.log.warn("Error in throttling-plugin limit handler", e)); // @ts-expect-error +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; - state.retryLimiter.on("failed", async function (error, info) { - const options = info.args[info.args.length - 1]; - const { - pathname - } = new URL(options.url, "http://github.test"); - const shouldRetryGraphQL = pathname.startsWith("/graphql") && error.status !== 401; +convert.rgb.xyz = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; - if (!(shouldRetryGraphQL || error.status === 403)) { - return; - } + // assume sRGB + r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); + g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); + b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); - const retryCount = ~~options.request.retryCount; - options.request.retryCount = retryCount; - const { - wantRetry, - retryAfter = 0 - } = await async function () { - if (/\bsecondary rate\b/i.test(error.message)) { - // The user has hit the secondary rate limit. (REST and GraphQL) - // https://docs.github.com/en/rest/overview/resources-in-the-rest-api#secondary-rate-limits - // The Retry-After header can sometimes be blank when hitting a secondary rate limit, - // but is always present after 2-3s, so make sure to set `retryAfter` to at least 5s by default. - const retryAfter = Math.max(~~error.response.headers["retry-after"], state.minimumSecondaryRateRetryAfter); - const wantRetry = await emitter.trigger("secondary-limit", retryAfter, options, octokit); - return { - wantRetry, - retryAfter - }; - } + var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); - if (error.response.headers != null && error.response.headers["x-ratelimit-remaining"] === "0") { - // The user has used all their allowed calls for the current time period (REST and GraphQL) - // https://docs.github.com/en/rest/reference/rate-limit (REST) - // https://docs.github.com/en/graphql/overview/resource-limitations#rate-limit (GraphQL) - const rateLimitReset = new Date(~~error.response.headers["x-ratelimit-reset"] * 1000).getTime(); - const retryAfter = Math.max(Math.ceil((rateLimitReset - Date.now()) / 1000), 0); - const wantRetry = await emitter.trigger("rate-limit", retryAfter, options, octokit); - return { - wantRetry, - retryAfter - }; - } + return [x * 100, y * 100, z * 100]; +}; - return {}; - }(); +convert.rgb.lab = function (rgb) { + var xyz = convert.rgb.xyz(rgb); + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; - if (wantRetry) { - options.request.retryCount++; - return retryAfter * state.retryAfterBaseValue; - } - }); - octokit.hook.wrap("request", wrapRequest.bind(null, state)); - return {}; -} -throttling.VERSION = VERSION; -throttling.triggersNotification = triggersNotification; + x /= 95.047; + y /= 100; + z /= 108.883; -exports.throttling = throttling; -//# sourceMappingURL=index.js.map + x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); -/***/ }), + return [l, a, b]; +}; -/***/ 3682: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +convert.hsl.rgb = function (hsl) { + var h = hsl[0] / 360; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var t1; + var t2; + var t3; + var rgb; + var val; + + if (s === 0) { + val = l * 255; + return [val, val, val]; + } -var register = __nccwpck_require__(4670) -var addHook = __nccwpck_require__(5549) -var removeHook = __nccwpck_require__(6819) + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } -// bind with array of arguments: https://stackoverflow.com/a/21792913 -var bind = Function.bind -var bindable = bind.bind(bind) + t1 = 2 * l - t2; -function bindApi (hook, state, name) { - var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state]) - hook.api = { remove: removeHookRef } - hook.remove = removeHookRef + rgb = [0, 0, 0]; + for (var i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } + if (t3 > 1) { + t3--; + } - ;['before', 'error', 'after', 'wrap'].forEach(function (kind) { - var args = name ? [state, kind, name] : [state, kind] - hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args) - }) -} + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } -function HookSingular () { - var singularHookName = 'h' - var singularHookState = { - registry: {} - } - var singularHook = register.bind(null, singularHookState, singularHookName) - bindApi(singularHook, singularHookState, singularHookName) - return singularHook -} + rgb[i] = val * 255; + } -function HookCollection () { - var state = { - registry: {} - } + return rgb; +}; - var hook = register.bind(null, state) - bindApi(hook, state) +convert.hsl.hsv = function (hsl) { + var h = hsl[0]; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var smin = s; + var lmin = Math.max(l, 0.01); + var sv; + var v; + + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + v = (l + s) / 2; + sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); + + return [h, sv * 100, v * 100]; +}; - return hook -} +convert.hsv.rgb = function (hsv) { + var h = hsv[0] / 60; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var hi = Math.floor(h) % 6; + + var f = h - Math.floor(h); + var p = 255 * v * (1 - s); + var q = 255 * v * (1 - (s * f)); + var t = 255 * v * (1 - (s * (1 - f))); + v *= 255; + + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; -var collectionHookDeprecationMessageDisplayed = false -function Hook () { - if (!collectionHookDeprecationMessageDisplayed) { - console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4') - collectionHookDeprecationMessageDisplayed = true - } - return HookCollection() -} +convert.hsv.hsl = function (hsv) { + var h = hsv[0]; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var vmin = Math.max(v, 0.01); + var lmin; + var sl; + var l; + + l = (2 - s) * v; + lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; + + return [h, sl * 100, l * 100]; +}; -Hook.Singular = HookSingular.bind() -Hook.Collection = HookCollection.bind() +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + var h = hwb[0] / 360; + var wh = hwb[1] / 100; + var bl = hwb[2] / 100; + var ratio = wh + bl; + var i; + var v; + var f; + var n; + + // wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } -module.exports = Hook -// expose constructors as a named property for TypeScript -module.exports.Hook = Hook -module.exports.Singular = Hook.Singular -module.exports.Collection = Hook.Collection + i = Math.floor(6 * h); + v = 1 - bl; + f = 6 * h - i; + if ((i & 0x01) !== 0) { + f = 1 - f; + } -/***/ }), + n = wh + f * (v - wh); // linear interpolation + + var r; + var g; + var b; + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } -/***/ 5549: -/***/ ((module) => { + return [r * 255, g * 255, b * 255]; +}; -module.exports = addHook; +convert.cmyk.rgb = function (cmyk) { + var c = cmyk[0] / 100; + var m = cmyk[1] / 100; + var y = cmyk[2] / 100; + var k = cmyk[3] / 100; + var r; + var g; + var b; -function addHook(state, kind, name, hook) { - var orig = hook; - if (!state.registry[name]) { - state.registry[name] = []; - } + r = 1 - Math.min(1, c * (1 - k) + k); + g = 1 - Math.min(1, m * (1 - k) + k); + b = 1 - Math.min(1, y * (1 - k) + k); - if (kind === "before") { - hook = function (method, options) { - return Promise.resolve() - .then(orig.bind(null, options)) - .then(method.bind(null, options)); - }; - } + return [r * 255, g * 255, b * 255]; +}; - if (kind === "after") { - hook = function (method, options) { - var result; - return Promise.resolve() - .then(method.bind(null, options)) - .then(function (result_) { - result = result_; - return orig(result, options); - }) - .then(function () { - return result; - }); - }; - } +convert.xyz.rgb = function (xyz) { + var x = xyz[0] / 100; + var y = xyz[1] / 100; + var z = xyz[2] / 100; + var r; + var g; + var b; - if (kind === "error") { - hook = function (method, options) { - return Promise.resolve() - .then(method.bind(null, options)) - .catch(function (error) { - return orig(error, options); - }); - }; - } + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - state.registry[name].push({ - hook: hook, - orig: orig, - }); -} + // assume sRGB + r = r > 0.0031308 + ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) + : r * 12.92; + g = g > 0.0031308 + ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) + : g * 12.92; -/***/ }), + b = b > 0.0031308 + ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) + : b * 12.92; -/***/ 4670: -/***/ ((module) => { + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); -module.exports = register; + return [r * 255, g * 255, b * 255]; +}; -function register(state, name, method, options) { - if (typeof method !== "function") { - throw new Error("method for before hook must be a function"); - } +convert.xyz.lab = function (xyz) { + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; - if (!options) { - options = {}; - } + x /= 95.047; + y /= 100; + z /= 108.883; - if (Array.isArray(name)) { - return name.reverse().reduce(function (callback, name) { - return register.bind(null, state, name, callback, options); - }, method)(); - } + x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); - return Promise.resolve().then(function () { - if (!state.registry[name]) { - return method(options); - } + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); - return state.registry[name].reduce(function (method, registered) { - return registered.hook.bind(null, method, options); - }, method)(); - }); -} + return [l, a, b]; +}; +convert.lab.xyz = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var x; + var y; + var z; + + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; + + var y2 = Math.pow(y, 3); + var x2 = Math.pow(x, 3); + var z2 = Math.pow(z, 3); + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; + + x *= 95.047; + y *= 100; + z *= 108.883; + + return [x, y, z]; +}; -/***/ }), +convert.lab.lch = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var hr; + var h; + var c; -/***/ 6819: -/***/ ((module) => { + hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; -module.exports = removeHook; + if (h < 0) { + h += 360; + } -function removeHook(state, name, method) { - if (!state.registry[name]) { - return; - } + c = Math.sqrt(a * a + b * b); - var index = state.registry[name] - .map(function (registered) { - return registered.orig; - }) - .indexOf(method); + return [l, c, h]; +}; - if (index === -1) { - return; - } +convert.lch.lab = function (lch) { + var l = lch[0]; + var c = lch[1]; + var h = lch[2]; + var a; + var b; + var hr; - state.registry[name].splice(index, 1); -} + hr = h / 360 * 2 * Math.PI; + a = c * Math.cos(hr); + b = c * Math.sin(hr); + return [l, a, b]; +}; -/***/ }), +convert.rgb.ansi16 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; + var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization -/***/ 1174: -/***/ (function(module) { + value = Math.round(value / 50); -/** - * This file contains the Bottleneck library (MIT), compiled to ES2017, and without Clustering support. - * https://github.com/SGrondin/bottleneck - */ -(function (global, factory) { - true ? module.exports = factory() : - 0; -}(this, (function () { 'use strict'; + if (value === 0) { + return 30; + } - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + var ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); - function getCjsExportFromNamespace (n) { - return n && n['default'] || n; + if (value === 2) { + ansi += 60; } - var load = function(received, defaults, onto = {}) { - var k, ref, v; - for (k in defaults) { - v = defaults[k]; - onto[k] = (ref = received[k]) != null ? ref : v; - } - return onto; - }; + return ansi; +}; - var overwrite = function(received, defaults, onto = {}) { - var k, v; - for (k in received) { - v = received[k]; - if (defaults[k] !== void 0) { - onto[k] = v; - } - } - return onto; - }; +convert.hsv.ansi16 = function (args) { + // optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; - var parser = { - load: load, - overwrite: overwrite - }; +convert.rgb.ansi256 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; - var DLList; + // we use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } - DLList = class DLList { - constructor(incr, decr) { - this.incr = incr; - this.decr = decr; - this._first = null; - this._last = null; - this.length = 0; - } + if (r > 248) { + return 231; + } - push(value) { - var node; - this.length++; - if (typeof this.incr === "function") { - this.incr(); - } - node = { - value, - prev: this._last, - next: null - }; - if (this._last != null) { - this._last.next = node; - this._last = node; - } else { - this._first = this._last = node; - } - return void 0; - } + return Math.round(((r - 8) / 247) * 24) + 232; + } - shift() { - var value; - if (this._first == null) { - return; - } else { - this.length--; - if (typeof this.decr === "function") { - this.decr(); - } - } - value = this._first.value; - if ((this._first = this._first.next) != null) { - this._first.prev = null; - } else { - this._last = null; - } - return value; - } + var ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); - first() { - if (this._first != null) { - return this._first.value; - } - } + return ansi; +}; - getArray() { - var node, ref, results; - node = this._first; - results = []; - while (node != null) { - results.push((ref = node, node = node.next, ref.value)); - } - return results; - } +convert.ansi16.rgb = function (args) { + var color = args % 10; - forEachShift(cb) { - var node; - node = this.shift(); - while (node != null) { - (cb(node), node = this.shift()); - } - return void 0; - } + // handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } - debug() { - var node, ref, ref1, ref2, results; - node = this._first; - results = []; - while (node != null) { - results.push((ref = node, node = node.next, { - value: ref.value, - prev: (ref1 = ref.prev) != null ? ref1.value : void 0, - next: (ref2 = ref.next) != null ? ref2.value : void 0 - })); - } - return results; - } + color = color / 10.5 * 255; - }; + return [color, color, color]; + } - var DLList_1 = DLList; + var mult = (~~(args > 50) + 1) * 0.5; + var r = ((color & 1) * mult) * 255; + var g = (((color >> 1) & 1) * mult) * 255; + var b = (((color >> 2) & 1) * mult) * 255; - var Events; + return [r, g, b]; +}; - Events = class Events { - constructor(instance) { - this.instance = instance; - this._events = {}; - if ((this.instance.on != null) || (this.instance.once != null) || (this.instance.removeAllListeners != null)) { - throw new Error("An Emitter already exists for this object"); - } - this.instance.on = (name, cb) => { - return this._addListener(name, "many", cb); - }; - this.instance.once = (name, cb) => { - return this._addListener(name, "once", cb); - }; - this.instance.removeAllListeners = (name = null) => { - if (name != null) { - return delete this._events[name]; - } else { - return this._events = {}; - } - }; - } +convert.ansi256.rgb = function (args) { + // handle greyscale + if (args >= 232) { + var c = (args - 232) * 10 + 8; + return [c, c, c]; + } - _addListener(name, status, cb) { - var base; - if ((base = this._events)[name] == null) { - base[name] = []; - } - this._events[name].push({cb, status}); - return this.instance; - } + args -= 16; - listenerCount(name) { - if (this._events[name] != null) { - return this._events[name].length; - } else { - return 0; - } - } + var rem; + var r = Math.floor(args / 36) / 5 * 255; + var g = Math.floor((rem = args % 36) / 6) / 5 * 255; + var b = (rem % 6) / 5 * 255; - async trigger(name, ...args) { - var e, promises; - try { - if (name !== "debug") { - this.trigger("debug", `Event triggered: ${name}`, args); - } - if (this._events[name] == null) { - return; - } - this._events[name] = this._events[name].filter(function(listener) { - return listener.status !== "none"; - }); - promises = this._events[name].map(async(listener) => { - var e, returned; - if (listener.status === "none") { - return; - } - if (listener.status === "once") { - listener.status = "none"; - } - try { - returned = typeof listener.cb === "function" ? listener.cb(...args) : void 0; - if (typeof (returned != null ? returned.then : void 0) === "function") { - return (await returned); - } else { - return returned; - } - } catch (error) { - e = error; - { - this.trigger("error", e); - } - return null; - } - }); - return ((await Promise.all(promises))).find(function(x) { - return x != null; - }); - } catch (error) { - e = error; - { - this.trigger("error", e); - } - return null; - } - } + return [r, g, b]; +}; - }; +convert.rgb.hex = function (args) { + var integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); - var Events_1 = Events; + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; - var DLList$1, Events$1, Queues; +convert.hex.rgb = function (args) { + var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } - DLList$1 = DLList_1; + var colorString = match[0]; - Events$1 = Events_1; + if (match[0].length === 3) { + colorString = colorString.split('').map(function (char) { + return char + char; + }).join(''); + } - Queues = class Queues { - constructor(num_priorities) { - var i; - this.Events = new Events$1(this); - this._length = 0; - this._lists = (function() { - var j, ref, results; - results = []; - for (i = j = 1, ref = num_priorities; (1 <= ref ? j <= ref : j >= ref); i = 1 <= ref ? ++j : --j) { - results.push(new DLList$1((() => { - return this.incr(); - }), (() => { - return this.decr(); - }))); - } - return results; - }).call(this); - } + var integer = parseInt(colorString, 16); + var r = (integer >> 16) & 0xFF; + var g = (integer >> 8) & 0xFF; + var b = integer & 0xFF; + + return [r, g, b]; +}; + +convert.rgb.hcg = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var max = Math.max(Math.max(r, g), b); + var min = Math.min(Math.min(r, g), b); + var chroma = (max - min); + var grayscale; + var hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma + 4; + } + + hue /= 6; + hue %= 1; + + return [hue * 360, chroma * 100, grayscale * 100]; +}; - incr() { - if (this._length++ === 0) { - return this.Events.trigger("leftzero"); - } - } +convert.hsl.hcg = function (hsl) { + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var c = 1; + var f = 0; - decr() { - if (--this._length === 0) { - return this.Events.trigger("zero"); - } - } + if (l < 0.5) { + c = 2.0 * s * l; + } else { + c = 2.0 * s * (1.0 - l); + } - push(job) { - return this._lists[job.options.priority].push(job); - } + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } - queued(priority) { - if (priority != null) { - return this._lists[priority].length; - } else { - return this._length; - } - } + return [hsl[0], c * 100, f * 100]; +}; - shiftAll(fn) { - return this._lists.forEach(function(list) { - return list.forEachShift(fn); - }); - } +convert.hsv.hcg = function (hsv) { + var s = hsv[1] / 100; + var v = hsv[2] / 100; - getFirst(arr = this._lists) { - var j, len, list; - for (j = 0, len = arr.length; j < len; j++) { - list = arr[j]; - if (list.length > 0) { - return list; - } - } - return []; - } + var c = s * v; + var f = 0; - shiftLastFrom(priority) { - return this.getFirst(this._lists.slice(priority).reverse()).shift(); - } + if (c < 1.0) { + f = (v - c) / (1 - c); + } - }; + return [hsv[0], c * 100, f * 100]; +}; - var Queues_1 = Queues; +convert.hcg.rgb = function (hcg) { + var h = hcg[0] / 360; + var c = hcg[1] / 100; + var g = hcg[2] / 100; - var BottleneckError; + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } - BottleneckError = class BottleneckError extends Error {}; + var pure = [0, 0, 0]; + var hi = (h % 1) * 6; + var v = hi % 1; + var w = 1 - v; + var mg = 0; + + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } - var BottleneckError_1 = BottleneckError; + mg = (1.0 - c) * g; - var BottleneckError$1, DEFAULT_PRIORITY, Job, NUM_PRIORITIES, parser$1; + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; - NUM_PRIORITIES = 10; +convert.hcg.hsv = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; - DEFAULT_PRIORITY = 5; + var v = c + g * (1.0 - c); + var f = 0; - parser$1 = parser; + if (v > 0.0) { + f = c / v; + } - BottleneckError$1 = BottleneckError_1; + return [hcg[0], f * 100, v * 100]; +}; - Job = class Job { - constructor(task, args, options, jobDefaults, rejectOnDrop, Events, _states, Promise) { - this.task = task; - this.args = args; - this.rejectOnDrop = rejectOnDrop; - this.Events = Events; - this._states = _states; - this.Promise = Promise; - this.options = parser$1.load(options, jobDefaults); - this.options.priority = this._sanitizePriority(this.options.priority); - if (this.options.id === jobDefaults.id) { - this.options.id = `${this.options.id}-${this._randomIndex()}`; - } - this.promise = new this.Promise((_resolve, _reject) => { - this._resolve = _resolve; - this._reject = _reject; - }); - this.retryCount = 0; - } +convert.hcg.hsl = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; - _sanitizePriority(priority) { - var sProperty; - sProperty = ~~priority !== priority ? DEFAULT_PRIORITY : priority; - if (sProperty < 0) { - return 0; - } else if (sProperty > NUM_PRIORITIES - 1) { - return NUM_PRIORITIES - 1; - } else { - return sProperty; - } - } + var l = g * (1.0 - c) + 0.5 * c; + var s = 0; - _randomIndex() { - return Math.random().toString(36).slice(2); - } + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } - doDrop({error, message = "This job has been dropped by Bottleneck"} = {}) { - if (this._states.remove(this.options.id)) { - if (this.rejectOnDrop) { - this._reject(error != null ? error : new BottleneckError$1(message)); - } - this.Events.trigger("dropped", {args: this.args, options: this.options, task: this.task, promise: this.promise}); - return true; - } else { - return false; - } - } + return [hcg[0], s * 100, l * 100]; +}; - _assertStatus(expected) { - var status; - status = this._states.jobStatus(this.options.id); - if (!(status === expected || (expected === "DONE" && status === null))) { - throw new BottleneckError$1(`Invalid job status ${status}, expected ${expected}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`); - } - } +convert.hcg.hwb = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; - doReceive() { - this._states.start(this.options.id); - return this.Events.trigger("received", {args: this.args, options: this.options}); - } +convert.hwb.hcg = function (hwb) { + var w = hwb[1] / 100; + var b = hwb[2] / 100; + var v = 1 - b; + var c = v - w; + var g = 0; - doQueue(reachedHWM, blocked) { - this._assertStatus("RECEIVED"); - this._states.next(this.options.id); - return this.Events.trigger("queued", {args: this.args, options: this.options, reachedHWM, blocked}); - } + if (c < 1) { + g = (v - c) / (1 - c); + } - doRun() { - if (this.retryCount === 0) { - this._assertStatus("QUEUED"); - this._states.next(this.options.id); - } else { - this._assertStatus("EXECUTING"); - } - return this.Events.trigger("scheduled", {args: this.args, options: this.options}); - } + return [hwb[0], c * 100, g * 100]; +}; - async doExecute(chained, clearGlobalState, run, free) { - var error, eventInfo, passed; - if (this.retryCount === 0) { - this._assertStatus("RUNNING"); - this._states.next(this.options.id); - } else { - this._assertStatus("EXECUTING"); - } - eventInfo = {args: this.args, options: this.options, retryCount: this.retryCount}; - this.Events.trigger("executing", eventInfo); - try { - passed = (await (chained != null ? chained.schedule(this.options, this.task, ...this.args) : this.task(...this.args))); - if (clearGlobalState()) { - this.doDone(eventInfo); - await free(this.options, eventInfo); - this._assertStatus("DONE"); - return this._resolve(passed); - } - } catch (error1) { - error = error1; - return this._onFailure(error, eventInfo, clearGlobalState, run, free); - } - } +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; - doExpire(clearGlobalState, run, free) { - var error, eventInfo; - if (this._states.jobStatus(this.options.id === "RUNNING")) { - this._states.next(this.options.id); - } - this._assertStatus("EXECUTING"); - eventInfo = {args: this.args, options: this.options, retryCount: this.retryCount}; - error = new BottleneckError$1(`This job timed out after ${this.options.expiration} ms.`); - return this._onFailure(error, eventInfo, clearGlobalState, run, free); - } +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; - async _onFailure(error, eventInfo, clearGlobalState, run, free) { - var retry, retryAfter; - if (clearGlobalState()) { - retry = (await this.Events.trigger("failed", error, eventInfo)); - if (retry != null) { - retryAfter = ~~retry; - this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo); - this.retryCount++; - return run(retryAfter); - } else { - this.doDone(eventInfo); - await free(this.options, eventInfo); - this._assertStatus("DONE"); - return this._reject(error); - } - } - } +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; - doDone(eventInfo) { - this._assertStatus("EXECUTING"); - this._states.next(this.options.id); - return this.Events.trigger("done", eventInfo); - } +convert.gray.hsl = convert.gray.hsv = function (args) { + return [0, 0, args[0]]; +}; - }; +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; - var Job_1 = Job; +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; - var BottleneckError$2, LocalDatastore, parser$2; +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; - parser$2 = parser; +convert.gray.hex = function (gray) { + var val = Math.round(gray[0] / 100 * 255) & 0xFF; + var integer = (val << 16) + (val << 8) + val; - BottleneckError$2 = BottleneckError_1; + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; - LocalDatastore = class LocalDatastore { - constructor(instance, storeOptions, storeInstanceOptions) { - this.instance = instance; - this.storeOptions = storeOptions; - this.clientId = this.instance._randomIndex(); - parser$2.load(storeInstanceOptions, storeInstanceOptions, this); - this._nextRequest = this._lastReservoirRefresh = this._lastReservoirIncrease = Date.now(); - this._running = 0; - this._done = 0; - this._unblockTime = 0; - this.ready = this.Promise.resolve(); - this.clients = {}; - this._startHeartbeat(); - } +convert.rgb.gray = function (rgb) { + var val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; - _startHeartbeat() { - var base; - if ((this.heartbeat == null) && (((this.storeOptions.reservoirRefreshInterval != null) && (this.storeOptions.reservoirRefreshAmount != null)) || ((this.storeOptions.reservoirIncreaseInterval != null) && (this.storeOptions.reservoirIncreaseAmount != null)))) { - return typeof (base = (this.heartbeat = setInterval(() => { - var amount, incr, maximum, now, reservoir; - now = Date.now(); - if ((this.storeOptions.reservoirRefreshInterval != null) && now >= this._lastReservoirRefresh + this.storeOptions.reservoirRefreshInterval) { - this._lastReservoirRefresh = now; - this.storeOptions.reservoir = this.storeOptions.reservoirRefreshAmount; - this.instance._drainAll(this.computeCapacity()); - } - if ((this.storeOptions.reservoirIncreaseInterval != null) && now >= this._lastReservoirIncrease + this.storeOptions.reservoirIncreaseInterval) { - ({ - reservoirIncreaseAmount: amount, - reservoirIncreaseMaximum: maximum, - reservoir - } = this.storeOptions); - this._lastReservoirIncrease = now; - incr = maximum != null ? Math.min(amount, maximum - reservoir) : amount; - if (incr > 0) { - this.storeOptions.reservoir += incr; - return this.instance._drainAll(this.computeCapacity()); - } - } - }, this.heartbeatInterval))).unref === "function" ? base.unref() : void 0; - } else { - return clearInterval(this.heartbeat); - } - } - async __publish__(message) { - await this.yieldLoop(); - return this.instance.Events.trigger("message", message.toString()); - } +/***/ }), - async __disconnect__(flush) { - await this.yieldLoop(); - clearInterval(this.heartbeat); - return this.Promise.resolve(); - } +/***/ 6931: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - yieldLoop(t = 0) { - return new this.Promise(function(resolve, reject) { - return setTimeout(resolve, t); - }); - } +var conversions = __nccwpck_require__(7391); +var route = __nccwpck_require__(880); - computePenalty() { - var ref; - return (ref = this.storeOptions.penalty) != null ? ref : (15 * this.storeOptions.minTime) || 5000; - } +var convert = {}; - async __updateSettings__(options) { - await this.yieldLoop(); - parser$2.overwrite(options, options, this.storeOptions); - this._startHeartbeat(); - this.instance._drainAll(this.computeCapacity()); - return true; - } +var models = Object.keys(conversions); - async __running__() { - await this.yieldLoop(); - return this._running; - } +function wrapRaw(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } - async __queued__() { - await this.yieldLoop(); - return this.instance.queued(); - } + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } - async __done__() { - await this.yieldLoop(); - return this._done; - } + return fn(args); + }; - async __groupCheck__(time) { - await this.yieldLoop(); - return (this._nextRequest + this.timeout) < time; - } + // preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } - computeCapacity() { - var maxConcurrent, reservoir; - ({maxConcurrent, reservoir} = this.storeOptions); - if ((maxConcurrent != null) && (reservoir != null)) { - return Math.min(maxConcurrent - this._running, reservoir); - } else if (maxConcurrent != null) { - return maxConcurrent - this._running; - } else if (reservoir != null) { - return reservoir; - } else { - return null; - } - } + return wrappedFn; +} - conditionsCheck(weight) { - var capacity; - capacity = this.computeCapacity(); - return (capacity == null) || weight <= capacity; - } +function wrapRounded(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } - async __incrementReservoir__(incr) { - var reservoir; - await this.yieldLoop(); - reservoir = this.storeOptions.reservoir += incr; - this.instance._drainAll(this.computeCapacity()); - return reservoir; - } + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } - async __currentReservoir__() { - await this.yieldLoop(); - return this.storeOptions.reservoir; - } + var result = fn(args); - isBlocked(now) { - return this._unblockTime >= now; - } + // we're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (var len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } - check(weight, now) { - return this.conditionsCheck(weight) && (this._nextRequest - now) <= 0; - } + return result; + }; - async __check__(weight) { - var now; - await this.yieldLoop(); - now = Date.now(); - return this.check(weight, now); - } + // preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } - async __register__(index, weight, expiration) { - var now, wait; - await this.yieldLoop(); - now = Date.now(); - if (this.conditionsCheck(weight)) { - this._running += weight; - if (this.storeOptions.reservoir != null) { - this.storeOptions.reservoir -= weight; - } - wait = Math.max(this._nextRequest - now, 0); - this._nextRequest = now + wait + this.storeOptions.minTime; - return { - success: true, - wait, - reservoir: this.storeOptions.reservoir - }; - } else { - return { - success: false - }; - } - } + return wrappedFn; +} - strategyIsBlock() { - return this.storeOptions.strategy === 3; - } +models.forEach(function (fromModel) { + convert[fromModel] = {}; - async __submit__(queueLength, weight) { - var blocked, now, reachedHWM; - await this.yieldLoop(); - if ((this.storeOptions.maxConcurrent != null) && weight > this.storeOptions.maxConcurrent) { - throw new BottleneckError$2(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${this.storeOptions.maxConcurrent}`); - } - now = Date.now(); - reachedHWM = (this.storeOptions.highWater != null) && queueLength === this.storeOptions.highWater && !this.check(weight, now); - blocked = this.strategyIsBlock() && (reachedHWM || this.isBlocked(now)); - if (blocked) { - this._unblockTime = now + this.computePenalty(); - this._nextRequest = this._unblockTime + this.storeOptions.minTime; - this.instance._dropAllQueued(); - } - return { - reachedHWM, - blocked, - strategy: this.storeOptions.strategy - }; - } + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); - async __free__(index, weight) { - await this.yieldLoop(); - this._running -= weight; - this._done += weight; - this.instance._drainAll(this.computeCapacity()); - return { - running: this._running - }; - } + var routes = route(fromModel); + var routeModels = Object.keys(routes); - }; + routeModels.forEach(function (toModel) { + var fn = routes[toModel]; - var LocalDatastore_1 = LocalDatastore; + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); - var BottleneckError$3, States; +module.exports = convert; - BottleneckError$3 = BottleneckError_1; - States = class States { - constructor(status1) { - this.status = status1; - this._jobs = {}; - this.counts = this.status.map(function() { - return 0; - }); - } +/***/ }), - next(id) { - var current, next; - current = this._jobs[id]; - next = current + 1; - if ((current != null) && next < this.status.length) { - this.counts[current]--; - this.counts[next]++; - return this._jobs[id]++; - } else if (current != null) { - this.counts[current]--; - return delete this._jobs[id]; - } - } +/***/ 880: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - start(id) { - var initial; - initial = 0; - this._jobs[id] = initial; - return this.counts[initial]++; - } +var conversions = __nccwpck_require__(7391); - remove(id) { - var current; - current = this._jobs[id]; - if (current != null) { - this.counts[current]--; - delete this._jobs[id]; - } - return current != null; - } +/* + this function routes a model to all other models. - jobStatus(id) { - var ref; - return (ref = this.status[this._jobs[id]]) != null ? ref : null; - } + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). - statusJobs(status) { - var k, pos, ref, results, v; - if (status != null) { - pos = this.status.indexOf(status); - if (pos < 0) { - throw new BottleneckError$3(`status must be one of ${this.status.join(', ')}`); - } - ref = this._jobs; - results = []; - for (k in ref) { - v = ref[k]; - if (v === pos) { - results.push(k); - } - } - return results; - } else { - return Object.keys(this._jobs); - } - } + conversions that are not possible simply are not included. +*/ - statusCounts() { - return this.counts.reduce(((acc, v, i) => { - acc[this.status[i]] = v; - return acc; - }), {}); - } +function buildGraph() { + var graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + var models = Object.keys(conversions); - }; + for (var len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } - var States_1 = States; + return graph; +} - var DLList$2, Sync; +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + var graph = buildGraph(); + var queue = [fromModel]; // unshift -> queue -> pop - DLList$2 = DLList_1; + graph[fromModel].distance = 0; - Sync = class Sync { - constructor(name, Promise) { - this.schedule = this.schedule.bind(this); - this.name = name; - this.Promise = Promise; - this._running = 0; - this._queue = new DLList$2(); - } + while (queue.length) { + var current = queue.pop(); + var adjacents = Object.keys(conversions[current]); - isEmpty() { - return this._queue.length === 0; - } + for (var len = adjacents.length, i = 0; i < len; i++) { + var adjacent = adjacents[i]; + var node = graph[adjacent]; - async _tryToRun() { - var args, cb, error, reject, resolve, returned, task; - if ((this._running < 1) && this._queue.length > 0) { - this._running++; - ({task, args, resolve, reject} = this._queue.shift()); - cb = (await (async function() { - try { - returned = (await task(...args)); - return function() { - return resolve(returned); - }; - } catch (error1) { - error = error1; - return function() { - return reject(error); - }; - } - })()); - this._running--; - this._tryToRun(); - return cb(); - } - } + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } - schedule(task, ...args) { - var promise, reject, resolve; - resolve = reject = null; - promise = new this.Promise(function(_resolve, _reject) { - resolve = _resolve; - return reject = _reject; - }); - this._queue.push({task, args, resolve, reject}); - this._tryToRun(); - return promise; - } + return graph; +} +function link(from, to) { + return function (args) { + return to(from(args)); }; +} - var Sync_1 = Sync; +function wrapConversion(toModel, graph) { + var path = [graph[toModel].parent, toModel]; + var fn = conversions[graph[toModel].parent][toModel]; - var version = "2.19.5"; - var version$1 = { - version: version - }; + var cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } - var version$2 = /*#__PURE__*/Object.freeze({ - version: version, - default: version$1 - }); + fn.conversion = path; + return fn; +} - var require$$2 = () => console.log('You must import the full version of Bottleneck in order to use this feature.'); +module.exports = function (fromModel) { + var graph = deriveBFS(fromModel); + var conversion = {}; - var require$$3 = () => console.log('You must import the full version of Bottleneck in order to use this feature.'); + var models = Object.keys(graph); + for (var len = models.length, i = 0; i < len; i++) { + var toModel = models[i]; + var node = graph[toModel]; - var require$$4 = () => console.log('You must import the full version of Bottleneck in order to use this feature.'); + if (node.parent === null) { + // no possible conversion, or this node is the source model. + continue; + } - var Events$2, Group, IORedisConnection$1, RedisConnection$1, Scripts$1, parser$3; + conversion[toModel] = wrapConversion(toModel, graph); + } - parser$3 = parser; + return conversion; +}; - Events$2 = Events_1; - RedisConnection$1 = require$$2; - IORedisConnection$1 = require$$3; +/***/ }), - Scripts$1 = require$$4; +/***/ 8510: +/***/ ((module) => { - Group = (function() { - class Group { - constructor(limiterOptions = {}) { - this.deleteKey = this.deleteKey.bind(this); - this.limiterOptions = limiterOptions; - parser$3.load(this.limiterOptions, this.defaults, this); - this.Events = new Events$2(this); - this.instances = {}; - this.Bottleneck = Bottleneck_1; - this._startAutoCleanup(); - this.sharedConnection = this.connection != null; - if (this.connection == null) { - if (this.limiterOptions.datastore === "redis") { - this.connection = new RedisConnection$1(Object.assign({}, this.limiterOptions, {Events: this.Events})); - } else if (this.limiterOptions.datastore === "ioredis") { - this.connection = new IORedisConnection$1(Object.assign({}, this.limiterOptions, {Events: this.Events})); - } - } - } +"use strict"; + + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; - key(key = "") { - var ref; - return (ref = this.instances[key]) != null ? ref : (() => { - var limiter; - limiter = this.instances[key] = new this.Bottleneck(Object.assign(this.limiterOptions, { - id: `${this.id}-${key}`, - timeout: this.timeout, - connection: this.connection - })); - this.Events.trigger("created", limiter, key); - return limiter; - })(); - } - async deleteKey(key = "") { - var deleted, instance; - instance = this.instances[key]; - if (this.connection) { - deleted = (await this.connection.__runCommand__(['del', ...Scripts$1.allKeys(`${this.id}-${key}`)])); - } - if (instance != null) { - delete this.instances[key]; - await instance.disconnect(); - } - return (instance != null) || deleted > 0; - } +/***/ }), - limiters() { - var k, ref, results, v; - ref = this.instances; - results = []; - for (k in ref) { - v = ref[k]; - results.push({ - key: k, - limiter: v - }); - } - return results; - } +/***/ 8222: +/***/ ((module, exports, __nccwpck_require__) => { - keys() { - return Object.keys(this.instances); - } +/* eslint-env browser */ - async clusterKeys() { - var cursor, end, found, i, k, keys, len, next, start; - if (this.connection == null) { - return this.Promise.resolve(this.keys()); - } - keys = []; - cursor = null; - start = `b_${this.id}-`.length; - end = "_settings".length; - while (cursor !== 0) { - [next, found] = (await this.connection.__runCommand__(["scan", cursor != null ? cursor : 0, "match", `b_${this.id}-*_settings`, "count", 10000])); - cursor = ~~next; - for (i = 0, len = found.length; i < len; i++) { - k = found[i]; - keys.push(k.slice(start, -end)); - } - } - return keys; - } +/** + * This is the web browser implementation of `debug()`. + */ - _startAutoCleanup() { - var base; - clearInterval(this.interval); - return typeof (base = (this.interval = setInterval(async() => { - var e, k, ref, results, time, v; - time = Date.now(); - ref = this.instances; - results = []; - for (k in ref) { - v = ref[k]; - try { - if ((await v._store.__groupCheck__(time))) { - results.push(this.deleteKey(k)); - } else { - results.push(void 0); - } - } catch (error) { - e = error; - results.push(v.Events.trigger("error", e)); - } - } - return results; - }, this.timeout / 2))).unref === "function" ? base.unref() : void 0; - } +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); - updateSettings(options = {}) { - parser$3.overwrite(options, this.defaults, this); - parser$3.overwrite(options, options, this.limiterOptions); - if (options.timeout != null) { - return this._startAutoCleanup(); - } - } +/** + * Colors. + */ - disconnect(flush = true) { - var ref; - if (!this.sharedConnection) { - return (ref = this.connection) != null ? ref.disconnect(flush) : void 0; - } - } +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; - } - Group.prototype.defaults = { - timeout: 1000 * 60 * 5, - connection: null, - Promise: Promise, - id: "group-key" - }; +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ - return Group; +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } - }).call(commonjsGlobal); + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } - var Group_1 = Group; + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} - var Batcher, Events$3, parser$4; +/** + * Colorize log arguments if enabled. + * + * @api public + */ - parser$4 = parser; +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); - Events$3 = Events_1; + if (!this.useColors) { + return; + } - Batcher = (function() { - class Batcher { - constructor(options = {}) { - this.options = options; - parser$4.load(this.options, this.defaults, this); - this.Events = new Events$3(this); - this._arr = []; - this._resetPromise(); - this._lastFlush = Date.now(); - } + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); - _resetPromise() { - return this._promise = new this.Promise((res, rej) => { - return this._resolve = res; - }); - } + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); - _flush() { - clearTimeout(this._timeout); - this._lastFlush = Date.now(); - this._resolve(); - this.Events.trigger("batch", this._arr); - this._arr = []; - return this._resetPromise(); - } + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = __nccwpck_require__(6243)(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ - add(data) { - var ret; - this._arr.push(data); - ret = this._promise; - if (this._arr.length === this.maxSize) { - this._flush(); - } else if ((this.maxTime != null) && this._arr.length === 1) { - this._timeout = setTimeout(() => { - return this._flush(); - }, this.maxTime); - } - return ret; - } +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; - } - Batcher.prototype.defaults = { - maxTime: null, - maxSize: null, - Promise: Promise - }; - return Batcher; +/***/ }), - }).call(commonjsGlobal); +/***/ 6243: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - var Batcher_1 = Batcher; - var require$$4$1 = () => console.log('You must import the full version of Bottleneck in order to use this feature.'); +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ - var require$$8 = getCjsExportFromNamespace(version$2); +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __nccwpck_require__(900); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); - var Bottleneck, DEFAULT_PRIORITY$1, Events$4, Job$1, LocalDatastore$1, NUM_PRIORITIES$1, Queues$1, RedisDatastore$1, States$1, Sync$1, parser$5, - splice = [].splice; + /** + * The currently active debug mode names, and names to skip. + */ - NUM_PRIORITIES$1 = 10; + createDebug.names = []; + createDebug.skips = []; - DEFAULT_PRIORITY$1 = 5; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; - parser$5 = parser; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } - Queues$1 = Queues_1; + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; - Job$1 = Job_1; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } - LocalDatastore$1 = LocalDatastore_1; + const self = debug; - RedisDatastore$1 = require$$4$1; + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; - Events$4 = Events_1; + args[0] = createDebug.coerce(args[0]); - States$1 = States_1; + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } - Sync$1 = Sync_1; + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); - Bottleneck = (function() { - class Bottleneck { - constructor(options = {}, ...invalid) { - var storeInstanceOptions, storeOptions; - this._addToQueue = this._addToQueue.bind(this); - this._validateOptions(options, invalid); - parser$5.load(options, this.instanceDefaults, this); - this._queues = new Queues$1(NUM_PRIORITIES$1); - this._scheduled = {}; - this._states = new States$1(["RECEIVED", "QUEUED", "RUNNING", "EXECUTING"].concat(this.trackDoneStatus ? ["DONE"] : [])); - this._limiter = null; - this.Events = new Events$4(this); - this._submitLock = new Sync$1("submit", this.Promise); - this._registerLock = new Sync$1("register", this.Promise); - storeOptions = parser$5.load(options, this.storeDefaults, {}); - this._store = (function() { - if (this.datastore === "redis" || this.datastore === "ioredis" || (this.connection != null)) { - storeInstanceOptions = parser$5.load(options, this.redisStoreDefaults, {}); - return new RedisDatastore$1(this, storeOptions, storeInstanceOptions); - } else if (this.datastore === "local") { - storeInstanceOptions = parser$5.load(options, this.localStoreDefaults, {}); - return new LocalDatastore$1(this, storeOptions, storeInstanceOptions); - } else { - throw new Bottleneck.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`); - } - }).call(this); - this._queues.on("leftzero", () => { - var ref; - return (ref = this._store.heartbeat) != null ? typeof ref.ref === "function" ? ref.ref() : void 0 : void 0; - }); - this._queues.on("zero", () => { - var ref; - return (ref = this._store.heartbeat) != null ? typeof ref.unref === "function" ? ref.unref() : void 0 : void 0; - }); - } + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); - _validateOptions(options, invalid) { - if (!((options != null) && typeof options === "object" && invalid.length === 0)) { - throw new Bottleneck.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1."); - } - } + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } - ready() { - return this._store.ready; - } + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } - clients() { - return this._store.clients; - } + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); - channel() { - return `b_${this.id}`; - } + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } - channel_client() { - return `b_${this.id}_${this._store.clientId}`; - } + return debug; + } - publish(message) { - return this._store.__publish__(message); - } + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } - disconnect(flush = true) { - return this._store.__disconnect__(flush); - } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } - chain(_limiter) { - this._limiter = _limiter; - return this; - } + namespaces = split[i].replace(/\*/g, '.*?'); - queued(priority) { - return this._queues.queued(priority); - } + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } - clusterQueued() { - return this._store.__queued__(); - } + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } - empty() { - return this.queued() === 0 && this._submitLock.isEmpty(); - } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } - running() { - return this._store.__running__(); - } + let i; + let len; - done() { - return this._store.__done__(); - } + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } - jobStatus(id) { - return this._states.jobStatus(id); - } + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } - jobs(status) { - return this._states.statusJobs(status); - } + return false; + } - counts() { - return this._states.statusCounts(); - } + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } - _randomIndex() { - return Math.random().toString(36).slice(2); - } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } - check(weight = 1) { - return this._store.__check__(weight); - } + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } - _clearGlobalState(index) { - if (this._scheduled[index] != null) { - clearTimeout(this._scheduled[index].expiration); - delete this._scheduled[index]; - return true; - } else { - return false; - } - } + createDebug.enable(createDebug.load()); - async _free(index, job, options, eventInfo) { - var e, running; - try { - ({running} = (await this._store.__free__(index, options.weight))); - this.Events.trigger("debug", `Freed ${options.id}`, eventInfo); - if (running === 0 && this.empty()) { - return this.Events.trigger("idle"); - } - } catch (error1) { - e = error1; - return this.Events.trigger("error", e); - } - } + return createDebug; +} - _run(index, job, wait) { - var clearGlobalState, free, run; - job.doRun(); - clearGlobalState = this._clearGlobalState.bind(this, index); - run = this._run.bind(this, index, job); - free = this._free.bind(this, index, job); - return this._scheduled[index] = { - timeout: setTimeout(() => { - return job.doExecute(this._limiter, clearGlobalState, run, free); - }, wait), - expiration: job.options.expiration != null ? setTimeout(function() { - return job.doExpire(clearGlobalState, run, free); - }, wait + job.options.expiration) : void 0, - job: job - }; - } +module.exports = setup; - _drainOne(capacity) { - return this._registerLock.schedule(() => { - var args, index, next, options, queue; - if (this.queued() === 0) { - return this.Promise.resolve(null); - } - queue = this._queues.getFirst(); - ({options, args} = next = queue.first()); - if ((capacity != null) && options.weight > capacity) { - return this.Promise.resolve(null); - } - this.Events.trigger("debug", `Draining ${options.id}`, {args, options}); - index = this._randomIndex(); - return this._store.__register__(index, options.weight, options.expiration).then(({success, wait, reservoir}) => { - var empty; - this.Events.trigger("debug", `Drained ${options.id}`, {success, args, options}); - if (success) { - queue.shift(); - empty = this.empty(); - if (empty) { - this.Events.trigger("empty"); - } - if (reservoir === 0) { - this.Events.trigger("depleted", empty); - } - this._run(index, next, wait); - return this.Promise.resolve(options.weight); - } else { - return this.Promise.resolve(null); - } - }); - }); - } - _drainAll(capacity, total = 0) { - return this._drainOne(capacity).then((drained) => { - var newCapacity; - if (drained != null) { - newCapacity = capacity != null ? capacity - drained : capacity; - return this._drainAll(newCapacity, total + drained); - } else { - return this.Promise.resolve(total); - } - }).catch((e) => { - return this.Events.trigger("error", e); - }); - } +/***/ }), + +/***/ 8237: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __nccwpck_require__(8222); +} else { + module.exports = __nccwpck_require__(5332); +} - _dropAllQueued(message) { - return this._queues.shiftAll(function(job) { - return job.doDrop({message}); - }); - } - stop(options = {}) { - var done, waitForExecuting; - options = parser$5.load(options, this.stopDefaults); - waitForExecuting = (at) => { - var finished; - finished = () => { - var counts; - counts = this._states.counts; - return (counts[0] + counts[1] + counts[2] + counts[3]) === at; - }; - return new this.Promise((resolve, reject) => { - if (finished()) { - return resolve(); - } else { - return this.on("done", () => { - if (finished()) { - this.removeAllListeners("done"); - return resolve(); - } - }); - } - }); - }; - done = options.dropWaitingJobs ? (this._run = function(index, next) { - return next.doDrop({ - message: options.dropErrorMessage - }); - }, this._drainOne = () => { - return this.Promise.resolve(null); - }, this._registerLock.schedule(() => { - return this._submitLock.schedule(() => { - var k, ref, v; - ref = this._scheduled; - for (k in ref) { - v = ref[k]; - if (this.jobStatus(v.job.options.id) === "RUNNING") { - clearTimeout(v.timeout); - clearTimeout(v.expiration); - v.job.doDrop({ - message: options.dropErrorMessage - }); - } - } - this._dropAllQueued(options.dropErrorMessage); - return waitForExecuting(0); - }); - })) : this.schedule({ - priority: NUM_PRIORITIES$1 - 1, - weight: 0 - }, () => { - return waitForExecuting(1); - }); - this._receive = function(job) { - return job._reject(new Bottleneck.prototype.BottleneckError(options.enqueueErrorMessage)); - }; - this.stop = () => { - return this.Promise.reject(new Bottleneck.prototype.BottleneckError("stop() has already been called")); - }; - return done; - } +/***/ }), - async _addToQueue(job) { - var args, blocked, error, options, reachedHWM, shifted, strategy; - ({args, options} = job); - try { - ({reachedHWM, blocked, strategy} = (await this._store.__submit__(this.queued(), options.weight))); - } catch (error1) { - error = error1; - this.Events.trigger("debug", `Could not queue ${options.id}`, {args, options, error}); - job.doDrop({error}); - return false; - } - if (blocked) { - job.doDrop(); - return true; - } else if (reachedHWM) { - shifted = strategy === Bottleneck.prototype.strategy.LEAK ? this._queues.shiftLastFrom(options.priority) : strategy === Bottleneck.prototype.strategy.OVERFLOW_PRIORITY ? this._queues.shiftLastFrom(options.priority + 1) : strategy === Bottleneck.prototype.strategy.OVERFLOW ? job : void 0; - if (shifted != null) { - shifted.doDrop(); - } - if ((shifted == null) || strategy === Bottleneck.prototype.strategy.OVERFLOW) { - if (shifted == null) { - job.doDrop(); - } - return reachedHWM; - } - } - job.doQueue(reachedHWM, blocked); - this._queues.push(job); - await this._drainAll(); - return reachedHWM; - } +/***/ 5332: +/***/ ((module, exports, __nccwpck_require__) => { - _receive(job) { - if (this._states.jobStatus(job.options.id) != null) { - job._reject(new Bottleneck.prototype.BottleneckError(`A job with the same id already exists (id=${job.options.id})`)); - return false; - } else { - job.doReceive(); - return this._submitLock.schedule(this._addToQueue, job); - } - } +/** + * Module dependencies. + */ - submit(...args) { - var cb, fn, job, options, ref, ref1, task; - if (typeof args[0] === "function") { - ref = args, [fn, ...args] = ref, [cb] = splice.call(args, -1); - options = parser$5.load({}, this.jobDefaults); - } else { - ref1 = args, [options, fn, ...args] = ref1, [cb] = splice.call(args, -1); - options = parser$5.load(options, this.jobDefaults); - } - task = (...args) => { - return new this.Promise(function(resolve, reject) { - return fn(...args, function(...args) { - return (args[0] != null ? reject : resolve)(args); - }); - }); - }; - job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise); - job.promise.then(function(args) { - return typeof cb === "function" ? cb(...args) : void 0; - }).catch(function(args) { - if (Array.isArray(args)) { - return typeof cb === "function" ? cb(...args) : void 0; - } else { - return typeof cb === "function" ? cb(args) : void 0; - } - }); - return this._receive(job); - } +const tty = __nccwpck_require__(3867); +const util = __nccwpck_require__(1669); - schedule(...args) { - var job, options, task; - if (typeof args[0] === "function") { - [task, ...args] = args; - options = {}; - } else { - [options, task, ...args] = args; - } - job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise); - this._receive(job); - return job.promise; - } +/** + * This is the Node.js implementation of `debug()`. + */ - wrap(fn) { - var schedule, wrapped; - schedule = this.schedule.bind(this); - wrapped = function(...args) { - return schedule(fn.bind(this), ...args); - }; - wrapped.withOptions = function(options, ...args) { - return schedule(options, fn, ...args); - }; - return wrapped; - } +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); - async updateSettings(options = {}) { - await this._store.__updateSettings__(parser$5.overwrite(options, this.storeDefaults)); - parser$5.overwrite(options, this.instanceDefaults, this); - return this; - } +/** + * Colors. + */ - currentReservoir() { - return this._store.__currentReservoir__(); - } +exports.colors = [6, 2, 3, 4, 5, 1]; - incrementReservoir(incr = 0) { - return this._store.__incrementReservoir__(incr); - } +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __nccwpck_require__(9318); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} - } - Bottleneck.default = Bottleneck; +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ - Bottleneck.Events = Events$4; +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); - Bottleneck.version = Bottleneck.prototype.version = require$$8.version; + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } - Bottleneck.strategy = Bottleneck.prototype.strategy = { - LEAK: 1, - OVERFLOW: 2, - OVERFLOW_PRIORITY: 4, - BLOCK: 3 - }; + obj[prop] = val; + return obj; +}, {}); - Bottleneck.BottleneckError = Bottleneck.prototype.BottleneckError = BottleneckError_1; +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ - Bottleneck.Group = Bottleneck.prototype.Group = Group_1; +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} - Bottleneck.RedisConnection = Bottleneck.prototype.RedisConnection = require$$2; +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ - Bottleneck.IORedisConnection = Bottleneck.prototype.IORedisConnection = require$$3; +function formatArgs(args) { + const {namespace: name, useColors} = this; - Bottleneck.Batcher = Bottleneck.prototype.Batcher = Batcher_1; + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; - Bottleneck.prototype.jobDefaults = { - priority: DEFAULT_PRIORITY$1, - weight: 1, - expiration: null, - id: "" - }; + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} - Bottleneck.prototype.storeDefaults = { - maxConcurrent: null, - minTime: 0, - highWater: null, - strategy: Bottleneck.prototype.strategy.LEAK, - penalty: null, - reservoir: null, - reservoirRefreshInterval: null, - reservoirRefreshAmount: null, - reservoirIncreaseInterval: null, - reservoirIncreaseAmount: null, - reservoirIncreaseMaximum: null - }; +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} - Bottleneck.prototype.localStoreDefaults = { - Promise: Promise, - timeout: null, - heartbeatInterval: 250 - }; +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ - Bottleneck.prototype.redisStoreDefaults = { - Promise: Promise, - timeout: null, - heartbeatInterval: 5000, - clientTimeout: 10000, - Redis: null, - clientOptions: {}, - clusterNodes: null, - clearDatastore: false, - connection: null - }; +function load() { + return process.env.DEBUG; +} - Bottleneck.prototype.instanceDefaults = { - datastore: "local", - connection: null, - id: "", - rejectOnDrop: true, - trackDoneStatus: false, - Promise: Promise - }; +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ - Bottleneck.prototype.stopDefaults = { - enqueueErrorMessage: "This limiter has been stopped and cannot accept new jobs.", - dropWaitingJobs: true, - dropErrorMessage: "This limiter has been stopped." - }; +function init(debug) { + debug.inspectOpts = {}; - return Bottleneck; + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} - }).call(commonjsGlobal); +module.exports = __nccwpck_require__(6243)(exports); - var Bottleneck_1 = Bottleneck; +const {formatters} = module.exports; - var lib = Bottleneck_1; +/** + * Map %o to `util.inspect()`, all on a single line. + */ - return lib; +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; -}))); +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; /***/ }), @@ -7222,6 +51956,32 @@ function checkEncoding(name) { } +/***/ }), + +/***/ 455: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = __nccwpck_require__(8047); + + +/***/ }), + +/***/ 1621: +/***/ ((module) => { + +"use strict"; + +module.exports = (flag, argv) => { + argv = argv || process.argv; + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const pos = argv.indexOf(prefix + flag); + const terminatorPos = argv.indexOf('--'); + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; + + /***/ }), /***/ 9695: @@ -8796,2927 +53556,20511 @@ module.exports = { "type": "_sbcs", "chars": "���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" } -} +} + +/***/ }), + +/***/ 1080: +/***/ ((module) => { + +"use strict"; + + +// Manually added data to be used by sbcs codec in addition to generated one. + +module.exports = { + // Not supported by iconv, not sure why. + "10029": "maccenteuro", + "maccenteuro": { + "type": "_sbcs", + "chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ" + }, + + "808": "cp808", + "ibm808": "cp808", + "cp808": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ " + }, + + "mik": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + + "cp720": { + "type": "_sbcs", + "chars": "\x80\x81éâ\x84à\x86çêëèïî\x8d\x8e\x8f\x90\u0651\u0652ô¤ـûùءآأؤ£إئابةتثجحخدذرزسشص«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ضطظعغفµقكلمنهوىي≡\u064b\u064c\u064d\u064e\u064f\u0650≈°∙·√ⁿ²■\u00a0" + }, + + // Aliases of generated encodings. + "ascii8bit": "ascii", + "usascii": "ascii", + "ansix34": "ascii", + "ansix341968": "ascii", + "ansix341986": "ascii", + "csascii": "ascii", + "cp367": "ascii", + "ibm367": "ascii", + "isoir6": "ascii", + "iso646us": "ascii", + "iso646irv": "ascii", + "us": "ascii", + + "latin1": "iso88591", + "latin2": "iso88592", + "latin3": "iso88593", + "latin4": "iso88594", + "latin5": "iso88599", + "latin6": "iso885910", + "latin7": "iso885913", + "latin8": "iso885914", + "latin9": "iso885915", + "latin10": "iso885916", + + "csisolatin1": "iso88591", + "csisolatin2": "iso88592", + "csisolatin3": "iso88593", + "csisolatin4": "iso88594", + "csisolatincyrillic": "iso88595", + "csisolatinarabic": "iso88596", + "csisolatingreek" : "iso88597", + "csisolatinhebrew": "iso88598", + "csisolatin5": "iso88599", + "csisolatin6": "iso885910", + + "l1": "iso88591", + "l2": "iso88592", + "l3": "iso88593", + "l4": "iso88594", + "l5": "iso88599", + "l6": "iso885910", + "l7": "iso885913", + "l8": "iso885914", + "l9": "iso885915", + "l10": "iso885916", + + "isoir14": "iso646jp", + "isoir57": "iso646cn", + "isoir100": "iso88591", + "isoir101": "iso88592", + "isoir109": "iso88593", + "isoir110": "iso88594", + "isoir144": "iso88595", + "isoir127": "iso88596", + "isoir126": "iso88597", + "isoir138": "iso88598", + "isoir148": "iso88599", + "isoir157": "iso885910", + "isoir166": "tis620", + "isoir179": "iso885913", + "isoir199": "iso885914", + "isoir203": "iso885915", + "isoir226": "iso885916", + + "cp819": "iso88591", + "ibm819": "iso88591", + + "cyrillic": "iso88595", + + "arabic": "iso88596", + "arabic8": "iso88596", + "ecma114": "iso88596", + "asmo708": "iso88596", + + "greek" : "iso88597", + "greek8" : "iso88597", + "ecma118" : "iso88597", + "elot928" : "iso88597", + + "hebrew": "iso88598", + "hebrew8": "iso88598", + + "turkish": "iso88599", + "turkish8": "iso88599", + + "thai": "iso885911", + "thai8": "iso885911", + + "celtic": "iso885914", + "celtic8": "iso885914", + "isoceltic": "iso885914", + + "tis6200": "tis620", + "tis62025291": "tis620", + "tis62025330": "tis620", + + "10000": "macroman", + "10006": "macgreek", + "10007": "maccyrillic", + "10079": "maciceland", + "10081": "macturkish", + + "cspc8codepage437": "cp437", + "cspc775baltic": "cp775", + "cspc850multilingual": "cp850", + "cspcp852": "cp852", + "cspc862latinhebrew": "cp862", + "cpgr": "cp869", + + "msee": "cp1250", + "mscyrl": "cp1251", + "msansi": "cp1252", + "msgreek": "cp1253", + "msturk": "cp1254", + "mshebr": "cp1255", + "msarab": "cp1256", + "winbaltrim": "cp1257", + + "cp20866": "koi8r", + "20866": "koi8r", + "ibm878": "koi8r", + "cskoi8r": "koi8r", + + "cp21866": "koi8u", + "21866": "koi8u", + "ibm1168": "koi8u", + + "strk10482002": "rk1048", + + "tcvn5712": "tcvn", + "tcvn57121": "tcvn", + + "gb198880": "iso646cn", + "cn": "iso646cn", + + "csiso14jisc6220ro": "iso646jp", + "jisc62201969ro": "iso646jp", + "jp": "iso646jp", + + "cshproman8": "hproman8", + "r8": "hproman8", + "roman8": "hproman8", + "xroman8": "hproman8", + "ibm1051": "hproman8", + + "mac": "macintosh", + "csmacintosh": "macintosh", +}; + + + +/***/ }), + +/***/ 1155: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +var Buffer = __nccwpck_require__(5118).Buffer; + +// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js + +// == UTF16-BE codec. ========================================================== + +exports.utf16be = Utf16BECodec; +function Utf16BECodec() { +} + +Utf16BECodec.prototype.encoder = Utf16BEEncoder; +Utf16BECodec.prototype.decoder = Utf16BEDecoder; +Utf16BECodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf16BEEncoder() { +} + +Utf16BEEncoder.prototype.write = function(str) { + var buf = Buffer.from(str, 'ucs2'); + for (var i = 0; i < buf.length; i += 2) { + var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp; + } + return buf; +} + +Utf16BEEncoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf16BEDecoder() { + this.overflowByte = -1; +} + +Utf16BEDecoder.prototype.write = function(buf) { + if (buf.length == 0) + return ''; + + var buf2 = Buffer.alloc(buf.length + 1), + i = 0, j = 0; + + if (this.overflowByte !== -1) { + buf2[0] = buf[0]; + buf2[1] = this.overflowByte; + i = 1; j = 2; + } + + for (; i < buf.length-1; i += 2, j+= 2) { + buf2[j] = buf[i+1]; + buf2[j+1] = buf[i]; + } + + this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1; + + return buf2.slice(0, j).toString('ucs2'); +} + +Utf16BEDecoder.prototype.end = function() { + this.overflowByte = -1; +} + + +// == UTF-16 codec ============================================================= +// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic. +// Defaults to UTF-16LE, as it's prevalent and default in Node. +// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le +// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'}); + +// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false). + +exports.utf16 = Utf16Codec; +function Utf16Codec(codecOptions, iconv) { + this.iconv = iconv; +} + +Utf16Codec.prototype.encoder = Utf16Encoder; +Utf16Codec.prototype.decoder = Utf16Decoder; + + +// -- Encoding (pass-through) + +function Utf16Encoder(options, codec) { + options = options || {}; + if (options.addBOM === undefined) + options.addBOM = true; + this.encoder = codec.iconv.getEncoder('utf-16le', options); +} + +Utf16Encoder.prototype.write = function(str) { + return this.encoder.write(str); +} + +Utf16Encoder.prototype.end = function() { + return this.encoder.end(); +} + + +// -- Decoding + +function Utf16Decoder(options, codec) { + this.decoder = null; + this.initialBufs = []; + this.initialBufsLen = 0; + + this.options = options || {}; + this.iconv = codec.iconv; +} + +Utf16Decoder.prototype.write = function(buf) { + if (!this.decoder) { + // Codec is not chosen yet. Accumulate initial bytes. + this.initialBufs.push(buf); + this.initialBufsLen += buf.length; + + if (this.initialBufsLen < 16) // We need more bytes to use space heuristic (see below) + return ''; + + // We have enough bytes -> detect endianness. + var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var resStr = ''; + for (var i = 0; i < this.initialBufs.length; i++) + resStr += this.decoder.write(this.initialBufs[i]); + + this.initialBufs.length = this.initialBufsLen = 0; + return resStr; + } + + return this.decoder.write(buf); +} + +Utf16Decoder.prototype.end = function() { + if (!this.decoder) { + var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var resStr = ''; + for (var i = 0; i < this.initialBufs.length; i++) + resStr += this.decoder.write(this.initialBufs[i]); + + var trail = this.decoder.end(); + if (trail) + resStr += trail; + + this.initialBufs.length = this.initialBufsLen = 0; + return resStr; + } + return this.decoder.end(); +} + +function detectEncoding(bufs, defaultEncoding) { + var b = []; + var charsProcessed = 0; + var asciiCharsLE = 0, asciiCharsBE = 0; // Number of ASCII chars when decoded as LE or BE. + + outer_loop: + for (var i = 0; i < bufs.length; i++) { + var buf = bufs[i]; + for (var j = 0; j < buf.length; j++) { + b.push(buf[j]); + if (b.length === 2) { + if (charsProcessed === 0) { + // Check BOM first. + if (b[0] === 0xFF && b[1] === 0xFE) return 'utf-16le'; + if (b[0] === 0xFE && b[1] === 0xFF) return 'utf-16be'; + } + + if (b[0] === 0 && b[1] !== 0) asciiCharsBE++; + if (b[0] !== 0 && b[1] === 0) asciiCharsLE++; + + b.length = 0; + charsProcessed++; + + if (charsProcessed >= 100) { + break outer_loop; + } + } + } + } + + // Make decisions. + // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon. + // So, we count ASCII as if it was LE or BE, and decide from that. + if (asciiCharsBE > asciiCharsLE) return 'utf-16be'; + if (asciiCharsBE < asciiCharsLE) return 'utf-16le'; + + // Couldn't decide (likely all zeros or not enough data). + return defaultEncoding || 'utf-16le'; +} + + + + +/***/ }), + +/***/ 9557: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +var Buffer = __nccwpck_require__(5118).Buffer; + +// == UTF32-LE/BE codec. ========================================================== + +exports._utf32 = Utf32Codec; + +function Utf32Codec(codecOptions, iconv) { + this.iconv = iconv; + this.bomAware = true; + this.isLE = codecOptions.isLE; +} + +exports.utf32le = { type: '_utf32', isLE: true }; +exports.utf32be = { type: '_utf32', isLE: false }; + +// Aliases +exports.ucs4le = 'utf32le'; +exports.ucs4be = 'utf32be'; + +Utf32Codec.prototype.encoder = Utf32Encoder; +Utf32Codec.prototype.decoder = Utf32Decoder; + +// -- Encoding + +function Utf32Encoder(options, codec) { + this.isLE = codec.isLE; + this.highSurrogate = 0; +} + +Utf32Encoder.prototype.write = function(str) { + var src = Buffer.from(str, 'ucs2'); + var dst = Buffer.alloc(src.length * 2); + var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE; + var offset = 0; + + for (var i = 0; i < src.length; i += 2) { + var code = src.readUInt16LE(i); + var isHighSurrogate = (0xD800 <= code && code < 0xDC00); + var isLowSurrogate = (0xDC00 <= code && code < 0xE000); + + if (this.highSurrogate) { + if (isHighSurrogate || !isLowSurrogate) { + // There shouldn't be two high surrogates in a row, nor a high surrogate which isn't followed by a low + // surrogate. If this happens, keep the pending high surrogate as a stand-alone semi-invalid character + // (technically wrong, but expected by some applications, like Windows file names). + write32.call(dst, this.highSurrogate, offset); + offset += 4; + } + else { + // Create 32-bit value from high and low surrogates; + var codepoint = (((this.highSurrogate - 0xD800) << 10) | (code - 0xDC00)) + 0x10000; + + write32.call(dst, codepoint, offset); + offset += 4; + this.highSurrogate = 0; + + continue; + } + } + + if (isHighSurrogate) + this.highSurrogate = code; + else { + // Even if the current character is a low surrogate, with no previous high surrogate, we'll + // encode it as a semi-invalid stand-alone character for the same reasons expressed above for + // unpaired high surrogates. + write32.call(dst, code, offset); + offset += 4; + this.highSurrogate = 0; + } + } + + if (offset < dst.length) + dst = dst.slice(0, offset); + + return dst; +}; + +Utf32Encoder.prototype.end = function() { + // Treat any leftover high surrogate as a semi-valid independent character. + if (!this.highSurrogate) + return; + + var buf = Buffer.alloc(4); + + if (this.isLE) + buf.writeUInt32LE(this.highSurrogate, 0); + else + buf.writeUInt32BE(this.highSurrogate, 0); + + this.highSurrogate = 0; + + return buf; +}; + +// -- Decoding + +function Utf32Decoder(options, codec) { + this.isLE = codec.isLE; + this.badChar = codec.iconv.defaultCharUnicode.charCodeAt(0); + this.overflow = []; +} + +Utf32Decoder.prototype.write = function(src) { + if (src.length === 0) + return ''; + + var i = 0; + var codepoint = 0; + var dst = Buffer.alloc(src.length + 4); + var offset = 0; + var isLE = this.isLE; + var overflow = this.overflow; + var badChar = this.badChar; + + if (overflow.length > 0) { + for (; i < src.length && overflow.length < 4; i++) + overflow.push(src[i]); + + if (overflow.length === 4) { + // NOTE: codepoint is a signed int32 and can be negative. + // NOTE: We copied this block from below to help V8 optimize it (it works with array, not buffer). + if (isLE) { + codepoint = overflow[i] | (overflow[i+1] << 8) | (overflow[i+2] << 16) | (overflow[i+3] << 24); + } else { + codepoint = overflow[i+3] | (overflow[i+2] << 8) | (overflow[i+1] << 16) | (overflow[i] << 24); + } + overflow.length = 0; + + offset = _writeCodepoint(dst, offset, codepoint, badChar); + } + } + + // Main loop. Should be as optimized as possible. + for (; i < src.length - 3; i += 4) { + // NOTE: codepoint is a signed int32 and can be negative. + if (isLE) { + codepoint = src[i] | (src[i+1] << 8) | (src[i+2] << 16) | (src[i+3] << 24); + } else { + codepoint = src[i+3] | (src[i+2] << 8) | (src[i+1] << 16) | (src[i] << 24); + } + offset = _writeCodepoint(dst, offset, codepoint, badChar); + } + + // Keep overflowing bytes. + for (; i < src.length; i++) { + overflow.push(src[i]); + } + + return dst.slice(0, offset).toString('ucs2'); +}; + +function _writeCodepoint(dst, offset, codepoint, badChar) { + // NOTE: codepoint is signed int32 and can be negative. We keep it that way to help V8 with optimizations. + if (codepoint < 0 || codepoint > 0x10FFFF) { + // Not a valid Unicode codepoint + codepoint = badChar; + } + + // Ephemeral Planes: Write high surrogate. + if (codepoint >= 0x10000) { + codepoint -= 0x10000; + + var high = 0xD800 | (codepoint >> 10); + dst[offset++] = high & 0xff; + dst[offset++] = high >> 8; + + // Low surrogate is written below. + var codepoint = 0xDC00 | (codepoint & 0x3FF); + } + + // Write BMP char or low surrogate. + dst[offset++] = codepoint & 0xff; + dst[offset++] = codepoint >> 8; + + return offset; +}; + +Utf32Decoder.prototype.end = function() { + this.overflow.length = 0; +}; + +// == UTF-32 Auto codec ============================================================= +// Decoder chooses automatically from UTF-32LE and UTF-32BE using BOM and space-based heuristic. +// Defaults to UTF-32LE. http://en.wikipedia.org/wiki/UTF-32 +// Encoder/decoder default can be changed: iconv.decode(buf, 'utf32', {defaultEncoding: 'utf-32be'}); + +// Encoder prepends BOM (which can be overridden with (addBOM: false}). + +exports.utf32 = Utf32AutoCodec; +exports.ucs4 = 'utf32'; + +function Utf32AutoCodec(options, iconv) { + this.iconv = iconv; +} + +Utf32AutoCodec.prototype.encoder = Utf32AutoEncoder; +Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder; + +// -- Encoding + +function Utf32AutoEncoder(options, codec) { + options = options || {}; + + if (options.addBOM === undefined) + options.addBOM = true; + + this.encoder = codec.iconv.getEncoder(options.defaultEncoding || 'utf-32le', options); +} + +Utf32AutoEncoder.prototype.write = function(str) { + return this.encoder.write(str); +}; + +Utf32AutoEncoder.prototype.end = function() { + return this.encoder.end(); +}; + +// -- Decoding + +function Utf32AutoDecoder(options, codec) { + this.decoder = null; + this.initialBufs = []; + this.initialBufsLen = 0; + this.options = options || {}; + this.iconv = codec.iconv; +} + +Utf32AutoDecoder.prototype.write = function(buf) { + if (!this.decoder) { + // Codec is not chosen yet. Accumulate initial bytes. + this.initialBufs.push(buf); + this.initialBufsLen += buf.length; + + if (this.initialBufsLen < 32) // We need more bytes to use space heuristic (see below) + return ''; + + // We have enough bytes -> detect endianness. + var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var resStr = ''; + for (var i = 0; i < this.initialBufs.length; i++) + resStr += this.decoder.write(this.initialBufs[i]); + + this.initialBufs.length = this.initialBufsLen = 0; + return resStr; + } + + return this.decoder.write(buf); +}; + +Utf32AutoDecoder.prototype.end = function() { + if (!this.decoder) { + var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var resStr = ''; + for (var i = 0; i < this.initialBufs.length; i++) + resStr += this.decoder.write(this.initialBufs[i]); + + var trail = this.decoder.end(); + if (trail) + resStr += trail; + + this.initialBufs.length = this.initialBufsLen = 0; + return resStr; + } + + return this.decoder.end(); +}; + +function detectEncoding(bufs, defaultEncoding) { + var b = []; + var charsProcessed = 0; + var invalidLE = 0, invalidBE = 0; // Number of invalid chars when decoded as LE or BE. + var bmpCharsLE = 0, bmpCharsBE = 0; // Number of BMP chars when decoded as LE or BE. + + outer_loop: + for (var i = 0; i < bufs.length; i++) { + var buf = bufs[i]; + for (var j = 0; j < buf.length; j++) { + b.push(buf[j]); + if (b.length === 4) { + if (charsProcessed === 0) { + // Check BOM first. + if (b[0] === 0xFF && b[1] === 0xFE && b[2] === 0 && b[3] === 0) { + return 'utf-32le'; + } + if (b[0] === 0 && b[1] === 0 && b[2] === 0xFE && b[3] === 0xFF) { + return 'utf-32be'; + } + } + + if (b[0] !== 0 || b[1] > 0x10) invalidBE++; + if (b[3] !== 0 || b[2] > 0x10) invalidLE++; + + if (b[0] === 0 && b[1] === 0 && (b[2] !== 0 || b[3] !== 0)) bmpCharsBE++; + if ((b[0] !== 0 || b[1] !== 0) && b[2] === 0 && b[3] === 0) bmpCharsLE++; + + b.length = 0; + charsProcessed++; + + if (charsProcessed >= 100) { + break outer_loop; + } + } + } + } + + // Make decisions. + if (bmpCharsBE - invalidBE > bmpCharsLE - invalidLE) return 'utf-32be'; + if (bmpCharsBE - invalidBE < bmpCharsLE - invalidLE) return 'utf-32le'; + + // Couldn't decide (likely all zeros or not enough data). + return defaultEncoding || 'utf-32le'; +} + + +/***/ }), + +/***/ 1644: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +var Buffer = __nccwpck_require__(5118).Buffer; + +// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152 +// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3 + +exports.utf7 = Utf7Codec; +exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7 +function Utf7Codec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7Codec.prototype.encoder = Utf7Encoder; +Utf7Codec.prototype.decoder = Utf7Decoder; +Utf7Codec.prototype.bomAware = true; + + +// -- Encoding + +var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g; + +function Utf7Encoder(options, codec) { + this.iconv = codec.iconv; +} + +Utf7Encoder.prototype.write = function(str) { + // Naive implementation. + // Non-direct chars are encoded as "+-"; single "+" char is encoded as "+-". + return Buffer.from(str.replace(nonDirectChars, function(chunk) { + return "+" + (chunk === '+' ? '' : + this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) + + "-"; + }.bind(this))); +} + +Utf7Encoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf7Decoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64Regex = /[A-Za-z0-9\/+]/; +var base64Chars = []; +for (var i = 0; i < 256; i++) + base64Chars[i] = base64Regex.test(String.fromCharCode(i)); + +var plusChar = '+'.charCodeAt(0), + minusChar = '-'.charCodeAt(0), + andChar = '&'.charCodeAt(0); + +Utf7Decoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '+' + if (buf[i] == plusChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64Chars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) {// "+-" -> "+" + res += "+"; + } else { + var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii"); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus is absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii"); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7Decoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + +// UTF-7-IMAP codec. +// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3) +// Differences: +// * Base64 part is started by "&" instead of "+" +// * Direct characters are 0x20-0x7E, except "&" (0x26) +// * In Base64, "," is used instead of "/" +// * Base64 must not be used to represent direct characters. +// * No implicit shift back from Base64 (should always end with '-') +// * String must end in non-shifted position. +// * "-&" while in base64 is not allowed. + + +exports.utf7imap = Utf7IMAPCodec; +function Utf7IMAPCodec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder; +Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder; +Utf7IMAPCodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf7IMAPEncoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = Buffer.alloc(6); + this.base64AccumIdx = 0; +} + +Utf7IMAPEncoder.prototype.write = function(str) { + var inBase64 = this.inBase64, + base64Accum = this.base64Accum, + base64AccumIdx = this.base64AccumIdx, + buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0; + + for (var i = 0; i < str.length; i++) { + var uChar = str.charCodeAt(i); + if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'. + if (inBase64) { + if (base64AccumIdx > 0) { + bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + inBase64 = false; + } + + if (!inBase64) { + buf[bufIdx++] = uChar; // Write direct character + + if (uChar === andChar) // Ampersand -> '&-' + buf[bufIdx++] = minusChar; + } + + } else { // Non-direct character + if (!inBase64) { + buf[bufIdx++] = andChar; // Write '&', then go to base64 mode. + inBase64 = true; + } + if (inBase64) { + base64Accum[base64AccumIdx++] = uChar >> 8; + base64Accum[base64AccumIdx++] = uChar & 0xFF; + + if (base64AccumIdx == base64Accum.length) { + bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx); + base64AccumIdx = 0; + } + } + } + } + + this.inBase64 = inBase64; + this.base64AccumIdx = base64AccumIdx; + + return buf.slice(0, bufIdx); +} + +Utf7IMAPEncoder.prototype.end = function() { + var buf = Buffer.alloc(10), bufIdx = 0; + if (this.inBase64) { + if (this.base64AccumIdx > 0) { + bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + this.base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + this.inBase64 = false; + } + + return buf.slice(0, bufIdx); +} + + +// -- Decoding + +function Utf7IMAPDecoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64IMAPChars = base64Chars.slice(); +base64IMAPChars[','.charCodeAt(0)] = true; + +Utf7IMAPDecoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + // It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end). + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '&' + if (buf[i] == andChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64IMAPChars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) { // "&-" -> "&" + res += "&"; + } else { + var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii").replace(/,/g, '/'); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus may be absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii").replace(/,/g, '/'); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7IMAPDecoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + + + +/***/ }), + +/***/ 7961: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +var BOMChar = '\uFEFF'; + +exports.PrependBOM = PrependBOMWrapper +function PrependBOMWrapper(encoder, options) { + this.encoder = encoder; + this.addBOM = true; +} + +PrependBOMWrapper.prototype.write = function(str) { + if (this.addBOM) { + str = BOMChar + str; + this.addBOM = false; + } + + return this.encoder.write(str); +} + +PrependBOMWrapper.prototype.end = function() { + return this.encoder.end(); +} + + +//------------------------------------------------------------------------------ + +exports.StripBOM = StripBOMWrapper; +function StripBOMWrapper(decoder, options) { + this.decoder = decoder; + this.pass = false; + this.options = options || {}; +} + +StripBOMWrapper.prototype.write = function(buf) { + var res = this.decoder.write(buf); + if (this.pass || !res) + return res; + + if (res[0] === BOMChar) { + res = res.slice(1); + if (typeof this.options.stripBOM === 'function') + this.options.stripBOM(); + } + + this.pass = true; + return res; +} + +StripBOMWrapper.prototype.end = function() { + return this.decoder.end(); +} + + + +/***/ }), + +/***/ 9032: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Buffer = __nccwpck_require__(5118).Buffer; + +var bomHandling = __nccwpck_require__(7961), + iconv = module.exports; + +// All codecs and aliases are kept here, keyed by encoding name/alias. +// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`. +iconv.encodings = null; + +// Characters emitted in case of error. +iconv.defaultCharUnicode = '�'; +iconv.defaultCharSingleByte = '?'; + +// Public API. +iconv.encode = function encode(str, encoding, options) { + str = "" + (str || ""); // Ensure string. + + var encoder = iconv.getEncoder(encoding, options); + + var res = encoder.write(str); + var trail = encoder.end(); + + return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res; +} + +iconv.decode = function decode(buf, encoding, options) { + if (typeof buf === 'string') { + if (!iconv.skipDecodeWarning) { + console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding'); + iconv.skipDecodeWarning = true; + } + + buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer. + } + + var decoder = iconv.getDecoder(encoding, options); + + var res = decoder.write(buf); + var trail = decoder.end(); + + return trail ? (res + trail) : res; +} + +iconv.encodingExists = function encodingExists(enc) { + try { + iconv.getCodec(enc); + return true; + } catch (e) { + return false; + } +} + +// Legacy aliases to convert functions +iconv.toEncoding = iconv.encode; +iconv.fromEncoding = iconv.decode; + +// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache. +iconv._codecDataCache = {}; +iconv.getCodec = function getCodec(encoding) { + if (!iconv.encodings) + iconv.encodings = __nccwpck_require__(2733); // Lazy load all encoding definitions. + + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + var enc = iconv._canonicalizeEncoding(encoding); + + // Traverse iconv.encodings to find actual codec. + var codecOptions = {}; + while (true) { + var codec = iconv._codecDataCache[enc]; + if (codec) + return codec; + + var codecDef = iconv.encodings[enc]; + + switch (typeof codecDef) { + case "string": // Direct alias to other encoding. + enc = codecDef; + break; + + case "object": // Alias with options. Can be layered. + for (var key in codecDef) + codecOptions[key] = codecDef[key]; + + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + enc = codecDef.type; + break; + + case "function": // Codec itself. + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + // The codec function must load all tables and return object with .encoder and .decoder methods. + // It'll be called only once (for each different options object). + codec = new codecDef(codecOptions, iconv); + + iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later. + return codec; + + default: + throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')"); + } + } +} + +iconv._canonicalizeEncoding = function(encoding) { + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, ""); +} + +iconv.getEncoder = function getEncoder(encoding, options) { + var codec = iconv.getCodec(encoding), + encoder = new codec.encoder(options, codec); + + if (codec.bomAware && options && options.addBOM) + encoder = new bomHandling.PrependBOM(encoder, options); + + return encoder; +} + +iconv.getDecoder = function getDecoder(encoding, options) { + var codec = iconv.getCodec(encoding), + decoder = new codec.decoder(options, codec); + + if (codec.bomAware && !(options && options.stripBOM === false)) + decoder = new bomHandling.StripBOM(decoder, options); + + return decoder; +} + +// Streaming API +// NOTE: Streaming API naturally depends on 'stream' module from Node.js. Unfortunately in browser environments this module can add +// up to 100Kb to the output bundle. To avoid unnecessary code bloat, we don't enable Streaming API in browser by default. +// If you would like to enable it explicitly, please add the following code to your app: +// > iconv.enableStreamingAPI(require('stream')); +iconv.enableStreamingAPI = function enableStreamingAPI(stream_module) { + if (iconv.supportsStreams) + return; + + // Dependency-inject stream module to create IconvLite stream classes. + var streams = __nccwpck_require__(6409)(stream_module); + + // Not public API yet, but expose the stream classes. + iconv.IconvLiteEncoderStream = streams.IconvLiteEncoderStream; + iconv.IconvLiteDecoderStream = streams.IconvLiteDecoderStream; + + // Streaming API. + iconv.encodeStream = function encodeStream(encoding, options) { + return new iconv.IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options); + } + + iconv.decodeStream = function decodeStream(encoding, options) { + return new iconv.IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options); + } + + iconv.supportsStreams = true; +} + +// Enable Streaming API automatically if 'stream' module is available and non-empty (the majority of environments). +var stream_module; +try { + stream_module = __nccwpck_require__(2413); +} catch (e) {} + +if (stream_module && stream_module.Transform) { + iconv.enableStreamingAPI(stream_module); + +} else { + // In rare cases where 'stream' module is not available by default, throw a helpful exception. + iconv.encodeStream = iconv.decodeStream = function() { + throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it."); + }; +} + +if (false) {} + + +/***/ }), + +/***/ 6409: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Buffer = __nccwpck_require__(5118).Buffer; + +// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments), +// we opt to dependency-inject it instead of creating a hard dependency. +module.exports = function(stream_module) { + var Transform = stream_module.Transform; + + // == Encoder stream ======================================================= + + function IconvLiteEncoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.decodeStrings = false; // We accept only strings, so we don't need to decode them. + Transform.call(this, options); + } + + IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteEncoderStream } + }); + + IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) { + if (typeof chunk != 'string') + return done(new Error("Iconv encoding stream needs strings as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } + } + + IconvLiteEncoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } + } + + IconvLiteEncoderStream.prototype.collect = function(cb) { + var chunks = []; + this.on('error', cb); + this.on('data', function(chunk) { chunks.push(chunk); }); + this.on('end', function() { + cb(null, Buffer.concat(chunks)); + }); + return this; + } + + + // == Decoder stream ======================================================= + + function IconvLiteDecoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.encoding = this.encoding = 'utf8'; // We output strings. + Transform.call(this, options); + } + + IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteDecoderStream } + }); + + IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) { + if (!Buffer.isBuffer(chunk) && !(chunk instanceof Uint8Array)) + return done(new Error("Iconv decoding stream needs buffers as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } + } + + IconvLiteDecoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } + } + + IconvLiteDecoderStream.prototype.collect = function(cb) { + var res = ''; + this.on('error', cb); + this.on('data', function(chunk) { res += chunk; }); + this.on('end', function() { + cb(null, res); + }); + return this; + } + + return { + IconvLiteEncoderStream: IconvLiteEncoderStream, + IconvLiteDecoderStream: IconvLiteDecoderStream, + }; +}; + + +/***/ }), + +/***/ 3287: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +/*! + * is-plain-object + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +function isObject(o) { + return Object.prototype.toString.call(o) === '[object Object]'; +} + +function isPlainObject(o) { + var ctor,prot; + + if (isObject(o) === false) return false; + + // If has modified constructor + ctor = o.constructor; + if (ctor === undefined) return true; + + // If has modified prototype + prot = ctor.prototype; + if (isObject(prot) === false) return false; + + // If constructor does not have an Object-specific method + if (prot.hasOwnProperty('isPrototypeOf') === false) { + return false; + } + + // Most likely a plain Object + return true; +} + +exports.isPlainObject = isPlainObject; + + +/***/ }), + +/***/ 1531: +/***/ ((__unused_webpack_module, exports) => { + +// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell +// License: MIT. (See LICENSE.) + +Object.defineProperty(exports, "__esModule", ({ + value: true +})) + +// This regex comes from regex.coffee, and is inserted here by generate-index.js +// (run `npm run build`). +exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g + +exports.matchToToken = function(match) { + var token = {type: "invalid", value: match[0], closed: undefined} + if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4]) + else if (match[ 5]) token.type = "comment" + else if (match[ 6]) token.type = "comment", token.closed = !!match[7] + else if (match[ 8]) token.type = "regex" + else if (match[ 9]) token.type = "number" + else if (match[10]) token.type = "name" + else if (match[11]) token.type = "punctuator" + else if (match[12]) token.type = "whitespace" + return token +} + + +/***/ }), + +/***/ 5733: +/***/ ((module) => { + +"use strict"; + + +const object = {}; +const hasOwnProperty = object.hasOwnProperty; +const forOwn = (object, callback) => { + for (const key in object) { + if (hasOwnProperty.call(object, key)) { + callback(key, object[key]); + } + } +}; + +const extend = (destination, source) => { + if (!source) { + return destination; + } + forOwn(source, (key, value) => { + destination[key] = value; + }); + return destination; +}; + +const forEach = (array, callback) => { + const length = array.length; + let index = -1; + while (++index < length) { + callback(array[index]); + } +}; + +const toString = object.toString; +const isArray = Array.isArray; +const isBuffer = Buffer.isBuffer; +const isObject = (value) => { + // This is a very simple check, but it’s good enough for what we need. + return toString.call(value) == '[object Object]'; +}; +const isString = (value) => { + return typeof value == 'string' || + toString.call(value) == '[object String]'; +}; +const isNumber = (value) => { + return typeof value == 'number' || + toString.call(value) == '[object Number]'; +}; +const isFunction = (value) => { + return typeof value == 'function'; +}; +const isMap = (value) => { + return toString.call(value) == '[object Map]'; +}; +const isSet = (value) => { + return toString.call(value) == '[object Set]'; +}; + +/*--------------------------------------------------------------------------*/ + +// https://mathiasbynens.be/notes/javascript-escapes#single +const singleEscapes = { + '"': '\\"', + '\'': '\\\'', + '\\': '\\\\', + '\b': '\\b', + '\f': '\\f', + '\n': '\\n', + '\r': '\\r', + '\t': '\\t' + // `\v` is omitted intentionally, because in IE < 9, '\v' == 'v'. + // '\v': '\\x0B' +}; +const regexSingleEscape = /["'\\\b\f\n\r\t]/; + +const regexDigit = /[0-9]/; +const regexWhitelist = /[ !#-&\(-\[\]-_a-~]/; + +const jsesc = (argument, options) => { + const increaseIndentation = () => { + oldIndent = indent; + ++options.indentLevel; + indent = options.indent.repeat(options.indentLevel) + }; + // Handle options + const defaults = { + 'escapeEverything': false, + 'minimal': false, + 'isScriptContext': false, + 'quotes': 'single', + 'wrap': false, + 'es6': false, + 'json': false, + 'compact': true, + 'lowercaseHex': false, + 'numbers': 'decimal', + 'indent': '\t', + 'indentLevel': 0, + '__inline1__': false, + '__inline2__': false + }; + const json = options && options.json; + if (json) { + defaults.quotes = 'double'; + defaults.wrap = true; + } + options = extend(defaults, options); + if ( + options.quotes != 'single' && + options.quotes != 'double' && + options.quotes != 'backtick' + ) { + options.quotes = 'single'; + } + const quote = options.quotes == 'double' ? + '"' : + (options.quotes == 'backtick' ? + '`' : + '\'' + ); + const compact = options.compact; + const lowercaseHex = options.lowercaseHex; + let indent = options.indent.repeat(options.indentLevel); + let oldIndent = ''; + const inline1 = options.__inline1__; + const inline2 = options.__inline2__; + const newLine = compact ? '' : '\n'; + let result; + let isEmpty = true; + const useBinNumbers = options.numbers == 'binary'; + const useOctNumbers = options.numbers == 'octal'; + const useDecNumbers = options.numbers == 'decimal'; + const useHexNumbers = options.numbers == 'hexadecimal'; + + if (json && argument && isFunction(argument.toJSON)) { + argument = argument.toJSON(); + } + + if (!isString(argument)) { + if (isMap(argument)) { + if (argument.size == 0) { + return 'new Map()'; + } + if (!compact) { + options.__inline1__ = true; + options.__inline2__ = false; + } + return 'new Map(' + jsesc(Array.from(argument), options) + ')'; + } + if (isSet(argument)) { + if (argument.size == 0) { + return 'new Set()'; + } + return 'new Set(' + jsesc(Array.from(argument), options) + ')'; + } + if (isBuffer(argument)) { + if (argument.length == 0) { + return 'Buffer.from([])'; + } + return 'Buffer.from(' + jsesc(Array.from(argument), options) + ')'; + } + if (isArray(argument)) { + result = []; + options.wrap = true; + if (inline1) { + options.__inline1__ = false; + options.__inline2__ = true; + } + if (!inline2) { + increaseIndentation(); + } + forEach(argument, (value) => { + isEmpty = false; + if (inline2) { + options.__inline2__ = false; + } + result.push( + (compact || inline2 ? '' : indent) + + jsesc(value, options) + ); + }); + if (isEmpty) { + return '[]'; + } + if (inline2) { + return '[' + result.join(', ') + ']'; + } + return '[' + newLine + result.join(',' + newLine) + newLine + + (compact ? '' : oldIndent) + ']'; + } else if (isNumber(argument)) { + if (json) { + // Some number values (e.g. `Infinity`) cannot be represented in JSON. + return JSON.stringify(argument); + } + if (useDecNumbers) { + return String(argument); + } + if (useHexNumbers) { + let hexadecimal = argument.toString(16); + if (!lowercaseHex) { + hexadecimal = hexadecimal.toUpperCase(); + } + return '0x' + hexadecimal; + } + if (useBinNumbers) { + return '0b' + argument.toString(2); + } + if (useOctNumbers) { + return '0o' + argument.toString(8); + } + } else if (!isObject(argument)) { + if (json) { + // For some values (e.g. `undefined`, `function` objects), + // `JSON.stringify(value)` returns `undefined` (which isn’t valid + // JSON) instead of `'null'`. + return JSON.stringify(argument) || 'null'; + } + return String(argument); + } else { // it’s an object + result = []; + options.wrap = true; + increaseIndentation(); + forOwn(argument, (key, value) => { + isEmpty = false; + result.push( + (compact ? '' : indent) + + jsesc(key, options) + ':' + + (compact ? '' : ' ') + + jsesc(value, options) + ); + }); + if (isEmpty) { + return '{}'; + } + return '{' + newLine + result.join(',' + newLine) + newLine + + (compact ? '' : oldIndent) + '}'; + } + } + + const string = argument; + // Loop over each code unit in the string and escape it + let index = -1; + const length = string.length; + result = ''; + while (++index < length) { + const character = string.charAt(index); + if (options.es6) { + const first = string.charCodeAt(index); + if ( // check if it’s the start of a surrogate pair + first >= 0xD800 && first <= 0xDBFF && // high surrogate + length > index + 1 // there is a next code unit + ) { + const second = string.charCodeAt(index + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + const codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + let hexadecimal = codePoint.toString(16); + if (!lowercaseHex) { + hexadecimal = hexadecimal.toUpperCase(); + } + result += '\\u{' + hexadecimal + '}'; + ++index; + continue; + } + } + } + if (!options.escapeEverything) { + if (regexWhitelist.test(character)) { + // It’s a printable ASCII character that is not `"`, `'` or `\`, + // so don’t escape it. + result += character; + continue; + } + if (character == '"') { + result += quote == character ? '\\"' : character; + continue; + } + if (character == '`') { + result += quote == character ? '\\`' : character; + continue; + } + if (character == '\'') { + result += quote == character ? '\\\'' : character; + continue; + } + } + if ( + character == '\0' && + !json && + !regexDigit.test(string.charAt(index + 1)) + ) { + result += '\\0'; + continue; + } + if (regexSingleEscape.test(character)) { + // no need for a `hasOwnProperty` check here + result += singleEscapes[character]; + continue; + } + const charCode = character.charCodeAt(0); + if (options.minimal && charCode != 0x2028 && charCode != 0x2029) { + result += character; + continue; + } + let hexadecimal = charCode.toString(16); + if (!lowercaseHex) { + hexadecimal = hexadecimal.toUpperCase(); + } + const longhand = hexadecimal.length > 2 || json; + const escaped = '\\' + (longhand ? 'u' : 'x') + + ('0000' + hexadecimal).slice(longhand ? -4 : -2); + result += escaped; + continue; + } + if (options.wrap) { + result = quote + result + quote; + } + if (quote == '`') { + result = result.replace(/\$\{/g, '\\\$\{'); + } + if (options.isScriptContext) { + // https://mathiasbynens.be/notes/etago + return result + .replace(/<\/(script|style)/gi, '<\\/$1') + .replace(/