From e53600ad818a6ce53db45d7617b653e6868c6ccf Mon Sep 17 00:00:00 2001 From: jinia91 Date: Thu, 16 Dec 2021 11:48:48 +0900 Subject: [PATCH] =?UTF-8?q?21.12.16=20=ED=94=84=EB=A1=A0=ED=8A=B8=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EC=9D=B4=EA=B2=8C=20=EB=A7=9E=EB=82=98=20?= =?UTF-8?q?=EC=8B=B6=EB=84=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- .../myblog/blog/article/domain/Article.java | 1 - .../resources/static/node_modules/.bin/jsesc | 15 + .../static/node_modules/.bin/jsesc.cmd | 17 + .../static/node_modules/.bin/jsesc.ps1 | 18 + .../resources/static/node_modules/.bin/parser | 15 + .../static/node_modules/.bin/parser.cmd | 17 + .../static/node_modules/.bin/parser.ps1 | 18 + .../static/node_modules/.package-lock.json | 13 + .../node_modules/@babel/code-frame/LICENSE | 22 + .../node_modules/@babel/code-frame/README.md | 19 + .../@babel/code-frame/lib/index.js | 163 + .../@babel/code-frame/package.json | 62 + .../node_modules/@babel/generator/LICENSE | 22 + .../node_modules/@babel/generator/README.md | 19 + .../@babel/generator/lib/buffer.js | 265 + .../@babel/generator/lib/generators/base.js | 96 + .../generator/lib/generators/classes.js | 174 + .../generator/lib/generators/expressions.js | 318 + .../@babel/generator/lib/generators/flow.js | 795 + .../@babel/generator/lib/generators/index.js | 148 + .../@babel/generator/lib/generators/jsx.js | 145 + .../generator/lib/generators/methods.js | 150 + .../generator/lib/generators/modules.js | 239 + .../generator/lib/generators/statements.js | 331 + .../lib/generators/template-literals.js | 33 + .../@babel/generator/lib/generators/types.js | 276 + .../generator/lib/generators/typescript.js | 806 + .../@babel/generator/lib/index.js | 97 + .../@babel/generator/lib/node/index.js | 111 + .../@babel/generator/lib/node/parentheses.js | 342 + .../@babel/generator/lib/node/whitespace.js | 214 + .../@babel/generator/lib/printer.js | 540 + .../@babel/generator/lib/source-map.js | 78 + .../@babel/generator/package.json | 67 + .../@babel/helper-function-name/LICENSE | 22 + .../@babel/helper-function-name/README.md | 19 + .../@babel/helper-function-name/lib/index.js | 188 + .../@babel/helper-function-name/package.json | 57 + .../@babel/helper-get-function-arity/LICENSE | 22 + .../helper-get-function-arity/README.md | 19 + .../helper-get-function-arity/lib/index.js | 27 + .../helper-get-function-arity/package.json | 55 + .../@babel/helper-hoist-variables/LICENSE | 22 + .../@babel/helper-hoist-variables/README.md | 19 + .../helper-hoist-variables/lib/index.js | 58 + .../helper-hoist-variables/package.json | 59 + .../helper-split-export-declaration/LICENSE | 22 + .../helper-split-export-declaration/README.md | 19 + .../lib/index.js | 67 + .../package.json | 55 + .../helper-validator-identifier/LICENSE | 22 + .../helper-validator-identifier/README.md | 19 + .../lib/identifier.js | 84 + .../helper-validator-identifier/lib/index.js | 57 + .../lib/keyword.js | 38 + .../helper-validator-identifier/package.json | 58 + .../scripts/generate-identifier-regex.js | 75 + .../node_modules/@babel/highlight/LICENSE | 22 + .../node_modules/@babel/highlight/README.md | 19 + .../@babel/highlight/lib/index.js | 116 + .../@babel/highlight/package.json | 61 + .../node_modules/@babel/parser/CHANGELOG.md | 1073 + .../static/node_modules/@babel/parser/LICENSE | 19 + .../node_modules/@babel/parser/README.md | 19 + .../@babel/parser/bin/babel-parser.js | 15 + .../node_modules/@babel/parser/lib/index.js | 15148 +++++++++ .../@babel/parser/lib/index.js.map | 1 + .../node_modules/@babel/parser/package.json | 77 + .../@babel/parser/typings/babel-parser.d.ts | 203 + .../node_modules/@babel/template/LICENSE | 22 + .../node_modules/@babel/template/README.md | 19 + .../@babel/template/lib/builder.js | 81 + .../@babel/template/lib/formatters.js | 71 + .../node_modules/@babel/template/lib/index.js | 32 + .../@babel/template/lib/literal.js | 80 + .../@babel/template/lib/options.js | 83 + .../node_modules/@babel/template/lib/parse.js | 188 + .../@babel/template/lib/populate.js | 135 + .../@babel/template/lib/string.js | 22 + .../node_modules/@babel/template/package.json | 57 + .../node_modules/@babel/traverse/LICENSE | 22 + .../node_modules/@babel/traverse/README.md | 19 + .../node_modules/@babel/traverse/lib/cache.js | 26 + .../@babel/traverse/lib/context.js | 137 + .../node_modules/@babel/traverse/lib/hub.js | 23 + .../node_modules/@babel/traverse/lib/index.js | 118 + .../@babel/traverse/lib/path/ancestry.js | 180 + .../@babel/traverse/lib/path/comments.js | 42 + .../@babel/traverse/lib/path/context.js | 265 + .../@babel/traverse/lib/path/conversion.js | 495 + .../@babel/traverse/lib/path/evaluation.js | 401 + .../@babel/traverse/lib/path/family.js | 407 + .../traverse/lib/path/generated/asserts.js | 5 + .../traverse/lib/path/generated/validators.js | 5 + .../lib/path/generated/virtual-types.js | 3 + .../@babel/traverse/lib/path/index.js | 253 + .../traverse/lib/path/inference/index.js | 156 + .../lib/path/inference/inferer-reference.js | 206 + .../traverse/lib/path/inference/inferers.js | 261 + .../@babel/traverse/lib/path/introspection.js | 436 + .../@babel/traverse/lib/path/lib/hoister.js | 206 + .../traverse/lib/path/lib/removal-hooks.js | 38 + .../traverse/lib/path/lib/virtual-types.js | 230 + .../@babel/traverse/lib/path/modification.js | 232 + .../@babel/traverse/lib/path/removal.js | 73 + .../@babel/traverse/lib/path/replacement.js | 260 + .../@babel/traverse/lib/scope/binding.js | 75 + .../@babel/traverse/lib/scope/index.js | 1015 + .../@babel/traverse/lib/scope/lib/renamer.js | 146 + .../node_modules/@babel/traverse/lib/types.js | 5 + .../@babel/traverse/lib/visitors.js | 242 + .../node_modules/@babel/traverse/package.json | 66 + .../traverse/scripts/generators/asserts.js | 25 + .../traverse/scripts/generators/validators.js | 43 + .../scripts/generators/virtual-types.js | 24 + .../@babel/traverse/scripts/package.json | 1 + .../static/node_modules/@babel/types/LICENSE | 22 + .../node_modules/@babel/types/README.md | 19 + .../@babel/types/lib/asserts/assertNode.js | 17 + .../types/lib/asserts/generated/index.js | 1507 + .../types/lib/ast-types/generated/index.js | 0 .../@babel/types/lib/builders/builder.js | 43 + .../lib/builders/flow/createFlowUnionType.js | 20 + .../flow/createTypeAnnotationBasedOnTypeof.js | 41 + .../types/lib/builders/generated/index.js | 1261 + .../types/lib/builders/generated/uppercase.js | 1507 + .../types/lib/builders/react/buildChildren.js | 29 + .../builders/typescript/createTSUnionType.js | 21 + .../@babel/types/lib/clone/clone.js | 12 + .../@babel/types/lib/clone/cloneDeep.js | 12 + .../types/lib/clone/cloneDeepWithoutLoc.js | 12 + .../@babel/types/lib/clone/cloneNode.js | 114 + .../@babel/types/lib/clone/cloneWithoutLoc.js | 12 + .../@babel/types/lib/comments/addComment.js | 15 + .../@babel/types/lib/comments/addComments.js | 23 + .../lib/comments/inheritInnerComments.js | 12 + .../lib/comments/inheritLeadingComments.js | 12 + .../lib/comments/inheritTrailingComments.js | 12 + .../types/lib/comments/inheritsComments.js | 19 + .../types/lib/comments/removeComments.js | 16 + .../types/lib/constants/generated/index.js | 105 + .../@babel/types/lib/constants/index.js | 49 + .../@babel/types/lib/converters/Scope.js | 0 .../types/lib/converters/ensureBlock.js | 12 + .../converters/gatherSequenceExpressions.js | 75 + .../lib/converters/toBindingIdentifierName.js | 14 + .../@babel/types/lib/converters/toBlock.js | 34 + .../types/lib/converters/toComputedKey.js | 15 + .../types/lib/converters/toExpression.js | 33 + .../types/lib/converters/toIdentifier.js | 30 + .../@babel/types/lib/converters/toKeyAlias.js | 46 + .../lib/converters/toSequenceExpression.js | 21 + .../types/lib/converters/toStatement.js | 47 + .../types/lib/converters/valueToNode.js | 99 + .../@babel/types/lib/definitions/core.js | 1604 + .../types/lib/definitions/experimental.js | 133 + .../@babel/types/lib/definitions/flow.js | 474 + .../@babel/types/lib/definitions/index.js | 103 + .../@babel/types/lib/definitions/jsx.js | 156 + .../@babel/types/lib/definitions/misc.js | 32 + .../types/lib/definitions/placeholders.js | 33 + .../types/lib/definitions/typescript.js | 470 + .../@babel/types/lib/definitions/utils.js | 343 + .../@babel/types/lib/index-legacy.d.ts | 2692 ++ .../node_modules/@babel/types/lib/index.d.ts | 2988 ++ .../node_modules/@babel/types/lib/index.js | 647 + .../@babel/types/lib/index.js.flow | 2549 ++ .../modifications/appendToMemberExpression.js | 15 + .../flow/removeTypeDuplicates.js | 78 + .../types/lib/modifications/inherits.js | 31 + .../prependToMemberExpression.js | 13 + .../lib/modifications/removeProperties.js | 30 + .../lib/modifications/removePropertiesDeep.js | 15 + .../typescript/removeTypeDuplicates.js | 54 + .../lib/retrievers/getBindingIdentifiers.js | 104 + .../retrievers/getOuterBindingIdentifiers.js | 15 + .../@babel/types/lib/traverse/traverse.js | 55 + .../@babel/types/lib/traverse/traverseFast.js | 28 + .../@babel/types/lib/utils/inherit.js | 12 + .../react/cleanJSXElementLiteralChild.js | 47 + .../@babel/types/lib/utils/shallowEqual.js | 18 + .../validators/buildMatchMemberExpression.js | 13 + .../types/lib/validators/generated/index.js | 4779 +++ .../@babel/types/lib/validators/is.js | 33 + .../@babel/types/lib/validators/isBinding.js | 31 + .../types/lib/validators/isBlockScoped.js | 14 + .../types/lib/validators/isImmutable.js | 24 + .../@babel/types/lib/validators/isLet.js | 14 + .../@babel/types/lib/validators/isNode.js | 12 + .../types/lib/validators/isNodesEquivalent.js | 67 + .../types/lib/validators/isPlaceholderType.js | 21 + .../types/lib/validators/isReferenced.js | 127 + .../@babel/types/lib/validators/isScope.js | 20 + .../lib/validators/isSpecifierDefault.js | 14 + .../@babel/types/lib/validators/isType.js | 24 + .../lib/validators/isValidES3Identifier.js | 14 + .../types/lib/validators/isValidIdentifier.js | 20 + .../@babel/types/lib/validators/isVar.js | 16 + .../types/lib/validators/matchesPattern.js | 42 + .../types/lib/validators/react/isCompatTag.js | 10 + .../lib/validators/react/isReactComponent.js | 12 + .../@babel/types/lib/validators/validate.js | 32 + .../node_modules/@babel/types/package.json | 77 + .../types/scripts/generators/asserts.js | 50 + .../types/scripts/generators/ast-types.js | 144 + .../types/scripts/generators/builders.js | 163 + .../types/scripts/generators/constants.js | 15 + .../@babel/types/scripts/generators/docs.js | 282 + .../@babel/types/scripts/generators/flow.js | 260 + .../scripts/generators/typescript-legacy.js | 369 + .../types/scripts/generators/validators.js | 87 + .../@babel/types/scripts/package.json | 1 + .../types/scripts/utils/formatBuilderName.js | 8 + .../@babel/types/scripts/utils/lowerFirst.js | 3 + .../types/scripts/utils/stringifyValidator.js | 66 + .../types/scripts/utils/toFunctionName.js | 4 + .../node_modules/@toast-ui/editor/README.md | 176 + .../@toast-ui/editor/dist/esm/i18n/ar.js | 63 + .../@toast-ui/editor/dist/esm/i18n/cs-cz.js | 63 + .../@toast-ui/editor/dist/esm/i18n/de-de.js | 63 + .../@toast-ui/editor/dist/esm/i18n/en-us.js | 63 + .../@toast-ui/editor/dist/esm/i18n/es-es.js | 63 + .../@toast-ui/editor/dist/esm/i18n/fi-fi.js | 63 + .../@toast-ui/editor/dist/esm/i18n/fr-fr.js | 63 + .../@toast-ui/editor/dist/esm/i18n/gl-es.js | 63 + .../@toast-ui/editor/dist/esm/i18n/hr-hr.js | 63 + .../@toast-ui/editor/dist/esm/i18n/i18n.js | 223 + .../@toast-ui/editor/dist/esm/i18n/it-it.js | 63 + .../@toast-ui/editor/dist/esm/i18n/ja-jp.js | 63 + .../@toast-ui/editor/dist/esm/i18n/ko-kr.js | 63 + .../@toast-ui/editor/dist/esm/i18n/nb-no.js | 63 + .../@toast-ui/editor/dist/esm/i18n/nl-nl.js | 63 + .../@toast-ui/editor/dist/esm/i18n/pl-pl.js | 63 + .../@toast-ui/editor/dist/esm/i18n/pt-br.js | 63 + .../@toast-ui/editor/dist/esm/i18n/ru-ru.js | 64 + .../@toast-ui/editor/dist/esm/i18n/sv-se.js | 63 + .../@toast-ui/editor/dist/esm/i18n/tr-tr.js | 63 + .../@toast-ui/editor/dist/esm/i18n/uk-ua.js | 63 + .../@toast-ui/editor/dist/esm/i18n/zh-cn.js | 63 + .../@toast-ui/editor/dist/esm/i18n/zh-tw.js | 63 + .../@toast-ui/editor/dist/esm/index.js | 25418 +++++++++++++++ .../@toast-ui/editor/dist/esm/indexViewer.js | 12730 ++++++++ .../@toast-ui/editor/dist/i18n/ar.js | 162 + .../@toast-ui/editor/dist/i18n/cs-cz.js | 162 + .../@toast-ui/editor/dist/i18n/de-de.js | 162 + .../@toast-ui/editor/dist/i18n/es-es.js | 162 + .../@toast-ui/editor/dist/i18n/fi-fi.js | 162 + .../@toast-ui/editor/dist/i18n/fr-fr.js | 162 + .../@toast-ui/editor/dist/i18n/gl-es.js | 162 + .../@toast-ui/editor/dist/i18n/hr-hr.js | 162 + .../@toast-ui/editor/dist/i18n/it-it.js | 162 + .../@toast-ui/editor/dist/i18n/ja-jp.js | 162 + .../@toast-ui/editor/dist/i18n/ko-kr.js | 162 + .../@toast-ui/editor/dist/i18n/nb-no.js | 162 + .../@toast-ui/editor/dist/i18n/nl-nl.js | 162 + .../@toast-ui/editor/dist/i18n/pl-pl.js | 162 + .../@toast-ui/editor/dist/i18n/pt-br.js | 162 + .../@toast-ui/editor/dist/i18n/ru-ru.js | 163 + .../@toast-ui/editor/dist/i18n/sv-se.js | 162 + .../@toast-ui/editor/dist/i18n/tr-tr.js | 162 + .../@toast-ui/editor/dist/i18n/uk-ua.js | 162 + .../@toast-ui/editor/dist/i18n/zh-cn.js | 162 + .../@toast-ui/editor/dist/i18n/zh-tw.js | 162 + .../editor/dist/theme/toastui-editor-dark.css | 474 + .../editor/dist/toastui-editor-only.css | 1064 + .../editor/dist/toastui-editor-viewer.css | 487 + .../editor/dist/toastui-editor-viewer.js | 14233 ++++++++ .../@toast-ui/editor/dist/toastui-editor.css | 1588 + .../@toast-ui/editor/dist/toastui-editor.js | 27081 ++++++++++++++++ .../@toast-ui/editor/package.json | 123 + .../@toast-ui/editor/types/convertor.d.ts | 140 + .../@toast-ui/editor/types/editor.d.ts | 354 + .../@toast-ui/editor/types/event.d.ts | 54 + .../@toast-ui/editor/types/index.d.ts | 70 + .../@toast-ui/editor/types/map.d.ts | 8 + .../@toast-ui/editor/types/markdown.d.ts | 60 + .../@toast-ui/editor/types/plugin.d.ts | 59 + .../editor/types/prosemirror-model.d.ts | 24 + .../editor/types/prosemirror-transform.d.ts | 35 + .../@toast-ui/editor/types/spec.d.ts | 43 + .../@toast-ui/editor/types/toastmark.d.ts | 357 + .../editor/types/toastui-editor-viewer.d.ts | 39 + .../@toast-ui/editor/types/ui.d.ts | 163 + .../@toast-ui/editor/types/wysiwyg.d.ts | 35 + .../node_modules/@yaireo/tagify/LICENSE | 19 + .../node_modules/@yaireo/tagify/README.md | 995 + .../@yaireo/tagify/dist/jQuery.tagify.min.js | 32 + .../@yaireo/tagify/dist/react.tagify.js | 8 + .../@yaireo/tagify/dist/tagify.css | 1 + .../@yaireo/tagify/dist/tagify.min.js | 8 + .../tagify/dist/tagify.polyfills.min.js | 10 + .../@yaireo/tagify/dist/tagify.vue | 27 + .../node_modules/@yaireo/tagify/package.json | 124 + .../@yaireo/tagify/src/tagify.scss | 693 + .../static/node_modules/ansi-styles/index.js | 165 + .../static/node_modules/ansi-styles/license | 9 + .../node_modules/ansi-styles/package.json | 88 + .../static/node_modules/ansi-styles/readme.md | 147 + .../static/node_modules/babel-eslint/LICENSE | 22 + .../node_modules/babel-eslint/README.md | 103 + .../babel-eslint/lib/analyze-scope.js | 346 + .../lib/babylon-to-espree/attachComments.js | 59 + .../lib/babylon-to-espree/convertComments.js | 17 + .../babylon-to-espree/convertTemplateType.js | 92 + .../lib/babylon-to-espree/index.js | 30 + .../lib/babylon-to-espree/toAST.js | 118 + .../lib/babylon-to-espree/toToken.js | 84 + .../lib/babylon-to-espree/toTokens.js | 10 + .../node_modules/babel-eslint/lib/index.js | 19 + .../babel-eslint/lib/parse-with-scope.js | 12 + .../node_modules/babel-eslint/lib/parse.js | 93 + .../babel-eslint/lib/require-from-eslint.js | 9 + .../babel-eslint/lib/visitor-keys.js | 15 + .../node_modules/babel-eslint/package.json | 90 + .../static/node_modules/bootstrap/LICENSE | 22 + .../static/node_modules/bootstrap/README.md | 239 + .../bootstrap/dist/css/bootstrap-grid.css | 5051 +++ .../bootstrap/dist/css/bootstrap-grid.css.map | 1 + .../bootstrap/dist/css/bootstrap-grid.min.css | 7 + .../dist/css/bootstrap-grid.min.css.map | 1 + .../bootstrap/dist/css/bootstrap-grid.rtl.css | 5050 +++ .../dist/css/bootstrap-grid.rtl.css.map | 1 + .../dist/css/bootstrap-grid.rtl.min.css | 7 + .../dist/css/bootstrap-grid.rtl.min.css.map | 1 + .../bootstrap/dist/css/bootstrap-reboot.css | 485 + .../dist/css/bootstrap-reboot.css.map | 1 + .../dist/css/bootstrap-reboot.min.css | 8 + .../dist/css/bootstrap-reboot.min.css.map | 1 + .../dist/css/bootstrap-reboot.rtl.css | 482 + .../dist/css/bootstrap-reboot.rtl.css.map | 1 + .../dist/css/bootstrap-reboot.rtl.min.css | 8 + .../dist/css/bootstrap-reboot.rtl.min.css.map | 1 + .../dist/css/bootstrap-utilities.css | 4866 +++ .../dist/css/bootstrap-utilities.css.map | 1 + .../dist/css/bootstrap-utilities.min.css | 7 + .../dist/css/bootstrap-utilities.min.css.map | 1 + .../dist/css/bootstrap-utilities.rtl.css | 4857 +++ .../dist/css/bootstrap-utilities.rtl.css.map | 1 + .../dist/css/bootstrap-utilities.rtl.min.css | 7 + .../css/bootstrap-utilities.rtl.min.css.map | 1 + .../bootstrap/dist/css/bootstrap.css | 11266 +++++++ .../bootstrap/dist/css/bootstrap.css.map | 1 + .../bootstrap/dist/css/bootstrap.min.css | 7 + .../bootstrap/dist/css/bootstrap.min.css.map | 1 + .../bootstrap/dist/css/bootstrap.rtl.css | 11242 +++++++ .../bootstrap/dist/css/bootstrap.rtl.css.map | 1 + .../bootstrap/dist/css/bootstrap.rtl.min.css | 7 + .../dist/css/bootstrap.rtl.min.css.map | 1 + .../bootstrap/dist/js/bootstrap.bundle.js | 6812 ++++ .../bootstrap/dist/js/bootstrap.bundle.js.map | 1 + .../bootstrap/dist/js/bootstrap.bundle.min.js | 7 + .../dist/js/bootstrap.bundle.min.js.map | 1 + .../bootstrap/dist/js/bootstrap.esm.js | 4999 +++ .../bootstrap/dist/js/bootstrap.esm.js.map | 1 + .../bootstrap/dist/js/bootstrap.esm.min.js | 7 + .../dist/js/bootstrap.esm.min.js.map | 1 + .../bootstrap/dist/js/bootstrap.js | 5046 +++ .../bootstrap/dist/js/bootstrap.js.map | 1 + .../bootstrap/dist/js/bootstrap.min.js | 7 + .../bootstrap/dist/js/bootstrap.min.js.map | 1 + .../node_modules/bootstrap/js/dist/alert.js | 235 + .../bootstrap/js/dist/alert.js.map | 1 + .../bootstrap/js/dist/base-component.js | 183 + .../bootstrap/js/dist/base-component.js.map | 1 + .../node_modules/bootstrap/js/dist/button.js | 146 + .../bootstrap/js/dist/button.js.map | 1 + .../bootstrap/js/dist/carousel.js | 743 + .../bootstrap/js/dist/carousel.js.map | 1 + .../bootstrap/js/dist/collapse.js | 495 + .../bootstrap/js/dist/collapse.js.map | 1 + .../bootstrap/js/dist/dom/data.js | 69 + .../bootstrap/js/dist/dom/data.js.map | 1 + .../bootstrap/js/dist/dom/event-handler.js | 322 + .../js/dist/dom/event-handler.js.map | 1 + .../bootstrap/js/dist/dom/manipulator.js | 89 + .../bootstrap/js/dist/dom/manipulator.js.map | 1 + .../bootstrap/js/dist/dom/selector-engine.js | 128 + .../js/dist/dom/selector-engine.js.map | 1 + .../bootstrap/js/dist/dropdown.js | 687 + .../bootstrap/js/dist/dropdown.js.map | 1 + .../node_modules/bootstrap/js/dist/modal.js | 1042 + .../bootstrap/js/dist/modal.js.map | 1 + .../bootstrap/js/dist/offcanvas.js | 867 + .../bootstrap/js/dist/offcanvas.js.map | 1 + .../node_modules/bootstrap/js/dist/popover.js | 184 + .../bootstrap/js/dist/popover.js.map | 1 + .../bootstrap/js/dist/scrollspy.js | 391 + .../bootstrap/js/dist/scrollspy.js.map | 1 + .../node_modules/bootstrap/js/dist/tab.js | 333 + .../node_modules/bootstrap/js/dist/tab.js.map | 1 + .../node_modules/bootstrap/js/dist/toast.js | 423 + .../bootstrap/js/dist/toast.js.map | 1 + .../node_modules/bootstrap/js/dist/tooltip.js | 1006 + .../bootstrap/js/dist/tooltip.js.map | 1 + .../node_modules/bootstrap/js/src/alert.js | 99 + .../bootstrap/js/src/base-component.js | 75 + .../node_modules/bootstrap/js/src/button.js | 86 + .../node_modules/bootstrap/js/src/carousel.js | 591 + .../node_modules/bootstrap/js/src/collapse.js | 335 + .../node_modules/bootstrap/js/src/dom/data.js | 57 + .../bootstrap/js/src/dom/event-handler.js | 348 + .../bootstrap/js/src/dom/manipulator.js | 80 + .../bootstrap/js/src/dom/selector-engine.js | 92 + .../node_modules/bootstrap/js/src/dropdown.js | 499 + .../node_modules/bootstrap/js/src/modal.js | 437 + .../bootstrap/js/src/offcanvas.js | 272 + .../node_modules/bootstrap/js/src/popover.js | 128 + .../bootstrap/js/src/scrollspy.js | 295 + .../node_modules/bootstrap/js/src/tab.js | 224 + .../node_modules/bootstrap/js/src/toast.js | 242 + .../node_modules/bootstrap/js/src/tooltip.js | 763 + .../bootstrap/js/src/util/backdrop.js | 130 + .../js/src/util/component-functions.js | 34 + .../bootstrap/js/src/util/focustrap.js | 105 + .../bootstrap/js/src/util/index.js | 333 + .../bootstrap/js/src/util/sanitizer.js | 126 + .../bootstrap/js/src/util/scrollbar.js | 97 + .../node_modules/bootstrap/package.json | 210 + .../bootstrap/scss/_accordion.scss | 118 + .../node_modules/bootstrap/scss/_alert.scss | 57 + .../node_modules/bootstrap/scss/_badge.scss | 29 + .../bootstrap/scss/_breadcrumb.scss | 28 + .../bootstrap/scss/_button-group.scss | 139 + .../node_modules/bootstrap/scss/_buttons.scss | 111 + .../node_modules/bootstrap/scss/_card.scss | 216 + .../bootstrap/scss/_carousel.scss | 229 + .../node_modules/bootstrap/scss/_close.scss | 40 + .../bootstrap/scss/_containers.scss | 41 + .../bootstrap/scss/_dropdown.scss | 240 + .../node_modules/bootstrap/scss/_forms.scss | 9 + .../bootstrap/scss/_functions.scss | 302 + .../node_modules/bootstrap/scss/_grid.scss | 33 + .../node_modules/bootstrap/scss/_helpers.scss | 9 + .../node_modules/bootstrap/scss/_images.scss | 42 + .../bootstrap/scss/_list-group.scss | 174 + .../node_modules/bootstrap/scss/_mixins.scss | 43 + .../node_modules/bootstrap/scss/_modal.scss | 209 + .../node_modules/bootstrap/scss/_nav.scss | 139 + .../node_modules/bootstrap/scss/_navbar.scss | 335 + .../bootstrap/scss/_offcanvas.scss | 83 + .../bootstrap/scss/_pagination.scss | 64 + .../bootstrap/scss/_placeholders.scss | 51 + .../node_modules/bootstrap/scss/_popover.scss | 158 + .../bootstrap/scss/_progress.scss | 48 + .../node_modules/bootstrap/scss/_reboot.scss | 625 + .../node_modules/bootstrap/scss/_root.scss | 54 + .../bootstrap/scss/_spinners.scss | 69 + .../node_modules/bootstrap/scss/_tables.scss | 155 + .../node_modules/bootstrap/scss/_toasts.scss | 51 + .../node_modules/bootstrap/scss/_tooltip.scss | 115 + .../bootstrap/scss/_transitions.scss | 27 + .../node_modules/bootstrap/scss/_type.scss | 104 + .../bootstrap/scss/_utilities.scss | 630 + .../bootstrap/scss/_variables.scss | 1641 + .../bootstrap/scss/bootstrap-grid.scss | 67 + .../bootstrap/scss/bootstrap-reboot.scss | 13 + .../bootstrap/scss/bootstrap-utilities.scss | 18 + .../bootstrap/scss/bootstrap.scss | 53 + .../scss/forms/_floating-labels.scss | 63 + .../bootstrap/scss/forms/_form-check.scss | 152 + .../bootstrap/scss/forms/_form-control.scss | 219 + .../bootstrap/scss/forms/_form-range.scss | 91 + .../bootstrap/scss/forms/_form-select.scss | 72 + .../bootstrap/scss/forms/_form-text.scss | 11 + .../bootstrap/scss/forms/_input-group.scss | 121 + .../bootstrap/scss/forms/_labels.scss | 36 + .../bootstrap/scss/forms/_validation.scss | 12 + .../bootstrap/scss/helpers/_clearfix.scss | 3 + .../scss/helpers/_colored-links.scss | 12 + .../bootstrap/scss/helpers/_position.scss | 30 + .../bootstrap/scss/helpers/_ratio.scss | 26 + .../bootstrap/scss/helpers/_stacks.scss | 15 + .../scss/helpers/_stretched-link.scss | 15 + .../scss/helpers/_text-truncation.scss | 7 + .../scss/helpers/_visually-hidden.scss | 8 + .../bootstrap/scss/helpers/_vr.scss | 8 + .../bootstrap/scss/mixins/_alert.scss | 11 + .../bootstrap/scss/mixins/_backdrop.scss | 14 + .../bootstrap/scss/mixins/_border-radius.scss | 78 + .../bootstrap/scss/mixins/_box-shadow.scss | 18 + .../bootstrap/scss/mixins/_breakpoints.scss | 127 + .../bootstrap/scss/mixins/_buttons.scss | 133 + .../bootstrap/scss/mixins/_caret.scss | 64 + .../bootstrap/scss/mixins/_clearfix.scss | 9 + .../bootstrap/scss/mixins/_color-scheme.scss | 7 + .../bootstrap/scss/mixins/_container.scss | 9 + .../bootstrap/scss/mixins/_deprecate.scss | 10 + .../bootstrap/scss/mixins/_forms.scss | 144 + .../bootstrap/scss/mixins/_gradients.scss | 47 + .../bootstrap/scss/mixins/_grid.scss | 151 + .../bootstrap/scss/mixins/_image.scss | 16 + .../bootstrap/scss/mixins/_list-group.scss | 24 + .../bootstrap/scss/mixins/_lists.scss | 7 + .../bootstrap/scss/mixins/_pagination.scss | 31 + .../bootstrap/scss/mixins/_reset-text.scss | 17 + .../bootstrap/scss/mixins/_resize.scss | 6 + .../scss/mixins/_table-variants.scss | 21 + .../bootstrap/scss/mixins/_text-truncate.scss | 8 + .../bootstrap/scss/mixins/_transition.scss | 26 + .../bootstrap/scss/mixins/_utilities.scss | 89 + .../scss/mixins/_visually-hidden.scss | 29 + .../bootstrap/scss/utilities/_api.scss | 47 + .../bootstrap/scss/vendor/_rfs.scss | 354 + .../static/node_modules/chalk/index.js | 228 + .../static/node_modules/chalk/index.js.flow | 93 + .../static/node_modules/chalk/license | 9 + .../static/node_modules/chalk/package.json | 103 + .../static/node_modules/chalk/readme.md | 314 + .../static/node_modules/chalk/templates.js | 128 + .../node_modules/chalk/types/index.d.ts | 97 + .../node_modules/color-convert/CHANGELOG.md | 54 + .../static/node_modules/color-convert/LICENSE | 21 + .../node_modules/color-convert/README.md | 68 + .../node_modules/color-convert/conversions.js | 868 + .../node_modules/color-convert/index.js | 78 + .../node_modules/color-convert/package.json | 81 + .../node_modules/color-convert/route.js | 97 + .../node_modules/color-name/.eslintrc.json | 43 + .../static/node_modules/color-name/.npmignore | 107 + .../static/node_modules/color-name/LICENSE | 8 + .../static/node_modules/color-name/README.md | 11 + .../static/node_modules/color-name/index.js | 152 + .../node_modules/color-name/package.json | 53 + .../static/node_modules/color-name/test.js | 7 + .../static/node_modules/debug/LICENSE | 19 + .../static/node_modules/debug/README.md | 455 + .../static/node_modules/debug/package.json | 101 + .../static/node_modules/debug/src/browser.js | 269 + .../static/node_modules/debug/src/common.js | 274 + .../static/node_modules/debug/src/index.js | 10 + .../static/node_modules/debug/src/node.js | 263 + .../static/node_modules/dompurify/LICENSE | 378 + .../static/node_modules/dompurify/README.md | 348 + .../node_modules/dompurify/dist/purify.cjs.js | 1392 + .../dompurify/dist/purify.cjs.js.map | 1 + .../node_modules/dompurify/dist/purify.es.js | 1390 + .../dompurify/dist/purify.es.js.map | 1 + .../node_modules/dompurify/dist/purify.js | 1398 + .../node_modules/dompurify/dist/purify.js.map | 1 + .../node_modules/dompurify/dist/purify.min.js | 3 + .../dompurify/dist/purify.min.js.map | 1 + .../node_modules/dompurify/package.json | 165 + .../escape-string-regexp/index.js | 11 + .../node_modules/escape-string-regexp/license | 21 + .../escape-string-regexp/package.json | 81 + .../escape-string-regexp/readme.md | 27 + .../eslint-visitor-keys/CHANGELOG.md | 25 + .../node_modules/eslint-visitor-keys/LICENSE | 201 + .../eslint-visitor-keys/README.md | 98 + .../eslint-visitor-keys/lib/index.js | 81 + .../eslint-visitor-keys/lib/visitor-keys.json | 284 + .../eslint-visitor-keys/package.json | 71 + .../node_modules/function-bind/.editorconfig | 20 + .../node_modules/function-bind/.eslintrc | 15 + .../node_modules/function-bind/.jscs.json | 176 + .../node_modules/function-bind/.npmignore | 22 + .../node_modules/function-bind/.travis.yml | 168 + .../static/node_modules/function-bind/LICENSE | 20 + .../node_modules/function-bind/README.md | 48 + .../function-bind/implementation.js | 52 + .../node_modules/function-bind/index.js | 5 + .../node_modules/function-bind/package.json | 94 + .../node_modules/function-bind/test/.eslintrc | 9 + .../node_modules/function-bind/test/index.js | 252 + .../static/node_modules/globals/globals.json | 1563 + .../static/node_modules/globals/index.js | 2 + .../static/node_modules/globals/license | 9 + .../static/node_modules/globals/package.json | 73 + .../static/node_modules/globals/readme.md | 41 + .../static/node_modules/has-flag/index.js | 8 + .../static/node_modules/has-flag/license | 9 + .../static/node_modules/has-flag/package.json | 76 + .../static/node_modules/has-flag/readme.md | 70 + .../static/node_modules/has/LICENSE-MIT | 22 + .../static/node_modules/has/README.md | 18 + .../static/node_modules/has/package.json | 73 + .../static/node_modules/has/src/index.js | 5 + .../static/node_modules/has/test/index.js | 10 + .../node_modules/is-core-module/.eslintignore | 1 + .../node_modules/is-core-module/.eslintrc | 18 + .../static/node_modules/is-core-module/.nycrc | 9 + .../node_modules/is-core-module/CHANGELOG.md | 117 + .../node_modules/is-core-module/LICENSE | 20 + .../node_modules/is-core-module/README.md | 40 + .../node_modules/is-core-module/core.json | 152 + .../node_modules/is-core-module/index.js | 69 + .../node_modules/is-core-module/package.json | 97 + .../node_modules/is-core-module/test/index.js | 130 + .../node_modules/js-tokens/CHANGELOG.md | 151 + .../static/node_modules/js-tokens/LICENSE | 21 + .../static/node_modules/js-tokens/README.md | 240 + .../static/node_modules/js-tokens/index.js | 23 + .../node_modules/js-tokens/package.json | 64 + .../static/node_modules/jsesc/LICENSE-MIT.txt | 20 + .../static/node_modules/jsesc/README.md | 421 + .../static/node_modules/jsesc/bin/jsesc | 148 + .../static/node_modules/jsesc/jsesc.js | 329 + .../static/node_modules/jsesc/man/jsesc.1 | 94 + .../static/node_modules/jsesc/package.json | 85 + .../resources/static/node_modules/ms/index.js | 162 + .../static/node_modules/ms/license.md | 21 + .../static/node_modules/ms/package.json | 69 + .../static/node_modules/ms/readme.md | 60 + .../static/node_modules/orderedmap/.tern-port | 1 + .../static/node_modules/orderedmap/LICENSE | 19 + .../static/node_modules/orderedmap/README.md | 66 + .../node_modules/orderedmap/index.es.js | 131 + .../static/node_modules/orderedmap/index.js | 129 + .../static/node_modules/orderedmap/index.mjs | 131 + .../node_modules/orderedmap/package.json | 58 + .../static/node_modules/path-parse/LICENSE | 21 + .../static/node_modules/path-parse/README.md | 42 + .../static/node_modules/path-parse/index.js | 75 + .../node_modules/path-parse/package.json | 61 + .../prosemirror-commands/.tern-project | 8 + .../prosemirror-commands/CHANGELOG.md | 216 + .../prosemirror-commands/CONTRIBUTING.md | 104 + .../node_modules/prosemirror-commands/LICENSE | 19 + .../prosemirror-commands/README.md | 28 + .../prosemirror-commands/dist/index.es.js | 689 + .../prosemirror-commands/dist/index.es.js.map | 1 + .../prosemirror-commands/dist/index.js | 716 + .../prosemirror-commands/dist/index.js.map | 1 + .../prosemirror-commands/package.json | 66 + .../prosemirror-commands/rollup.config.js | 14 + .../prosemirror-commands/src/README.md | 35 + .../prosemirror-commands/src/commands.js | 641 + .../prosemirror-history/.tern-project | 8 + .../prosemirror-history/CHANGELOG.md | 126 + .../prosemirror-history/CONTRIBUTING.md | 104 + .../node_modules/prosemirror-history/LICENSE | 19 + .../prosemirror-history/README.md | 27 + .../prosemirror-history/dist/index.es.js | 456 + .../prosemirror-history/dist/index.es.js.map | 1 + .../prosemirror-history/dist/index.js | 470 + .../prosemirror-history/dist/index.js.map | 1 + .../prosemirror-history/package.json | 67 + .../prosemirror-history/rollup.config.js | 14 + .../prosemirror-history/src/README.md | 17 + .../prosemirror-history/src/history.js | 455 + .../prosemirror-inputrules/.tern-project | 8 + .../prosemirror-inputrules/CHANGELOG.md | 85 + .../prosemirror-inputrules/CONTRIBUTING.md | 104 + .../prosemirror-inputrules/LICENSE | 19 + .../prosemirror-inputrules/README.md | 29 + .../prosemirror-inputrules/dist/index.es.js | 177 + .../dist/index.es.js.map | 1 + .../prosemirror-inputrules/dist/index.js | 192 + .../prosemirror-inputrules/dist/index.js.map | 1 + .../prosemirror-inputrules/package.json | 62 + .../prosemirror-inputrules/rollup.config.js | 14 + .../prosemirror-inputrules/src/README.md | 23 + .../prosemirror-inputrules/src/index.js | 4 + .../prosemirror-inputrules/src/inputrules.js | 122 + .../src/rulebuilders.js | 51 + .../prosemirror-inputrules/src/rules.js | 17 + .../prosemirror-keymap/.tern-project | 8 + .../prosemirror-keymap/CHANGELOG.md | 80 + .../prosemirror-keymap/CONTRIBUTING.md | 104 + .../node_modules/prosemirror-keymap/LICENSE | 19 + .../node_modules/prosemirror-keymap/README.md | 27 + .../prosemirror-keymap/dist/index.es.js | 105 + .../prosemirror-keymap/dist/index.es.js.map | 1 + .../prosemirror-keymap/dist/index.js | 110 + .../prosemirror-keymap/dist/index.js.map | 1 + .../prosemirror-keymap/package.json | 64 + .../prosemirror-keymap/rollup.config.js | 14 + .../prosemirror-keymap/src/README.md | 5 + .../prosemirror-keymap/src/keymap.js | 102 + .../prosemirror-model/.tern-project | 8 + .../prosemirror-model/CHANGELOG.md | 546 + .../prosemirror-model/CONTRIBUTING.md | 104 + .../node_modules/prosemirror-model/LICENSE | 19 + .../node_modules/prosemirror-model/README.md | 29 + .../prosemirror-model/dist/index.es.js | 3462 ++ .../prosemirror-model/dist/index.es.js.map | 1 + .../prosemirror-model/dist/index.js | 3482 ++ .../prosemirror-model/dist/index.js.map | 1 + .../prosemirror-model/etc/link-self.js | 13 + .../prosemirror-model/package.json | 69 + .../prosemirror-model/rollup.config.js | 14 + .../prosemirror-model/src/README.md | 58 + .../prosemirror-model/src/comparedeep.js | 15 + .../prosemirror-model/src/content.js | 389 + .../prosemirror-model/src/diff.js | 50 + .../prosemirror-model/src/fragment.js | 279 + .../prosemirror-model/src/from_dom.js | 824 + .../prosemirror-model/src/index.js | 11 + .../prosemirror-model/src/mark.js | 116 + .../prosemirror-model/src/node.js | 419 + .../prosemirror-model/src/replace.js | 225 + .../prosemirror-model/src/resolvedpos.js | 291 + .../prosemirror-model/src/schema.js | 588 + .../prosemirror-model/src/to_dom.js | 195 + .../prosemirror-state/.tern-project | 8 + .../prosemirror-state/CHANGELOG.md | 260 + .../prosemirror-state/CONTRIBUTING.md | 104 + .../node_modules/prosemirror-state/LICENSE | 19 + .../node_modules/prosemirror-state/README.md | 28 + .../prosemirror-state/dist/index.es.js | 1134 + .../prosemirror-state/dist/index.es.js.map | 1 + .../prosemirror-state/dist/index.js | 1146 + .../prosemirror-state/dist/index.js.map | 1 + .../prosemirror-state/package.json | 70 + .../prosemirror-state/rollup.config.js | 14 + .../prosemirror-state/src/README.md | 39 + .../prosemirror-state/src/index.js | 7 + .../prosemirror-state/src/plugin.js | 134 + .../prosemirror-state/src/selection.js | 474 + .../prosemirror-state/src/state.js | 288 + .../prosemirror-state/src/transaction.js | 205 + .../prosemirror-transform/.tern-project | 8 + .../prosemirror-transform/CHANGELOG.md | 358 + .../prosemirror-transform/CONTRIBUTING.md | 104 + .../prosemirror-transform/LICENSE | 19 + .../prosemirror-transform/README.md | 29 + .../prosemirror-transform/dist/index.es.js | 1689 + .../dist/index.es.js.map | 1 + .../prosemirror-transform/dist/index.js | 1711 + .../prosemirror-transform/dist/index.js.map | 1 + .../prosemirror-transform/package.json | 68 + .../prosemirror-transform/rollup.config.js | 14 + .../prosemirror-transform/src/README.md | 55 + .../prosemirror-transform/src/index.js | 8 + .../prosemirror-transform/src/map.js | 261 + .../prosemirror-transform/src/mark.js | 108 + .../prosemirror-transform/src/mark_step.js | 127 + .../prosemirror-transform/src/replace.js | 492 + .../prosemirror-transform/src/replace_step.js | 182 + .../prosemirror-transform/src/step.js | 110 + .../prosemirror-transform/src/structure.js | 291 + .../prosemirror-transform/src/transform.js | 71 + .../prosemirror-view/.tern-project | 8 + .../prosemirror-view/CHANGELOG.md | 1735 + .../prosemirror-view/CONTRIBUTING.md | 104 + .../node_modules/prosemirror-view/LICENSE | 19 + .../node_modules/prosemirror-view/README.md | 28 + .../prosemirror-view/dist/index.es.js | 5440 ++++ .../prosemirror-view/dist/index.es.js.map | 1 + .../prosemirror-view/dist/index.js | 5449 ++++ .../prosemirror-view/dist/index.js.map | 1 + .../prosemirror-view/package.json | 69 + .../prosemirror-view/rollup.config.js | 14 + .../prosemirror-view/src/README.md | 28 + .../prosemirror-view/src/browser.js | 23 + .../prosemirror-view/src/capturekeys.js | 271 + .../prosemirror-view/src/clipboard.js | 226 + .../prosemirror-view/src/decoration.js | 695 + .../node_modules/prosemirror-view/src/dom.js | 92 + .../prosemirror-view/src/domchange.js | 343 + .../prosemirror-view/src/domcoords.js | 458 + .../prosemirror-view/src/domobserver.js | 238 + .../prosemirror-view/src/index.js | 656 + .../prosemirror-view/src/input.js | 714 + .../prosemirror-view/src/selection.js | 193 + .../prosemirror-view/src/viewdesc.js | 1427 + .../prosemirror-view/style/prosemirror.css | 51 + .../static/node_modules/resolve/.editorconfig | 37 + .../static/node_modules/resolve/.eslintignore | 1 + .../static/node_modules/resolve/.eslintrc | 39 + .../static/node_modules/resolve/LICENSE | 21 + .../static/node_modules/resolve/SECURITY.md | 3 + .../static/node_modules/resolve/appveyor.yml | 74 + .../node_modules/resolve/example/async.js | 5 + .../node_modules/resolve/example/sync.js | 3 + .../static/node_modules/resolve/index.js | 6 + .../static/node_modules/resolve/lib/async.js | 320 + .../static/node_modules/resolve/lib/caller.js | 8 + .../static/node_modules/resolve/lib/core.js | 53 + .../static/node_modules/resolve/lib/core.json | 83 + .../node_modules/resolve/lib/is-core.js | 5 + .../resolve/lib/node-modules-paths.js | 42 + .../resolve/lib/normalize-options.js | 10 + .../static/node_modules/resolve/lib/sync.js | 199 + .../static/node_modules/resolve/package.json | 80 + .../node_modules/resolve/readme.markdown | 279 + .../node_modules/resolve/test/.eslintrc | 5 + .../static/node_modules/resolve/test/core.js | 81 + .../node_modules/resolve/test/dotdot.js | 29 + .../resolve/test/dotdot/abc/index.js | 2 + .../node_modules/resolve/test/dotdot/index.js | 1 + .../resolve/test/faulty_basedir.js | 29 + .../node_modules/resolve/test/filter.js | 34 + .../node_modules/resolve/test/filter_sync.js | 33 + .../static/node_modules/resolve/test/mock.js | 315 + .../node_modules/resolve/test/mock_sync.js | 216 + .../node_modules/resolve/test/module_dir.js | 56 + .../test/module_dir/xmodules/aaa/index.js | 1 + .../test/module_dir/ymodules/aaa/index.js | 1 + .../test/module_dir/zmodules/bbb/main.js | 1 + .../test/module_dir/zmodules/bbb/package.json | 3 + .../resolve/test/node-modules-paths.js | 143 + .../node_modules/resolve/test/node_path.js | 70 + .../resolve/test/node_path/x/aaa/index.js | 1 + .../resolve/test/node_path/x/ccc/index.js | 1 + .../resolve/test/node_path/y/bbb/index.js | 1 + .../resolve/test/node_path/y/ccc/index.js | 1 + .../node_modules/resolve/test/nonstring.js | 9 + .../node_modules/resolve/test/pathfilter.js | 75 + .../resolve/test/pathfilter/deep_ref/main.js | 0 .../node_modules/resolve/test/precedence.js | 23 + .../resolve/test/precedence/aaa.js | 1 + .../resolve/test/precedence/aaa/index.js | 1 + .../resolve/test/precedence/aaa/main.js | 1 + .../resolve/test/precedence/bbb.js | 1 + .../resolve/test/precedence/bbb/main.js | 1 + .../node_modules/resolve/test/resolver.js | 450 + .../resolve/test/resolver/baz/doom.js | 0 .../resolve/test/resolver/baz/package.json | 4 + .../resolve/test/resolver/baz/quux.js | 1 + .../resolve/test/resolver/browser_field/a.js | 0 .../resolve/test/resolver/browser_field/b.js | 0 .../test/resolver/browser_field/package.json | 5 + .../resolve/test/resolver/cup.coffee | 1 + .../resolve/test/resolver/dot_main/index.js | 1 + .../test/resolver/dot_main/package.json | 3 + .../test/resolver/dot_slash_main/index.js | 1 + .../test/resolver/dot_slash_main/package.json | 3 + .../node_modules/resolve/test/resolver/foo.js | 1 + .../test/resolver/incorrect_main/index.js | 2 + .../test/resolver/incorrect_main/package.json | 3 + .../test/resolver/invalid_main/package.json | 7 + .../resolve/test/resolver/mug.coffee | 0 .../node_modules/resolve/test/resolver/mug.js | 0 .../test/resolver/multirepo/lerna.json | 6 + .../test/resolver/multirepo/package.json | 20 + .../multirepo/packages/package-a/index.js | 35 + .../multirepo/packages/package-a/package.json | 14 + .../multirepo/packages/package-b/index.js | 0 .../multirepo/packages/package-b/package.json | 14 + .../resolver/nested_symlinks/mylib/async.js | 26 + .../nested_symlinks/mylib/package.json | 15 + .../resolver/nested_symlinks/mylib/sync.js | 12 + .../test/resolver/other_path/lib/other-lib.js | 0 .../resolve/test/resolver/other_path/root.js | 0 .../resolve/test/resolver/quux/foo/index.js | 1 + .../resolve/test/resolver/same_names/foo.js | 1 + .../test/resolver/same_names/foo/index.js | 1 + .../resolver/symlinked/_/node_modules/foo.js | 0 .../symlinked/_/symlink_target/.gitkeep | 0 .../test/resolver/symlinked/package/bar.js | 1 + .../resolver/symlinked/package/package.json | 3 + .../test/resolver/without_basedir/main.js | 5 + .../resolve/test/resolver_sync.js | 358 + .../resolve/test/shadowed_core.js | 54 + .../shadowed_core/node_modules/util/index.js | 0 .../node_modules/resolve/test/subdirs.js | 13 + .../node_modules/resolve/test/symlinks.js | 176 + .../static/node_modules/rope-sequence/LICENSE | 19 + .../node_modules/rope-sequence/README.md | 63 + .../rope-sequence/dist/index.es.js | 209 + .../node_modules/rope-sequence/dist/index.js | 211 + .../node_modules/rope-sequence/index.js | 190 + .../node_modules/rope-sequence/package.json | 62 + .../static/node_modules/rope-sequence/test.js | 78 + .../node_modules/source-map/CHANGELOG.md | 301 + .../static/node_modules/source-map/LICENSE | 28 + .../static/node_modules/source-map/README.md | 729 + .../source-map/dist/source-map.debug.js | 3091 ++ .../source-map/dist/source-map.js | 3090 ++ .../source-map/dist/source-map.min.js | 2 + .../source-map/dist/source-map.min.js.map | 1 + .../node_modules/source-map/lib/array-set.js | 121 + .../node_modules/source-map/lib/base64-vlq.js | 140 + .../node_modules/source-map/lib/base64.js | 67 + .../source-map/lib/binary-search.js | 111 + .../source-map/lib/mapping-list.js | 79 + .../node_modules/source-map/lib/quick-sort.js | 114 + .../source-map/lib/source-map-consumer.js | 1082 + .../source-map/lib/source-map-generator.js | 416 + .../source-map/lib/source-node.js | 413 + .../node_modules/source-map/lib/util.js | 417 + .../node_modules/source-map/package.json | 211 + .../node_modules/source-map/source-map.js | 8 + .../node_modules/supports-color/browser.js | 5 + .../node_modules/supports-color/index.js | 131 + .../node_modules/supports-color/license | 9 + .../node_modules/supports-color/package.json | 85 + .../node_modules/supports-color/readme.md | 66 + .../node_modules/to-fast-properties/index.js | 27 + .../node_modules/to-fast-properties/license | 10 + .../to-fast-properties/package.json | 67 + .../node_modules/to-fast-properties/readme.md | 37 + .../node_modules/tui-font-size-picker/LICENSE | 21 + .../tui-font-size-picker/README.md | 60 + .../dist/font-size-picker.js | 740 + .../tui-font-size-picker/index.d.ts | 3 + .../tui-font-size-picker/package.json | 92 + .../node_modules/w3c-keyname/.tern-port | 1 + .../static/node_modules/w3c-keyname/LICENSE | 19 + .../static/node_modules/w3c-keyname/README.md | 18 + .../static/node_modules/w3c-keyname/index.cjs | 132 + .../node_modules/w3c-keyname/index.d.ts | 5 + .../node_modules/w3c-keyname/index.es.js | 124 + .../node_modules/w3c-keyname/package.json | 65 + .../static/node_modules/wow.js/.npmignore | 4 + .../static/node_modules/wow.js/.travis.yml | 3 + .../static/node_modules/wow.js/Gruntfile.js | 94 + .../static/node_modules/wow.js/LICENSE | 34 + .../static/node_modules/wow.js/README.md | 140 + .../static/node_modules/wow.js/bower.json | 25 + .../node_modules/wow.js/css/libs/animate.css | 2744 ++ .../static/node_modules/wow.js/css/site.css | 36 + .../static/node_modules/wow.js/demo.html | 52 + .../static/node_modules/wow.js/dist/wow.js | 533 + .../node_modules/wow.js/dist/wow.js.map | 1 + .../node_modules/wow.js/dist/wow.min.js | 3 + .../node_modules/wow.js/dist/wow.min.js.gz | Bin 0 -> 2823 bytes .../static/node_modules/wow.js/package.json | 77 + .../coffeescripts/helpers/SpecHelper.coffee | 1 + .../wow.js/spec/coffeescripts/wow-spec.coffee | 334 + .../spec/javascripts/fixtures/custom.html | 1 + .../spec/javascripts/fixtures/simple.html | 1 + .../spec/javascripts/helpers/SpecHelper.js | 4 + .../spec/javascripts/libs/jasmine-jquery.js | 812 + .../wow.js/spec/javascripts/libs/jquery.js | 9789 ++++++ .../wow.js/spec/javascripts/wow-spec.js | 244 + .../node_modules/wow.js/src/.eslintrc.json | 15 + .../static/node_modules/wow.js/src/WOW.js | 412 + 920 files changed, 324250 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/static/node_modules/.bin/jsesc create mode 100644 src/main/resources/static/node_modules/.bin/jsesc.cmd create mode 100644 src/main/resources/static/node_modules/.bin/jsesc.ps1 create mode 100644 src/main/resources/static/node_modules/.bin/parser create mode 100644 src/main/resources/static/node_modules/.bin/parser.cmd create mode 100644 src/main/resources/static/node_modules/.bin/parser.ps1 create mode 100644 src/main/resources/static/node_modules/.package-lock.json create mode 100644 src/main/resources/static/node_modules/@babel/code-frame/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/code-frame/README.md create mode 100644 src/main/resources/static/node_modules/@babel/code-frame/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/code-frame/package.json create mode 100644 src/main/resources/static/node_modules/@babel/generator/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/generator/README.md create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/buffer.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/base.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/classes.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/expressions.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/flow.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/index.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/jsx.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/methods.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/modules.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/statements.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/template-literals.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/types.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/generators/typescript.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/node/index.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/node/parentheses.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/node/whitespace.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/printer.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/lib/source-map.js create mode 100644 src/main/resources/static/node_modules/@babel/generator/package.json create mode 100644 src/main/resources/static/node_modules/@babel/helper-function-name/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/helper-function-name/README.md create mode 100644 src/main/resources/static/node_modules/@babel/helper-function-name/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/helper-function-name/package.json create mode 100644 src/main/resources/static/node_modules/@babel/helper-get-function-arity/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/helper-get-function-arity/README.md create mode 100644 src/main/resources/static/node_modules/@babel/helper-get-function-arity/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/helper-get-function-arity/package.json create mode 100644 src/main/resources/static/node_modules/@babel/helper-hoist-variables/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/helper-hoist-variables/README.md create mode 100644 src/main/resources/static/node_modules/@babel/helper-hoist-variables/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/helper-hoist-variables/package.json create mode 100644 src/main/resources/static/node_modules/@babel/helper-split-export-declaration/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/helper-split-export-declaration/README.md create mode 100644 src/main/resources/static/node_modules/@babel/helper-split-export-declaration/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/helper-split-export-declaration/package.json create mode 100644 src/main/resources/static/node_modules/@babel/helper-validator-identifier/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/helper-validator-identifier/README.md create mode 100644 src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/identifier.js create mode 100644 src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/keyword.js create mode 100644 src/main/resources/static/node_modules/@babel/helper-validator-identifier/package.json create mode 100644 src/main/resources/static/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js create mode 100644 src/main/resources/static/node_modules/@babel/highlight/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/highlight/README.md create mode 100644 src/main/resources/static/node_modules/@babel/highlight/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/highlight/package.json create mode 100644 src/main/resources/static/node_modules/@babel/parser/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/@babel/parser/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/parser/README.md create mode 100644 src/main/resources/static/node_modules/@babel/parser/bin/babel-parser.js create mode 100644 src/main/resources/static/node_modules/@babel/parser/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/parser/lib/index.js.map create mode 100644 src/main/resources/static/node_modules/@babel/parser/package.json create mode 100644 src/main/resources/static/node_modules/@babel/parser/typings/babel-parser.d.ts create mode 100644 src/main/resources/static/node_modules/@babel/template/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/template/README.md create mode 100644 src/main/resources/static/node_modules/@babel/template/lib/builder.js create mode 100644 src/main/resources/static/node_modules/@babel/template/lib/formatters.js create mode 100644 src/main/resources/static/node_modules/@babel/template/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/template/lib/literal.js create mode 100644 src/main/resources/static/node_modules/@babel/template/lib/options.js create mode 100644 src/main/resources/static/node_modules/@babel/template/lib/parse.js create mode 100644 src/main/resources/static/node_modules/@babel/template/lib/populate.js create mode 100644 src/main/resources/static/node_modules/@babel/template/lib/string.js create mode 100644 src/main/resources/static/node_modules/@babel/template/package.json create mode 100644 src/main/resources/static/node_modules/@babel/traverse/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/traverse/README.md create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/cache.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/context.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/hub.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/ancestry.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/comments.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/context.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/conversion.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/evaluation.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/family.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/generated/asserts.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/generated/validators.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/generated/virtual-types.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/index.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/inference/index.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/inference/inferers.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/introspection.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/lib/hoister.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/lib/virtual-types.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/modification.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/removal.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/path/replacement.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/scope/binding.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/scope/index.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/scope/lib/renamer.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/types.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/lib/visitors.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/package.json create mode 100644 src/main/resources/static/node_modules/@babel/traverse/scripts/generators/asserts.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/scripts/generators/validators.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/scripts/generators/virtual-types.js create mode 100644 src/main/resources/static/node_modules/@babel/traverse/scripts/package.json create mode 100644 src/main/resources/static/node_modules/@babel/types/LICENSE create mode 100644 src/main/resources/static/node_modules/@babel/types/README.md create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/asserts/assertNode.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/asserts/generated/index.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/ast-types/generated/index.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/builders/builder.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/builders/generated/index.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/builders/generated/uppercase.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/builders/react/buildChildren.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/clone/clone.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/clone/cloneDeep.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/clone/cloneNode.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/comments/addComment.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/comments/addComments.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/comments/inheritInnerComments.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/comments/inheritLeadingComments.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/comments/inheritTrailingComments.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/comments/inheritsComments.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/comments/removeComments.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/constants/generated/index.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/constants/index.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/Scope.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/ensureBlock.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/toBlock.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/toComputedKey.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/toExpression.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/toIdentifier.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/toKeyAlias.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/toSequenceExpression.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/toStatement.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/converters/valueToNode.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/definitions/core.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/definitions/experimental.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/definitions/flow.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/definitions/index.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/definitions/jsx.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/definitions/misc.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/definitions/placeholders.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/definitions/typescript.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/definitions/utils.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/index-legacy.d.ts create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/index.d.ts create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/index.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/index.js.flow create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/modifications/inherits.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/modifications/removeProperties.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/traverse/traverse.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/traverse/traverseFast.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/utils/inherit.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/utils/shallowEqual.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/generated/index.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/is.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isBinding.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isBlockScoped.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isImmutable.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isLet.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isNode.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isNodesEquivalent.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isPlaceholderType.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isReferenced.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isScope.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isSpecifierDefault.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isType.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isValidES3Identifier.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isValidIdentifier.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/isVar.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/matchesPattern.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/react/isCompatTag.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/react/isReactComponent.js create mode 100644 src/main/resources/static/node_modules/@babel/types/lib/validators/validate.js create mode 100644 src/main/resources/static/node_modules/@babel/types/package.json create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/generators/asserts.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/generators/ast-types.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/generators/builders.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/generators/constants.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/generators/docs.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/generators/flow.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/generators/typescript-legacy.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/generators/validators.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/package.json create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/utils/formatBuilderName.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/utils/lowerFirst.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/utils/stringifyValidator.js create mode 100644 src/main/resources/static/node_modules/@babel/types/scripts/utils/toFunctionName.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/README.md create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ar.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/cs-cz.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/de-de.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/en-us.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/es-es.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/fi-fi.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/fr-fr.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/gl-es.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/hr-hr.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/i18n.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/it-it.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ja-jp.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ko-kr.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/nb-no.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/nl-nl.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/pl-pl.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/pt-br.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ru-ru.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/sv-se.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/tr-tr.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/uk-ua.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/zh-cn.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/zh-tw.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/index.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/indexViewer.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/ar.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/cs-cz.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/de-de.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/es-es.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/fi-fi.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/fr-fr.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/gl-es.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/hr-hr.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/it-it.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/ja-jp.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/ko-kr.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/nb-no.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/nl-nl.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/pl-pl.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/pt-br.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/ru-ru.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/sv-se.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/tr-tr.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/uk-ua.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/zh-cn.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/i18n/zh-tw.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/theme/toastui-editor-dark.css create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/toastui-editor-only.css create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/toastui-editor-viewer.css create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/toastui-editor-viewer.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/toastui-editor.css create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/dist/toastui-editor.js create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/package.json create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/convertor.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/editor.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/event.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/index.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/map.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/markdown.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/plugin.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/prosemirror-model.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/prosemirror-transform.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/spec.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/toastmark.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/toastui-editor-viewer.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/ui.d.ts create mode 100644 src/main/resources/static/node_modules/@toast-ui/editor/types/wysiwyg.d.ts create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/LICENSE create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/README.md create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/dist/jQuery.tagify.min.js create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/dist/react.tagify.js create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/dist/tagify.css create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/dist/tagify.min.js create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/dist/tagify.polyfills.min.js create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/dist/tagify.vue create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/package.json create mode 100644 src/main/resources/static/node_modules/@yaireo/tagify/src/tagify.scss create mode 100644 src/main/resources/static/node_modules/ansi-styles/index.js create mode 100644 src/main/resources/static/node_modules/ansi-styles/license create mode 100644 src/main/resources/static/node_modules/ansi-styles/package.json create mode 100644 src/main/resources/static/node_modules/ansi-styles/readme.md create mode 100644 src/main/resources/static/node_modules/babel-eslint/LICENSE create mode 100644 src/main/resources/static/node_modules/babel-eslint/README.md create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/analyze-scope.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/babylon-to-espree/attachComments.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/babylon-to-espree/convertComments.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/babylon-to-espree/convertTemplateType.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/babylon-to-espree/index.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/babylon-to-espree/toAST.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/babylon-to-espree/toToken.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/babylon-to-espree/toTokens.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/index.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/parse-with-scope.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/parse.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/require-from-eslint.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/lib/visitor-keys.js create mode 100644 src/main/resources/static/node_modules/babel-eslint/package.json create mode 100644 src/main/resources/static/node_modules/bootstrap/LICENSE create mode 100644 src/main/resources/static/node_modules/bootstrap/README.md create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-grid.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-grid.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-grid.min.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-grid.min.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-reboot.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-reboot.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-utilities.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-utilities.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap.min.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap.min.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap.rtl.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap.rtl.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.bundle.js create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.bundle.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.esm.js create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.esm.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.esm.min.js create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.esm.min.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.js create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.min.js create mode 100644 src/main/resources/static/node_modules/bootstrap/dist/js/bootstrap.min.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/alert.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/alert.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/base-component.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/base-component.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/button.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/button.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/carousel.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/carousel.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/collapse.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/collapse.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dom/data.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dom/data.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dom/event-handler.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dom/event-handler.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dom/manipulator.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dom/manipulator.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dom/selector-engine.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dom/selector-engine.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dropdown.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/dropdown.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/modal.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/modal.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/offcanvas.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/offcanvas.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/popover.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/popover.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/scrollspy.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/scrollspy.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/tab.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/tab.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/toast.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/toast.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/tooltip.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/dist/tooltip.js.map create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/alert.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/base-component.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/button.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/carousel.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/collapse.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/dom/data.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/dom/event-handler.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/dom/manipulator.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/dom/selector-engine.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/dropdown.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/modal.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/offcanvas.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/popover.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/scrollspy.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/tab.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/toast.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/tooltip.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/util/backdrop.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/util/component-functions.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/util/focustrap.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/util/index.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/util/sanitizer.js create mode 100644 src/main/resources/static/node_modules/bootstrap/js/src/util/scrollbar.js create mode 100644 src/main/resources/static/node_modules/bootstrap/package.json create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_accordion.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_alert.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_badge.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_breadcrumb.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_button-group.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_buttons.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_card.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_carousel.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_close.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_containers.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_dropdown.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_forms.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_functions.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_grid.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_helpers.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_images.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_list-group.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_mixins.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_modal.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_nav.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_navbar.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_offcanvas.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_pagination.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_placeholders.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_popover.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_progress.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_reboot.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_root.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_spinners.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_tables.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_toasts.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_tooltip.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_transitions.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_type.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_utilities.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/_variables.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/bootstrap-grid.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/bootstrap-reboot.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/bootstrap-utilities.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/bootstrap.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/forms/_floating-labels.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/forms/_form-check.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/forms/_form-control.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/forms/_form-range.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/forms/_form-select.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/forms/_form-text.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/forms/_input-group.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/forms/_labels.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/forms/_validation.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/helpers/_clearfix.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/helpers/_colored-links.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/helpers/_position.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/helpers/_ratio.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/helpers/_stacks.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/helpers/_stretched-link.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/helpers/_text-truncation.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/helpers/_visually-hidden.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/helpers/_vr.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_alert.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_backdrop.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_border-radius.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_box-shadow.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_breakpoints.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_buttons.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_caret.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_clearfix.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_color-scheme.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_container.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_deprecate.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_forms.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_gradients.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_grid.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_image.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_list-group.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_lists.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_pagination.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_reset-text.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_resize.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_table-variants.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_text-truncate.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_transition.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_utilities.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/mixins/_visually-hidden.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/utilities/_api.scss create mode 100644 src/main/resources/static/node_modules/bootstrap/scss/vendor/_rfs.scss create mode 100644 src/main/resources/static/node_modules/chalk/index.js create mode 100644 src/main/resources/static/node_modules/chalk/index.js.flow create mode 100644 src/main/resources/static/node_modules/chalk/license create mode 100644 src/main/resources/static/node_modules/chalk/package.json create mode 100644 src/main/resources/static/node_modules/chalk/readme.md create mode 100644 src/main/resources/static/node_modules/chalk/templates.js create mode 100644 src/main/resources/static/node_modules/chalk/types/index.d.ts create mode 100644 src/main/resources/static/node_modules/color-convert/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/color-convert/LICENSE create mode 100644 src/main/resources/static/node_modules/color-convert/README.md create mode 100644 src/main/resources/static/node_modules/color-convert/conversions.js create mode 100644 src/main/resources/static/node_modules/color-convert/index.js create mode 100644 src/main/resources/static/node_modules/color-convert/package.json create mode 100644 src/main/resources/static/node_modules/color-convert/route.js create mode 100644 src/main/resources/static/node_modules/color-name/.eslintrc.json create mode 100644 src/main/resources/static/node_modules/color-name/.npmignore create mode 100644 src/main/resources/static/node_modules/color-name/LICENSE create mode 100644 src/main/resources/static/node_modules/color-name/README.md create mode 100644 src/main/resources/static/node_modules/color-name/index.js create mode 100644 src/main/resources/static/node_modules/color-name/package.json create mode 100644 src/main/resources/static/node_modules/color-name/test.js create mode 100644 src/main/resources/static/node_modules/debug/LICENSE create mode 100644 src/main/resources/static/node_modules/debug/README.md create mode 100644 src/main/resources/static/node_modules/debug/package.json create mode 100644 src/main/resources/static/node_modules/debug/src/browser.js create mode 100644 src/main/resources/static/node_modules/debug/src/common.js create mode 100644 src/main/resources/static/node_modules/debug/src/index.js create mode 100644 src/main/resources/static/node_modules/debug/src/node.js create mode 100644 src/main/resources/static/node_modules/dompurify/LICENSE create mode 100644 src/main/resources/static/node_modules/dompurify/README.md create mode 100644 src/main/resources/static/node_modules/dompurify/dist/purify.cjs.js create mode 100644 src/main/resources/static/node_modules/dompurify/dist/purify.cjs.js.map create mode 100644 src/main/resources/static/node_modules/dompurify/dist/purify.es.js create mode 100644 src/main/resources/static/node_modules/dompurify/dist/purify.es.js.map create mode 100644 src/main/resources/static/node_modules/dompurify/dist/purify.js create mode 100644 src/main/resources/static/node_modules/dompurify/dist/purify.js.map create mode 100644 src/main/resources/static/node_modules/dompurify/dist/purify.min.js create mode 100644 src/main/resources/static/node_modules/dompurify/dist/purify.min.js.map create mode 100644 src/main/resources/static/node_modules/dompurify/package.json create mode 100644 src/main/resources/static/node_modules/escape-string-regexp/index.js create mode 100644 src/main/resources/static/node_modules/escape-string-regexp/license create mode 100644 src/main/resources/static/node_modules/escape-string-regexp/package.json create mode 100644 src/main/resources/static/node_modules/escape-string-regexp/readme.md create mode 100644 src/main/resources/static/node_modules/eslint-visitor-keys/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/eslint-visitor-keys/LICENSE create mode 100644 src/main/resources/static/node_modules/eslint-visitor-keys/README.md create mode 100644 src/main/resources/static/node_modules/eslint-visitor-keys/lib/index.js create mode 100644 src/main/resources/static/node_modules/eslint-visitor-keys/lib/visitor-keys.json create mode 100644 src/main/resources/static/node_modules/eslint-visitor-keys/package.json create mode 100644 src/main/resources/static/node_modules/function-bind/.editorconfig create mode 100644 src/main/resources/static/node_modules/function-bind/.eslintrc create mode 100644 src/main/resources/static/node_modules/function-bind/.jscs.json create mode 100644 src/main/resources/static/node_modules/function-bind/.npmignore create mode 100644 src/main/resources/static/node_modules/function-bind/.travis.yml create mode 100644 src/main/resources/static/node_modules/function-bind/LICENSE create mode 100644 src/main/resources/static/node_modules/function-bind/README.md create mode 100644 src/main/resources/static/node_modules/function-bind/implementation.js create mode 100644 src/main/resources/static/node_modules/function-bind/index.js create mode 100644 src/main/resources/static/node_modules/function-bind/package.json create mode 100644 src/main/resources/static/node_modules/function-bind/test/.eslintrc create mode 100644 src/main/resources/static/node_modules/function-bind/test/index.js create mode 100644 src/main/resources/static/node_modules/globals/globals.json create mode 100644 src/main/resources/static/node_modules/globals/index.js create mode 100644 src/main/resources/static/node_modules/globals/license create mode 100644 src/main/resources/static/node_modules/globals/package.json create mode 100644 src/main/resources/static/node_modules/globals/readme.md create mode 100644 src/main/resources/static/node_modules/has-flag/index.js create mode 100644 src/main/resources/static/node_modules/has-flag/license create mode 100644 src/main/resources/static/node_modules/has-flag/package.json create mode 100644 src/main/resources/static/node_modules/has-flag/readme.md create mode 100644 src/main/resources/static/node_modules/has/LICENSE-MIT create mode 100644 src/main/resources/static/node_modules/has/README.md create mode 100644 src/main/resources/static/node_modules/has/package.json create mode 100644 src/main/resources/static/node_modules/has/src/index.js create mode 100644 src/main/resources/static/node_modules/has/test/index.js create mode 100644 src/main/resources/static/node_modules/is-core-module/.eslintignore create mode 100644 src/main/resources/static/node_modules/is-core-module/.eslintrc create mode 100644 src/main/resources/static/node_modules/is-core-module/.nycrc create mode 100644 src/main/resources/static/node_modules/is-core-module/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/is-core-module/LICENSE create mode 100644 src/main/resources/static/node_modules/is-core-module/README.md create mode 100644 src/main/resources/static/node_modules/is-core-module/core.json create mode 100644 src/main/resources/static/node_modules/is-core-module/index.js create mode 100644 src/main/resources/static/node_modules/is-core-module/package.json create mode 100644 src/main/resources/static/node_modules/is-core-module/test/index.js create mode 100644 src/main/resources/static/node_modules/js-tokens/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/js-tokens/LICENSE create mode 100644 src/main/resources/static/node_modules/js-tokens/README.md create mode 100644 src/main/resources/static/node_modules/js-tokens/index.js create mode 100644 src/main/resources/static/node_modules/js-tokens/package.json create mode 100644 src/main/resources/static/node_modules/jsesc/LICENSE-MIT.txt create mode 100644 src/main/resources/static/node_modules/jsesc/README.md create mode 100644 src/main/resources/static/node_modules/jsesc/bin/jsesc create mode 100644 src/main/resources/static/node_modules/jsesc/jsesc.js create mode 100644 src/main/resources/static/node_modules/jsesc/man/jsesc.1 create mode 100644 src/main/resources/static/node_modules/jsesc/package.json create mode 100644 src/main/resources/static/node_modules/ms/index.js create mode 100644 src/main/resources/static/node_modules/ms/license.md create mode 100644 src/main/resources/static/node_modules/ms/package.json create mode 100644 src/main/resources/static/node_modules/ms/readme.md create mode 100644 src/main/resources/static/node_modules/orderedmap/.tern-port create mode 100644 src/main/resources/static/node_modules/orderedmap/LICENSE create mode 100644 src/main/resources/static/node_modules/orderedmap/README.md create mode 100644 src/main/resources/static/node_modules/orderedmap/index.es.js create mode 100644 src/main/resources/static/node_modules/orderedmap/index.js create mode 100644 src/main/resources/static/node_modules/orderedmap/index.mjs create mode 100644 src/main/resources/static/node_modules/orderedmap/package.json create mode 100644 src/main/resources/static/node_modules/path-parse/LICENSE create mode 100644 src/main/resources/static/node_modules/path-parse/README.md create mode 100644 src/main/resources/static/node_modules/path-parse/index.js create mode 100644 src/main/resources/static/node_modules/path-parse/package.json create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/.tern-project create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/CONTRIBUTING.md create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/LICENSE create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/dist/index.es.js create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/dist/index.es.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/dist/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/dist/index.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/package.json create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/rollup.config.js create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/src/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-commands/src/commands.js create mode 100644 src/main/resources/static/node_modules/prosemirror-history/.tern-project create mode 100644 src/main/resources/static/node_modules/prosemirror-history/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/prosemirror-history/CONTRIBUTING.md create mode 100644 src/main/resources/static/node_modules/prosemirror-history/LICENSE create mode 100644 src/main/resources/static/node_modules/prosemirror-history/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-history/dist/index.es.js create mode 100644 src/main/resources/static/node_modules/prosemirror-history/dist/index.es.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-history/dist/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-history/dist/index.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-history/package.json create mode 100644 src/main/resources/static/node_modules/prosemirror-history/rollup.config.js create mode 100644 src/main/resources/static/node_modules/prosemirror-history/src/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-history/src/history.js create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/.tern-project create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/CONTRIBUTING.md create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/LICENSE create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/dist/index.es.js create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/dist/index.es.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/dist/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/dist/index.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/package.json create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/rollup.config.js create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/src/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/src/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/src/inputrules.js create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/src/rulebuilders.js create mode 100644 src/main/resources/static/node_modules/prosemirror-inputrules/src/rules.js create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/.tern-project create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/CONTRIBUTING.md create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/LICENSE create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/dist/index.es.js create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/dist/index.es.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/dist/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/dist/index.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/package.json create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/rollup.config.js create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/src/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-keymap/src/keymap.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/.tern-project create mode 100644 src/main/resources/static/node_modules/prosemirror-model/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/prosemirror-model/CONTRIBUTING.md create mode 100644 src/main/resources/static/node_modules/prosemirror-model/LICENSE create mode 100644 src/main/resources/static/node_modules/prosemirror-model/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-model/dist/index.es.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/dist/index.es.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-model/dist/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/dist/index.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-model/etc/link-self.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/package.json create mode 100644 src/main/resources/static/node_modules/prosemirror-model/rollup.config.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/comparedeep.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/content.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/diff.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/fragment.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/from_dom.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/mark.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/node.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/replace.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/resolvedpos.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/schema.js create mode 100644 src/main/resources/static/node_modules/prosemirror-model/src/to_dom.js create mode 100644 src/main/resources/static/node_modules/prosemirror-state/.tern-project create mode 100644 src/main/resources/static/node_modules/prosemirror-state/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/prosemirror-state/CONTRIBUTING.md create mode 100644 src/main/resources/static/node_modules/prosemirror-state/LICENSE create mode 100644 src/main/resources/static/node_modules/prosemirror-state/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-state/dist/index.es.js create mode 100644 src/main/resources/static/node_modules/prosemirror-state/dist/index.es.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-state/dist/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-state/dist/index.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-state/package.json create mode 100644 src/main/resources/static/node_modules/prosemirror-state/rollup.config.js create mode 100644 src/main/resources/static/node_modules/prosemirror-state/src/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-state/src/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-state/src/plugin.js create mode 100644 src/main/resources/static/node_modules/prosemirror-state/src/selection.js create mode 100644 src/main/resources/static/node_modules/prosemirror-state/src/state.js create mode 100644 src/main/resources/static/node_modules/prosemirror-state/src/transaction.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/.tern-project create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/CONTRIBUTING.md create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/LICENSE create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/dist/index.es.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/dist/index.es.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/dist/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/dist/index.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/package.json create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/rollup.config.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/map.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/mark.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/mark_step.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/replace.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/replace_step.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/step.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/structure.js create mode 100644 src/main/resources/static/node_modules/prosemirror-transform/src/transform.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/.tern-project create mode 100644 src/main/resources/static/node_modules/prosemirror-view/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/prosemirror-view/CONTRIBUTING.md create mode 100644 src/main/resources/static/node_modules/prosemirror-view/LICENSE create mode 100644 src/main/resources/static/node_modules/prosemirror-view/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-view/dist/index.es.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/dist/index.es.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-view/dist/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/dist/index.js.map create mode 100644 src/main/resources/static/node_modules/prosemirror-view/package.json create mode 100644 src/main/resources/static/node_modules/prosemirror-view/rollup.config.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/README.md create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/browser.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/capturekeys.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/clipboard.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/decoration.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/dom.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/domchange.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/domcoords.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/domobserver.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/index.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/input.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/selection.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/src/viewdesc.js create mode 100644 src/main/resources/static/node_modules/prosemirror-view/style/prosemirror.css create mode 100644 src/main/resources/static/node_modules/resolve/.editorconfig create mode 100644 src/main/resources/static/node_modules/resolve/.eslintignore create mode 100644 src/main/resources/static/node_modules/resolve/.eslintrc create mode 100644 src/main/resources/static/node_modules/resolve/LICENSE create mode 100644 src/main/resources/static/node_modules/resolve/SECURITY.md create mode 100644 src/main/resources/static/node_modules/resolve/appveyor.yml create mode 100644 src/main/resources/static/node_modules/resolve/example/async.js create mode 100644 src/main/resources/static/node_modules/resolve/example/sync.js create mode 100644 src/main/resources/static/node_modules/resolve/index.js create mode 100644 src/main/resources/static/node_modules/resolve/lib/async.js create mode 100644 src/main/resources/static/node_modules/resolve/lib/caller.js create mode 100644 src/main/resources/static/node_modules/resolve/lib/core.js create mode 100644 src/main/resources/static/node_modules/resolve/lib/core.json create mode 100644 src/main/resources/static/node_modules/resolve/lib/is-core.js create mode 100644 src/main/resources/static/node_modules/resolve/lib/node-modules-paths.js create mode 100644 src/main/resources/static/node_modules/resolve/lib/normalize-options.js create mode 100644 src/main/resources/static/node_modules/resolve/lib/sync.js create mode 100644 src/main/resources/static/node_modules/resolve/package.json create mode 100644 src/main/resources/static/node_modules/resolve/readme.markdown create mode 100644 src/main/resources/static/node_modules/resolve/test/.eslintrc create mode 100644 src/main/resources/static/node_modules/resolve/test/core.js create mode 100644 src/main/resources/static/node_modules/resolve/test/dotdot.js create mode 100644 src/main/resources/static/node_modules/resolve/test/dotdot/abc/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/dotdot/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/faulty_basedir.js create mode 100644 src/main/resources/static/node_modules/resolve/test/filter.js create mode 100644 src/main/resources/static/node_modules/resolve/test/filter_sync.js create mode 100644 src/main/resources/static/node_modules/resolve/test/mock.js create mode 100644 src/main/resources/static/node_modules/resolve/test/mock_sync.js create mode 100644 src/main/resources/static/node_modules/resolve/test/module_dir.js create mode 100644 src/main/resources/static/node_modules/resolve/test/module_dir/xmodules/aaa/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/module_dir/ymodules/aaa/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/module_dir/zmodules/bbb/main.js create mode 100644 src/main/resources/static/node_modules/resolve/test/module_dir/zmodules/bbb/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/node-modules-paths.js create mode 100644 src/main/resources/static/node_modules/resolve/test/node_path.js create mode 100644 src/main/resources/static/node_modules/resolve/test/node_path/x/aaa/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/node_path/x/ccc/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/node_path/y/bbb/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/node_path/y/ccc/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/nonstring.js create mode 100644 src/main/resources/static/node_modules/resolve/test/pathfilter.js create mode 100644 src/main/resources/static/node_modules/resolve/test/pathfilter/deep_ref/main.js create mode 100644 src/main/resources/static/node_modules/resolve/test/precedence.js create mode 100644 src/main/resources/static/node_modules/resolve/test/precedence/aaa.js create mode 100644 src/main/resources/static/node_modules/resolve/test/precedence/aaa/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/precedence/aaa/main.js create mode 100644 src/main/resources/static/node_modules/resolve/test/precedence/bbb.js create mode 100644 src/main/resources/static/node_modules/resolve/test/precedence/bbb/main.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/baz/doom.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/baz/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/baz/quux.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/browser_field/a.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/browser_field/b.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/browser_field/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/cup.coffee create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/dot_main/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/dot_main/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/dot_slash_main/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/dot_slash_main/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/foo.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/incorrect_main/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/incorrect_main/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/invalid_main/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/mug.coffee create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/mug.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/multirepo/lerna.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/multirepo/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/other_path/lib/other-lib.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/other_path/root.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/quux/foo/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/same_names/foo.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/same_names/foo/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/symlinked/package/bar.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/symlinked/package/package.json create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver/without_basedir/main.js create mode 100644 src/main/resources/static/node_modules/resolve/test/resolver_sync.js create mode 100644 src/main/resources/static/node_modules/resolve/test/shadowed_core.js create mode 100644 src/main/resources/static/node_modules/resolve/test/shadowed_core/node_modules/util/index.js create mode 100644 src/main/resources/static/node_modules/resolve/test/subdirs.js create mode 100644 src/main/resources/static/node_modules/resolve/test/symlinks.js create mode 100644 src/main/resources/static/node_modules/rope-sequence/LICENSE create mode 100644 src/main/resources/static/node_modules/rope-sequence/README.md create mode 100644 src/main/resources/static/node_modules/rope-sequence/dist/index.es.js create mode 100644 src/main/resources/static/node_modules/rope-sequence/dist/index.js create mode 100644 src/main/resources/static/node_modules/rope-sequence/index.js create mode 100644 src/main/resources/static/node_modules/rope-sequence/package.json create mode 100644 src/main/resources/static/node_modules/rope-sequence/test.js create mode 100644 src/main/resources/static/node_modules/source-map/CHANGELOG.md create mode 100644 src/main/resources/static/node_modules/source-map/LICENSE create mode 100644 src/main/resources/static/node_modules/source-map/README.md create mode 100644 src/main/resources/static/node_modules/source-map/dist/source-map.debug.js create mode 100644 src/main/resources/static/node_modules/source-map/dist/source-map.js create mode 100644 src/main/resources/static/node_modules/source-map/dist/source-map.min.js create mode 100644 src/main/resources/static/node_modules/source-map/dist/source-map.min.js.map create mode 100644 src/main/resources/static/node_modules/source-map/lib/array-set.js create mode 100644 src/main/resources/static/node_modules/source-map/lib/base64-vlq.js create mode 100644 src/main/resources/static/node_modules/source-map/lib/base64.js create mode 100644 src/main/resources/static/node_modules/source-map/lib/binary-search.js create mode 100644 src/main/resources/static/node_modules/source-map/lib/mapping-list.js create mode 100644 src/main/resources/static/node_modules/source-map/lib/quick-sort.js create mode 100644 src/main/resources/static/node_modules/source-map/lib/source-map-consumer.js create mode 100644 src/main/resources/static/node_modules/source-map/lib/source-map-generator.js create mode 100644 src/main/resources/static/node_modules/source-map/lib/source-node.js create mode 100644 src/main/resources/static/node_modules/source-map/lib/util.js create mode 100644 src/main/resources/static/node_modules/source-map/package.json create mode 100644 src/main/resources/static/node_modules/source-map/source-map.js create mode 100644 src/main/resources/static/node_modules/supports-color/browser.js create mode 100644 src/main/resources/static/node_modules/supports-color/index.js create mode 100644 src/main/resources/static/node_modules/supports-color/license create mode 100644 src/main/resources/static/node_modules/supports-color/package.json create mode 100644 src/main/resources/static/node_modules/supports-color/readme.md create mode 100644 src/main/resources/static/node_modules/to-fast-properties/index.js create mode 100644 src/main/resources/static/node_modules/to-fast-properties/license create mode 100644 src/main/resources/static/node_modules/to-fast-properties/package.json create mode 100644 src/main/resources/static/node_modules/to-fast-properties/readme.md create mode 100644 src/main/resources/static/node_modules/tui-font-size-picker/LICENSE create mode 100644 src/main/resources/static/node_modules/tui-font-size-picker/README.md create mode 100644 src/main/resources/static/node_modules/tui-font-size-picker/dist/font-size-picker.js create mode 100644 src/main/resources/static/node_modules/tui-font-size-picker/index.d.ts create mode 100644 src/main/resources/static/node_modules/tui-font-size-picker/package.json create mode 100644 src/main/resources/static/node_modules/w3c-keyname/.tern-port create mode 100644 src/main/resources/static/node_modules/w3c-keyname/LICENSE create mode 100644 src/main/resources/static/node_modules/w3c-keyname/README.md create mode 100644 src/main/resources/static/node_modules/w3c-keyname/index.cjs create mode 100644 src/main/resources/static/node_modules/w3c-keyname/index.d.ts create mode 100644 src/main/resources/static/node_modules/w3c-keyname/index.es.js create mode 100644 src/main/resources/static/node_modules/w3c-keyname/package.json create mode 100644 src/main/resources/static/node_modules/wow.js/.npmignore create mode 100644 src/main/resources/static/node_modules/wow.js/.travis.yml create mode 100644 src/main/resources/static/node_modules/wow.js/Gruntfile.js create mode 100644 src/main/resources/static/node_modules/wow.js/LICENSE create mode 100644 src/main/resources/static/node_modules/wow.js/README.md create mode 100644 src/main/resources/static/node_modules/wow.js/bower.json create mode 100644 src/main/resources/static/node_modules/wow.js/css/libs/animate.css create mode 100644 src/main/resources/static/node_modules/wow.js/css/site.css create mode 100644 src/main/resources/static/node_modules/wow.js/demo.html create mode 100644 src/main/resources/static/node_modules/wow.js/dist/wow.js create mode 100644 src/main/resources/static/node_modules/wow.js/dist/wow.js.map create mode 100644 src/main/resources/static/node_modules/wow.js/dist/wow.min.js create mode 100644 src/main/resources/static/node_modules/wow.js/dist/wow.min.js.gz create mode 100644 src/main/resources/static/node_modules/wow.js/package.json create mode 100644 src/main/resources/static/node_modules/wow.js/spec/coffeescripts/helpers/SpecHelper.coffee create mode 100644 src/main/resources/static/node_modules/wow.js/spec/coffeescripts/wow-spec.coffee create mode 100644 src/main/resources/static/node_modules/wow.js/spec/javascripts/fixtures/custom.html create mode 100644 src/main/resources/static/node_modules/wow.js/spec/javascripts/fixtures/simple.html create mode 100644 src/main/resources/static/node_modules/wow.js/spec/javascripts/helpers/SpecHelper.js create mode 100644 src/main/resources/static/node_modules/wow.js/spec/javascripts/libs/jasmine-jquery.js create mode 100644 src/main/resources/static/node_modules/wow.js/spec/javascripts/libs/jquery.js create mode 100644 src/main/resources/static/node_modules/wow.js/spec/javascripts/wow-spec.js create mode 100644 src/main/resources/static/node_modules/wow.js/src/.eslintrc.json create mode 100644 src/main/resources/static/node_modules/wow.js/src/WOW.js diff --git a/.gitignore b/.gitignore index 0a6fb97..fcd6058 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,7 @@ out/ ### NPM ### -src/main/resources/static/node_modules +#src/main/resources/static/node_modules ### config ### src/main/resources/application-dev.yml \ No newline at end of file diff --git a/src/main/java/myblog/blog/article/domain/Article.java b/src/main/java/myblog/blog/article/domain/Article.java index 319c89a..8fbc525 100644 --- a/src/main/java/myblog/blog/article/domain/Article.java +++ b/src/main/java/myblog/blog/article/domain/Article.java @@ -29,7 +29,6 @@ import java.util.List; initialValue = 1, allocationSize = 50) /* - fts 구현을 위한 인덱스 설정 - - */ @Table(indexes = { @Index(name="i_article_title", columnList = "title"), diff --git a/src/main/resources/static/node_modules/.bin/jsesc b/src/main/resources/static/node_modules/.bin/jsesc new file mode 100644 index 0000000..f2bbda3 --- /dev/null +++ b/src/main/resources/static/node_modules/.bin/jsesc @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../jsesc/bin/jsesc" "$@" + ret=$? +else + node "$basedir/../jsesc/bin/jsesc" "$@" + ret=$? +fi +exit $ret diff --git a/src/main/resources/static/node_modules/.bin/jsesc.cmd b/src/main/resources/static/node_modules/.bin/jsesc.cmd new file mode 100644 index 0000000..e724793 --- /dev/null +++ b/src/main/resources/static/node_modules/.bin/jsesc.cmd @@ -0,0 +1,17 @@ +@ECHO off +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +"%_prog%" "%dp0%\..\jsesc\bin\jsesc" %* +ENDLOCAL +EXIT /b %errorlevel% +:find_dp0 +SET dp0=%~dp0 +EXIT /b diff --git a/src/main/resources/static/node_modules/.bin/jsesc.ps1 b/src/main/resources/static/node_modules/.bin/jsesc.ps1 new file mode 100644 index 0000000..1751cf9 --- /dev/null +++ b/src/main/resources/static/node_modules/.bin/jsesc.ps1 @@ -0,0 +1,18 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + & "$basedir/node$exe" "$basedir/../jsesc/bin/jsesc" $args + $ret=$LASTEXITCODE +} else { + & "node$exe" "$basedir/../jsesc/bin/jsesc" $args + $ret=$LASTEXITCODE +} +exit $ret diff --git a/src/main/resources/static/node_modules/.bin/parser b/src/main/resources/static/node_modules/.bin/parser new file mode 100644 index 0000000..baec122 --- /dev/null +++ b/src/main/resources/static/node_modules/.bin/parser @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../@babel/parser/bin/babel-parser.js" "$@" + ret=$? +else + node "$basedir/../@babel/parser/bin/babel-parser.js" "$@" + ret=$? +fi +exit $ret diff --git a/src/main/resources/static/node_modules/.bin/parser.cmd b/src/main/resources/static/node_modules/.bin/parser.cmd new file mode 100644 index 0000000..21e2ef6 --- /dev/null +++ b/src/main/resources/static/node_modules/.bin/parser.cmd @@ -0,0 +1,17 @@ +@ECHO off +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +"%_prog%" "%dp0%\..\@babel\parser\bin\babel-parser.js" %* +ENDLOCAL +EXIT /b %errorlevel% +:find_dp0 +SET dp0=%~dp0 +EXIT /b diff --git a/src/main/resources/static/node_modules/.bin/parser.ps1 b/src/main/resources/static/node_modules/.bin/parser.ps1 new file mode 100644 index 0000000..82ec139 --- /dev/null +++ b/src/main/resources/static/node_modules/.bin/parser.ps1 @@ -0,0 +1,18 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + & "$basedir/node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args + $ret=$LASTEXITCODE +} else { + & "node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args + $ret=$LASTEXITCODE +} +exit $ret diff --git a/src/main/resources/static/node_modules/.package-lock.json b/src/main/resources/static/node_modules/.package-lock.json new file mode 100644 index 0000000..31b154f --- /dev/null +++ b/src/main/resources/static/node_modules/.package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "static", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "node_modules/bootstrap": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz", + "integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==" + } + } +} diff --git a/src/main/resources/static/node_modules/@babel/code-frame/LICENSE b/src/main/resources/static/node_modules/@babel/code-frame/LICENSE new file mode 100644 index 0000000..f31575e --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/code-frame/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/main/resources/static/node_modules/@babel/code-frame/README.md b/src/main/resources/static/node_modules/@babel/code-frame/README.md new file mode 100644 index 0000000..08cacb0 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/code-frame/README.md @@ -0,0 +1,19 @@ +# @babel/code-frame + +> Generate errors that contain a code frame that point to source locations. + +See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/code-frame +``` + +or using yarn: + +```sh +yarn add @babel/code-frame --dev +``` diff --git a/src/main/resources/static/node_modules/@babel/code-frame/lib/index.js b/src/main/resources/static/node_modules/@babel/code-frame/lib/index.js new file mode 100644 index 0000000..cba3f83 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/code-frame/lib/index.js @@ -0,0 +1,163 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.codeFrameColumns = codeFrameColumns; +exports.default = _default; + +var _highlight = require("@babel/highlight"); + +let deprecationWarningShown = false; + +function getDefs(chalk) { + return { + 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 codeFrameColumns(rawLines, loc, opts = {}) { + const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts); + const chalk = (0, _highlight.getChalk)(opts); + 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; + } +} + +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)); + } + } + + colNumber = Math.max(colNumber, 0); + const location = { + start: { + column: colNumber, + line: lineNumber + } + }; + return codeFrameColumns(rawLines, location, opts); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/code-frame/package.json b/src/main/resources/static/node_modules/@babel/code-frame/package.json new file mode 100644 index 0000000..f9c611a --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/code-frame/package.json @@ -0,0 +1,62 @@ +{ + "_from": "@babel/code-frame@^7.0.0", + "_id": "@babel/code-frame@7.16.0", + "_inBundle": false, + "_integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "_location": "/@babel/code-frame", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@babel/code-frame@^7.0.0", + "name": "@babel/code-frame", + "escapedName": "@babel%2fcode-frame", + "scope": "@babel", + "rawSpec": "^7.0.0", + "saveSpec": null, + "fetchSpec": "^7.0.0" + }, + "_requiredBy": [ + "/@babel/template", + "/@babel/traverse", + "/babel-eslint" + ], + "_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", + "_shasum": "0dfc80309beec8411e65e706461c408b0bb9b431", + "_spec": "@babel/code-frame@^7.0.0", + "_where": "C:\\blog\\blog\\src\\main\\resources\\static\\node_modules\\babel-eslint", + "author": { + "name": "The Babel Team", + "url": "https://babel.dev/team" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen" + }, + "bundleDependencies": false, + "dependencies": { + "@babel/highlight": "^7.16.0" + }, + "deprecated": false, + "description": "Generate errors that contain a code frame that point to source locations.", + "devDependencies": { + "@types/chalk": "^2.0.0", + "chalk": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "homepage": "https://babel.dev/docs/en/next/babel-code-frame", + "license": "MIT", + "main": "./lib/index.js", + "name": "@babel/code-frame", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "packages/babel-code-frame" + }, + "version": "7.16.0" +} diff --git a/src/main/resources/static/node_modules/@babel/generator/LICENSE b/src/main/resources/static/node_modules/@babel/generator/LICENSE new file mode 100644 index 0000000..f31575e --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/main/resources/static/node_modules/@babel/generator/README.md b/src/main/resources/static/node_modules/@babel/generator/README.md new file mode 100644 index 0000000..b760238 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/README.md @@ -0,0 +1,19 @@ +# @babel/generator + +> Turns an AST into code. + +See our website [@babel/generator](https://babeljs.io/docs/en/babel-generator) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20generator%22+is%3Aopen) associated with this package. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/generator +``` + +or using yarn: + +```sh +yarn add @babel/generator --dev +``` diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/buffer.js b/src/main/resources/static/node_modules/@babel/generator/lib/buffer.js new file mode 100644 index 0000000..1445813 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/buffer.js @@ -0,0 +1,265 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +const SPACES_RE = /^[ \t]+$/; + +class Buffer { + constructor(map) { + this._map = null; + this._buf = ""; + this._last = 0; + this._queue = []; + this._position = { + line: 1, + column: 0 + }; + this._sourcePosition = { + identifierName: null, + line: null, + column: null, + filename: null + }; + this._disallowedPop = null; + this._map = map; + } + + get() { + this._flush(); + + const map = this._map; + const result = { + code: this._buf.trimRight(), + map: null, + rawMappings: map == null ? void 0 : map.getRawMappings() + }; + + if (map) { + Object.defineProperty(result, "map", { + configurable: true, + enumerable: true, + + get() { + return this.map = map.get(); + }, + + set(value) { + Object.defineProperty(this, "map", { + value, + writable: true + }); + } + + }); + } + + return result; + } + + append(str) { + this._flush(); + + const { + line, + column, + filename, + identifierName, + force + } = this._sourcePosition; + + this._append(str, line, column, identifierName, filename, force); + } + + queue(str) { + if (str === "\n") { + while (this._queue.length > 0 && SPACES_RE.test(this._queue[0][0])) { + this._queue.shift(); + } + } + + const { + line, + column, + filename, + identifierName, + force + } = this._sourcePosition; + + this._queue.unshift([str, line, column, identifierName, filename, force]); + } + + _flush() { + let item; + + while (item = this._queue.pop()) { + this._append(...item); + } + } + + _append(str, line, column, identifierName, filename, force) { + this._buf += str; + this._last = str.charCodeAt(str.length - 1); + let i = str.indexOf("\n"); + let last = 0; + + if (i !== 0) { + this._mark(line, column, identifierName, filename, force); + } + + while (i !== -1) { + this._position.line++; + this._position.column = 0; + last = i + 1; + + if (last < str.length) { + this._mark(++line, 0, identifierName, filename, force); + } + + i = str.indexOf("\n", last); + } + + this._position.column += str.length - last; + } + + _mark(line, column, identifierName, filename, force) { + var _this$_map; + + (_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position.line, this._position.column, line, column, identifierName, filename, force); + } + + removeTrailingNewline() { + if (this._queue.length > 0 && this._queue[0][0] === "\n") { + this._queue.shift(); + } + } + + removeLastSemicolon() { + if (this._queue.length > 0 && this._queue[0][0] === ";") { + this._queue.shift(); + } + } + + getLastChar() { + let last; + + if (this._queue.length > 0) { + const str = this._queue[0][0]; + last = str.charCodeAt(0); + } else { + last = this._last; + } + + return last; + } + + endsWithCharAndNewline() { + const queue = this._queue; + + if (queue.length > 0) { + const last = queue[0][0]; + const lastCp = last.charCodeAt(0); + if (lastCp !== 10) return; + + if (queue.length > 1) { + const secondLast = queue[1][0]; + return secondLast.charCodeAt(0); + } else { + return this._last; + } + } + } + + hasContent() { + return this._queue.length > 0 || !!this._last; + } + + exactSource(loc, cb) { + this.source("start", loc, true); + cb(); + this.source("end", loc); + + this._disallowPop("start", loc); + } + + source(prop, loc, force) { + if (prop && !loc) return; + + this._normalizePosition(prop, loc, this._sourcePosition, force); + } + + withSource(prop, loc, cb) { + if (!this._map) return cb(); + const originalLine = this._sourcePosition.line; + const originalColumn = this._sourcePosition.column; + const originalFilename = this._sourcePosition.filename; + const originalIdentifierName = this._sourcePosition.identifierName; + this.source(prop, loc); + cb(); + + if ((!this._sourcePosition.force || this._sourcePosition.line !== originalLine || this._sourcePosition.column !== originalColumn || this._sourcePosition.filename !== originalFilename) && (!this._disallowedPop || this._disallowedPop.line !== originalLine || this._disallowedPop.column !== originalColumn || this._disallowedPop.filename !== originalFilename)) { + this._sourcePosition.line = originalLine; + this._sourcePosition.column = originalColumn; + this._sourcePosition.filename = originalFilename; + this._sourcePosition.identifierName = originalIdentifierName; + this._sourcePosition.force = false; + this._disallowedPop = null; + } + } + + _disallowPop(prop, loc) { + if (prop && !loc) return; + this._disallowedPop = this._normalizePosition(prop, loc); + } + + _normalizePosition(prop, loc, targetObj, force) { + const pos = loc ? loc[prop] : null; + + if (targetObj === undefined) { + targetObj = { + identifierName: null, + line: null, + column: null, + filename: null, + force: false + }; + } + + const origLine = targetObj.line; + const origColumn = targetObj.column; + const origFilename = targetObj.filename; + targetObj.identifierName = prop === "start" && (loc == null ? void 0 : loc.identifierName) || null; + targetObj.line = pos == null ? void 0 : pos.line; + targetObj.column = pos == null ? void 0 : pos.column; + targetObj.filename = loc == null ? void 0 : loc.filename; + + if (force || targetObj.line !== origLine || targetObj.column !== origColumn || targetObj.filename !== origFilename) { + targetObj.force = force; + } + + return targetObj; + } + + getCurrentColumn() { + const extra = this._queue.reduce((acc, item) => item[0] + acc, ""); + + const lastIndex = extra.lastIndexOf("\n"); + return lastIndex === -1 ? this._position.column + extra.length : extra.length - 1 - lastIndex; + } + + getCurrentLine() { + const extra = this._queue.reduce((acc, item) => item[0] + acc, ""); + + let count = 0; + + for (let i = 0; i < extra.length; i++) { + if (extra[i] === "\n") count++; + } + + return this._position.line + count; + } + +} + +exports.default = Buffer; \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/base.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/base.js new file mode 100644 index 0000000..9a5f5d1 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/base.js @@ -0,0 +1,96 @@ +"use strict"; + +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) { + this.printInnerComments(node, false); + this.printSequence(node.directives, node); + if (node.directives && node.directives.length) this.newline(); + this.printSequence(node.body, node); +} + +function BlockStatement(node) { + var _node$directives; + + this.token("{"); + this.printInnerComments(node); + const hasDirectives = (_node$directives = node.directives) == null ? void 0 : _node$directives.length; + + if (node.body.length || hasDirectives) { + this.newline(); + this.printSequence(node.directives, node, { + indent: true + }); + if (hasDirectives) this.newline(); + this.printSequence(node.body, node, { + indent: true + }); + this.removeTrailingNewline(); + this.source("end", node.loc); + if (!this.endsWith(10)) this.newline(); + this.rightBrace(); + } else { + this.source("end", node.loc); + this.token("}"); + } +} + +function Directive(node) { + this.print(node.value, node); + this.semicolon(); +} + +const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/; +const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/; + +function DirectiveLiteral(node) { + const raw = this.getPossibleRaw(node); + + if (raw != null) { + 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}\n`); +} + +function Placeholder(node) { + this.token("%%"); + this.print(node.name); + this.token("%%"); + + if (node.expectedNode === "Statement") { + this.semicolon(); + } +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/classes.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/classes.js new file mode 100644 index 0000000..dac4087 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/classes.js @@ -0,0 +1,174 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +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 = require("@babel/types"); + +const { + isExportDefaultDeclaration, + isExportNamedDeclaration +} = _t; + +function ClassDeclaration(node, parent) { + if (!this.format.decoratorsBeforeExport || !isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent)) { + this.printJoin(node.decorators, node); + } + + if (node.declare) { + this.word("declare"); + this.space(); + } + + if (node.abstract) { + this.word("abstract"); + this.space(); + } + + this.word("class"); + this.printInnerComments(node); + + 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 ClassBody(node) { + this.token("{"); + this.printInnerComments(node); + + if (node.body.length === 0) { + this.token("}"); + } else { + this.newline(); + this.indent(); + this.printSequence(node.body, node); + this.dedent(); + if (!this.endsWith(10)) this.newline(); + this.rightBrace(); + } +} + +function ClassProperty(node) { + this.printJoin(node.decorators, node); + this.source("end", node.key.loc); + this.tsPrintClassMemberModifiers(node, true); + + if (node.computed) { + this.token("["); + this.print(node.key, node); + this.token("]"); + } else { + this._variance(node); + + this.print(node.key, node); + } + + if (node.optional) { + this.token("?"); + } + + if (node.definite) { + this.token("!"); + } + + this.print(node.typeAnnotation, node); + + if (node.value) { + this.space(); + this.token("="); + 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.token("="); + 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) { + this.printJoin(node.decorators, node); + this.source("end", node.key.loc); + this.tsPrintClassMemberModifiers(node, false); + + this._methodHead(node); +} + +function StaticBlock(node) { + this.word("static"); + this.space(); + this.token("{"); + + if (node.body.length === 0) { + this.token("}"); + } else { + this.newline(); + this.printSequence(node.body, node, { + indent: true + }); + this.rightBrace(); + } +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/expressions.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/expressions.js new file mode 100644 index 0000000..aa65c5c --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/expressions.js @@ -0,0 +1,318 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.LogicalExpression = exports.BinaryExpression = exports.AssignmentExpression = AssignmentExpression; +exports.AssignmentPattern = AssignmentPattern; +exports.AwaitExpression = void 0; +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 = void 0; + +var _t = require("@babel/types"); + +var n = require("../node"); + +const { + isCallExpression, + isLiteral, + isMemberExpression, + isNewExpression +} = _t; + +function UnaryExpression(node) { + if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof" || node.operator === "throw") { + this.word(node.operator); + this.space(); + } else { + this.token(node.operator); + } + + this.print(node.argument, node); +} + +function DoExpression(node) { + if (node.async) { + this.word("async"); + this.space(); + } + + this.word("do"); + this.space(); + this.print(node.body, node); +} + +function ParenthesizedExpression(node) { + this.token("("); + this.print(node.expression, node); + this.token(")"); +} + +function UpdateExpression(node) { + if (node.prefix) { + this.token(node.operator); + this.print(node.argument, node); + } else { + this.startTerminatorless(true); + this.print(node.argument, node); + this.endTerminatorless(); + this.token(node.operator); + } +} + +function ConditionalExpression(node) { + this.print(node.test, node); + this.space(); + this.token("?"); + this.space(); + this.print(node.consequent, node); + this.space(); + this.token(":"); + 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.token("("); + this.printList(node.arguments, node); + this.token(")"); +} + +function SequenceExpression(node) { + this.printList(node.expressions, node); +} + +function ThisExpression() { + this.word("this"); +} + +function Super() { + this.word("super"); +} + +function Decorator(node) { + this.token("@"); + this.print(node.expression, node); + this.newline(); +} + +function OptionalMemberExpression(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 (node.optional) { + this.token("?."); + } + + if (computed) { + this.token("["); + this.print(node.property, node); + this.token("]"); + } else { + if (!node.optional) { + this.token("."); + } + + this.print(node.property, node); + } +} + +function OptionalCallExpression(node) { + this.print(node.callee, node); + this.print(node.typeArguments, node); + this.print(node.typeParameters, node); + + if (node.optional) { + this.token("?."); + } + + this.token("("); + this.printList(node.arguments, node); + this.token(")"); +} + +function CallExpression(node) { + this.print(node.callee, node); + this.print(node.typeArguments, node); + this.print(node.typeParameters, node); + this.token("("); + this.printList(node.arguments, node); + this.token(")"); +} + +function Import() { + this.word("import"); +} + +function buildYieldAwait(keyword) { + return function (node) { + this.word(keyword); + + if (node.delegate) { + this.token("*"); + } + + if (node.argument) { + this.space(); + const terminatorState = this.startTerminatorless(); + this.print(node.argument, node); + this.endTerminatorless(terminatorState); + } + }; +} + +const YieldExpression = buildYieldAwait("yield"); +exports.YieldExpression = YieldExpression; +const AwaitExpression = buildYieldAwait("await"); +exports.AwaitExpression = AwaitExpression; + +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.token("?"); + this.print(node.left.typeAnnotation, node); + this.space(); + this.token("="); + 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.token("("); + } + + 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.token(")"); + } +} + +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.token("["); + this.print(node.property, node); + this.token("]"); + } else { + this.token("."); + this.print(node.property, node); + } +} + +function MetaProperty(node) { + this.print(node.meta, node); + this.token("."); + this.print(node.property, node); +} + +function PrivateName(node) { + this.token("#"); + this.print(node.id, node); +} + +function V8IntrinsicIdentifier(node) { + this.token("%"); + this.word(node.name); +} + +function ModuleExpression(node) { + this.word("module"); + this.space(); + this.token("{"); + + if (node.body.body.length === 0) { + this.token("}"); + } else { + this.newline(); + this.printSequence(node.body.body, node, { + indent: true + }); + this.rightBrace(); + } +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/flow.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/flow.js new file mode 100644 index 0000000..badac39 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/flow.js @@ -0,0 +1,795 @@ +"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 = require("@babel/types"); + +var _modules = require("./modules"); + +var _types2 = require("./types"); + +const { + isDeclareExportDeclaration, + isStatement +} = _t; + +function AnyTypeAnnotation() { + this.word("any"); +} + +function ArrayTypeAnnotation(node) { + this.print(node.elementType, node); + this.token("["); + this.token("]"); +} + +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.token("%"); + this.word("checks"); +} + +function DeclaredPredicate(node) { + this.token("%"); + this.word("checks"); + this.token("("); + this.print(node.value, node); + this.token(")"); +} + +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.token("."); + 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.apply(this, arguments); +} + +function DeclareExportAllDeclaration() { + this.word("declare"); + this.space(); + + _modules.ExportAllDeclaration.apply(this, arguments); +} + +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.token(","); +} + +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.token("{"); + + if (node.specifiers.length) { + this.space(); + this.printList(node.specifiers, node); + this.space(); + } + + this.token("}"); + + if (node.source) { + this.space(); + this.word("from"); + this.space(); + this.print(node.source, node); + } + + this.semicolon(); + } +} + +function ExistsTypeAnnotation() { + this.token("*"); +} + +function FunctionTypeAnnotation(node, parent) { + this.print(node.typeParameters, node); + this.token("("); + + if (node.this) { + this.word("this"); + this.token(":"); + this.space(); + this.print(node.this.typeAnnotation, node); + + if (node.params.length || node.rest) { + this.token(","); + this.space(); + } + } + + this.printList(node.params, node); + + if (node.rest) { + if (node.params.length) { + this.token(","); + this.space(); + } + + this.token("..."); + this.print(node.rest, node); + } + + this.token(")"); + + if (parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction" || parent.type === "ObjectTypeProperty" && parent.method) { + this.token(":"); + } else { + this.space(); + this.token("=>"); + } + + this.space(); + this.print(node.returnType, node); +} + +function FunctionTypeParam(node) { + this.print(node.name, node); + if (node.optional) this.token("?"); + + if (node.name) { + this.token(":"); + this.space(); + } + + this.print(node.typeAnnotation, node); +} + +function InterfaceExtends(node) { + this.print(node.id, node); + this.print(node.typeParameters, node); +} + +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.mixins && node.mixins.length) { + this.space(); + this.word("mixins"); + this.space(); + this.printList(node.mixins, node); + } + + if (node.implements && 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) { + if (node.variance) { + if (node.variance.kind === "plus") { + this.token("+"); + } else if (node.variance.kind === "minus") { + this.token("-"); + } + } +} + +function InterfaceDeclaration(node) { + this.word("interface"); + this.space(); + + this._interfaceish(node); +} + +function andSeparator() { + this.space(); + this.token("&"); + this.space(); +} + +function InterfaceTypeAnnotation(node) { + this.word("interface"); + + if (node.extends && node.extends.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.token("?"); + this.print(node.typeAnnotation, node); +} + +function NumberTypeAnnotation() { + this.word("number"); +} + +function StringTypeAnnotation() { + this.word("string"); +} + +function ThisTypeAnnotation() { + this.word("this"); +} + +function TupleTypeAnnotation(node) { + this.token("["); + this.printList(node.types, node); + this.token("]"); +} + +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.token("="); + this.space(); + this.print(node.right, node); + this.semicolon(); +} + +function TypeAnnotation(node) { + this.token(":"); + this.space(); + if (node.optional) this.token("?"); + this.print(node.typeAnnotation, node); +} + +function TypeParameterInstantiation(node) { + this.token("<"); + this.printList(node.params, node, {}); + this.token(">"); +} + +function TypeParameter(node) { + this._variance(node); + + this.word(node.name); + + if (node.bound) { + this.print(node.bound, node); + } + + if (node.default) { + this.space(); + this.token("="); + 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.token(":"); + this.space(); + this.print(node.supertype, node); + } + + if (node.impltype) { + this.space(); + this.token("="); + this.space(); + this.print(node.impltype, node); + } + + this.semicolon(); +} + +function ObjectTypeAnnotation(node) { + if (node.exact) { + this.token("{|"); + } else { + this.token("{"); + } + + const props = [...node.properties, ...(node.callProperties || []), ...(node.indexers || []), ...(node.internalSlots || [])]; + + if (props.length) { + 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.token(","); + 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.token("}"); + } +} + +function ObjectTypeInternalSlot(node) { + if (node.static) { + this.word("static"); + this.space(); + } + + this.token("["); + this.token("["); + this.print(node.id, node); + this.token("]"); + this.token("]"); + if (node.optional) this.token("?"); + + if (!node.method) { + this.token(":"); + 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.token("["); + + if (node.id) { + this.print(node.id, node); + this.token(":"); + this.space(); + } + + this.print(node.key, node); + this.token("]"); + this.token(":"); + 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.token("?"); + + if (!node.method) { + this.token(":"); + 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.token("."); + this.print(node.id, node); +} + +function SymbolTypeAnnotation() { + this.word("symbol"); +} + +function orSeparator() { + this.space(); + this.token("|"); + this.space(); +} + +function UnionTypeAnnotation(node) { + this.printJoin(node.types, node, { + separator: orSeparator + }); +} + +function TypeCastExpression(node) { + this.token("("); + this.print(node.expression, node); + this.print(node.typeAnnotation, node); + this.token(")"); +} + +function Variance(node) { + if (node.kind === "plus") { + this.token("+"); + } else { + this.token("-"); + } +} + +function VoidTypeAnnotation() { + this.word("void"); +} + +function IndexedAccessType(node) { + this.print(node.objectType, node); + this.token("["); + this.print(node.indexType, node); + this.token("]"); +} + +function OptionalIndexedAccessType(node) { + this.print(node.objectType, node); + + if (node.optional) { + this.token("?."); + } + + this.token("["); + this.print(node.indexType, node); + this.token("]"); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/index.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/index.js new file mode 100644 index 0000000..8820db0 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/index.js @@ -0,0 +1,148 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _templateLiterals = require("./template-literals"); + +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 = require("./expressions"); + +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 = require("./statements"); + +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 = require("./classes"); + +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 = require("./methods"); + +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 = require("./modules"); + +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 = require("./types"); + +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 = require("./flow"); + +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 = require("./base"); + +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 = require("./jsx"); + +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 = require("./typescript"); + +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]; + } + }); +}); \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/jsx.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/jsx.js new file mode 100644 index 0000000..3c11f59 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/jsx.js @@ -0,0 +1,145 @@ +"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.token("="); + this.print(node.value, node); + } +} + +function JSXIdentifier(node) { + this.word(node.name); +} + +function JSXNamespacedName(node) { + this.print(node.namespace, node); + this.token(":"); + this.print(node.name, node); +} + +function JSXMemberExpression(node) { + this.print(node.object, node); + this.token("."); + this.print(node.property, node); +} + +function JSXSpreadAttribute(node) { + this.token("{"); + this.token("..."); + this.print(node.argument, node); + this.token("}"); +} + +function JSXExpressionContainer(node) { + this.token("{"); + this.print(node.expression, node); + this.token("}"); +} + +function JSXSpreadChild(node) { + this.token("{"); + this.token("..."); + this.print(node.expression, node); + this.token("}"); +} + +function JSXText(node) { + const raw = this.getPossibleRaw(node); + + if (raw != null) { + this.token(raw); + } else { + this.token(node.value); + } +} + +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.token("<"); + 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.token(">"); + } +} + +function JSXClosingElement(node) { + this.token(""); +} + +function JSXEmptyExpression(node) { + this.printInnerComments(node); +} + +function JSXFragment(node) { + this.print(node.openingFragment, node); + this.indent(); + + for (const child of node.children) { + this.print(child, node); + } + + this.dedent(); + this.print(node.closingFragment, node); +} + +function JSXOpeningFragment() { + this.token("<"); + this.token(">"); +} + +function JSXClosingFragment() { + this.token(""); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/methods.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/methods.js new file mode 100644 index 0000000..d31e7fa --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/methods.js @@ -0,0 +1,150 @@ +"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 = require("@babel/types"); + +const { + isIdentifier +} = _t; + +function _params(node) { + this.print(node.typeParameters, node); + this.token("("); + + this._parameters(node.params, node); + + this.token(")"); + this.print(node.returnType, node); +} + +function _parameters(parameters, parent) { + for (let i = 0; i < parameters.length; i++) { + this._param(parameters[i], parent); + + if (i < parameters.length - 1) { + this.token(","); + this.space(); + } + } +} + +function _param(parameter, parent) { + this.printJoin(parameter.decorators, parameter); + this.print(parameter, parent); + if (parameter.optional) this.token("?"); + 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._catchUp("start", key.loc); + + this.word("async"); + this.space(); + } + + if (kind === "method" || kind === "init") { + if (node.generator) { + this.token("*"); + } + } + + if (node.computed) { + this.token("["); + this.print(key, node); + this.token("]"); + } else { + this.print(key, node); + } + + if (node.optional) { + this.token("?"); + } + + this._params(node); +} + +function _predicate(node) { + if (node.predicate) { + if (!node.returnType) { + this.token(":"); + } + + this.space(); + this.print(node.predicate, node); + } +} + +function _functionHead(node) { + if (node.async) { + this.word("async"); + this.space(); + } + + this.word("function"); + if (node.generator) this.token("*"); + this.printInnerComments(node); + this.space(); + + if (node.id) { + this.print(node.id, node); + } + + this._params(node); + + this._predicate(node); +} + +function FunctionExpression(node) { + this._functionHead(node); + + this.space(); + this.print(node.body, node); +} + +function ArrowFunctionExpression(node) { + if (node.async) { + this.word("async"); + this.space(); + } + + const firstParam = node.params[0]; + + if (!this.format.retainLines && !this.format.auxiliaryCommentBefore && !this.format.auxiliaryCommentAfter && node.params.length === 1 && isIdentifier(firstParam) && !hasTypesOrComments(node, firstParam)) { + this.print(firstParam, node); + } else { + this._params(node); + } + + this._predicate(node); + + this.space(); + 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); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/modules.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/modules.js new file mode 100644 index 0000000..7a3cc26 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/modules.js @@ -0,0 +1,239 @@ +"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; + +var _t = require("@babel/types"); + +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.token("*"); + this.space(); + this.word("as"); + this.space(); + this.print(node.exported, node); +} + +function ExportAllDeclaration(node) { + this.word("export"); + this.space(); + + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + + this.token("*"); + this.space(); + this.word("from"); + this.space(); + this.print(node.source, node); + this.printAssertions(node); + this.semicolon(); +} + +function ExportNamedDeclaration(node) { + if (this.format.decoratorsBeforeExport && isClassDeclaration(node.declaration)) { + this.printJoin(node.declaration.decorators, node); + } + + this.word("export"); + this.space(); + ExportDeclaration.apply(this, arguments); +} + +function ExportDefaultDeclaration(node) { + if (this.format.decoratorsBeforeExport && isClassDeclaration(node.declaration)) { + this.printJoin(node.declaration.decorators, node); + } + + this.word("export"); + this.space(); + this.word("default"); + this.space(); + ExportDeclaration.apply(this, arguments); +} + +function ExportDeclaration(node) { + 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.token(","); + this.space(); + } + } else { + break; + } + } + + if (specifiers.length || !specifiers.length && !hasSpecial) { + this.token("{"); + + if (specifiers.length) { + this.space(); + this.printList(specifiers, node); + this.space(); + } + + this.token("}"); + } + + if (node.source) { + this.space(); + this.word("from"); + this.space(); + this.print(node.source, node); + this.printAssertions(node); + } + + this.semicolon(); + } +} + +function ImportDeclaration(node) { + this.word("import"); + this.space(); + + if (node.importKind === "type" || node.importKind === "typeof") { + this.word(node.importKind); + this.space(); + } + + const specifiers = node.specifiers.slice(0); + + if (specifiers != null && specifiers.length) { + for (;;) { + const first = specifiers[0]; + + if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) { + this.print(specifiers.shift(), node); + + if (specifiers.length) { + this.token(","); + this.space(); + } + } else { + break; + } + } + + if (specifiers.length) { + this.token("{"); + this.space(); + this.printList(specifiers, node); + this.space(); + this.token("}"); + } + + this.space(); + this.word("from"); + this.space(); + } + + this.print(node.source, node); + this.printAssertions(node); + { + var _node$attributes; + + if ((_node$attributes = node.attributes) != null && _node$attributes.length) { + this.space(); + this.word("with"); + this.space(); + this.printList(node.attributes, node); + } + } + this.semicolon(); +} + +function ImportAttribute(node) { + this.print(node.key); + this.token(":"); + this.space(); + this.print(node.value); +} + +function ImportNamespaceSpecifier(node) { + this.token("*"); + this.space(); + this.word("as"); + this.space(); + this.print(node.local, node); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/statements.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/statements.js new file mode 100644 index 0000000..8b7b8fd --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/statements.js @@ -0,0 +1,331 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BreakStatement = void 0; +exports.CatchClause = CatchClause; +exports.ContinueStatement = void 0; +exports.DebuggerStatement = DebuggerStatement; +exports.DoWhileStatement = DoWhileStatement; +exports.ForOfStatement = exports.ForInStatement = void 0; +exports.ForStatement = ForStatement; +exports.IfStatement = IfStatement; +exports.LabeledStatement = LabeledStatement; +exports.ReturnStatement = void 0; +exports.SwitchCase = SwitchCase; +exports.SwitchStatement = SwitchStatement; +exports.ThrowStatement = void 0; +exports.TryStatement = TryStatement; +exports.VariableDeclaration = VariableDeclaration; +exports.VariableDeclarator = VariableDeclarator; +exports.WhileStatement = WhileStatement; +exports.WithStatement = WithStatement; + +var _t = require("@babel/types"); + +const { + isFor, + isForStatement, + isIfStatement, + isStatement +} = _t; + +function WithStatement(node) { + this.word("with"); + this.space(); + this.token("("); + this.print(node.object, node); + this.token(")"); + this.printBlock(node); +} + +function IfStatement(node) { + this.word("if"); + this.space(); + this.token("("); + this.print(node.test, node); + this.token(")"); + this.space(); + const needsBlock = node.alternate && isIfStatement(getLastStatement(node.consequent)); + + if (needsBlock) { + this.token("{"); + this.newline(); + this.indent(); + } + + this.printAndIndentOnComments(node.consequent, node); + + if (needsBlock) { + this.dedent(); + this.newline(); + this.token("}"); + } + + if (node.alternate) { + if (this.endsWith(125)) this.space(); + this.word("else"); + this.space(); + this.printAndIndentOnComments(node.alternate, node); + } +} + +function getLastStatement(statement) { + if (!isStatement(statement.body)) return statement; + return getLastStatement(statement.body); +} + +function ForStatement(node) { + this.word("for"); + this.space(); + this.token("("); + this.inForStatementInitCounter++; + this.print(node.init, node); + this.inForStatementInitCounter--; + this.token(";"); + + if (node.test) { + this.space(); + this.print(node.test, node); + } + + this.token(";"); + + if (node.update) { + this.space(); + this.print(node.update, node); + } + + this.token(")"); + this.printBlock(node); +} + +function WhileStatement(node) { + this.word("while"); + this.space(); + this.token("("); + this.print(node.test, node); + this.token(")"); + this.printBlock(node); +} + +const buildForXStatement = function (op) { + return function (node) { + this.word("for"); + this.space(); + + if (op === "of" && node.await) { + this.word("await"); + this.space(); + } + + this.token("("); + this.print(node.left, node); + this.space(); + this.word(op); + this.space(); + this.print(node.right, node); + this.token(")"); + this.printBlock(node); + }; +}; + +const ForInStatement = buildForXStatement("in"); +exports.ForInStatement = ForInStatement; +const ForOfStatement = buildForXStatement("of"); +exports.ForOfStatement = ForOfStatement; + +function DoWhileStatement(node) { + this.word("do"); + this.space(); + this.print(node.body, node); + this.space(); + this.word("while"); + this.space(); + this.token("("); + this.print(node.test, node); + this.token(")"); + this.semicolon(); +} + +function buildLabelStatement(prefix, key = "label") { + return function (node) { + this.word(prefix); + const label = node[key]; + + if (label) { + this.space(); + const isLabel = key == "label"; + const terminatorState = this.startTerminatorless(isLabel); + this.print(label, node); + this.endTerminatorless(terminatorState); + } + + this.semicolon(); + }; +} + +const ContinueStatement = buildLabelStatement("continue"); +exports.ContinueStatement = ContinueStatement; +const ReturnStatement = buildLabelStatement("return", "argument"); +exports.ReturnStatement = ReturnStatement; +const BreakStatement = buildLabelStatement("break"); +exports.BreakStatement = BreakStatement; +const ThrowStatement = buildLabelStatement("throw", "argument"); +exports.ThrowStatement = ThrowStatement; + +function LabeledStatement(node) { + this.print(node.label, node); + this.token(":"); + 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.token("("); + this.print(node.param, node); + this.print(node.param.typeAnnotation, node); + this.token(")"); + this.space(); + } + + this.print(node.body, node); +} + +function SwitchStatement(node) { + this.word("switch"); + this.space(); + this.token("("); + this.print(node.discriminant, node); + this.token(")"); + this.space(); + this.token("{"); + this.printSequence(node.cases, node, { + indent: true, + + addNewlines(leading, cas) { + if (!leading && node.cases[node.cases.length - 1] === cas) return -1; + } + + }); + this.token("}"); +} + +function SwitchCase(node) { + if (node.test) { + this.word("case"); + this.space(); + this.print(node.test, node); + this.token(":"); + } else { + this.word("default"); + this.token(":"); + } + + if (node.consequent.length) { + this.newline(); + this.printSequence(node.consequent, node, { + indent: true + }); + } +} + +function DebuggerStatement() { + this.word("debugger"); + this.semicolon(); +} + +function variableDeclarationIndent() { + this.token(","); + this.newline(); + + if (this.endsWith(10)) { + for (let i = 0; i < 4; i++) this.space(true); + } +} + +function constDeclarationIndent() { + this.token(","); + this.newline(); + + if (this.endsWith(10)) { + for (let i = 0; i < 6; i++) this.space(true); + } +} + +function VariableDeclaration(node, parent) { + if (node.declare) { + this.word("declare"); + this.space(); + } + + this.word(node.kind); + this.space(); + let hasInits = false; + + if (!isFor(parent)) { + for (const declar of node.declarations) { + if (declar.init) { + hasInits = true; + } + } + } + + let separator; + + if (hasInits) { + separator = node.kind === "const" ? constDeclarationIndent : variableDeclarationIndent; + } + + this.printList(node.declarations, node, { + separator + }); + + 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.token("!"); + this.print(node.id.typeAnnotation, node); + + if (node.init) { + this.space(); + this.token("="); + this.space(); + this.print(node.init, node); + } +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/template-literals.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/template-literals.js new file mode 100644 index 0000000..0543303 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/template-literals.js @@ -0,0 +1,33 @@ +"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); +} + +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); + } + } +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/types.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/types.js new file mode 100644 index 0000000..94c8d9f --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/types.js @@ -0,0 +1,276 @@ +"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 = require("@babel/types"); + +var _jsesc = require("jsesc"); + +const { + isAssignmentPattern, + isIdentifier +} = _t; + +function Identifier(node) { + this.exactSource(node.loc, () => { + this.word(node.name); + }); +} + +function ArgumentPlaceholder() { + this.token("?"); +} + +function RestElement(node) { + this.token("..."); + this.print(node.argument, node); +} + +function ObjectExpression(node) { + const props = node.properties; + this.token("{"); + this.printInnerComments(node); + + if (props.length) { + this.space(); + this.printList(props, node, { + indent: true, + statement: true + }); + this.space(); + } + + this.token("}"); +} + +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.token("["); + this.print(node.key, node); + this.token("]"); + } 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.token(":"); + this.space(); + this.print(node.value, node); +} + +function ArrayExpression(node) { + const elems = node.elements; + const len = elems.length; + this.token("["); + this.printInnerComments(node); + + 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.token(","); + } else { + this.token(","); + } + } + + this.token("]"); +} + +function RecordExpression(node) { + const props = node.properties; + let startToken; + let endToken; + + if (this.format.recordAndTupleSyntaxType === "bar") { + startToken = "{|"; + endToken = "|}"; + } else if (this.format.recordAndTupleSyntaxType === "hash") { + startToken = "#{"; + endToken = "}"; + } else { + throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`); + } + + this.token(startToken); + this.printInnerComments(node); + + 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); + this.printInnerComments(node); + + 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.token(","); + } + } + + 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 != null) { + this.token(raw); + return; + } + + const val = _jsesc(node.value, Object.assign(this.format.jsescOption, this.format.jsonCompatibleStrings && { + json: true + })); + + return this.token(val); +} + +function BigIntLiteral(node) { + const raw = this.getPossibleRaw(node); + + if (!this.format.minified && raw != null) { + this.word(raw); + return; + } + + this.word(node.value + "n"); +} + +function DecimalLiteral(node) { + const raw = this.getPossibleRaw(node); + + if (!this.format.minified && raw != null) { + 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.token("#"); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/generators/typescript.js b/src/main/resources/static/node_modules/@babel/generator/lib/generators/typescript.js new file mode 100644 index 0000000..93a4385 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/generators/typescript.js @@ -0,0 +1,806 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.TSAnyKeyword = TSAnyKeyword; +exports.TSArrayType = TSArrayType; +exports.TSAsExpression = TSAsExpression; +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.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.tsPrintBraced = tsPrintBraced; +exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers; +exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType; +exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName; +exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase; +exports.tsPrintTypeLiteralOrInterfaceBody = tsPrintTypeLiteralOrInterfaceBody; +exports.tsPrintUnionOrIntersectionType = tsPrintUnionOrIntersectionType; + +function TSTypeAnnotation(node) { + this.token(":"); + this.space(); + if (node.optional) this.token("?"); + this.print(node.typeAnnotation, node); +} + +function TSTypeParameterInstantiation(node) { + this.token("<"); + this.printList(node.params, node, {}); + this.token(">"); +} + +function TSTypeParameter(node) { + 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.token("="); + 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) { + if (node.declare) { + this.word("declare"); + this.space(); + } + + this._functionHead(node); + + this.token(";"); +} + +function TSDeclareMethod(node) { + this._classMethodHead(node); + + this.token(";"); +} + +function TSQualifiedName(node) { + this.print(node.left, node); + this.token("."); + this.print(node.right, node); +} + +function TSCallSignatureDeclaration(node) { + this.tsPrintSignatureDeclarationBase(node); + this.token(";"); +} + +function TSConstructSignatureDeclaration(node) { + this.word("new"); + this.space(); + this.tsPrintSignatureDeclarationBase(node); + this.token(";"); +} + +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.token("="); + this.space(); + this.print(initializer, node); + } + + this.token(";"); +} + +function tsPrintPropertyOrMethodName(node) { + if (node.computed) { + this.token("["); + } + + this.print(node.key, node); + + if (node.computed) { + this.token("]"); + } + + if (node.optional) { + this.token("?"); + } +} + +function TSMethodSignature(node) { + const { + kind + } = node; + + if (kind === "set" || kind === "get") { + this.word(kind); + this.space(); + } + + this.tsPrintPropertyOrMethodName(node); + this.tsPrintSignatureDeclarationBase(node); + this.token(";"); +} + +function TSIndexSignature(node) { + const { + readonly, + static: isStatic + } = node; + + if (isStatic) { + this.word("static"); + this.space(); + } + + if (readonly) { + this.word("readonly"); + this.space(); + } + + this.token("["); + + this._parameters(node.parameters, node); + + this.token("]"); + this.print(node.typeAnnotation, node); + this.token(";"); +} + +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, + parameters + } = node; + this.print(typeParameters, node); + this.token("("); + + this._parameters(parameters, node); + + this.token(")"); + this.space(); + this.token("=>"); + this.space(); + this.print(node.typeAnnotation.typeAnnotation, node); +} + +function TSTypeReference(node) { + this.print(node.typeName, node); + this.print(node.typeParameters, node); +} + +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); +} + +function TSTypeLiteral(node) { + this.tsPrintTypeLiteralOrInterfaceBody(node.members, node); +} + +function tsPrintTypeLiteralOrInterfaceBody(members, node) { + this.tsPrintBraced(members, node); +} + +function tsPrintBraced(members, node) { + this.token("{"); + + if (members.length) { + this.indent(); + this.newline(); + + for (const member of members) { + this.print(member, node); + this.newline(); + } + + this.dedent(); + this.rightBrace(); + } else { + this.token("}"); + } +} + +function TSArrayType(node) { + this.print(node.elementType, node); + this.token("[]"); +} + +function TSTupleType(node) { + this.token("["); + this.printList(node.elementTypes, node); + this.token("]"); +} + +function TSOptionalType(node) { + this.print(node.typeAnnotation, node); + this.token("?"); +} + +function TSRestType(node) { + this.token("..."); + this.print(node.typeAnnotation, node); +} + +function TSNamedTupleMember(node) { + this.print(node.label, node); + if (node.optional) this.token("?"); + this.token(":"); + this.space(); + this.print(node.elementType, node); +} + +function TSUnionType(node) { + this.tsPrintUnionOrIntersectionType(node, "|"); +} + +function TSIntersectionType(node) { + this.tsPrintUnionOrIntersectionType(node, "&"); +} + +function tsPrintUnionOrIntersectionType(node, sep) { + this.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.token("?"); + this.space(); + this.print(node.trueType); + this.space(); + this.token(":"); + this.space(); + this.print(node.falseType); +} + +function TSInferType(node) { + this.token("infer"); + this.space(); + this.print(node.typeParameter); +} + +function TSParenthesizedType(node) { + this.token("("); + this.print(node.typeAnnotation, node); + this.token(")"); +} + +function TSTypeOperator(node) { + this.word(node.operator); + this.space(); + this.print(node.typeAnnotation, node); +} + +function TSIndexedAccessType(node) { + this.print(node.objectType, node); + this.token("["); + this.print(node.indexType, node); + this.token("]"); +} + +function TSMappedType(node) { + const { + nameType, + optional, + readonly, + typeParameter + } = node; + this.token("{"); + this.space(); + + if (readonly) { + tokenIfPlusMinus(this, readonly); + this.word("readonly"); + this.space(); + } + + this.token("["); + 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.token("]"); + + if (optional) { + tokenIfPlusMinus(this, optional); + this.token("?"); + } + + this.token(":"); + this.space(); + this.print(node.typeAnnotation, node); + this.space(); + this.token("}"); +} + +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.token("="); + this.space(); + this.print(typeAnnotation, node); + this.token(";"); +} + +function TSAsExpression(node) { + const { + expression, + typeAnnotation + } = node; + this.print(expression, node); + this.space(); + this.word("as"); + this.space(); + this.print(typeAnnotation, node); +} + +function TSTypeAssertion(node) { + const { + typeAnnotation, + expression + } = node; + this.token("<"); + this.print(typeAnnotation, node); + this.token(">"); + this.space(); + this.print(expression, 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(); + this.tsPrintBraced(members, node); +} + +function TSEnumMember(node) { + const { + id, + initializer + } = node; + this.print(id, node); + + if (initializer) { + this.space(); + this.token("="); + this.space(); + this.print(initializer, node); + } + + this.token(","); +} + +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.token(";"); + return; + } + + let body = node.body; + + while (body.type === "TSModuleDeclaration") { + this.token("."); + this.print(body.id, body); + body = body.body; + } + + this.space(); + this.print(body, node); +} + +function TSModuleBlock(node) { + this.tsPrintBraced(node.body, node); +} + +function TSImportType(node) { + const { + argument, + qualifier, + typeParameters + } = node; + this.word("import"); + this.token("("); + this.print(argument, node); + this.token(")"); + + if (qualifier) { + this.token("."); + 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.token("="); + this.space(); + this.print(moduleReference, node); + this.token(";"); +} + +function TSExternalModuleReference(node) { + this.token("require("); + this.print(node.expression, node); + this.token(")"); +} + +function TSNonNullExpression(node) { + this.print(node.expression, node); + this.token("!"); +} + +function TSExportAssignment(node) { + this.word("export"); + this.space(); + this.token("="); + this.space(); + this.print(node.expression, node); + this.token(";"); +} + +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, + parameters + } = node; + this.print(typeParameters, node); + this.token("("); + + this._parameters(parameters, node); + + this.token(")"); + this.print(node.typeAnnotation, node); +} + +function tsPrintClassMemberModifiers(node, isField) { + 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(); + } +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/index.js b/src/main/resources/static/node_modules/@babel/generator/lib/index.js new file mode 100644 index 0000000..ca8a0bd --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/index.js @@ -0,0 +1,97 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.CodeGenerator = void 0; +exports.default = generate; + +var _sourceMap = require("./source-map"); + +var _printer = require("./printer"); + +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) { + 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: " ", + base: 0 + }, + decoratorsBeforeExport: !!opts.decoratorsBeforeExport, + jsescOption: Object.assign({ + quotes: "double", + wrap: true, + minimal: false + }, opts.jsescOption), + recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType, + topicToken: opts.topicToken + }; + { + format.jsonCompatibleStrings = opts.jsonCompatibleStrings; + } + + if (format.minified) { + format.compact = true; + + format.shouldPrintComment = format.shouldPrintComment || (() => format.comments); + } else { + format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0); + } + + if (format.compact === "auto") { + format.compact = 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; + } + + 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(); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/node/index.js b/src/main/resources/static/node_modules/@babel/generator/lib/node/index.js new file mode 100644 index 0000000..b594ae4 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/node/index.js @@ -0,0 +1,111 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.needsParens = needsParens; +exports.needsWhitespace = needsWhitespace; +exports.needsWhitespaceAfter = needsWhitespaceAfter; +exports.needsWhitespaceBefore = needsWhitespaceBefore; + +var whitespace = require("./whitespace"); + +var parens = require("./parentheses"); + +var _t = require("@babel/types"); + +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); +const expandedWhitespaceList = expandAliases(whitespace.list); + +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 0; + + if (isExpressionStatement(node)) { + node = node.expression; + } + + let linesInfo = find(expandedWhitespaceNodes, node, parent); + + if (!linesInfo) { + const items = find(expandedWhitespaceList, node, parent); + + if (items) { + for (let i = 0; i < items.length; i++) { + linesInfo = needsWhitespace(items[i], node, type); + if (linesInfo) break; + } + } + } + + if (typeof linesInfo === "object" && linesInfo !== null) { + return linesInfo[type] || 0; + } + + return 0; +} + +function needsWhitespaceBefore(node, parent) { + return needsWhitespace(node, parent, "before"); +} + +function needsWhitespaceAfter(node, parent) { + return needsWhitespace(node, parent, "after"); +} + +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); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/node/parentheses.js b/src/main/resources/static/node_modules/@babel/generator/lib/node/parentheses.js new file mode 100644 index 0000000..5761a58 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/node/parentheses.js @@ -0,0 +1,342 @@ +"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.TSAsExpression = TSAsExpression; +exports.TSInferType = TSInferType; +exports.TSTypeAssertion = TSTypeAssertion; +exports.TSIntersectionType = exports.TSUnionType = TSUnionType; +exports.UnaryLike = UnaryLike; +exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation; +exports.UpdateExpression = UpdateExpression; +exports.AwaitExpression = exports.YieldExpression = YieldExpression; + +var _t = require("@babel/types"); + +const { + isArrayTypeAnnotation, + isArrowFunctionExpression, + isAssignmentExpression, + isAwaitExpression, + isBinary, + isBinaryExpression, + isCallExpression, + isClassDeclaration, + isClassExpression, + isConditional, + isConditionalExpression, + isExportDeclaration, + isExportDefaultDeclaration, + isExpressionStatement, + isFor, + isForInStatement, + isForOfStatement, + isForStatement, + isIfStatement, + isIndexedAccessType, + isIntersectionTypeAnnotation, + isLogicalExpression, + isMemberExpression, + isNewExpression, + isNullableTypeAnnotation, + isObjectPattern, + isOptionalCallExpression, + isOptionalMemberExpression, + isReturnStatement, + isSequenceExpression, + isSwitchStatement, + isTSArrayType, + isTSAsExpression, + isTSIntersectionType, + isTSNonNullExpression, + isTSOptionalType, + isTSRestType, + isTSTypeAssertion, + isTSUnionType, + isTaggedTemplateExpression, + isThrowStatement, + isTypeAnnotation, + isUnaryLike, + isUnionTypeAnnotation, + isVariableDeclarator, + isWhileStatement, + isYieldExpression +} = _t; +const PRECEDENCE = { + "||": 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 +}; + +const isClassExtendsClause = (node, parent) => (isClassDeclaration(parent) || isClassExpression(parent)) && 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) { + 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, { + expressionStatement: true, + arrowBody: true + }); +} + +function DoExpression(node, parent, printStack) { + return !node.async && isFirstInContext(printStack, { + expressionStatement: true + }); +} + +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 TSTypeAssertion() { + 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 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, { + expressionStatement: true, + exportDefault: true + }); +} + +function UnaryLike(node, parent) { + return hasPostfixPart(node, parent) || isBinaryExpression(parent, { + operator: "**", + left: node + }) || isClassExtendsClause(node, parent); +} + +function FunctionExpression(node, parent, printStack) { + return isFirstInContext(printStack, { + expressionStatement: true, + exportDefault: true + }); +} + +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) || isTSTypeAssertion(parent) || isTSAsExpression(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) { + 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) { + if (node.name === "let") { + const isFollowedByBracket = isMemberExpression(parent, { + object: node, + computed: true + }) || isOptionalMemberExpression(parent, { + object: node, + computed: true, + optional: false + }); + return isFirstInContext(printStack, { + expressionStatement: isFollowedByBracket, + forHead: isFollowedByBracket, + forInHead: isFollowedByBracket, + forOfHead: true + }); + } + + return node.name === "async" && isForOfStatement(parent) && node === parent.left; +} + +function isFirstInContext(printStack, { + expressionStatement = false, + arrowBody = false, + exportDefault = false, + forHead = false, + forInHead = false, + forOfHead = false +}) { + let i = printStack.length - 1; + 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 (hasPostfixPart(node, parent) && !isNewExpression(parent) || isSequenceExpression(parent) && parent.expressions[0] === node || isConditional(parent, { + test: node + }) || isBinary(parent, { + left: node + }) || isAssignmentExpression(parent, { + left: node + })) { + node = parent; + i--; + parent = printStack[i]; + } else { + return false; + } + } + + return false; +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/node/whitespace.js b/src/main/resources/static/node_modules/@babel/generator/lib/node/whitespace.js new file mode 100644 index 0000000..80e2da9 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/node/whitespace.js @@ -0,0 +1,214 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.nodes = exports.list = void 0; + +var _t = require("@babel/types"); + +const { + FLIPPED_ALIAS_KEYS, + isArrayExpression, + isAssignmentExpression, + isBinary, + isBlockStatement, + isCallExpression, + isFunction, + isIdentifier, + isLiteral, + isMemberExpression, + isObjectExpression, + isOptionalCallExpression, + isOptionalMemberExpression, + isStringLiteral +} = _t; + +function crawl(node, state = {}) { + if (isMemberExpression(node) || isOptionalMemberExpression(node)) { + crawl(node.object, state); + if (node.computed) crawl(node.property, state); + } else if (isBinary(node) || isAssignmentExpression(node)) { + crawl(node.left, state); + crawl(node.right, state); + } else if (isCallExpression(node) || isOptionalCallExpression(node)) { + state.hasCall = true; + crawl(node.callee, state); + } else if (isFunction(node)) { + state.hasFunction = true; + } else if (isIdentifier(node)) { + state.hasHelper = state.hasHelper || isHelper(node.callee); + } + + return state; +} + +function isHelper(node) { + if (isMemberExpression(node)) { + return isHelper(node.object) || isHelper(node.property); + } else if (isIdentifier(node)) { + return node.name === "require" || node.name[0] === "_"; + } 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 { + before: state.hasFunction, + after: true + }; + } + }, + + SwitchCase(node, parent) { + return { + before: !!node.consequent.length || parent.cases[0] === node, + after: !node.consequent.length && parent.cases[parent.cases.length - 1] === node + }; + }, + + LogicalExpression(node) { + if (isFunction(node.left) || isFunction(node.right)) { + return { + after: true + }; + } + }, + + Literal(node) { + if (isStringLiteral(node) && node.value === "use strict") { + return { + after: true + }; + } + }, + + CallExpression(node) { + if (isFunction(node.callee) || isHelper(node)) { + return { + before: true, + after: true + }; + } + }, + + OptionalCallExpression(node) { + if (isFunction(node.callee)) { + return { + before: true, + after: true + }; + } + }, + + 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) { + const state = crawl(declar.init); + enabled = isHelper(declar.init) && state.hasCall || state.hasFunction; + } + + if (enabled) { + return { + before: true, + after: true + }; + } + } + }, + + IfStatement(node) { + if (isBlockStatement(node.consequent)) { + return { + before: true, + after: true + }; + } + } + +}; +exports.nodes = nodes; + +nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node, parent) { + if (parent.properties[0] === node) { + return { + before: true + }; + } +}; + +nodes.ObjectTypeCallProperty = function (node, parent) { + var _parent$properties; + + if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) != null && _parent$properties.length)) { + return { + before: true + }; + } +}; + +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 { + before: true + }; + } +}; + +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 { + before: true + }; + } +}; + +const list = { + VariableDeclaration(node) { + return node.declarations.map(decl => decl.init); + }, + + ArrayExpression(node) { + return node.elements; + }, + + ObjectExpression(node) { + return node.properties; + } + +}; +exports.list = list; +[["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function ([type, amounts]) { + if (typeof amounts === "boolean") { + amounts = { + after: amounts, + before: amounts + }; + } + + [type].concat(FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { + nodes[type] = function () { + return amounts; + }; + }); +}); \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/printer.js b/src/main/resources/static/node_modules/@babel/generator/lib/printer.js new file mode 100644 index 0000000..0decd21 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/printer.js @@ -0,0 +1,540 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _buffer = require("./buffer"); + +var n = require("./node"); + +var _t = require("@babel/types"); + +var generatorFunctions = require("./generators"); + +const { + isProgram, + isFile, + isEmptyStatement +} = _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 { + needsParens, + needsWhitespaceAfter, + needsWhitespaceBefore +} = n; + +class Printer { + constructor(format, map) { + this.inForStatementInitCounter = 0; + this._printStack = []; + this._indent = 0; + this._insideAux = false; + this._parenPushNewlineState = null; + this._noLineTerminator = false; + this._printAuxAfterOnNextUserNode = false; + this._printedComments = new WeakSet(); + this._endsWithInteger = false; + this._endsWithWord = false; + this.format = format; + this._buf = new _buffer.default(map); + } + + 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(); + + this._append(";", !force); + } + + rightBrace() { + if (this.format.minified) { + this._buf.removeLastSemicolon(); + } + + this.token("}"); + } + + 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) { + if (this._endsWithWord || this.endsWith(47) && str.charCodeAt(0) === 47) { + this._space(); + } + + this._maybeAddAuxComment(); + + this._append(str); + + this._endsWithWord = true; + } + + 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) { + const lastChar = this.getLastChar(); + const strFirst = str.charCodeAt(0); + + if (str === "--" && lastChar === 33 || strFirst === 43 && lastChar === 43 || strFirst === 45 && lastChar === 45 || strFirst === 46 && this._endsWithInteger) { + this._space(); + } + + this._maybeAddAuxComment(); + + this._append(str); + } + + newline(i = 1) { + if (this.format.retainLines || this.format.compact) return; + + if (this.format.concise) { + this.space(); + return; + } + + const charBeforeNewline = this.endsWithCharAndNewline(); + if (charBeforeNewline === 10) return; + + if (charBeforeNewline === 123 || charBeforeNewline === 58) { + i--; + } + + if (i <= 0) return; + + for (let j = 0; j < i; j++) { + this._newline(); + } + } + + endsWith(char) { + return this.getLastChar() === char; + } + + getLastChar() { + return this._buf.getLastChar(); + } + + endsWithCharAndNewline() { + return this._buf.endsWithCharAndNewline(); + } + + removeTrailingNewline() { + this._buf.removeTrailingNewline(); + } + + exactSource(loc, cb) { + this._catchUp("start", loc); + + this._buf.exactSource(loc, cb); + } + + source(prop, loc) { + this._catchUp(prop, loc); + + this._buf.source(prop, loc); + } + + withSource(prop, loc, cb) { + this._catchUp(prop, loc); + + this._buf.withSource(prop, loc, cb); + } + + _space() { + this._append(" ", true); + } + + _newline() { + this._append("\n", true); + } + + _append(str, queue = false) { + this._maybeAddParen(str); + + this._maybeIndent(str); + + if (queue) this._buf.queue(str);else this._buf.append(str); + this._endsWithWord = false; + this._endsWithInteger = false; + } + + _maybeIndent(str) { + if (this._indent && this.endsWith(10) && str.charCodeAt(0) !== 10) { + this._buf.queue(this._getIndent()); + } + } + + _maybeAddParen(str) { + const parenPushNewlineState = this._parenPushNewlineState; + if (!parenPushNewlineState) return; + let i; + + for (i = 0; i < str.length && str[i] === " "; i++) continue; + + if (i === str.length) { + return; + } + + const cha = str[i]; + + if (cha !== "\n") { + if (cha !== "/" || i + 1 === str.length) { + this._parenPushNewlineState = null; + return; + } + + const chaPost = str[i + 1]; + + if (chaPost === "*") { + if (PURE_ANNOTATION_RE.test(str.slice(i + 2, str.length - 2))) { + return; + } + } else if (chaPost !== "/") { + this._parenPushNewlineState = null; + return; + } + } + + this.token("("); + this.indent(); + parenPushNewlineState.printed = true; + } + + _catchUp(prop, loc) { + if (!this.format.retainLines) return; + const pos = loc ? loc[prop] : null; + + if ((pos == null ? void 0 : pos.line) != null) { + const count = pos.line - this._buf.getCurrentLine(); + + for (let i = 0; i < count; i++) { + this._newline(); + } + } + } + + _getIndent() { + return this.format.indent.style.repeat(this._indent); + } + + startTerminatorless(isLabel = false) { + if (isLabel) { + this._noLineTerminator = true; + return null; + } else { + return this._parenPushNewlineState = { + printed: false + }; + } + } + + endTerminatorless(state) { + this._noLineTerminator = false; + + if (state != null && state.printed) { + this.dedent(); + this.newline(); + this.token(")"); + } + } + + print(node, parent) { + if (!node) return; + const oldConcise = this.format.concise; + + if (node._compact) { + this.format.concise = true; + } + + const printMethod = this[node.type]; + + if (!printMethod) { + throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node == null ? void 0 : node.constructor.name)}`); + } + + this._printStack.push(node); + + const oldInAux = this._insideAux; + this._insideAux = !node.loc; + + this._maybeAddAuxComment(this._insideAux && !oldInAux); + + let shouldPrintParens = needsParens(node, parent, this._printStack); + + if (this.format.retainFunctionParens && node.type === "FunctionExpression" && node.extra && node.extra.parenthesized) { + shouldPrintParens = true; + } + + if (shouldPrintParens) this.token("("); + + this._printLeadingComments(node); + + const loc = isProgram(node) || isFile(node) ? null : node.loc; + this.withSource("start", loc, () => { + printMethod.call(this, node, parent); + }); + + this._printTrailingComments(node); + + if (shouldPrintParens) this.token(")"); + + this._printStack.pop(); + + this.format.concise = oldConcise; + this._insideAux = oldInAux; + } + + _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 + }); + } + } + + _printAuxAfterComment() { + if (!this._printAuxAfterOnNextUserNode) return; + this._printAuxAfterOnNextUserNode = false; + const comment = this.format.auxiliaryCommentAfter; + + if (comment) { + this._printComment({ + type: "CommentBlock", + value: comment + }); + } + } + + getPossibleRaw(node) { + const extra = node.extra; + + if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) { + return extra.raw; + } + } + + printJoin(nodes, parent, opts = {}) { + if (!(nodes != null && nodes.length)) return; + if (opts.indent) this.indent(); + const newlineOpts = { + addNewlines: opts.addNewlines + }; + + for (let i = 0; i < nodes.length; i++) { + const node = nodes[i]; + if (!node) continue; + if (opts.statement) this._printNewline(true, node, parent, newlineOpts); + this.print(node, parent); + + if (opts.iterator) { + opts.iterator(node, i); + } + + if (opts.separator && i < nodes.length - 1) { + opts.separator.call(this); + } + + if (opts.statement) this._printNewline(false, node, parent, newlineOpts); + } + + if (opts.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 (!isEmptyStatement(node)) { + this.space(); + } + + this.print(node, parent); + } + + _printTrailingComments(node) { + this._printComments(this._getComments(false, node)); + } + + _printLeadingComments(node) { + this._printComments(this._getComments(true, node), true); + } + + printInnerComments(node, indent = true) { + var _node$innerComments; + + if (!((_node$innerComments = node.innerComments) != null && _node$innerComments.length)) return; + if (indent) this.indent(); + + this._printComments(node.innerComments); + + if (indent) this.dedent(); + } + + printSequence(nodes, parent, opts = {}) { + opts.statement = true; + return this.printJoin(nodes, parent, opts); + } + + printList(items, parent, opts = {}) { + if (opts.separator == null) { + opts.separator = commaSeparator; + } + + return this.printJoin(items, parent, opts); + } + + _printNewline(leading, node, parent, opts) { + if (this.format.retainLines || this.format.compact) return; + + if (this.format.concise) { + this.space(); + return; + } + + let lines = 0; + + if (this._buf.hasContent()) { + if (!leading) lines++; + if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0; + const needs = leading ? needsWhitespaceBefore : needsWhitespaceAfter; + if (needs(node, parent)) lines++; + } + + this.newline(Math.min(2, lines)); + } + + _getComments(leading, node) { + return node && (leading ? node.leadingComments : node.trailingComments) || []; + } + + _printComment(comment, skipNewLines) { + if (!this.format.shouldPrintComment(comment.value)) return; + if (comment.ignore) return; + if (this._printedComments.has(comment)) return; + + this._printedComments.add(comment); + + const isBlockComment = comment.type === "CommentBlock"; + const printNewLines = isBlockComment && !skipNewLines && !this._noLineTerminator; + if (printNewLines && this._buf.hasContent()) this.newline(1); + const lastCharCode = this.getLastChar(); + + if (lastCharCode !== 91 && lastCharCode !== 123) { + this.space(); + } + + let val = !isBlockComment && !this._noLineTerminator ? `//${comment.value}\n` : `/*${comment.value}*/`; + + if (isBlockComment && 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"); + } + + const indentSize = Math.max(this._getIndent().length, this.format.retainLines ? 0 : this._buf.getCurrentColumn()); + val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`); + } + + if (this.endsWith(47)) this._space(); + this.withSource("start", comment.loc, () => { + this._append(val); + }); + if (printNewLines) this.newline(1); + } + + _printComments(comments, inlinePureAnnotation) { + if (!(comments != null && comments.length)) return; + + if (inlinePureAnnotation && comments.length === 1 && PURE_ANNOTATION_RE.test(comments[0].value)) { + this._printComment(comments[0], this._buf.hasContent() && !this.endsWith(10)); + } else { + for (const comment of comments) { + this._printComment(comment); + } + } + } + + printAssertions(node) { + var _node$assertions; + + if ((_node$assertions = node.assertions) != null && _node$assertions.length) { + this.space(); + this.word("assert"); + this.space(); + this.token("{"); + this.space(); + this.printList(node.assertions, node); + this.space(); + this.token("}"); + } + } + +} + +Object.assign(Printer.prototype, generatorFunctions); +{ + Printer.prototype.Noop = function Noop() {}; +} +var _default = Printer; +exports.default = _default; + +function commaSeparator() { + this.token(","); + this.space(); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/lib/source-map.js b/src/main/resources/static/node_modules/@babel/generator/lib/source-map.js new file mode 100644 index 0000000..99da1de --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/lib/source-map.js @@ -0,0 +1,78 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _sourceMap = require("source-map"); + +class SourceMap { + constructor(opts, code) { + this._cachedMap = void 0; + this._code = void 0; + this._opts = void 0; + this._rawMappings = void 0; + this._lastGenLine = void 0; + this._lastSourceLine = void 0; + this._lastSourceColumn = void 0; + this._cachedMap = null; + this._code = code; + this._opts = opts; + this._rawMappings = []; + } + + get() { + if (!this._cachedMap) { + const map = this._cachedMap = new _sourceMap.SourceMapGenerator({ + sourceRoot: this._opts.sourceRoot + }); + const code = this._code; + + if (typeof code === "string") { + map.setSourceContent(this._opts.sourceFileName.replace(/\\/g, "/"), code); + } else if (typeof code === "object") { + Object.keys(code).forEach(sourceFileName => { + map.setSourceContent(sourceFileName.replace(/\\/g, "/"), code[sourceFileName]); + }); + } + + this._rawMappings.forEach(mapping => map.addMapping(mapping), map); + } + + return this._cachedMap.toJSON(); + } + + getRawMappings() { + return this._rawMappings.slice(); + } + + mark(generatedLine, generatedColumn, line, column, identifierName, filename, force) { + if (this._lastGenLine !== generatedLine && line === null) return; + + if (!force && this._lastGenLine === generatedLine && this._lastSourceLine === line && this._lastSourceColumn === column) { + return; + } + + this._cachedMap = null; + this._lastGenLine = generatedLine; + this._lastSourceLine = line; + this._lastSourceColumn = column; + + this._rawMappings.push({ + name: identifierName || undefined, + generated: { + line: generatedLine, + column: generatedColumn + }, + source: line == null ? undefined : (filename || this._opts.sourceFileName).replace(/\\/g, "/"), + original: line == null ? undefined : { + line: line, + column: column + } + }); + } + +} + +exports.default = SourceMap; \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/generator/package.json b/src/main/resources/static/node_modules/@babel/generator/package.json new file mode 100644 index 0000000..6ce3ad9 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/generator/package.json @@ -0,0 +1,67 @@ +{ + "_from": "@babel/generator@^7.16.0", + "_id": "@babel/generator@7.16.0", + "_inBundle": false, + "_integrity": "sha512-RR8hUCfRQn9j9RPKEVXo9LiwoxLPYn6hNZlvUOR8tSnaxlD0p0+la00ZP9/SnRt6HchKr+X0fO2r8vrETiJGew==", + "_location": "/@babel/generator", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@babel/generator@^7.16.0", + "name": "@babel/generator", + "escapedName": "@babel%2fgenerator", + "scope": "@babel", + "rawSpec": "^7.16.0", + "saveSpec": null, + "fetchSpec": "^7.16.0" + }, + "_requiredBy": [ + "/@babel/traverse" + ], + "_resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.0.tgz", + "_shasum": "d40f3d1d5075e62d3500bccb67f3daa8a95265b2", + "_spec": "@babel/generator@^7.16.0", + "_where": "C:\\blog\\blog\\src\\main\\resources\\static\\node_modules\\@babel\\traverse", + "author": { + "name": "The Babel Team", + "url": "https://babel.dev/team" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20generator%22+is%3Aopen" + }, + "bundleDependencies": false, + "dependencies": { + "@babel/types": "^7.16.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "deprecated": false, + "description": "Turns an AST into code.", + "devDependencies": { + "@babel/helper-fixtures": "^7.16.0", + "@babel/parser": "^7.16.0", + "@types/jsesc": "^2.5.0", + "@types/source-map": "^0.5.0", + "charcodes": "^0.2.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "files": [ + "lib" + ], + "homepage": "https://babel.dev/docs/en/next/babel-generator", + "license": "MIT", + "main": "./lib/index.js", + "name": "@babel/generator", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "packages/babel-generator" + }, + "version": "7.16.0" +} diff --git a/src/main/resources/static/node_modules/@babel/helper-function-name/LICENSE b/src/main/resources/static/node_modules/@babel/helper-function-name/LICENSE new file mode 100644 index 0000000..f31575e --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-function-name/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/main/resources/static/node_modules/@babel/helper-function-name/README.md b/src/main/resources/static/node_modules/@babel/helper-function-name/README.md new file mode 100644 index 0000000..36a6593 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-function-name/README.md @@ -0,0 +1,19 @@ +# @babel/helper-function-name + +> Helper function to change the property 'name' of every function + +See our website [@babel/helper-function-name](https://babeljs.io/docs/en/babel-helper-function-name) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-function-name +``` + +or using yarn: + +```sh +yarn add @babel/helper-function-name --dev +``` diff --git a/src/main/resources/static/node_modules/@babel/helper-function-name/lib/index.js b/src/main/resources/static/node_modules/@babel/helper-function-name/lib/index.js new file mode 100644 index 0000000..59e88e9 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-function-name/lib/index.js @@ -0,0 +1,188 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _default; + +var _helperGetFunctionArity = require("@babel/helper-get-function-arity"); + +var _template = require("@babel/template"); + +var _t = require("@babel/types"); + +const { + NOT_LOCAL_BINDING, + cloneNode, + identifier, + isAssignmentExpression, + isFunction, + isIdentifier, + isLiteral, + isNullLiteral, + isObjectMethod, + isObjectProperty, + isRegExpLiteral, + isTemplateLiteral, + isVariableDeclarator, + toBindingIdentifierName +} = _t; +const buildPropertyMethodAssignmentWrapper = (0, _template.default)(` + (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 = (0, _template.default)(` + (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 = (0, _helperGetFunctionArity.default)(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), + references: [], + 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) { + 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; + } + + name = toBindingIdentifierName(name); + id = identifier(name); + id[NOT_LOCAL_BINDING] = true; + const state = visit(node, name, scope); + return wrap(state, node, id, scope) || node; +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/helper-function-name/package.json b/src/main/resources/static/node_modules/@babel/helper-function-name/package.json new file mode 100644 index 0000000..faddcf3 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-function-name/package.json @@ -0,0 +1,57 @@ +{ + "_from": "@babel/helper-function-name@^7.16.0", + "_id": "@babel/helper-function-name@7.16.0", + "_inBundle": false, + "_integrity": "sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==", + "_location": "/@babel/helper-function-name", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@babel/helper-function-name@^7.16.0", + "name": "@babel/helper-function-name", + "escapedName": "@babel%2fhelper-function-name", + "scope": "@babel", + "rawSpec": "^7.16.0", + "saveSpec": null, + "fetchSpec": "^7.16.0" + }, + "_requiredBy": [ + "/@babel/traverse" + ], + "_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz", + "_shasum": "b7dd0797d00bbfee4f07e9c4ea5b0e30c8bb1481", + "_spec": "@babel/helper-function-name@^7.16.0", + "_where": "C:\\blog\\blog\\src\\main\\resources\\static\\node_modules\\@babel\\traverse", + "author": { + "name": "The Babel Team", + "url": "https://babel.dev/team" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "bundleDependencies": false, + "dependencies": { + "@babel/helper-get-function-arity": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/types": "^7.16.0" + }, + "deprecated": false, + "description": "Helper function to change the property 'name' of every function", + "engines": { + "node": ">=6.9.0" + }, + "homepage": "https://babel.dev/docs/en/next/babel-helper-function-name", + "license": "MIT", + "main": "./lib/index.js", + "name": "@babel/helper-function-name", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "packages/babel-helper-function-name" + }, + "version": "7.16.0" +} diff --git a/src/main/resources/static/node_modules/@babel/helper-get-function-arity/LICENSE b/src/main/resources/static/node_modules/@babel/helper-get-function-arity/LICENSE new file mode 100644 index 0000000..f31575e --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-get-function-arity/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/main/resources/static/node_modules/@babel/helper-get-function-arity/README.md b/src/main/resources/static/node_modules/@babel/helper-get-function-arity/README.md new file mode 100644 index 0000000..8fa48c1 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-get-function-arity/README.md @@ -0,0 +1,19 @@ +# @babel/helper-get-function-arity + +> Helper function to get function arity + +See our website [@babel/helper-get-function-arity](https://babeljs.io/docs/en/babel-helper-get-function-arity) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-get-function-arity +``` + +or using yarn: + +```sh +yarn add @babel/helper-get-function-arity --dev +``` diff --git a/src/main/resources/static/node_modules/@babel/helper-get-function-arity/lib/index.js b/src/main/resources/static/node_modules/@babel/helper-get-function-arity/lib/index.js new file mode 100644 index 0000000..61e22ed --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-get-function-arity/lib/index.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _default; + +var _t = require("@babel/types"); + +const { + isAssignmentPattern, + isRestElement +} = _t; + +function _default(node) { + const params = node.params; + + for (let i = 0; i < params.length; i++) { + const param = params[i]; + + if (isAssignmentPattern(param) || isRestElement(param)) { + return i; + } + } + + return params.length; +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/helper-get-function-arity/package.json b/src/main/resources/static/node_modules/@babel/helper-get-function-arity/package.json new file mode 100644 index 0000000..8d39553 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-get-function-arity/package.json @@ -0,0 +1,55 @@ +{ + "_from": "@babel/helper-get-function-arity@^7.16.0", + "_id": "@babel/helper-get-function-arity@7.16.0", + "_inBundle": false, + "_integrity": "sha512-ASCquNcywC1NkYh/z7Cgp3w31YW8aojjYIlNg4VeJiHkqyP4AzIvr4qx7pYDb4/s8YcsZWqqOSxgkvjUz1kpDQ==", + "_location": "/@babel/helper-get-function-arity", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@babel/helper-get-function-arity@^7.16.0", + "name": "@babel/helper-get-function-arity", + "escapedName": "@babel%2fhelper-get-function-arity", + "scope": "@babel", + "rawSpec": "^7.16.0", + "saveSpec": null, + "fetchSpec": "^7.16.0" + }, + "_requiredBy": [ + "/@babel/helper-function-name" + ], + "_resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz", + "_shasum": "0088c7486b29a9cb5d948b1a1de46db66e089cfa", + "_spec": "@babel/helper-get-function-arity@^7.16.0", + "_where": "C:\\blog\\blog\\src\\main\\resources\\static\\node_modules\\@babel\\helper-function-name", + "author": { + "name": "The Babel Team", + "url": "https://babel.dev/team" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "bundleDependencies": false, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "deprecated": false, + "description": "Helper function to get function arity", + "engines": { + "node": ">=6.9.0" + }, + "homepage": "https://babel.dev/docs/en/next/babel-helper-get-function-arity", + "license": "MIT", + "main": "./lib/index.js", + "name": "@babel/helper-get-function-arity", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "packages/babel-helper-get-function-arity" + }, + "version": "7.16.0" +} diff --git a/src/main/resources/static/node_modules/@babel/helper-hoist-variables/LICENSE b/src/main/resources/static/node_modules/@babel/helper-hoist-variables/LICENSE new file mode 100644 index 0000000..f31575e --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-hoist-variables/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/main/resources/static/node_modules/@babel/helper-hoist-variables/README.md b/src/main/resources/static/node_modules/@babel/helper-hoist-variables/README.md new file mode 100644 index 0000000..d3eb8fc --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-hoist-variables/README.md @@ -0,0 +1,19 @@ +# @babel/helper-hoist-variables + +> Helper function to hoist variables + +See our website [@babel/helper-hoist-variables](https://babeljs.io/docs/en/babel-helper-hoist-variables) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-hoist-variables +``` + +or using yarn: + +```sh +yarn add @babel/helper-hoist-variables --dev +``` diff --git a/src/main/resources/static/node_modules/@babel/helper-hoist-variables/lib/index.js b/src/main/resources/static/node_modules/@babel/helper-hoist-variables/lib/index.js new file mode 100644 index 0000000..31fb847 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-hoist-variables/lib/index.js @@ -0,0 +1,58 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = hoistVariables; + +var _t = require("@babel/types"); + +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 + }); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/helper-hoist-variables/package.json b/src/main/resources/static/node_modules/@babel/helper-hoist-variables/package.json new file mode 100644 index 0000000..e6390ea --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-hoist-variables/package.json @@ -0,0 +1,59 @@ +{ + "TODO": "The @babel/traverse dependency is only needed for the NodePath TS type. We can consider exporting it from @babel/core.", + "_from": "@babel/helper-hoist-variables@^7.16.0", + "_id": "@babel/helper-hoist-variables@7.16.0", + "_inBundle": false, + "_integrity": "sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg==", + "_location": "/@babel/helper-hoist-variables", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@babel/helper-hoist-variables@^7.16.0", + "name": "@babel/helper-hoist-variables", + "escapedName": "@babel%2fhelper-hoist-variables", + "scope": "@babel", + "rawSpec": "^7.16.0", + "saveSpec": null, + "fetchSpec": "^7.16.0" + }, + "_requiredBy": [ + "/@babel/traverse" + ], + "_resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz", + "_shasum": "4c9023c2f1def7e28ff46fc1dbcd36a39beaa81a", + "_spec": "@babel/helper-hoist-variables@^7.16.0", + "_where": "C:\\blog\\blog\\src\\main\\resources\\static\\node_modules\\@babel\\traverse", + "author": { + "name": "The Babel Team", + "url": "https://babel.dev/team" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "bundleDependencies": false, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "deprecated": false, + "description": "Helper function to hoist variables", + "devDependencies": { + "@babel/traverse": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "homepage": "https://babel.dev/docs/en/next/babel-helper-hoist-variables", + "license": "MIT", + "main": "./lib/index.js", + "name": "@babel/helper-hoist-variables", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "packages/babel-helper-hoist-variables" + }, + "version": "7.16.0" +} diff --git a/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/LICENSE b/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/LICENSE new file mode 100644 index 0000000..f31575e --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/README.md b/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/README.md new file mode 100644 index 0000000..a6f5404 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/README.md @@ -0,0 +1,19 @@ +# @babel/helper-split-export-declaration + +> + +See our website [@babel/helper-split-export-declaration](https://babeljs.io/docs/en/babel-helper-split-export-declaration) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-split-export-declaration +``` + +or using yarn: + +```sh +yarn add @babel/helper-split-export-declaration --dev +``` diff --git a/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/lib/index.js b/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/lib/index.js new file mode 100644 index 0000000..6007f89 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/lib/index.js @@ -0,0 +1,67 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = splitExportDeclaration; + +var _t = require("@babel/types"); + +const { + cloneNode, + exportNamedDeclaration, + exportSpecifier, + identifier, + variableDeclaration, + variableDeclarator +} = _t; + +function splitExportDeclaration(exportDeclaration) { + if (!exportDeclaration.isExportDeclaration()) { + throw new Error("Only export declarations can be split."); + } + + const isDefault = exportDeclaration.isExportDefaultDeclaration(); + const declaration = exportDeclaration.get("declaration"); + const isClassDeclaration = declaration.isClassDeclaration(); + + if (isDefault) { + const standaloneDeclaration = declaration.isFunctionDeclaration() || isClassDeclaration; + 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 || declaration.isFunctionExpression() || declaration.isClassExpression()) { + declaration.node.id = cloneNode(id); + } + } + + const updatedDeclaration = standaloneDeclaration ? declaration : 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; + } + + if (exportDeclaration.get("specifiers").length > 0) { + throw new Error("It doesn't make sense to split exported specifiers."); + } + + 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; +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/package.json b/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/package.json new file mode 100644 index 0000000..97ed593 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-split-export-declaration/package.json @@ -0,0 +1,55 @@ +{ + "_from": "@babel/helper-split-export-declaration@^7.16.0", + "_id": "@babel/helper-split-export-declaration@7.16.0", + "_inBundle": false, + "_integrity": "sha512-0YMMRpuDFNGTHNRiiqJX19GjNXA4H0E8jZ2ibccfSxaCogbm3am5WN/2nQNj0YnQwGWM1J06GOcQ2qnh3+0paw==", + "_location": "/@babel/helper-split-export-declaration", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@babel/helper-split-export-declaration@^7.16.0", + "name": "@babel/helper-split-export-declaration", + "escapedName": "@babel%2fhelper-split-export-declaration", + "scope": "@babel", + "rawSpec": "^7.16.0", + "saveSpec": null, + "fetchSpec": "^7.16.0" + }, + "_requiredBy": [ + "/@babel/traverse" + ], + "_resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz", + "_shasum": "29672f43663e936df370aaeb22beddb3baec7438", + "_spec": "@babel/helper-split-export-declaration@^7.16.0", + "_where": "C:\\blog\\blog\\src\\main\\resources\\static\\node_modules\\@babel\\traverse", + "author": { + "name": "The Babel Team", + "url": "https://babel.dev/team" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "bundleDependencies": false, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "deprecated": false, + "description": ">", + "engines": { + "node": ">=6.9.0" + }, + "homepage": "https://babel.dev/docs/en/next/babel-helper-split-export-declaration", + "license": "MIT", + "main": "./lib/index.js", + "name": "@babel/helper-split-export-declaration", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "packages/babel-helper-split-export-declaration" + }, + "version": "7.16.0" +} diff --git a/src/main/resources/static/node_modules/@babel/helper-validator-identifier/LICENSE b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/LICENSE new file mode 100644 index 0000000..f31575e --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/main/resources/static/node_modules/@babel/helper-validator-identifier/README.md b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/README.md new file mode 100644 index 0000000..6733576 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/README.md @@ -0,0 +1,19 @@ +# @babel/helper-validator-identifier + +> Validate identifier/keywords name + +See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/babel-helper-validator-identifier) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-validator-identifier +``` + +or using yarn: + +```sh +yarn add @babel/helper-validator-identifier --dev +``` diff --git a/src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/identifier.js b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/identifier.js new file mode 100644 index 0000000..b8a5d9a --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/identifier.js @@ -0,0 +1,84 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isIdentifierStart = isIdentifierStart; +exports.isIdentifierChar = isIdentifierChar; +exports.isIdentifierName = isIdentifierName; +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\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-\u0ecd\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, 85, 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, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 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, 46, 2, 18, 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, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 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, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; +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, 154, 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, 161, 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, 19306, 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, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 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; +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/index.js b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/index.js new file mode 100644 index 0000000..7b623c9 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/index.js @@ -0,0 +1,57 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "isIdentifierName", { + enumerable: true, + get: function () { + return _identifier.isIdentifierName; + } +}); +Object.defineProperty(exports, "isIdentifierChar", { + enumerable: true, + get: function () { + return _identifier.isIdentifierChar; + } +}); +Object.defineProperty(exports, "isIdentifierStart", { + enumerable: true, + get: function () { + return _identifier.isIdentifierStart; + } +}); +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; + } +}); +Object.defineProperty(exports, "isKeyword", { + enumerable: true, + get: function () { + return _keyword.isKeyword; + } +}); + +var _identifier = require("./identifier"); + +var _keyword = require("./keyword"); \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/keyword.js b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/keyword.js new file mode 100644 index 0000000..110cee4 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/lib/keyword.js @@ -0,0 +1,38 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isReservedWord = isReservedWord; +exports.isStrictReservedWord = isStrictReservedWord; +exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord; +exports.isStrictBindReservedWord = isStrictBindReservedWord; +exports.isKeyword = isKeyword; +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); +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/helper-validator-identifier/package.json b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/package.json new file mode 100644 index 0000000..d0d7317 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/package.json @@ -0,0 +1,58 @@ +{ + "_from": "@babel/helper-validator-identifier@^7.15.7", + "_id": "@babel/helper-validator-identifier@7.15.7", + "_inBundle": false, + "_integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "_location": "/@babel/helper-validator-identifier", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@babel/helper-validator-identifier@^7.15.7", + "name": "@babel/helper-validator-identifier", + "escapedName": "@babel%2fhelper-validator-identifier", + "scope": "@babel", + "rawSpec": "^7.15.7", + "saveSpec": null, + "fetchSpec": "^7.15.7" + }, + "_requiredBy": [ + "/@babel/highlight", + "/@babel/types" + ], + "_resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", + "_shasum": "220df993bfe904a4a6b02ab4f3385a5ebf6e2389", + "_spec": "@babel/helper-validator-identifier@^7.15.7", + "_where": "C:\\blog\\blog\\src\\main\\resources\\static\\node_modules\\@babel\\highlight", + "author": { + "name": "The Babel Team", + "url": "https://babel.dev/team" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Validate identifier/keywords name", + "devDependencies": { + "@unicode/unicode-14.0.0": "^1.2.1", + "charcodes": "^0.2.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "exports": "./lib/index.js", + "homepage": "https://github.com/babel/babel#readme", + "license": "MIT", + "main": "./lib/index.js", + "name": "@babel/helper-validator-identifier", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "packages/babel-helper-validator-identifier" + }, + "version": "7.15.7" +} diff --git a/src/main/resources/static/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js new file mode 100644 index 0000000..f644d77 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js @@ -0,0 +1,75 @@ +"use strict"; + +// Always use the latest available version of Unicode! +// https://tc39.github.io/ecma262/#sec-conformance +const version = "14.0.0"; + +const start = require("@unicode/unicode-" + + version + + "/Binary_Property/ID_Start/code-points.js").filter(function (ch) { + return ch > 0x7f; +}); +let last = -1; +const cont = [0x200c, 0x200d].concat( + require("@unicode/unicode-" + + version + + "/Binary_Property/ID_Continue/code-points.js").filter(function (ch) { + return ch > 0x7f && search(start, ch, last + 1) == -1; + }) +); + +function search(arr, ch, starting) { + for (let i = starting; arr[i] <= ch && i < arr.length; last = i++) { + if (arr[i] === ch) return i; + } + return -1; +} + +function pad(str, width) { + while (str.length < width) str = "0" + str; + return str; +} + +function esc(code) { + const hex = code.toString(16); + if (hex.length <= 2) return "\\x" + pad(hex, 2); + else return "\\u" + pad(hex, 4); +} + +function generate(chars) { + const astral = []; + let re = ""; + for (let i = 0, at = 0x10000; i < chars.length; i++) { + const from = chars[i]; + let to = from; + while (i < chars.length - 1 && chars[i + 1] == to + 1) { + i++; + to++; + } + if (to <= 0xffff) { + if (from == to) re += esc(from); + else if (from + 1 == to) re += esc(from) + esc(to); + else re += esc(from) + "-" + esc(to); + } else { + astral.push(from - at, to - from); + at = to; + } + } + return { nonASCII: re, astral: astral }; +} + +const startData = generate(start); +const contData = generate(cont); + +console.log("/* prettier-ignore */"); +console.log('let nonASCIIidentifierStartChars = "' + startData.nonASCII + '";'); +console.log("/* prettier-ignore */"); +console.log('let nonASCIIidentifierChars = "' + contData.nonASCII + '";'); +console.log("/* prettier-ignore */"); +console.log( + "const astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";" +); +console.log("/* prettier-ignore */"); +console.log( + "const astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";" +); diff --git a/src/main/resources/static/node_modules/@babel/highlight/LICENSE b/src/main/resources/static/node_modules/@babel/highlight/LICENSE new file mode 100644 index 0000000..f31575e --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/highlight/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/main/resources/static/node_modules/@babel/highlight/README.md b/src/main/resources/static/node_modules/@babel/highlight/README.md new file mode 100644 index 0000000..f8887ad --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/highlight/README.md @@ -0,0 +1,19 @@ +# @babel/highlight + +> Syntax highlight JavaScript strings for output in terminals. + +See our website [@babel/highlight](https://babeljs.io/docs/en/babel-highlight) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/highlight +``` + +or using yarn: + +```sh +yarn add @babel/highlight --dev +``` diff --git a/src/main/resources/static/node_modules/@babel/highlight/lib/index.js b/src/main/resources/static/node_modules/@babel/highlight/lib/index.js new file mode 100644 index 0000000..b8537b2 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/highlight/lib/index.js @@ -0,0 +1,116 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = highlight; +exports.getChalk = getChalk; +exports.shouldHighlight = shouldHighlight; + +var _jsTokens = require("js-tokens"); + +var _helperValidatorIdentifier = require("@babel/helper-validator-identifier"); + +var _chalk = require("chalk"); + +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.substr(offset - 2, 2) == " colorize(str)).join("\n"); + } else { + highlighted += value; + } + } + + return highlighted; +} + +function shouldHighlight(options) { + return !!_chalk.supportsColor || options.forceColor; +} + +function getChalk(options) { + return options.forceColor ? new _chalk.constructor({ + enabled: true, + level: 1 + }) : _chalk; +} + +function highlight(code, options = {}) { + if (shouldHighlight(options)) { + const chalk = getChalk(options); + const defs = getDefs(chalk); + return highlightTokens(defs, code); + } else { + return code; + } +} \ No newline at end of file diff --git a/src/main/resources/static/node_modules/@babel/highlight/package.json b/src/main/resources/static/node_modules/@babel/highlight/package.json new file mode 100644 index 0000000..7441472 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/highlight/package.json @@ -0,0 +1,61 @@ +{ + "_from": "@babel/highlight@^7.16.0", + "_id": "@babel/highlight@7.16.0", + "_inBundle": false, + "_integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "_location": "/@babel/highlight", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@babel/highlight@^7.16.0", + "name": "@babel/highlight", + "escapedName": "@babel%2fhighlight", + "scope": "@babel", + "rawSpec": "^7.16.0", + "saveSpec": null, + "fetchSpec": "^7.16.0" + }, + "_requiredBy": [ + "/@babel/code-frame" + ], + "_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", + "_shasum": "6ceb32b2ca4b8f5f361fb7fd821e3fddf4a1725a", + "_spec": "@babel/highlight@^7.16.0", + "_where": "C:\\blog\\blog\\src\\main\\resources\\static\\node_modules\\@babel\\code-frame", + "author": { + "name": "The Babel Team", + "url": "https://babel.dev/team" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "bundleDependencies": false, + "dependencies": { + "@babel/helper-validator-identifier": "^7.15.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "deprecated": false, + "description": "Syntax highlight JavaScript strings for output in terminals.", + "devDependencies": { + "@types/chalk": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "homepage": "https://babel.dev/docs/en/next/babel-highlight", + "license": "MIT", + "main": "./lib/index.js", + "name": "@babel/highlight", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "packages/babel-highlight" + }, + "version": "7.16.0" +} diff --git a/src/main/resources/static/node_modules/@babel/parser/CHANGELOG.md b/src/main/resources/static/node_modules/@babel/parser/CHANGELOG.md new file mode 100644 index 0000000..b3840ac --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/parser/CHANGELOG.md @@ -0,0 +1,1073 @@ +# Changelog + +> **Tags:** +> - :boom: [Breaking Change] +> - :eyeglasses: [Spec Compliance] +> - :rocket: [New Feature] +> - :bug: [Bug Fix] +> - :memo: [Documentation] +> - :house: [Internal] +> - :nail_care: [Polish] + +> Semver Policy: https://github.com/babel/babel/tree/main/packages/babel-parser#semver + +_Note: Gaps between patch versions are faulty, broken or test releases._ + +See the [Babel Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) for the pre-6.8.0 version Changelog. + +## 6.17.1 (2017-05-10) + +### :bug: Bug Fix + * Fix typo in flow spread operator error (Brian Ng) + * Fixed invalid number literal parsing ([#473](https://github.com/babel/babylon/pull/473)) (Alex Kuzmenko) + * Fix number parser ([#433](https://github.com/babel/babylon/pull/433)) (Alex Kuzmenko) + * Ensure non pattern shorthand props are checked for reserved words ([#479](https://github.com/babel/babylon/pull/479)) (Brian Ng) + * Remove jsx context when parsing arrow functions ([#475](https://github.com/babel/babylon/pull/475)) (Brian Ng) + * Allow super in class properties ([#499](https://github.com/babel/babylon/pull/499)) (Brian Ng) + * Allow flow class field to be named constructor ([#510](https://github.com/babel/babylon/pull/510)) (Brian Ng) + +## 6.17.0 (2017-04-20) + +### :bug: Bug Fix + * Cherry-pick #418 to 6.x ([#476](https://github.com/babel/babylon/pull/476)) (Sebastian McKenzie) + * Add support for invalid escapes in tagged templates ([#274](https://github.com/babel/babylon/pull/274)) (Kevin Gibbons) + * Throw error if new.target is used outside of a function ([#402](https://github.com/babel/babylon/pull/402)) (Brian Ng) + * Fix parsing of class properties ([#351](https://github.com/babel/babylon/pull/351)) (Kevin Gibbons) + * Fix parsing yield with dynamicImport ([#383](https://github.com/babel/babylon/pull/383)) (Brian Ng) + * Ensure consistent start args for parseParenItem ([#386](https://github.com/babel/babylon/pull/386)) (Brian Ng) + +## 7.0.0-beta.8 (2017-04-04) + +### New Feature +* Add support for flow type spread (#418) (Conrad Buck) +* Allow statics in flow interfaces (#427) (Brian Ng) + +### Bug Fix +* Fix predicate attachment to match flow parser (#428) (Brian Ng) +* Add extra.raw back to JSXText and JSXAttribute (#344) (Alex Rattray) +* Fix rest parameters with array and objects (#424) (Brian Ng) +* Fix number parser (#433) (Alex Kuzmenko) + +### Docs +* Fix CONTRIBUTING.md [skip ci] (#432) (Alex Kuzmenko) + +### Internal +* Use babel-register script when running babel smoke tests (#442) (Brian Ng) + +## 7.0.0-beta.7 (2017-03-22) + +### Spec Compliance +* Remove babylon plugin for template revision since it's stage-4 (#426) (Henry Zhu) + +### Bug Fix + +* Fix push-pop logic in flow (#405) (Daniel Tschinder) + +## 7.0.0-beta.6 (2017-03-21) + +### New Feature +* Add support for invalid escapes in tagged templates (#274) (Kevin Gibbons) + +### Polish +* Improves error message when super is called outside of constructor (#408) (Arshabh Kumar Agarwal) + +### Docs + +* [7.0] Moved value field in spec from ObjectMember to ObjectProperty as ObjectMethod's don't have it (#415) [skip ci] (James Browning) + +## 7.0.0-beta.5 (2017-03-21) + +### Bug Fix +* Throw error if new.target is used outside of a function (#402) (Brian Ng) +* Fix parsing of class properties (#351) (Kevin Gibbons) + +### Other + * Test runner: Detect extra property in 'actual' but not in 'expected'. (#407) (Andy) + * Optimize travis builds (#419) (Daniel Tschinder) + * Update codecov to 2.0 (#412) (Daniel Tschinder) + * Fix spec for ClassMethod: It doesn't have a function, it *is* a function. (#406) [skip ci] (Andy) + * Changed Non-existent RestPattern to RestElement which is what is actually parsed (#409) [skip ci] (James Browning) + * Upgrade flow to 0.41 (Daniel Tschinder) + * Fix watch command (#403) (Brian Ng) + * Update yarn lock (Daniel Tschinder) + * Fix watch command (#403) (Brian Ng) + * chore(package): update flow-bin to version 0.41.0 (#395) (greenkeeper[bot]) + * Add estree test for correct order of directives (Daniel Tschinder) + * Add DoExpression to spec (#364) (Alex Kuzmenko) + * Mention cloning of repository in CONTRIBUTING.md (#391) [skip ci] (Sumedh Nimkarde) + * Explain how to run only one test (#389) [skip ci] (Aaron Ang) + + ## 7.0.0-beta.4 (2017-03-01) + +* Don't consume async when checking for async func decl (#377) (Brian Ng) +* add `ranges` option [skip ci] (Henry Zhu) +* Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300) (Andrew Levine) + +## 7.0.0-beta.3 (2017-02-28) + +- [7.0] Change RestProperty/SpreadProperty to RestElement/SpreadElement (#384) +- Merge changes from 6.x + +## 7.0.0-beta.2 (2017-02-20) + +- estree: correctly change literals in all cases (#368) (Daniel Tschinder) + +## 7.0.0-beta.1 (2017-02-20) + +- Fix negative number literal typeannotations (#366) (Daniel Tschinder) +- Update contributing with more test info [skip ci] (#355) (Brian Ng) + +## 7.0.0-beta.0 (2017-02-15) + +- Reintroduce Variance node (#333) (Daniel Tschinder) +- Rename NumericLiteralTypeAnnotation to NumberLiteralTypeAnnotation (#332) (Charles Pick) +- [7.0] Remove ForAwaitStatement, add await flag to ForOfStatement (#349) (Brandon Dail) +- chore(package): update ava to version 0.18.0 (#345) (greenkeeper[bot]) +- chore(package): update babel-plugin-istanbul to version 4.0.0 (#350) (greenkeeper[bot]) +- Change location of ObjectTypeIndexer to match flow (#228) (Daniel Tschinder) +- Rename flow AST Type ExistentialTypeParam to ExistsTypeAnnotation (#322) (Toru Kobayashi) +- Revert "Temporary rollback for erroring on trailing comma with spread (#154)" (#290) (Daniel Tschinder) +- Remove classConstructorCall plugin (#291) (Brian Ng) +- Update yarn.lock (Daniel Tschinder) +- Update cross-env to 3.x (Daniel Tschinder) +- [7.0] Remove node 0.10, 0.12 and 5 from Travis (#284) (Sergey Rubanov) +- Remove `String.fromCodePoint` shim (#279) (Mathias Bynens) + +## 6.16.1 (2017-02-23) + +### :bug: Regression + +- Revert "Fix export default async function to be FunctionDeclaration" ([#375](https://github.com/babel/babylon/pull/375)) + +Need to modify Babel for this AST node change, so moving to 7.0. + +- Revert "Don't parse class properties without initializers when classProperties plugin is disabled, and Flow is enabled" ([#376](https://github.com/babel/babylon/pull/376)) + +[react-native](https://github.com/facebook/react-native/issues/12542) broke with this so we reverted. + +## 6.16.0 (2017-02-23) + +### :rocket: New Feature + +***ESTree*** compatibility as plugin ([#277](https://github.com/babel/babylon/pull/277)) (Daniel Tschinder) + +We finally introduce a new compatibility layer for ESTree. To put babylon into ESTree-compatible mode the new plugin `estree` can be enabled. In this mode the parser will output an AST that is compliant to the specs of [ESTree](https://github.com/estree/estree/) + +We highly recommend everyone who uses babylon outside of babel to use this plugin. This will make it much easier for users to switch between different ESTree-compatible parsers. We so far tested several projects with different parsers and exchanged their parser to babylon and in nearly all cases it worked out of the box. Some other estree-compatible parsers include `acorn`, `esprima`, `espree`, `flow-parser`, etc. + +To enable `estree` mode simply add the plugin in the config: +```json +{ + "plugins": [ "estree" ] +} +``` + +If you want to migrate your project from non-ESTree mode to ESTree, have a look at our [Readme](https://github.com/babel/babylon/#output), where all deviations are mentioned. + +Add a parseExpression public method ([#213](https://github.com/babel/babylon/pull/213)) (jeromew) + +Babylon exports a new function to parse a single expression + +```js +import { parseExpression } from 'babylon'; + +const ast = parseExpression('x || y && z', options); +``` + +The returned AST will only consist of the expression. The options are the same as for `parse()` + +Add startLine option ([#346](https://github.com/babel/babylon/pull/346)) (Raphael Mu) + +A new option was added to babylon allowing to change the initial linenumber for the first line which is usually `1`. +Changing this for example to `100` will make line `1` of the input source to be marked as line `100`, line `2` as `101`, line `3` as `102`, ... + +Function predicate declaration ([#103](https://github.com/babel/babylon/pull/103)) (Panagiotis Vekris) + +Added support for function predicates which flow introduced in version 0.33.0 + +```js +declare function is_number(x: mixed): boolean %checks(typeof x === "number"); +``` + +Allow imports in declare module ([#315](https://github.com/babel/babylon/pull/315)) (Daniel Tschinder) + +Added support for imports within module declarations which flow introduced in version 0.37.0 + +```js +declare module "C" { + import type { DT } from "D"; + declare export type CT = { D: DT }; +} +``` + +### :eyeglasses: Spec Compliance + +Forbid semicolons after decorators in classes ([#352](https://github.com/babel/babylon/pull/352)) (Kevin Gibbons) + +This example now correctly throws an error when there is a semicolon after the decorator: + +```js +class A { +@a; +foo(){} +} +``` + +Keywords are not allowed as local specifier ([#307](https://github.com/babel/babylon/pull/307)) (Daniel Tschinder) + +Using keywords in imports is not allowed anymore: + +```js +import { default } from "foo"; +import { a as debugger } from "foo"; +``` + +Do not allow overwritting of primitive types ([#314](https://github.com/babel/babylon/pull/314)) (Daniel Tschinder) + +In flow it is now forbidden to overwrite the primitive types `"any"`, `"mixed"`, `"empty"`, `"bool"`, `"boolean"`, `"number"`, `"string"`, `"void"` and `"null"` with your own type declaration. + +Disallow import type { type a } from … ([#305](https://github.com/babel/babylon/pull/305)) (Daniel Tschinder) + +The following code now correctly throws an error + +```js +import type { type a } from "foo"; +``` + +Don't parse class properties without initializers when classProperties is disabled and Flow is enabled ([#300](https://github.com/babel/babylon/pull/300)) (Andrew Levine) + +Ensure that you enable the `classProperties` plugin in order to enable correct parsing of class properties. Prior to this version it was possible to parse them by enabling the `flow` plugin but this was not intended the behaviour. + +If you enable the flow plugin you can only define the type of the class properties, but not initialize them. + +Fix export default async function to be FunctionDeclaration ([#324](https://github.com/babel/babylon/pull/324)) (Daniel Tschinder) + +Parsing the following code now returns a `FunctionDeclaration` AST node instead of `FunctionExpression`. + +```js +export default async function bar() {}; +``` + +### :nail_care: Polish + +Improve error message on attempt to destructure named import ([#288](https://github.com/babel/babylon/pull/288)) (Brian Ng) + +### :bug: Bug Fix + +Fix negative number literal typeannotations ([#366](https://github.com/babel/babylon/pull/366)) (Daniel Tschinder) + +Ensure takeDecorators is called on exported class ([#358](https://github.com/babel/babylon/pull/358)) (Brian Ng) + +ESTree: correctly change literals in all cases ([#368](https://github.com/babel/babylon/pull/368)) (Daniel Tschinder) + +Correctly convert RestProperty to Assignable ([#339](https://github.com/babel/babylon/pull/339)) (Daniel Tschinder) + +Fix #321 by allowing question marks in type params ([#338](https://github.com/babel/babylon/pull/338)) (Daniel Tschinder) + +Fix #336 by correctly setting arrow-param ([#337](https://github.com/babel/babylon/pull/337)) (Daniel Tschinder) + +Fix parse error when destructuring `set` with default value ([#317](https://github.com/babel/babylon/pull/317)) (Brian Ng) + +Fix ObjectTypeCallProperty static ([#298](https://github.com/babel/babylon/pull/298)) (Dan Harper) + + +### :house: Internal + +Fix generator-method-with-computed-name spec ([#360](https://github.com/babel/babylon/pull/360)) (Alex Rattray) + +Fix flow type-parameter-declaration test with unintended semantic ([#361](https://github.com/babel/babylon/pull/361)) (Alex Rattray) + +Cleanup and splitup parser functions ([#295](https://github.com/babel/babylon/pull/295)) (Daniel Tschinder) + +chore(package): update flow-bin to version 0.38.0 ([#313](https://github.com/babel/babylon/pull/313)) (greenkeeper[bot]) + +Call inner function instead of 1:1 copy to plugin ([#294](https://github.com/babel/babylon/pull/294)) (Daniel Tschinder) + +Update eslint-config-babel to the latest version 🚀 ([#299](https://github.com/babel/babylon/pull/299)) (greenkeeper[bot]) + +Update eslint-config-babel to the latest version 🚀 ([#293](https://github.com/babel/babylon/pull/293)) (greenkeeper[bot]) + +devDeps: remove eslint-plugin-babel ([#292](https://github.com/babel/babylon/pull/292)) (Kai Cataldo) + +Correct indent eslint rule config ([#276](https://github.com/babel/babylon/pull/276)) (Daniel Tschinder) + +Fail tests that have expected.json and throws-option ([#285](https://github.com/babel/babylon/pull/285)) (Daniel Tschinder) + +### :memo: Documentation + +Update contributing with more test info [skip ci] ([#355](https://github.com/babel/babylon/pull/355)) (Brian Ng) + +Update API documentation ([#330](https://github.com/babel/babylon/pull/330)) (Timothy Gu) + +Added keywords to package.json ([#323](https://github.com/babel/babylon/pull/323)) (Dmytro) + +AST spec: fix casing of `RegExpLiteral` ([#318](https://github.com/babel/babylon/pull/318)) (Mathias Bynens) + +## 6.15.0 (2017-01-10) + +### :eyeglasses: Spec Compliance + +Add support for Flow shorthand import type ([#267](https://github.com/babel/babylon/pull/267)) (Jeff Morrison) + +This change implements flows new shorthand import syntax +and where previously you had to write this code: + +```js +import {someValue} from "blah"; +import type {someType} from "blah"; +import typeof {someOtherValue} from "blah"; +``` + +you can now write it like this: + +```js +import { + someValue, + type someType, + typeof someOtherValue, +} from "blah"; +``` + +For more information look at [this](https://github.com/facebook/flow/pull/2890) pull request. + +flow: allow leading pipes in all positions ([#256](https://github.com/babel/babylon/pull/256)) (Vladimir Kurchatkin) + +This change now allows a leading pipe everywhere types can be used: +```js +var f = (x): | 1 | 2 => 1; +``` + +Throw error when exporting non-declaration ([#241](https://github.com/babel/babylon/pull/241)) (Kai Cataldo) + +Previously babylon parsed the following exports, although they are not valid: +```js +export typeof foo; +export new Foo(); +export function() {}; +export for (;;); +export while(foo); +``` + +### :bug: Bug Fix + +Don't set inType flag when parsing property names ([#266](https://github.com/babel/babylon/pull/266)) (Vladimir Kurchatkin) + +This fixes parsing of this case: + +```js +const map = { + [age <= 17] : 'Too young' +}; +``` + +Fix source location for JSXEmptyExpression nodes (fixes #248) ([#249](https://github.com/babel/babylon/pull/249)) (James Long) + +The following case produced an invalid AST +```js +
{/* foo */}
+``` + +Use fromCodePoint to convert high value unicode entities ([#243](https://github.com/babel/babylon/pull/243)) (Ryan Duffy) + +When high value unicode entities (e.g. 💩) were used in the input source code they are now correctly encoded in the resulting AST. + +Rename folder to avoid Windows-illegal characters ([#281](https://github.com/babel/babylon/pull/281)) (Ryan Plant) + +Allow this.state.clone() when parsing decorators ([#262](https://github.com/babel/babylon/pull/262)) (Alex Rattray) + +### :house: Internal + +User external-helpers ([#254](https://github.com/babel/babylon/pull/254)) (Daniel Tschinder) + +Add watch script for dev ([#234](https://github.com/babel/babylon/pull/234)) (Kai Cataldo) + +Freeze current plugins list for "*" option, and remove from README.md ([#245](https://github.com/babel/babylon/pull/245)) (Andrew Levine) + +Prepare tests for multiple fixture runners. ([#240](https://github.com/babel/babylon/pull/240)) (Daniel Tschinder) + +Add some test coverage for decorators stage-0 plugin ([#250](https://github.com/babel/babylon/pull/250)) (Andrew Levine) + +Refactor tokenizer types file ([#263](https://github.com/babel/babylon/pull/263)) (Sven SAULEAU) + +Update eslint-config-babel to the latest version 🚀 ([#273](https://github.com/babel/babylon/pull/273)) (greenkeeper[bot]) + +chore(package): update rollup to version 0.41.0 ([#272](https://github.com/babel/babylon/pull/272)) (greenkeeper[bot]) + +chore(package): update flow-bin to version 0.37.0 ([#255](https://github.com/babel/babylon/pull/255)) (greenkeeper[bot]) + +## 6.14.1 (2016-11-17) + +### :bug: Bug Fix + +Allow `"plugins": ["*"]` ([#229](https://github.com/babel/babylon/pull/229)) (Daniel Tschinder) + +```js +{ + "plugins": ["*"] +} +``` + +Will include all parser plugins instead of specifying each one individually. Useful for tools like babel-eslint, jscodeshift, and ast-explorer. + +## 6.14.0 (2016-11-16) + +### :eyeglasses: Spec Compliance + +Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo) + +[11.6.2.2 Future Reserved Words](http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words) + +Babylon will throw for more reserved words such as `enum` or `await` (in strict mode). + +``` +class enum {} // throws +class await {} // throws in strict mode (module) +``` + +Optional names for function types and object type indexers ([#197](https://github.com/babel/babylon/pull/197)) (Gabe Levi) + +So where you used to have to write + +```js +type A = (x: string, y: boolean) => number; +type B = (z: string) => number; +type C = { [key: string]: number }; +``` + +you can now write (with flow 0.34.0) + +```js +type A = (string, boolean) => number; +type B = string => number; +type C = { [string]: number }; +``` + +Parse flow nested array type annotations like `number[][]` ([#219](https://github.com/babel/babylon/pull/219)) (Bernhard Häussner) + +Supports these form now of specifying array types: + +```js +var a: number[][][][]; +var b: string[][]; +``` + +### :bug: Bug Fix + +Correctly eat semicolon at the end of `DelcareModuleExports` ([#223](https://github.com/babel/babylon/pull/223)) (Daniel Tschinder) + +``` +declare module "foo" { declare module.exports: number } +declare module "foo" { declare module.exports: number; } // also allowed now +``` + +### :house: Internal + + * Count Babel tests towards Babylon code coverage ([#182](https://github.com/babel/babylon/pull/182)) (Moti Zilberman) + * Fix strange line endings ([#214](https://github.com/babel/babylon/pull/214)) (Thomas Grainger) + * Add node 7 (Daniel Tschinder) + * chore(package): update flow-bin to version 0.34.0 ([#204](https://github.com/babel/babylon/pull/204)) (Greenkeeper) + +## v6.13.1 (2016-10-26) + +### :nail_care: Polish + +- Use rollup for bundling to speed up startup time ([#190](https://github.com/babel/babylon/pull/190)) ([@drewml](https://github.com/DrewML)) + +```js +const babylon = require('babylon'); +const ast = babylon.parse('var foo = "lol";'); +``` + +With that test case, there was a ~95ms savings by removing the need for node to build/traverse the dependency graph. + +**Without bundling** +![image](https://cloud.githubusercontent.com/assets/5233399/19420264/3133497e-93ad-11e6-9a6a-2da59c4f5c13.png) + +**With bundling** +![image](https://cloud.githubusercontent.com/assets/5233399/19420267/388f556e-93ad-11e6-813e-7c5c396be322.png) + +- add clean command [skip ci] ([#201](https://github.com/babel/babylon/pull/201)) (Henry Zhu) +- add ForAwaitStatement (async generator already added) [skip ci] ([#196](https://github.com/babel/babylon/pull/196)) (Henry Zhu) + +## v6.13.0 (2016-10-21) + +### :eyeglasses: Spec Compliance + +Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman) + +> See https://flowtype.org/docs/variance.html for more information + +```js +type T = { +p: T }; +interface T { -p: T }; +declare class T { +[k:K]: V }; +class T { -[k:K]: V }; +class C2 { +p: T = e }; +``` + +Raise error on duplicate definition of __proto__ ([#183](https://github.com/babel/babylon/pull/183)) (Moti Zilberman) + +```js +({ __proto__: 1, __proto__: 2 }) // Throws an error now +``` + +### :bug: Bug Fix + +Flow: Allow class properties to be named `static` ([#184](https://github.com/babel/babylon/pull/184)) (Moti Zilberman) + +```js +declare class A { + static: T; +} +``` + +Allow "async" as identifier for object literal property shorthand ([#187](https://github.com/babel/babylon/pull/187)) (Andrew Levine) + +```js +var foo = { async, bar }; +``` + +### :nail_care: Polish + +Fix flowtype and add inType to state ([#189](https://github.com/babel/babylon/pull/189)) (Daniel Tschinder) + +> This improves the performance slightly (because of hidden classes) + +### :house: Internal + +Fix .gitattributes line ending setting ([#191](https://github.com/babel/babylon/pull/191)) (Moti Zilberman) + +Increase test coverage ([#175](https://github.com/babel/babylon/pull/175) (Moti Zilberman) + +Readd missin .eslinignore for IDEs (Daniel Tschinder) + +Error on missing expected.json fixture in CI ([#188](https://github.com/babel/babylon/pull/188)) (Moti Zilberman) + +Add .gitattributes and .editorconfig for LF line endings ([#179](https://github.com/babel/babylon/pull/179)) (Moti Zilberman) + +Fixes two tests that are failing after the merge of #172 ([#177](https://github.com/babel/babylon/pull/177)) (Moti Zilberman) + +## v6.12.0 (2016-10-14) + +### :eyeglasses: Spec Compliance + +Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler) + +#### Dynamic Import + +- Proposal Repo: https://github.com/domenic/proposal-dynamic-import +- Championed by [@domenic](https://github.com/domenic) +- stage-2 +- [sept-28 tc39 notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-09/sept-28.md#113a-import) + +> This repository contains a proposal for adding a "function-like" import() module loading syntactic form to JavaScript + +```js +import(`./section-modules/${link.dataset.entryModule}.js`) +.then(module => { + module.loadPageInto(main); +}) +``` + +Add EmptyTypeAnnotation ([#171](https://github.com/babel/babylon/pull/171)) (Sam Goldman) + +#### EmptyTypeAnnotation + +Just wasn't covered before. + +```js +type T = empty; +``` + +### :bug: Bug Fix + +Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels) + +```js +// was failing due to sparse array +export const { foo: [ ,, qux7 ] } = bar; +``` + +Allow keyword in Flow object declaration property names with type parameters ([#146](https://github.com/babel/babylon/pull/146)) (Dan Harper) + +```js +declare class X { + foobar(): void; + static foobar(): void; +} +``` + +Allow keyword in object/class property names with Flow type parameters ([#145](https://github.com/babel/babylon/pull/145)) (Dan Harper) + +```js +class Foo { + delete(item: T): T { + return item; + } +} +``` + +Allow typeAnnotations for yield expressions ([#174](https://github.com/babel/babylon/pull/174))) (Daniel Tschinder) + +```js +function *foo() { + const x = (yield 5: any); +} +``` + +### :nail_care: Polish + +Annotate more errors with expected token ([#172](https://github.com/babel/babylon/pull/172))) (Moti Zilberman) + +```js +// Unexpected token, expected ; (1:6) +{ set 1 } +``` + +### :house: Internal + +Remove kcheck ([#173](https://github.com/babel/babylon/pull/173))) (Daniel Tschinder) + +Also run flow, linting, babel tests on separate instances (add back node 0.10) + +## v6.11.6 (2016-10-12) + +### :bug: Bug Fix/Regression + +Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels) + +```js +// was failing with `Cannot read property 'type' of null` because of null identifiers +export const { foo: [ ,, qux7 ] } = bar; +``` + +## v6.11.5 (2016-10-12) + +### :eyeglasses: Spec Compliance + +Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo) + +```js +// `foo` has already been exported. Exported identifiers must be unique. (2:20) +export function foo() {}; +export const { a: [{foo}] } = bar; +``` + +Fix: Check for duplicate named exports in exported rest elements/properties ([#164](https://github.com/babel/babylon/pull/164)) (Kai Cataldo) + +```js +// `foo` has already been exported. Exported identifiers must be unique. (2:22) +export const foo = 1; +export const [bar, ...foo] = baz; +``` + +### :bug: Bug Fix + +Fix: Allow identifier `async` for default param in arrow expression ([#165](https://github.com/babel/babylon/pull/165)) (Kai Cataldo) + +```js +// this is ok now +const test = ({async = true}) => {}; +``` + +### :nail_care: Polish + +Babylon will now print out the token it's expecting if there's a `SyntaxError` ([#150](https://github.com/babel/babylon/pull/150)) (Daniel Tschinder) + +```bash +# So in the case of a missing ending curly (`}`) +Module build failed: SyntaxError: Unexpected token, expected } (30:0) + 28 | } + 29 | +> 30 | + | ^ +``` + +## v6.11.4 (2016-10-03) + +Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu) + +## v6.11.3 (2016-10-01) + +### :eyeglasses: Spec Compliance + +Add static errors for object rest (#149) ([@danez](https://github.com/danez)) + +> https://github.com/sebmarkbage/ecmascript-rest-spread + +Object rest copies the *rest* of properties from the right hand side `obj` starting from the left to right. + +```js +let { x, y, ...z } = { x: 1, y: 2, z: 3 }; +// x = 1 +// y = 2 +// z = { z: 3 } +``` + +#### New Syntax Errors: + +**SyntaxError**: The rest element has to be the last element when destructuring (1:10) +```bash +> 1 | let { ...x, y, z } = { x: 1, y: 2, z: 3}; + | ^ +# Previous behavior: +# x = { x: 1, y: 2, z: 3 } +# y = 2 +# z = 3 +``` + +Before, this was just a more verbose way of shallow copying `obj` since it doesn't actually do what you think. + +**SyntaxError**: Cannot have multiple rest elements when destructuring (1:13) + +```bash +> 1 | let { x, ...y, ...z } = { x: 1, y: 2, z: 3}; + | ^ +# Previous behavior: +# x = 1 +# y = { y: 2, z: 3 } +# z = { y: 2, z: 3 } +``` + +Before y and z would just be the same value anyway so there is no reason to need to have both. + +**SyntaxError**: A trailing comma is not permitted after the rest element (1:16) + +```js +let { x, y, ...z, } = obj; +``` + +The rationale for this is that the use case for trailing comma is that you can add something at the end without affecting the line above. Since a RestProperty always has to be the last property it doesn't make sense. + +--- + +get / set are valid property names in default assignment (#142) ([@jezell](https://github.com/jezell)) + +```js +// valid +function something({ set = null, get = null }) {} +``` + +## v6.11.2 (2016-09-23) + +### Bug Fix + +- [#139](https://github.com/babel/babylon/issues/139) Don't do the duplicate check if not an identifier (#140) @hzoo + +```js +// regression with duplicate export check +SyntaxError: ./typography.js: `undefined` has already been exported. Exported identifiers must be unique. (22:13) + 20 | + 21 | export const { rhythm } = typography; +> 22 | export const { TypographyStyle } = typography +``` + +Bail out for now, and make a change to account for destructuring in the next release. + +## 6.11.1 (2016-09-22) + +### Bug Fix +- [#137](https://github.com/babel/babylon/pull/137) - Fix a regression with duplicate exports - it was erroring on all keys in `Object.prototype`. @danez + +```javascript +export toString from './toString'; +``` + +```bash +`toString` has already been exported. Exported identifiers must be unique. (1:7) +> 1 | export toString from './toString'; + | ^ + 2 | +``` + +## 6.11.0 (2016-09-22) + +### Spec Compliance (will break CI) + +- Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo + +```js +// Only one default export allowed per module. (2:9) +export default function() {}; +export { foo as default }; + +// Only one default export allowed per module. (2:0) +export default {}; +export default function() {}; + +// `Foo` has already been exported. Exported identifiers must be unique. (2:0) +export { Foo }; +export class Foo {}; +``` + +### New Feature (Syntax) + +- Add support for computed class property names ([#121](https://github.com/babel/babylon/pull/121)) @motiz88 + +```js +// AST +interface ClassProperty <: Node { + type: "ClassProperty"; + key: Identifier; + value: Expression; + computed: boolean; // added +} +``` + +```js +// with "plugins": ["classProperties"] +class Foo { + [x] + ['y'] +} + +class Bar { + [p] + [m] () {} +} + ``` + +### Bug Fix + +- Fix `static` property falling through in the declare class Flow AST ([#135](https://github.com/babel/babylon/pull/135)) @danharper + +```js +declare class X { + a: number; + static b: number; // static + c: number; // this was being marked as static in the AST as well +} +``` + +### Polish + +- Rephrase "assigning/binding to rvalue" errors to include context ([#119](https://github.com/babel/babylon/pull/119)) @motiz88 + +```js +// Used to error with: +// SyntaxError: Assigning to rvalue (1:0) + +// Now: +// Invalid left-hand side in assignment expression (1:0) +3 = 4 + +// Invalid left-hand side in for-in statement (1:5) +for (+i in {}); +``` + +### Internal + +- Fix call to `this.parseMaybeAssign` with correct arguments ([#133](https://github.com/babel/babylon/pull/133)) @danez +- Add semver note to changelog ([#131](https://github.com/babel/babylon/pull/131)) @hzoo + +## 6.10.0 (2016-09-19) + +> We plan to include some spec compliance bugs in patch versions. An example was the multiple default exports issue. + +### Spec Compliance + +* Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu) + +> It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false. https://tc39.github.io/ecma262/2016/#sec-function-definitions-static-semantics-early-errors + +More Context: [tc39-notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-07/july-29.md#611-the-scope-of-use-strict-with-respect-to-destructuring-in-parameter-lists) + +For example: + +```js +// this errors because it uses destructuring and default parameters +// in a function with a "use strict" directive +function a([ option1, option2 ] = []) { + "use strict"; +} + ``` + +The solution would be to use a top level "use strict" or to remove the destructuring or default parameters when using a function + "use strict" or to. + +### New Feature + +* Exact object type annotations for Flow plugin ([#104](https://github.com/babel/babylon/pull/104)) (Basil Hosmer) + +Added to flow in https://github.com/facebook/flow/commit/c710c40aa2a115435098d6c0dfeaadb023cd39b8 + +Looks like: + +```js +var a : {| x: number, y: string |} = { x: 0, y: 'foo' }; +``` + +### Bug Fixes + +* Include `typeParameter` location in `ArrowFunctionExpression` ([#126](https://github.com/babel/babylon/pull/126)) (Daniel Tschinder) +* Error on invalid flow type annotation with default assignment ([#122](https://github.com/babel/babylon/pull/122)) (Dan Harper) +* Fix Flow return types on arrow functions ([#124](https://github.com/babel/babylon/pull/124)) (Dan Harper) + +### Misc + +* Add tests for export extensions ([#127](https://github.com/babel/babylon/pull/127)) (Daniel Tschinder) +* Fix Contributing guidelines [skip ci] (Daniel Tschinder) + +## 6.9.2 (2016-09-09) + +The only change is to remove the `babel-runtime` dependency by compiling with Babel's ES2015 loose mode. So using babylon standalone should be smaller. + +## 6.9.1 (2016-08-23) + +This release contains mainly small bugfixes but also updates babylons default mode to es2017. The features for `exponentiationOperator`, `asyncFunctions` and `trailingFunctionCommas` which previously needed to be activated via plugin are now enabled by default and the plugins are now no-ops. + +### Bug Fixes + +- Fix issues with default object params in async functions ([#96](https://github.com/babel/babylon/pull/96)) @danez +- Fix issues with flow-types and async function ([#95](https://github.com/babel/babylon/pull/95)) @danez +- Fix arrow functions with destructuring, types & default value ([#94](https://github.com/babel/babylon/pull/94)) @danharper +- Fix declare class with qualified type identifier ([#97](https://github.com/babel/babylon/pull/97)) @danez +- Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas plugins and enable them by default ([#98](https://github.com/babel/babylon/pull/98)) @danez + +## 6.9.0 (2016-08-16) + +### New syntax support + +- Add JSX spread children ([#42](https://github.com/babel/babylon/pull/42)) @calebmer + +(Be aware that React is not going to support this syntax) + +```js +
+ {...todos.map(todo => )} +
+``` + +- Add support for declare module.exports ([#72](https://github.com/babel/babylon/pull/72)) @danez + +```js +declare module "foo" { + declare module.exports: {} +} +``` + +### New Features + +- If supplied, attach filename property to comment node loc. ([#80](https://github.com/babel/babylon/pull/80)) @divmain +- Add identifier name to node loc field ([#90](https://github.com/babel/babylon/pull/90)) @kittens + +### Bug Fixes + +- Fix exponential operator to behave according to spec ([#75](https://github.com/babel/babylon/pull/75)) @danez +- Fix lookahead to not add comments to arrays which are not cloned ([#76](https://github.com/babel/babylon/pull/76)) @danez +- Fix accidental fall-through in Flow type parsing. ([#82](https://github.com/babel/babylon/pull/82)) @xiemaisi +- Only allow declares inside declare module ([#73](https://github.com/babel/babylon/pull/73)) @danez +- Small fix for parsing type parameter declarations ([#83](https://github.com/babel/babylon/pull/83)) @gabelevi +- Fix arrow param locations with flow types ([#57](https://github.com/babel/babylon/pull/57)) @danez +- Fixes SyntaxError position with flow optional type ([#65](https://github.com/babel/babylon/pull/65)) @danez + +### Internal + +- Add codecoverage to tests @danez +- Fix tests to not save expected output if we expect the test to fail @danez +- Make a shallow clone of babel for testing @danez +- chore(package): update cross-env to version 2.0.0 ([#77](https://github.com/babel/babylon/pull/77)) @greenkeeperio-bot +- chore(package): update ava to version 0.16.0 ([#86](https://github.com/babel/babylon/pull/86)) @greenkeeperio-bot +- chore(package): update babel-plugin-istanbul to version 2.0.0 ([#89](https://github.com/babel/babylon/pull/89)) @greenkeeperio-bot +- chore(package): update nyc to version 8.0.0 ([#88](https://github.com/babel/babylon/pull/88)) @greenkeeperio-bot + +## 6.8.4 (2016-07-06) + +### Bug Fixes + +- Fix the location of params, when flow and default value used ([#68](https://github.com/babel/babylon/pull/68)) @danez + +## 6.8.3 (2016-07-02) + +### Bug Fixes + +- Fix performance regression introduced in 6.8.2 with conditionals ([#63](https://github.com/babel/babylon/pull/63)) @danez + +## 6.8.2 (2016-06-24) + +### Bug Fixes + +- Fix parse error with yielding jsx elements in generators `function* it() { yield ; }` ([#31](https://github.com/babel/babylon/pull/31)) @eldereal +- When cloning nodes do not clone its comments ([#24](https://github.com/babel/babylon/pull/24)) @danez +- Fix parse errors when using arrow functions with an spread element and return type `(...props): void => {}` ([#10](https://github.com/babel/babylon/pull/10)) @danez +- Fix leading comments added from previous node ([#23](https://github.com/babel/babylon/pull/23)) @danez +- Fix parse errors with flow's optional arguments `(arg?) => {}` ([#19](https://github.com/babel/babylon/pull/19)) @danez +- Support negative numeric type literals @kittens +- Remove line terminator restriction after await keyword @kittens +- Remove grouped type arrow restriction as it seems flow no longer has it @kittens +- Fix parse error with generic methods that have the name `get` or `set` `class foo { get() {} }` ([#55](https://github.com/babel/babylon/pull/55)) @vkurchatkin +- Fix parse error with arrow functions that have flow type parameter declarations `(x: T): T => x;` ([#54](https://github.com/babel/babylon/pull/54)) @gabelevi + +### Documentation + +- Document AST differences from ESTree ([#41](https://github.com/babel/babylon/pull/41)) @nene +- Move ast spec from babel/babel ([#46](https://github.com/babel/babylon/pull/46)) @hzoo + +### Internal + +- Enable skipped tests ([#16](https://github.com/babel/babylon/pull/16)) @danez +- Add script to test latest version of babylon with babel ([#21](https://github.com/babel/babylon/pull/21)) @danez +- Upgrade test runner ava @kittens +- Add missing generate-identifier-regex script @kittens +- Rename parser context types @kittens +- Add node v6 to travis testing @hzoo +- Update to Unicode v9 ([#45](https://github.com/babel/babylon/pull/45)) @mathiasbynens + +## 6.8.1 (2016-06-06) + +### New Feature + +- Parse type parameter declarations with defaults like `type Foo = T` + +### Bug Fixes +- Type parameter declarations need 1 or more type parameters. +- The existential type `*` is not a valid type parameter. +- The existential type `*` is a primary type + +### Spec Compliance +- The param list for type parameter declarations now consists of `TypeParameter` nodes +- New `TypeParameter` AST Node (replaces using the `Identifier` node before) + +``` +interface TypeParameter <: Node { + bound: TypeAnnotation; + default: TypeAnnotation; + name: string; + variance: "plus" | "minus"; +} +``` + +## 6.8.0 (2016-05-02) + +#### New Feature + +##### Parse Method Parameter Decorators ([#12](https://github.com/babel/babylon/pull/12)) + +> [Method Parameter Decorators](https://goo.gl/8MmCMG) is now a TC39 [stage 0 proposal](https://github.com/tc39/ecma262/blob/master/stage0.md). + +Examples: + +```js +class Foo { + constructor(@foo() x, @bar({ a: 123 }) @baz() y) {} +} + +export default function func(@foo() x, @bar({ a: 123 }) @baz() y) {} + +var obj = { + method(@foo() x, @bar({ a: 123 }) @baz() y) {} +}; +``` + +##### Parse for-await statements (w/ `asyncGenerators` plugin) ([#17](https://github.com/babel/babylon/pull/17)) + +There is also a new node type, `ForAwaitStatement`. + +> [Async generators and for-await](https://github.com/tc39/proposal-async-iteration) are now a [stage 2 proposal](https://github.com/tc39/ecma262#current-proposals). + +Example: + +```js +async function f() { + for await (let x of y); +} +``` diff --git a/src/main/resources/static/node_modules/@babel/parser/LICENSE b/src/main/resources/static/node_modules/@babel/parser/LICENSE new file mode 100644 index 0000000..d4c7fc5 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/parser/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2012-2014 by various contributors (see AUTHORS) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/main/resources/static/node_modules/@babel/parser/README.md b/src/main/resources/static/node_modules/@babel/parser/README.md new file mode 100644 index 0000000..513748c --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/parser/README.md @@ -0,0 +1,19 @@ +# @babel/parser + +> A JavaScript parser + +See our website [@babel/parser](https://babeljs.io/docs/en/babel-parser) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20parser%20(babylon)%22+is%3Aopen) associated with this package. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/parser +``` + +or using yarn: + +```sh +yarn add @babel/parser --dev +``` diff --git a/src/main/resources/static/node_modules/@babel/parser/bin/babel-parser.js b/src/main/resources/static/node_modules/@babel/parser/bin/babel-parser.js new file mode 100644 index 0000000..3aca314 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/parser/bin/babel-parser.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node +/* eslint no-var: 0 */ + +var parser = require(".."); +var fs = require("fs"); + +var filename = process.argv[2]; +if (!filename) { + console.error("no filename specified"); +} else { + var file = fs.readFileSync(filename, "utf8"); + var ast = parser.parse(file); + + console.log(JSON.stringify(ast, null, " ")); +} diff --git a/src/main/resources/static/node_modules/@babel/parser/lib/index.js b/src/main/resources/static/node_modules/@babel/parser/lib/index.js new file mode 100644 index 0000000..281584c --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/parser/lib/index.js @@ -0,0 +1,15148 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +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]|\/\/.*|\/\*.*?\*\/)*/y; +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 Position { + constructor(line, col) { + this.line = void 0; + this.column = void 0; + this.line = line; + this.column = col; + } + +} +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 getLineInfo(input, offset) { + let line = 1; + let lineStart = 0; + let match; + lineBreakG.lastIndex = 0; + + while ((match = lineBreakG.exec(input)) && match.index < offset) { + line++; + lineStart = lineBreakG.lastIndex; + } + + return new Position(line, offset - lineStart); +} + +class BaseParser { + constructor() { + this.sawUnambiguousESM = false; + this.ambiguousScriptDifferentAst = false; + } + + hasPlugin(name) { + return this.plugins.has(name); + } + + getPluginOption(plugin, name) { + if (this.hasPlugin(plugin)) return this.plugins.get(plugin)[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; + } + } + + 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 ErrorCodes = Object.freeze({ + SyntaxError: "BABEL_PARSER_SYNTAX_ERROR", + SourceTypeModuleError: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED" +}); + +const ErrorMessages = makeErrorTemplates({ + AccessorIsGenerator: "A %0ter 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.", + 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' accesor must not have any formal parameters.", + BadSetterArity: "A 'set' accesor must have exactly one formal parameter.", + BadSetterRestParameter: "A 'set' accesor 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: "'%0' require an initialization value.", + DecoratorBeforeExport: "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax.", + DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?", + DecoratorExportClass: "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.", + 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: "`%0` 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: "A string literal cannot be used as an exported binding without `from`.\n- Did you mean `export { '%0' as '%1' } from 'some-module'`?", + ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.", + ForInOfLoopInitializer: "'%0' loop variable declaration may not have an initializer.", + 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: "Unsyntactic %0.", + IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.", + IllegalReturn: "'return' outside of function.", + ImportBindingIsString: 'A string literal cannot be used as an imported binding.\n- Did you mean `import { "%0" as foo }`?', + ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments.", + ImportCallArity: "`import()` requires exactly %0.", + ImportCallNotNewExpression: "Cannot use new with import(...).", + ImportCallSpreadArgument: "`...` is not allowed in `import()`.", + InvalidBigIntLiteral: "Invalid BigIntLiteral.", + InvalidCodePoint: "Code point out of bounds.", + InvalidDecimal: "Invalid decimal.", + InvalidDigit: "Expected number in radix %0.", + InvalidEscapeSequence: "Bad character escape sequence.", + InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.", + InvalidEscapedReservedWord: "Escape sequence in keyword %0.", + InvalidIdentifier: "Invalid identifier %0.", + InvalidLhs: "Invalid left-hand side in %0.", + InvalidLhsBinding: "Binding invalid left-hand side in %0.", + InvalidNumber: "Invalid number.", + InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.", + InvalidOrUnexpectedToken: "Unexpected character '%0'.", + InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.", + InvalidPrivateFieldResolution: "Private name #%0 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: "Label '%0' is already declared.", + LetInLexicalBinding: "'let' is not allowed to be used as a name in 'let' or 'const' declarations.", + 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.", + 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: 'Duplicate key "%0" is not allowed in module attributes.', + ModuleExportNameHasLoneSurrogate: "An export name cannot include a lone surrogate, found '\\u%0'.", + ModuleExportUndefined: "Export '%0' 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.", + PipeBodyIsTighter: "Unexpected %0 after pipeline body; any %0 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: 'Invalid topic token %0. In order to use %0 as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "%0" }.', + PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.", + PipeUnparenthesizedBody: "Hack-style pipe body cannot be an unparenthesized %0 expression; 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.', + PrivateInExpectedIn: "Private names are only allowed in property accesses (`obj.#%0`) or in `in` expressions (`#%0 in obj`).", + PrivateNameRedeclaration: "Duplicate private name #%0.", + 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, inside a block, or as the body of an if statement.", + StaticPrototype: "Classes may not have static property named prototype.", + StrictDelete: "Deleting local variable in strict mode.", + StrictEvalArguments: "Assigning to '%0' in strict mode.", + StrictEvalArgumentsBinding: "Binding '%0' 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.", + 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: "Unexpected keyword '%0'.", + 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: "Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p).", + UnexpectedReservedWord: "Unexpected reserved word '%0'.", + UnexpectedSuper: "'super' is only allowed in object methods and classes.", + UnexpectedToken: "Unexpected token '%0'.", + UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.", + 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: "The only valid meta property for %0 is %0.%1.", + 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.", + VarRedeclaration: "Identifier '%0' 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." +}, ErrorCodes.SyntaxError); +const SourceTypeModuleErrorMessages = makeErrorTemplates({ + ImportMetaOutsideModule: `import.meta may appear only with 'sourceType: "module"'`, + ImportOutsideModule: `'import' and 'export' may appear only with 'sourceType: "module"'` +}, ErrorCodes.SourceTypeModuleError); + +function keepReasonCodeCompat(reasonCode, syntaxPlugin) { + { + if (syntaxPlugin === "flow" && reasonCode === "PatternIsOptional") { + return "OptionalBindingPattern"; + } + } + return reasonCode; +} + +function makeErrorTemplates(messages, code, syntaxPlugin) { + const templates = {}; + Object.keys(messages).forEach(reasonCode => { + templates[reasonCode] = Object.freeze({ + code, + reasonCode: keepReasonCodeCompat(reasonCode, syntaxPlugin), + template: messages[reasonCode] + }); + }); + return Object.freeze(templates); +} +class ParserError extends CommentsParser { + getLocationForPosition(pos) { + let loc; + if (pos === this.state.start) loc = this.state.startLoc;else if (pos === this.state.lastTokStart) loc = this.state.lastTokStartLoc;else if (pos === this.state.end) loc = this.state.endLoc;else if (pos === this.state.lastTokEnd) loc = this.state.lastTokEndLoc;else loc = getLineInfo(this.input, pos); + return loc; + } + + raise(pos, { + code, + reasonCode, + template + }, ...params) { + return this.raiseWithData(pos, { + code, + reasonCode + }, template, ...params); + } + + raiseOverwrite(pos, { + code, + template + }, ...params) { + const loc = this.getLocationForPosition(pos); + const message = template.replace(/%(\d+)/g, (_, i) => params[i]) + ` (${loc.line}:${loc.column})`; + + if (this.options.errorRecovery) { + const errors = this.state.errors; + + for (let i = errors.length - 1; i >= 0; i--) { + const error = errors[i]; + + if (error.pos === pos) { + return Object.assign(error, { + message + }); + } else if (error.pos < pos) { + break; + } + } + } + + return this._raise({ + code, + loc, + pos + }, message); + } + + raiseWithData(pos, data, errorTemplate, ...params) { + const loc = this.getLocationForPosition(pos); + const message = errorTemplate.replace(/%(\d+)/g, (_, i) => params[i]) + ` (${loc.line}:${loc.column})`; + return this._raise(Object.assign({ + loc, + pos + }, data), message); + } + + _raise(errorContext, message) { + const err = new SyntaxError(message); + Object.assign(err, errorContext); + + if (this.options.errorRecovery) { + if (!this.isLookahead) this.state.errors.push(err); + return err; + } else { + throw err; + } + } + +} + +var estree = (superClass => class extends superClass { + 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 directiveLiteral = directive.value; + const stmt = this.startNodeAt(directive.start, directive.loc.start); + const expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start); + expression.value = directiveLiteral.extra.expressionValue; + expression.raw = directiveLiteral.extra.raw; + stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end); + stmt.directive = directiveLiteral.extra.raw.slice(1, -1); + return this.finishNodeAt(stmt, "ExpressionStatement", directive.end, directive.loc.end); + } + + 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, ...args) { + super.parseBlockBody(node, ...args); + 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; + } + + type = "MethodDefinition"; + return this.finishNode(node, type); + } + + 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, startPos, startLoc, isPattern, refExpressionErrors) { + const node = super.parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors); + + if (node) { + node.kind = "init"; + node.type = "Property"; + } + + return node; + } + + 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)) { + this.toAssignable(node.value, isLHS); + return node; + } + + return super.toAssignable(node, isLHS); + } + + toAssignableObjectExpressionProp(prop, ...args) { + if (prop.kind === "get" || prop.kind === "set") { + this.raise(prop.key.start, ErrorMessages.PatternHasAccessor); + } else if (prop.method) { + this.raise(prop.key.start, ErrorMessages.PatternHasMethod); + } else { + super.toAssignableObjectExpressionProp(prop, ...args); + } + } + + finishCallExpression(node, optional) { + super.finishCallExpression(node, optional); + + if (node.callee.type === "Import") { + node.type = "ImportExpression"; + node.source = node.arguments[0]; + + if (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(node) { + super.parseExport(node); + + 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; + } + + break; + } + + return node; + } + + parseSubscript(base, startPos, startLoc, noCalls, state) { + const node = super.parseSubscript(base, startPos, 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); + } + + isOptionalChain(node) { + return node.type === "ChainExpression"; + } + + isObjectProperty(node) { + return node.type === "Property" && node.kind === "init" && !node.method; + } + + isObjectMethod(node) { + return node.method || node.kind === "get" || node.kind === "set"; + } + +}); + +class TokContext { + constructor(token, preserveSpace) { + this.token = void 0; + this.preserveSpace = void 0; + this.token = token; + this.preserveSpace = !!preserveSpace; + } + +} +const types = { + brace: new TokContext("{"), + 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("}", { + beforeExpr + }), + 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 + }), + 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 + }), + 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), + 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 + }), + _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 + }), + _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 >= 87 && token <= 122; +} +function tokenKeywordOrIdentifierIsKeyword(token) { + return token <= 86; +} +function tokenIsKeywordOrIdentifier(token) { + return token >= 52 && token <= 122; +} +function tokenIsLiteralPropertyName(token) { + return token >= 52 && token <= 126; +} +function tokenComesBeforeExpression(token) { + return tokenBeforeExprs[token]; +} +function tokenCanStartExpression(token) { + return tokenStartsExprs[token]; +} +function tokenIsAssignment(token) { + return token >= 27 && token <= 31; +} +function tokenIsFlowInterfaceOrTypeOrOpaque(token) { + return token >= 119 && token <= 121; +} +function tokenIsLoop(token) { + return token >= 84 && token <= 86; +} +function tokenIsKeyword(token) { + return token >= 52 && token <= 86; +} +function tokenIsOperator(token) { + return token >= 35 && token <= 53; +} +function tokenIsPostfix(token) { + return token === 32; +} +function tokenIsPrefix(token) { + return tokenPrefixes[token]; +} +function tokenIsTSTypeOperator(token) { + return token >= 111 && token <= 113; +} +function tokenIsTSDeclarationStart(token) { + return token >= 114 && token <= 120; +} +function tokenLabelName(token) { + return tokenLabels[token]; +} +function tokenOperatorPrecedence(token) { + return tokenBinops[token]; +} +function tokenIsRightAssociative(token) { + return token === 51; +} +function getExportedToken(token) { + return tokenTypes[token]; +} +function isTokenType(obj) { + return typeof obj === "number"; +} +{ + 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[132].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\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-\u0ecd\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, 85, 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, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 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, 46, 2, 18, 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, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 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, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; +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, 154, 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, 161, 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, 19306, 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, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 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) { + return current === 64 && next === 64; +} +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); +} + +const SCOPE_OTHER = 0b000000000, + SCOPE_PROGRAM = 0b000000001, + SCOPE_FUNCTION = 0b000000010, + SCOPE_ARROW = 0b000000100, + SCOPE_SIMPLE_CATCH = 0b000001000, + SCOPE_SUPER = 0b000010000, + SCOPE_DIRECT_SUPER = 0b000100000, + SCOPE_CLASS = 0b001000000, + SCOPE_STATIC_BLOCK = 0b010000000, + SCOPE_TS_MODULE = 0b100000000, + SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_TS_MODULE; +const BIND_KIND_VALUE = 0b000000000001, + BIND_KIND_TYPE = 0b000000000010, + BIND_SCOPE_VAR = 0b000000000100, + BIND_SCOPE_LEXICAL = 0b000000001000, + BIND_SCOPE_FUNCTION = 0b000000010000, + BIND_FLAGS_NONE = 0b000001000000, + BIND_FLAGS_CLASS = 0b000010000000, + BIND_FLAGS_TS_ENUM = 0b000100000000, + BIND_FLAGS_TS_CONST_ENUM = 0b001000000000, + BIND_FLAGS_TS_EXPORT_ONLY = 0b010000000000, + BIND_FLAGS_FLOW_DECLARE_FN = 0b100000000000; +const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS, + BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0, + BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0, + BIND_FUNCTION = BIND_KIND_VALUE | 0 | BIND_SCOPE_FUNCTION | 0, + BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS, + BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0, + BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM, + BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY, + BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE, + BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE, + BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM, + BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY, + BIND_FLOW_DECLARE_FN = BIND_FLAGS_FLOW_DECLARE_FN; +const CLASS_ELEMENT_FLAG_STATIC = 0b100, + CLASS_ELEMENT_KIND_GETTER = 0b010, + CLASS_ELEMENT_KIND_SETTER = 0b001, + CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER; +const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC, + CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC, + CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_KIND_GETTER, + CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_KIND_SETTER, + CLASS_ELEMENT_OTHER = 0; + +class Scope { + constructor(flags) { + this.var = new Set(); + this.lexical = new Set(); + this.functions = new Set(); + this.flags = flags; + } + +} +class ScopeHandler { + constructor(raise, inModule) { + this.scopeStack = []; + this.undefinedExports = new Map(); + this.undefinedPrivateNames = new Map(); + this.raise = raise; + this.inModule = inModule; + } + + get inFunction() { + return (this.currentVarScopeFlags() & SCOPE_FUNCTION) > 0; + } + + get allowSuper() { + return (this.currentThisScopeFlags() & SCOPE_SUPER) > 0; + } + + get allowDirectSuper() { + return (this.currentThisScopeFlags() & SCOPE_DIRECT_SUPER) > 0; + } + + get inClass() { + return (this.currentThisScopeFlags() & SCOPE_CLASS) > 0; + } + + get inClassAndNotInNonArrowFunction() { + const flags = this.currentThisScopeFlags(); + return (flags & SCOPE_CLASS) > 0 && (flags & SCOPE_FUNCTION) === 0; + } + + get inStaticBlock() { + for (let i = this.scopeStack.length - 1;; i--) { + const { + flags + } = this.scopeStack[i]; + + if (flags & SCOPE_STATIC_BLOCK) { + return true; + } + + if (flags & (SCOPE_VAR | SCOPE_CLASS)) { + return false; + } + } + } + + get inNonArrowFunction() { + return (this.currentThisScopeFlags() & SCOPE_FUNCTION) > 0; + } + + get treatFunctionsAsVar() { + return this.treatFunctionsAsVarInScope(this.currentScope()); + } + + createScope(flags) { + return new Scope(flags); + } + + enter(flags) { + this.scopeStack.push(this.createScope(flags)); + } + + exit() { + this.scopeStack.pop(); + } + + treatFunctionsAsVarInScope(scope) { + return !!(scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_PROGRAM); + } + + declareName(name, bindingType, pos) { + let scope = this.currentScope(); + + if (bindingType & BIND_SCOPE_LEXICAL || bindingType & BIND_SCOPE_FUNCTION) { + this.checkRedeclarationInScope(scope, name, bindingType, pos); + + if (bindingType & BIND_SCOPE_FUNCTION) { + scope.functions.add(name); + } else { + scope.lexical.add(name); + } + + if (bindingType & BIND_SCOPE_LEXICAL) { + this.maybeExportDefined(scope, name); + } + } else if (bindingType & BIND_SCOPE_VAR) { + for (let i = this.scopeStack.length - 1; i >= 0; --i) { + scope = this.scopeStack[i]; + this.checkRedeclarationInScope(scope, name, bindingType, pos); + scope.var.add(name); + this.maybeExportDefined(scope, name); + if (scope.flags & SCOPE_VAR) break; + } + } + + if (this.inModule && scope.flags & SCOPE_PROGRAM) { + this.undefinedExports.delete(name); + } + } + + maybeExportDefined(scope, name) { + if (this.inModule && scope.flags & SCOPE_PROGRAM) { + this.undefinedExports.delete(name); + } + } + + checkRedeclarationInScope(scope, name, bindingType, pos) { + if (this.isRedeclaredInScope(scope, name, bindingType)) { + this.raise(pos, ErrorMessages.VarRedeclaration, name); + } + } + + isRedeclaredInScope(scope, name, bindingType) { + if (!(bindingType & BIND_KIND_VALUE)) return false; + + if (bindingType & BIND_SCOPE_LEXICAL) { + return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name); + } + + if (bindingType & BIND_SCOPE_FUNCTION) { + return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name); + } + + return scope.lexical.has(name) && !(scope.flags & SCOPE_SIMPLE_CATCH && 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.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 & SCOPE_VAR) { + return flags; + } + } + } + + currentThisScopeFlags() { + for (let i = this.scopeStack.length - 1;; i--) { + const { + flags + } = this.scopeStack[i]; + + if (flags & (SCOPE_VAR | SCOPE_CLASS) && !(flags & SCOPE_ARROW)) { + 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, pos) { + const scope = this.currentScope(); + + if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) { + this.checkRedeclarationInScope(scope, name, bindingType, pos); + this.maybeExportDefined(scope, name); + scope.declareFunctions.add(name); + return; + } + + super.declareName(...arguments); + } + + isRedeclaredInScope(scope, name, bindingType) { + if (super.isRedeclaredInScope(...arguments)) return true; + + if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) { + 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 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.topicContext = { + maxNumOfResolvableTopics: 0, + maxTopicIndex: null + }; + this.soloAwait = false; + this.inFSharpPipelineDirectBody = false; + this.labels = []; + this.decoratorStack = [[]]; + this.comments = []; + this.commentStack = []; + this.pos = 0; + this.type = 129; + this.value = null; + this.start = 0; + this.end = 0; + this.lastTokEndLoc = null; + this.lastTokStartLoc = null; + this.lastTokStart = 0; + this.lastTokEnd = 0; + this.context = [types.brace]; + this.canStartJSXElement = true; + this.containsEsc = false; + 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); + } + + curPosition() { + return new Position(this.curLine, this.pos - this.lineStart); + } + + 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 VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100]); +const forbiddenNumericSeparatorSiblings = { + decBinOct: [46, 66, 69, 79, 95, 98, 101, 111], + hex: [46, 88, 95, 120] +}; +const allowedNumericSeparatorSiblings = {}; +allowedNumericSeparatorSiblings.bin = [48, 49]; +allowedNumericSeparatorSiblings.oct = [...allowedNumericSeparatorSiblings.bin, 50, 51, 52, 53, 54, 55]; +allowedNumericSeparatorSiblings.dec = [...allowedNumericSeparatorSiblings.oct, 56, 57]; +allowedNumericSeparatorSiblings.hex = [...allowedNumericSeparatorSiblings.dec, 65, 66, 67, 68, 69, 70, 97, 98, 99, 100, 101, 102]; +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 ParserError { + constructor(options, input) { + super(); + this.isLookahead = void 0; + this.tokens = []; + 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.lastTokEnd = this.state.end; + 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, + lastTokEnd: state.end, + context: [this.curContext()], + inType: state.inType + }; + } + + 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()); + } + + 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((message, pos) => this.raise(pos, message)); + this.state.strictErrors.clear(); + } + } + + curContext() { + return this.state.context[this.state.context.length - 1]; + } + + nextToken() { + const curContext = this.curContext(); + if (!curContext.preserveSpace) 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(129); + return; + } + + if (curContext === types.template) { + this.readTmplToken(); + } else { + this.getTokenFromCode(this.codePointAtPos(this.state.pos)); + } + } + + skipBlockComment() { + let startLoc; + if (!this.isLookahead) startLoc = this.state.curPosition(); + const start = this.state.pos; + const end = this.input.indexOf("*/", start + 2); + if (end === -1) throw this.raise(start, ErrorMessages.UnterminatedComment); + this.state.pos = end + 2; + 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 + 2, + 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) { + 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) { + 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; + const prevType = this.state.type; + this.state.type = type; + this.state.value = val; + + if (!this.isLookahead) { + this.state.endLoc = this.state.curPosition(); + 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(this.state.pos, ErrorMessages.UnexpectedDigitAfterHash); + } + + if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) { + this.expectPlugin("recordAndTuple"); + + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "hash") { + throw this.raise(this.state.pos, next === 123 ? ErrorMessages.RecordExpressionHashIncorrectStartSyntaxType : ErrorMessages.TupleExpressionHashIncorrectStartSyntaxType); + } + + this.state.pos += 2; + + if (next === 123) { + this.finishToken(7); + } else { + this.finishToken(1); + } + } else if (isIdentifierStart(next)) { + ++this.state.pos; + this.finishToken(128, this.readWord1(next)); + } else if (next === 92) { + ++this.state.pos; + this.finishToken(128, this.readWord1()); + } else { + this.finishOp(25, 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(29, 2); + } else { + this.finishOp(50, 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(26, value); + return true; + } + + readToken_mult_modulo(code) { + let type = code === 42 ? 49 : 48; + 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 = 51; + } + + if (next === 61 && !this.state.inType) { + width++; + type = code === 37 ? 31 : 28; + } + + 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(28, 3); + } else { + this.finishOp(code === 124 ? 37 : 38, 2); + } + + return; + } + + if (code === 124) { + if (next === 62) { + this.finishOp(35, 2); + return; + } + + if (this.hasPlugin("recordAndTuple") && next === 125) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise(this.state.pos, ErrorMessages.RecordExpressionBarIncorrectEndSyntaxType); + } + + this.state.pos += 2; + this.finishToken(9); + return; + } + + if (this.hasPlugin("recordAndTuple") && next === 93) { + if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") { + throw this.raise(this.state.pos, ErrorMessages.TupleExpressionBarIncorrectEndSyntaxType); + } + + this.state.pos += 2; + this.finishToken(4); + return; + } + } + + if (next === 61) { + this.finishOp(28, 2); + return; + } + + this.finishOp(code === 124 ? 39 : 41, 1); + } + + readToken_caret() { + const next = this.input.charCodeAt(this.state.pos + 1); + + if (next === 61 && !this.state.inType) { + this.finishOp(30, 2); + } else { + this.finishOp(40, 1); + } + } + + readToken_plus_min(code) { + const next = this.input.charCodeAt(this.state.pos + 1); + + if (next === code) { + this.finishOp(32, 2); + return; + } + + if (next === 61) { + this.finishOp(28, 2); + } else { + this.finishOp(47, 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(28, 3); + return; + } + + this.finishOp(46, 2); + return; + } + + if (next === 61) { + this.finishOp(45, 2); + return; + } + + this.finishOp(43, 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(28, size + 1); + return; + } + + this.finishOp(46, size); + return; + } + + if (next === 61) { + this.finishOp(45, 2); + return; + } + + this.finishOp(44, 1); + } + + readToken_eq_excl(code) { + const next = this.input.charCodeAt(this.state.pos + 1); + + if (next === 61) { + this.finishOp(42, 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 ? 27 : 33, 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(28, 3); + } else { + this.finishOp(36, 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(this.state.pos, ErrorMessages.TupleExpressionBarIncorrectStartSyntaxType); + } + + 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(this.state.pos, ErrorMessages.RecordExpressionBarIncorrectStartSyntaxType); + } + + 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.state.pos; + this.finishToken(22); + 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(34, 1); + return; + + case 64: + ++this.state.pos; + this.finishToken(24); + return; + + case 35: + this.readToken_numberSign(); + return; + + case 92: + this.readWord(); + return; + + default: + if (isIdentifierStart(code)) { + this.readWord(code); + return; + } + + } + + throw this.raise(this.state.pos, ErrorMessages.InvalidOrUnexpectedToken, 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 start = this.state.start + 1; + let escaped, inClass; + let { + pos + } = this.state; + + for (;; ++pos) { + if (pos >= this.length) { + throw this.raise(start, ErrorMessages.UnterminatedRegExp); + } + + const ch = this.input.charCodeAt(pos); + + if (isNewLine(ch)) { + throw this.raise(start, ErrorMessages.UnterminatedRegExp); + } + + 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 = ""; + + while (pos < this.length) { + const cp = this.codePointAtPos(pos); + const char = String.fromCharCode(cp); + + if (VALID_REGEX_FLAGS.has(cp)) { + if (mods.includes(char)) { + this.raise(pos + 1, ErrorMessages.DuplicateRegExpFlags); + } + } else if (isIdentifierChar(cp) || cp === 92) { + this.raise(pos + 1, ErrorMessages.MalformedRegExpFlags); + } else { + break; + } + + ++pos; + mods += char; + } + + this.state.pos = pos; + this.finishToken(127, { + pattern: content, + flags: mods + }); + } + + readInt(radix, len, forceLen, allowNumSeparator = true) { + const start = this.state.pos; + const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct; + const allowedSiblings = radix === 16 ? allowedNumericSeparatorSiblings.hex : radix === 10 ? allowedNumericSeparatorSiblings.dec : radix === 8 ? allowedNumericSeparatorSiblings.oct : allowedNumericSeparatorSiblings.bin; + let invalid = false; + let total = 0; + + for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { + const code = this.input.charCodeAt(this.state.pos); + let val; + + if (code === 95) { + const prev = this.input.charCodeAt(this.state.pos - 1); + const next = this.input.charCodeAt(this.state.pos + 1); + + if (allowedSiblings.indexOf(next) === -1) { + this.raise(this.state.pos, ErrorMessages.UnexpectedNumericSeparator); + } else if (forbiddenSiblings.indexOf(prev) > -1 || forbiddenSiblings.indexOf(next) > -1 || Number.isNaN(next)) { + this.raise(this.state.pos, ErrorMessages.UnexpectedNumericSeparator); + } + + if (!allowNumSeparator) { + this.raise(this.state.pos, ErrorMessages.NumericSeparatorInEscapeSequence); + } + + ++this.state.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 (this.options.errorRecovery && val <= 9) { + val = 0; + this.raise(this.state.start + i + 2, ErrorMessages.InvalidDigit, radix); + } else if (forceLen) { + val = 0; + invalid = true; + } else { + break; + } + } + + ++this.state.pos; + total = total * radix + val; + } + + if (this.state.pos === start || len != null && this.state.pos - start !== len || invalid) { + return null; + } + + return total; + } + + readRadixNumber(radix) { + const start = this.state.pos; + let isBigInt = false; + this.state.pos += 2; + const val = this.readInt(radix); + + if (val == null) { + this.raise(this.state.start + 2, ErrorMessages.InvalidDigit, radix); + } + + const next = this.input.charCodeAt(this.state.pos); + + if (next === 110) { + ++this.state.pos; + isBigInt = true; + } else if (next === 109) { + throw this.raise(start, ErrorMessages.InvalidDecimal); + } + + if (isIdentifierStart(this.codePointAtPos(this.state.pos))) { + throw this.raise(this.state.pos, ErrorMessages.NumberIdentifier); + } + + if (isBigInt) { + const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, ""); + this.finishToken(125, str); + return; + } + + this.finishToken(124, val); + } + + readNumber(startsWithDot) { + const start = this.state.pos; + let isFloat = false; + let isBigInt = false; + let isDecimal = false; + let hasExponent = false; + let isOctal = false; + + if (!startsWithDot && this.readInt(10) === null) { + this.raise(start, ErrorMessages.InvalidNumber); + } + + 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(start, ErrorMessages.StrictOctalLiteral); + + if (!this.state.strict) { + const underscorePos = integer.indexOf("_"); + + if (underscorePos > 0) { + this.raise(underscorePos + start, ErrorMessages.ZeroDigitNumericSeparator); + } + } + + 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(start, ErrorMessages.InvalidOrMissingExponent); + } + + isFloat = true; + hasExponent = true; + next = this.input.charCodeAt(this.state.pos); + } + + if (next === 110) { + if (isFloat || hasLeadingZero) { + this.raise(start, ErrorMessages.InvalidBigIntLiteral); + } + + ++this.state.pos; + isBigInt = true; + } + + if (next === 109) { + this.expectPlugin("decimal", this.state.pos); + + if (hasExponent || hasLeadingZero) { + this.raise(start, ErrorMessages.InvalidDecimal); + } + + ++this.state.pos; + isDecimal = true; + } + + if (isIdentifierStart(this.codePointAtPos(this.state.pos))) { + throw this.raise(this.state.pos, ErrorMessages.NumberIdentifier); + } + + const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, ""); + + if (isBigInt) { + this.finishToken(125, str); + return; + } + + if (isDecimal) { + this.finishToken(126, str); + return; + } + + const val = isOctal ? parseInt(str, 8) : parseFloat(str); + this.finishToken(124, val); + } + + readCodePoint(throwOnInvalid) { + const ch = this.input.charCodeAt(this.state.pos); + let code; + + if (ch === 123) { + const codePos = ++this.state.pos; + code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos, true, throwOnInvalid); + ++this.state.pos; + + if (code !== null && code > 0x10ffff) { + if (throwOnInvalid) { + this.raise(codePos, ErrorMessages.InvalidCodePoint); + } else { + return null; + } + } + } else { + code = this.readHexChar(4, false, throwOnInvalid); + } + + return code; + } + + readString(quote) { + let out = "", + chunkStart = ++this.state.pos; + + for (;;) { + if (this.state.pos >= this.length) { + throw this.raise(this.state.start, ErrorMessages.UnterminatedString); + } + + const ch = this.input.charCodeAt(this.state.pos); + if (ch === quote) break; + + if (ch === 92) { + out += this.input.slice(chunkStart, this.state.pos); + out += this.readEscapedChar(false); + chunkStart = this.state.pos; + } else if (ch === 8232 || ch === 8233) { + ++this.state.pos; + ++this.state.curLine; + this.state.lineStart = this.state.pos; + } else if (isNewLine(ch)) { + throw this.raise(this.state.start, ErrorMessages.UnterminatedString); + } else { + ++this.state.pos; + } + } + + out += this.input.slice(chunkStart, this.state.pos++); + this.finishToken(123, out); + } + + readTmplToken() { + let out = "", + chunkStart = this.state.pos, + containsInvalid = false; + + for (;;) { + if (this.state.pos >= this.length) { + throw this.raise(this.state.start, ErrorMessages.UnterminatedTemplate); + } + + const ch = this.input.charCodeAt(this.state.pos); + + if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) { + if (this.state.pos === this.state.start && this.match(20)) { + if (ch === 36) { + this.state.pos += 2; + this.finishToken(23); + return; + } else { + ++this.state.pos; + this.finishToken(22); + return; + } + } + + out += this.input.slice(chunkStart, this.state.pos); + this.finishToken(20, containsInvalid ? null : out); + return; + } + + if (ch === 92) { + out += this.input.slice(chunkStart, this.state.pos); + const escaped = this.readEscapedChar(true); + + if (escaped === null) { + containsInvalid = true; + } else { + out += escaped; + } + + chunkStart = this.state.pos; + } else if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.state.pos); + ++this.state.pos; + + switch (ch) { + case 13: + if (this.input.charCodeAt(this.state.pos) === 10) { + ++this.state.pos; + } + + case 10: + out += "\n"; + break; + + default: + out += String.fromCharCode(ch); + break; + } + + ++this.state.curLine; + this.state.lineStart = this.state.pos; + chunkStart = this.state.pos; + } else { + ++this.state.pos; + } + } + } + + recordStrictModeErrors(pos, message) { + if (this.state.strict && !this.state.strictErrors.has(pos)) { + this.raise(pos, message); + } else { + this.state.strictErrors.set(pos, message); + } + } + + readEscapedChar(inTemplate) { + const throwOnInvalid = !inTemplate; + const ch = this.input.charCodeAt(++this.state.pos); + ++this.state.pos; + + switch (ch) { + case 110: + return "\n"; + + case 114: + return "\r"; + + case 120: + { + const code = this.readHexChar(2, false, throwOnInvalid); + return code === null ? null : String.fromCharCode(code); + } + + case 117: + { + const code = this.readCodePoint(throwOnInvalid); + return code === null ? null : String.fromCodePoint(code); + } + + case 116: + return "\t"; + + case 98: + return "\b"; + + case 118: + return "\u000b"; + + case 102: + return "\f"; + + case 13: + if (this.input.charCodeAt(this.state.pos) === 10) { + ++this.state.pos; + } + + case 10: + this.state.lineStart = this.state.pos; + ++this.state.curLine; + + case 8232: + case 8233: + return ""; + + case 56: + case 57: + if (inTemplate) { + return null; + } else { + this.recordStrictModeErrors(this.state.pos - 1, ErrorMessages.StrictNumericEscape); + } + + default: + if (ch >= 48 && ch <= 55) { + const codePos = this.state.pos - 1; + const match = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/); + let octalStr = match[0]; + let octal = parseInt(octalStr, 8); + + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } + + this.state.pos += octalStr.length - 1; + const next = this.input.charCodeAt(this.state.pos); + + if (octalStr !== "0" || next === 56 || next === 57) { + if (inTemplate) { + return null; + } else { + this.recordStrictModeErrors(codePos, ErrorMessages.StrictNumericEscape); + } + } + + return String.fromCharCode(octal); + } + + return String.fromCharCode(ch); + } + } + + readHexChar(len, forceLen, throwOnInvalid) { + const codePos = this.state.pos; + const n = this.readInt(16, len, forceLen, false); + + if (n === null) { + if (throwOnInvalid) { + this.raise(codePos, ErrorMessages.InvalidEscapeSequence); + } else { + this.state.pos = codePos - 1; + } + } + + return n; + } + + 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.pos; + const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar; + + if (this.input.charCodeAt(++this.state.pos) !== 117) { + this.raise(this.state.pos, ErrorMessages.MissingUnicodeEscape); + chunkStart = this.state.pos - 1; + continue; + } + + ++this.state.pos; + const esc = this.readCodePoint(true); + + if (esc !== null) { + if (!identifierCheck(esc)) { + this.raise(escStart, ErrorMessages.EscapedCharNotAnIdentifier); + } + + 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(122, word); + } + } + + checkKeywordEscapes() { + const { + type + } = this.state; + + if (tokenIsKeyword(type) && this.state.containsEsc) { + this.raise(this.state.start, ErrorMessages.InvalidEscapedReservedWord, tokenLabelName(type)); + } + } + + updateContext(prevType) { + const { + context, + type + } = this.state; + + switch (type) { + case 8: + context.pop(); + break; + + case 5: + case 7: + case 23: + context.push(types.brace); + break; + + case 22: + if (context[context.length - 1] === types.template) { + context.pop(); + } else { + context.push(types.template); + } + + break; + } + } + +} + +class ClassScope { + constructor() { + this.privateNames = new Set(); + this.loneAccessors = new Map(); + this.undefinedPrivateNames = new Map(); + } + +} +class ClassScopeHandler { + constructor(raise) { + this.stack = []; + this.undefinedPrivateNames = new Map(); + this.raise = raise; + } + + 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, pos] of Array.from(oldClassScope.undefinedPrivateNames)) { + if (current) { + if (!current.undefinedPrivateNames.has(name)) { + current.undefinedPrivateNames.set(name, pos); + } + } else { + this.raise(pos, ErrorMessages.InvalidPrivateFieldResolution, name); + } + } + } + + declarePrivateName(name, elementType, pos) { + const classScope = this.current(); + let redefined = classScope.privateNames.has(name); + + if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) { + const accessor = redefined && classScope.loneAccessors.get(name); + + if (accessor) { + const oldStatic = accessor & CLASS_ELEMENT_FLAG_STATIC; + const newStatic = elementType & CLASS_ELEMENT_FLAG_STATIC; + const oldKind = accessor & CLASS_ELEMENT_KIND_ACCESSOR; + const newKind = elementType & CLASS_ELEMENT_KIND_ACCESSOR; + redefined = oldKind === newKind || oldStatic !== newStatic; + if (!redefined) classScope.loneAccessors.delete(name); + } else if (!redefined) { + classScope.loneAccessors.set(name, elementType); + } + } + + if (redefined) { + this.raise(pos, ErrorMessages.PrivateNameRedeclaration, name); + } + + classScope.privateNames.add(name); + classScope.undefinedPrivateNames.delete(name); + } + + usePrivateName(name, pos) { + let classScope; + + for (classScope of this.stack) { + if (classScope.privateNames.has(name)) return; + } + + if (classScope) { + classScope.undefinedPrivateNames.set(name, pos); + } else { + this.raise(pos, ErrorMessages.InvalidPrivateFieldResolution, name); + } + } + +} + +const kExpression = 0, + kMaybeArrowParameterDeclaration = 1, + kMaybeAsyncArrowParameterDeclaration = 2, + kParameterDeclaration = 3; + +class ExpressionScope { + constructor(type = kExpression) { + this.type = void 0; + this.type = type; + } + + canBeArrowParameterDeclaration() { + return this.type === kMaybeAsyncArrowParameterDeclaration || this.type === kMaybeArrowParameterDeclaration; + } + + isCertainlyParameterDeclaration() { + return this.type === kParameterDeclaration; + } + +} + +class ArrowHeadParsingScope extends ExpressionScope { + constructor(type) { + super(type); + this.errors = new Map(); + } + + recordDeclarationError(pos, template) { + this.errors.set(pos, template); + } + + clearDeclarationError(pos) { + this.errors.delete(pos); + } + + iterateErrors(iterator) { + this.errors.forEach(iterator); + } + +} + +class ExpressionScopeHandler { + constructor(raise) { + this.stack = [new ExpressionScope()]; + this.raise = raise; + } + + enter(scope) { + this.stack.push(scope); + } + + exit() { + this.stack.pop(); + } + + recordParameterInitializerError(pos, template) { + const { + stack + } = this; + let i = stack.length - 1; + let scope = stack[i]; + + while (!scope.isCertainlyParameterDeclaration()) { + if (scope.canBeArrowParameterDeclaration()) { + scope.recordDeclarationError(pos, template); + } else { + return; + } + + scope = stack[--i]; + } + + this.raise(pos, template); + } + + recordParenthesizedIdentifierError(pos, template) { + const { + stack + } = this; + const scope = stack[stack.length - 1]; + + if (scope.isCertainlyParameterDeclaration()) { + this.raise(pos, template); + } else if (scope.canBeArrowParameterDeclaration()) { + scope.recordDeclarationError(pos, template); + } else { + return; + } + } + + recordAsyncArrowParametersError(pos, template) { + const { + stack + } = this; + let i = stack.length - 1; + let scope = stack[i]; + + while (scope.canBeArrowParameterDeclaration()) { + if (scope.type === kMaybeAsyncArrowParameterDeclaration) { + scope.recordDeclarationError(pos, template); + } + + scope = stack[--i]; + } + } + + validateAsPattern() { + const { + stack + } = this; + const currentScope = stack[stack.length - 1]; + if (!currentScope.canBeArrowParameterDeclaration()) return; + currentScope.iterateErrors((template, pos) => { + this.raise(pos, template); + let i = stack.length - 2; + let scope = stack[i]; + + while (scope.canBeArrowParameterDeclaration()) { + scope.clearDeclarationError(pos); + scope = stack[--i]; + } + }); + } + +} +function newParameterDeclarationScope() { + return new ExpressionScope(kParameterDeclaration); +} +function newArrowHeadScope() { + return new ArrowHeadParsingScope(kMaybeArrowParameterDeclaration); +} +function newAsyncArrowScope() { + return new ArrowHeadParsingScope(kMaybeAsyncArrowParameterDeclaration); +} +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, val) { + if (!node) return; + const extra = node.extra = node.extra || {}; + extra[key] = val; + } + + 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, template) { + if (!this.eatContextual(token)) this.unexpected(null, template); + } + + canInsertSemicolon() { + return this.match(129) || this.match(8) || this.hasPrecedingLineBreak(); + } + + hasPrecedingLineBreak() { + return lineBreak.test(this.input.slice(this.state.lastTokEnd, 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(this.state.lastTokEnd, ErrorMessages.MissingSemicolon); + } + + expect(type, pos) { + this.eat(type) || this.unexpected(pos, type); + } + + assertNoSpace(message = "Unexpected space.") { + if (this.state.start > this.state.lastTokEnd) { + this.raise(this.state.lastTokEnd, { + code: ErrorCodes.SyntaxError, + reasonCode: "UnexpectedSpace", + template: message + }); + } + } + + unexpected(pos, messageOrType = { + code: ErrorCodes.SyntaxError, + reasonCode: "UnexpectedToken", + template: "Unexpected token" + }) { + if (isTokenType(messageOrType)) { + messageOrType = { + code: ErrorCodes.SyntaxError, + reasonCode: "UnexpectedToken", + template: `Unexpected token, expected "${tokenLabelName(messageOrType)}"` + }; + } + + throw this.raise(pos != null ? pos : this.state.start, messageOrType); + } + + expectPlugin(name, pos) { + if (!this.hasPlugin(name)) { + throw this.raiseWithData(pos != null ? pos : this.state.start, { + missingPlugin: [name] + }, `This experimental syntax requires enabling the parser plugin: '${name}'`); + } + + return true; + } + + expectOnePlugin(names, pos) { + if (!names.some(n => this.hasPlugin(n))) { + throw this.raiseWithData(pos != null ? pos : this.state.start, { + missingPlugin: names + }, `This experimental syntax requires enabling one of the following parser plugin(s): '${names.join(", ")}'`); + } + } + + 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 { + shorthandAssign, + doubleProto, + optionalParameters + } = refExpressionErrors; + const hasErrors = shorthandAssign + doubleProto + optionalParameters > -3; + + if (!andThrow) { + return hasErrors; + } else if (hasErrors) { + if (shorthandAssign >= 0) { + this.unexpected(shorthandAssign); + } + + if (doubleProto >= 0) { + this.raise(doubleProto, ErrorMessages.DuplicateProto); + } + + if (optionalParameters >= 0) { + this.unexpected(optionalParameters); + } + } + } + + 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); + } + + isOptionalChain(node) { + return node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression"; + } + + 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.raise.bind(this), this.inModule); + const oldProdParam = this.prodParam; + this.prodParam = new ProductionParameterHandler(); + const oldClassScope = this.classScope; + this.classScope = new ClassScopeHandler(this.raise.bind(this)); + const oldExpressionScope = this.expressionScope; + this.expressionScope = new ExpressionScopeHandler(this.raise.bind(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(SCOPE_PROGRAM); + this.prodParam.enter(paramFlags); + } + +} +class ExpressionErrors { + constructor() { + this.shorthandAssign = -1; + this.doubleProto = -1; + this.optionalParameters = -1; + } + +} + +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(); + 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 = "StringLiteral"; + cloned.start = start; + cloned.end = end; + cloned.loc = loc; + cloned.range = range; + 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(pos, loc) { + return new Node(this, pos, loc); + } + + startNodeAtNode(type) { + return this.startNodeAt(type.start, type.loc.start); + } + + finishNode(node, type) { + return this.finishNodeAt(node, type, this.state.lastTokEnd, this.state.lastTokEndLoc); + } + + finishNodeAt(node, type, pos, loc) { + + node.type = type; + node.end = pos; + node.loc.end = loc; + if (this.options.ranges) node.range[1] = pos; + if (this.options.attachComment) this.processComment(node); + return node; + } + + resetStartLocation(node, start, startLoc) { + node.start = start; + node.loc.start = startLoc; + if (this.options.ranges) node.range[0] = start; + } + + resetEndLocation(node, end = this.state.lastTokEnd, endLoc = this.state.lastTokEndLoc) { + node.end = end; + node.loc.end = endLoc; + if (this.options.ranges) node.range[1] = end; + } + + resetStartLocationFromNode(node, locationNode) { + this.resetStartLocation(node, locationNode.start, locationNode.loc.start); + } + +} + +const reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]); +const FlowErrors = makeErrorTemplates({ + 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: "Cannot overwrite reserved type %0.", + 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: "Boolean enum members need to be initialized. Use either `%0 = true,` or `%0 = false,` in enum `%1`.", + EnumDuplicateMemberName: "Enum member names need to be unique, but the name `%0` has already been used before in enum `%1`.", + EnumInconsistentMemberValues: "Enum `%0` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.", + EnumInvalidExplicitType: "Enum type `%1` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `%0`.", + EnumInvalidExplicitTypeUnknownSupplied: "Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `%0`.", + EnumInvalidMemberInitializerPrimaryType: "Enum `%0` has type `%2`, so the initializer of `%1` needs to be a %2 literal.", + EnumInvalidMemberInitializerSymbolType: "Symbol enum members cannot be initialized. Use `%1,` in enum `%0`.", + EnumInvalidMemberInitializerUnknownType: "The enum member initializer for `%1` needs to be a literal (either a boolean, number, or string) in enum `%0`.", + EnumInvalidMemberName: "Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `%0`, consider using `%1`, in enum `%2`.", + EnumNumberMemberNotInitialized: "Number enum members need to be initialized, e.g. `%1 = 1` in enum `%0`.", + EnumStringMemberInconsistentlyInitailized: "String enum members need to consistently either all use initializers, or use no initializers, in enum `%0`.", + GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.", + 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: "A binding pattern parameter cannot be optional in an implementation signature.", + 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: "Unexpected reserved type %0.", + 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: "`declare export %0` is not supported. Use `%1` instead.", + UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.", + UnterminatedFlowComment: "Unterminated flow-comment." +}, ErrorCodes.SyntaxError, "flow"); + +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"; +} + +function isMaybeDefaultImport(type) { + return tokenIsKeywordOrIdentifier(type) && type !== 91; +} + +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 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 !== 123 && type !== 13 && type !== 26) { + if (this.flowPragma === undefined) { + this.flowPragma = null; + } + } + + return 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"); + } + } + + return 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 moduloPos = this.state.start; + this.next(); + this.expectContextual(101); + + if (this.state.lastTokStart > moduloPos + 1) { + this.raise(moduloPos, FlowErrors.UnexpectedSpaceBetweenModuloChecks); + } + + if (this.eat(10)) { + node.value = this.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(48)) { + this.state.inType = oldInType; + predicate = this.flowParsePredicate(); + } else { + type = this.flowParseType(); + this.state.inType = oldInType; + + if (this.match(48)) { + 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(43)) { + 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, BIND_FLOW_DECLARE_FN, node.id.start); + return this.finishNode(node, "DeclareFunction"); + } + + flowParseDeclare(node, insideModule) { + if (this.match(74)) { + return this.flowParseDeclareClass(node); + } else if (this.match(62)) { + return this.flowParseDeclareFunction(node); + } else if (this.match(68)) { + return this.flowParseDeclareVariable(node); + } else if (this.eatContextual(117)) { + if (this.match(16)) { + return this.flowParseDeclareModuleExports(node); + } else { + if (insideModule) { + this.raise(this.state.lastTokStart, FlowErrors.NestedDeclareModule); + } + + return this.flowParseDeclareModule(node); + } + } else if (this.isContextual(120)) { + return this.flowParseDeclareTypeAlias(node); + } else if (this.isContextual(121)) { + return this.flowParseDeclareOpaqueType(node); + } else if (this.isContextual(119)) { + return this.flowParseDeclareInterface(node); + } else if (this.match(76)) { + return this.flowParseDeclareExportDeclaration(node, insideModule); + } else { + throw this.unexpected(); + } + } + + flowParseDeclareVariable(node) { + this.next(); + node.id = this.flowParseTypeAnnotatableIdentifier(true); + this.scope.declareName(node.id.name, BIND_VAR, node.id.start); + this.semicolon(); + return this.finishNode(node, "DeclareVariable"); + } + + flowParseDeclareModule(node) { + this.scope.enter(SCOPE_OTHER); + + if (this.match(123)) { + node.id = this.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(77)) { + this.next(); + + if (!this.isContextual(120) && !this.match(81)) { + this.raise(this.state.lastTokStart, FlowErrors.InvalidNonTypeImportInDeclareModule); + } + + this.parseImport(bodyNode); + } else { + this.expectContextual(115, 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(bodyElement.start, FlowErrors.AmbiguousDeclareModuleKind); + } + + kind = "ES"; + } else if (bodyElement.type === "DeclareModuleExports") { + if (hasModuleExport) { + this.raise(bodyElement.start, FlowErrors.DuplicateDeclareModuleExports); + } + + if (kind === "ES") { + this.raise(bodyElement.start, FlowErrors.AmbiguousDeclareModuleKind); + } + + kind = "CommonJS"; + hasModuleExport = true; + } + }); + node.kind = kind || "CommonJS"; + return this.finishNode(node, "DeclareModule"); + } + + flowParseDeclareExportDeclaration(node, insideModule) { + this.expect(76); + + if (this.eat(59)) { + if (this.match(62) || this.match(74)) { + 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(69) || this.isLet() || (this.isContextual(120) || this.isContextual(119)) && !insideModule) { + const label = this.state.value; + const suggestion = exportSuggestions[label]; + throw this.raise(this.state.start, FlowErrors.UnsupportedDeclareExportKind, label, suggestion); + } + + if (this.match(68) || this.match(62) || this.match(74) || this.isContextual(121)) { + node.declaration = this.flowParseDeclare(this.startNode()); + node.default = false; + return this.finishNode(node, "DeclareExportDeclaration"); + } else if (this.match(49) || this.match(5) || this.isContextual(119) || this.isContextual(120) || this.isContextual(121)) { + node = this.parseExport(node); + + if (node.type === "ExportNamedDeclaration") { + node.type = "ExportDeclaration"; + node.default = false; + delete node.exportKind; + } + + node.type = "Declare" + node.type; + return node; + } + } + + throw this.unexpected(); + } + + flowParseDeclareModuleExports(node) { + this.next(); + this.expectContextual(102); + node.typeAnnotation = this.flowParseTypeAnnotation(); + this.semicolon(); + return this.finishNode(node, "DeclareModuleExports"); + } + + flowParseDeclareTypeAlias(node) { + this.next(); + this.flowParseTypeAlias(node); + node.type = "DeclareTypeAlias"; + return node; + } + + flowParseDeclareOpaqueType(node) { + this.next(); + this.flowParseOpaqueType(node, true); + node.type = "DeclareOpaqueType"; + return node; + } + + flowParseDeclareInterface(node) { + this.next(); + this.flowParseInterfaceish(node); + return this.finishNode(node, "DeclareInterface"); + } + + flowParseInterfaceish(node, isClass = false) { + node.id = this.flowParseRestrictedIdentifier(!isClass, true); + this.scope.declareName(node.id.name, isClass ? BIND_FUNCTION : BIND_LEXICAL, node.id.start); + + if (this.match(43)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } else { + node.typeParameters = null; + } + + node.extends = []; + node.implements = []; + node.mixins = []; + + if (this.eat(75)) { + do { + node.extends.push(this.flowParseInterfaceExtends()); + } while (!isClass && this.eat(12)); + } + + if (this.isContextual(108)) { + this.next(); + + do { + node.mixins.push(this.flowParseInterfaceExtends()); + } while (this.eat(12)); + } + + if (this.isContextual(104)) { + this.next(); + + 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(43)) { + node.typeParameters = this.flowParseTypeParameterInstantiation(); + } else { + node.typeParameters = null; + } + + return this.finishNode(node, "InterfaceExtends"); + } + + flowParseInterface(node) { + this.flowParseInterfaceish(node); + return this.finishNode(node, "InterfaceDeclaration"); + } + + checkNotUnderscore(word) { + if (word === "_") { + this.raise(this.state.start, FlowErrors.UnexpectedReservedUnderscore); + } + } + + checkReservedType(word, startLoc, declaration) { + if (!reservedTypes.has(word)) return; + this.raise(startLoc, declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, word); + } + + flowParseRestrictedIdentifier(liberal, declaration) { + this.checkReservedType(this.state.value, this.state.start, declaration); + return this.parseIdentifier(liberal); + } + + flowParseTypeAlias(node) { + node.id = this.flowParseRestrictedIdentifier(false, true); + this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start); + + if (this.match(43)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } else { + node.typeParameters = null; + } + + node.right = this.flowParseTypeInitialiser(27); + this.semicolon(); + return this.finishNode(node, "TypeAlias"); + } + + flowParseOpaqueType(node, declare) { + this.expectContextual(120); + node.id = this.flowParseRestrictedIdentifier(true, true); + this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start); + + if (this.match(43)) { + 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(27); + } + + this.semicolon(); + return this.finishNode(node, "OpaqueType"); + } + + flowParseTypeParameter(requireDefault = false) { + const nodeStart = this.state.start; + 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(27)) { + this.eat(27); + node.default = this.flowParseType(); + } else { + if (requireDefault) { + this.raise(nodeStart, FlowErrors.MissingTypeParamDefault); + } + } + + return this.finishNode(node, "TypeParameter"); + } + + flowParseTypeParameterDeclaration() { + const oldInType = this.state.inType; + const node = this.startNode(); + node.params = []; + this.state.inType = true; + + if (this.match(43) || this.match(132)) { + 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(44)) { + this.expect(12); + } + } while (!this.match(44)); + + this.expect(44); + 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(43); + const oldNoAnonFunctionType = this.state.noAnonFunctionType; + this.state.noAnonFunctionType = false; + + while (!this.match(44)) { + node.params.push(this.flowParseType()); + + if (!this.match(44)) { + this.expect(12); + } + } + + this.state.noAnonFunctionType = oldNoAnonFunctionType; + this.expect(44); + 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(43); + + while (!this.match(44)) { + node.params.push(this.flowParseTypeOrImplicitInstantiation()); + + if (!this.match(44)) { + this.expect(12); + } + } + + this.expect(44); + this.state.inType = oldInType; + return this.finishNode(node, "TypeParameterInstantiation"); + } + + flowParseInterfaceType() { + const node = this.startNode(); + this.expectContextual(119); + node.extends = []; + + if (this.eat(75)) { + 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(124) || this.match(123) ? this.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(43) || this.match(10)) { + node.method = true; + node.optional = false; + node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, 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(43)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } + + this.expect(10); + + if (this.match(72)) { + 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 protoStart = null; + let inexactStart = null; + const node = this.startNode(); + + if (allowProto && this.isContextual(109)) { + const lookahead = this.lookahead(); + + if (lookahead.type !== 14 && lookahead.type !== 17) { + this.next(); + protoStart = this.state.start; + allowStatic = false; + } + } + + if (allowStatic && this.isContextual(98)) { + const lookahead = this.lookahead(); + + if (lookahead.type !== 14 && lookahead.type !== 17) { + this.next(); + isStatic = true; + } + } + + const variance = this.flowParseVariance(); + + if (this.eat(0)) { + if (protoStart != null) { + this.unexpected(protoStart); + } + + if (this.eat(0)) { + if (variance) { + this.unexpected(variance.start); + } + + nodeStart.internalSlots.push(this.flowParseObjectTypeInternalSlot(node, isStatic)); + } else { + nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance)); + } + } else if (this.match(10) || this.match(43)) { + if (protoStart != null) { + this.unexpected(protoStart); + } + + if (variance) { + this.unexpected(variance.start); + } + + nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic)); + } else { + let kind = "init"; + + if (this.isContextual(92) || this.isContextual(97)) { + const lookahead = this.lookahead(); + + if (tokenIsLiteralPropertyName(lookahead.type)) { + kind = this.state.value; + this.next(); + } + } + + const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic, protoStart, variance, kind, allowSpread, allowInexact != null ? allowInexact : !exact); + + if (propOrInexact === null) { + inexact = true; + inexactStart = this.state.lastTokStart; + } else { + nodeStart.properties.push(propOrInexact); + } + } + + this.flowObjectTypeSemicolon(); + + if (inexactStart && !this.match(8) && !this.match(9)) { + this.raise(inexactStart, FlowErrors.UnexpectedExplicitInexactInObject); + } + } + + this.expect(endDelim); + + if (allowSpread) { + nodeStart.inexact = inexact; + } + + const out = this.finishNode(nodeStart, "ObjectTypeAnnotation"); + this.state.inType = oldInType; + return out; + } + + flowParseObjectTypeProperty(node, isStatic, protoStart, 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(this.state.lastTokStart, FlowErrors.InexactInsideNonObject); + } else if (!allowInexact) { + this.raise(this.state.lastTokStart, FlowErrors.InexactInsideExact); + } + + if (variance) { + this.raise(variance.start, FlowErrors.InexactVariance); + } + + return null; + } + + if (!allowSpread) { + this.raise(this.state.lastTokStart, FlowErrors.UnexpectedSpreadType); + } + + if (protoStart != null) { + this.unexpected(protoStart); + } + + if (variance) { + this.raise(variance.start, FlowErrors.SpreadVariance); + } + + node.argument = this.flowParseType(); + return this.finishNode(node, "ObjectTypeSpreadProperty"); + } else { + node.key = this.flowParseObjectPropertyKey(); + node.static = isStatic; + node.proto = protoStart != null; + node.kind = kind; + let optional = false; + + if (this.match(43) || this.match(10)) { + node.method = true; + + if (protoStart != null) { + this.unexpected(protoStart); + } + + if (variance) { + this.unexpected(variance.start); + } + + node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start)); + + if (kind === "get" || kind === "set") { + this.flowCheckGetterSetterParams(node); + } + + if (!allowSpread && node.key.name === "constructor" && node.value.this) { + this.raise(node.value.this.start, FlowErrors.ThisParamBannedInConstructor); + } + } 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 start = property.start; + const length = property.value.params.length + (property.value.rest ? 1 : 0); + + if (property.value.this) { + this.raise(property.value.this.start, property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam); + } + + if (length !== paramCount) { + if (property.kind === "get") { + this.raise(start, ErrorMessages.BadGetterArity); + } else { + this.raise(start, ErrorMessages.BadSetterArity); + } + } + + if (property.kind === "set" && property.value.rest) { + this.raise(start, ErrorMessages.BadSetterRestParameter); + } + } + + flowObjectTypeSemicolon() { + if (!this.eat(13) && !this.eat(12) && !this.match(8) && !this.match(9)) { + this.unexpected(); + } + } + + flowParseQualifiedTypeIdentifier(startPos, startLoc, id) { + startPos = startPos || this.state.start; + startLoc = startLoc || this.state.startLoc; + let node = id || this.flowParseRestrictedIdentifier(true); + + while (this.eat(16)) { + const node2 = this.startNodeAt(startPos, startLoc); + node2.qualification = node; + node2.id = this.flowParseRestrictedIdentifier(true); + node = this.finishNode(node2, "QualifiedTypeIdentifier"); + } + + return node; + } + + flowParseGenericType(startPos, startLoc, id) { + const node = this.startNodeAt(startPos, startLoc); + node.typeParameters = null; + node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id); + + if (this.match(43)) { + node.typeParameters = this.flowParseTypeParameterInstantiation(); + } + + return this.finishNode(node, "GenericTypeAnnotation"); + } + + flowParseTypeofType() { + const node = this.startNode(); + this.expect(81); + 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 === 72; + + if (lh.type === 14 || lh.type === 17) { + if (isThis && !first) { + this.raise(node.start, FlowErrors.ThisParamMustBeFirst); + } + + name = this.parseIdentifier(isThis); + + if (this.eat(17)) { + optional = true; + + if (isThis) { + this.raise(node.start, FlowErrors.ThisParamMayNotBeOptional); + } + } + + 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.start, 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(72)) { + _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(startPos, 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(startPos, startLoc, id); + } + } + + flowParsePrimaryType() { + const startPos = this.state.start; + 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 43: + 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(72)) { + 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 123: + return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation"); + + case 79: + case 80: + node.value = this.match(79); + this.next(); + return this.finishNode(node, "BooleanLiteralTypeAnnotation"); + + case 47: + if (this.state.value === "-") { + this.next(); + + if (this.match(124)) { + return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node); + } + + if (this.match(125)) { + return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node); + } + + throw this.raise(this.state.start, FlowErrors.UnexpectedSubtractionOperand); + } + + throw this.unexpected(); + + case 124: + return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation"); + + case 125: + return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation"); + + case 82: + this.next(); + return this.finishNode(node, "VoidTypeAnnotation"); + + case 78: + this.next(); + return this.finishNode(node, "NullLiteralTypeAnnotation"); + + case 72: + this.next(); + return this.finishNode(node, "ThisTypeAnnotation"); + + case 49: + this.next(); + return this.finishNode(node, "ExistsTypeAnnotation"); + + case 81: + 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(119)) { + return this.flowParseInterfaceType(); + } + + return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier()); + } + + } + + throw this.unexpected(); + } + + flowParsePostfixType() { + const startPos = this.state.start; + 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(startPos, 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.start, 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(41); + const type = this.flowParseAnonFunctionWithoutParens(); + node.types = [type]; + + while (this.eat(41)) { + node.types.push(this.flowParseAnonFunctionWithoutParens()); + } + + return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation"); + } + + flowParseUnionType() { + const node = this.startNode(); + this.eat(39); + const type = this.flowParseIntersectionType(); + node.types = [type]; + + while (this.eat(39)) { + 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 === 122 && this.state.value === "_") { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + const node = this.parseIdentifier(); + return this.flowParseGenericType(startPos, 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.end, node.typeAnnotation.loc.end); + return node.expression; + } + + flowParseVariance() { + let variance = null; + + if (this.match(47)) { + variance = this.startNode(); + + if (this.state.value === "+") { + variance.kind = "plus"; + } else { + variance.kind = "minus"; + } + + this.next(); + this.finishNode(variance, "Variance"); + } + + return variance; + } + + parseFunctionBody(node, allowExpressionBody, isMethod = false) { + if (allowExpressionBody) { + return 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; + } + + super.parseFunctionBodyAndFinish(node, type, isMethod); + } + + parseStatement(context, topLevel) { + if (this.state.strict && this.isContextual(119)) { + const lookahead = this.lookahead(); + + if (tokenIsKeywordOrIdentifier(lookahead.type)) { + const node = this.startNode(); + this.next(); + return this.flowParseInterface(node); + } + } else if (this.shouldParseEnums() && this.isContextual(116)) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); + } + + const stmt = super.parseStatement(context, topLevel); + + if (this.flowPragma === undefined && !this.isValidDirective(stmt)) { + this.flowPragma = null; + } + + return stmt; + } + + parseExpressionStatement(node, expr) { + if (expr.type === "Identifier") { + if (expr.name === "declare") { + if (this.match(74) || tokenIsIdentifier(this.state.type) || this.match(62) || this.match(68) || this.match(76)) { + 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); + } + + shouldParseExportDeclaration() { + const { + type + } = this.state; + + if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 116) { + return !this.state.containsEsc; + } + + return super.shouldParseExportDeclaration(); + } + + isExportDefaultSpecifier() { + const { + type + } = this.state; + + if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 116) { + return this.state.containsEsc; + } + + return super.isExportDefaultSpecifier(); + } + + parseExportDefaultExpression() { + if (this.shouldParseEnums() && this.isContextual(116)) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); + } + + return super.parseExportDefaultExpression(); + } + + parseConditional(expr, startPos, 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(startPos, 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(state.start, FlowErrors.AmbiguousConditionalArrow); + } + + 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.trailingComma, false); + this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW); + 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, startPos, startLoc) { + node = super.parseParenItem(node, startPos, startLoc); + + if (this.eat(17)) { + node.optional = true; + this.resetEndLocation(node); + } + + if (this.match(14)) { + const typeCastNode = this.startNodeAt(startPos, 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); + } + + parseExport(node) { + const decl = super.parseExport(node); + + if (decl.type === "ExportNamedDeclaration" || decl.type === "ExportAllDeclaration") { + decl.exportKind = decl.exportKind || "value"; + } + + return decl; + } + + parseExportDeclaration(node) { + if (this.isContextual(120)) { + node.exportKind = "type"; + const declarationNode = this.startNode(); + this.next(); + + if (this.match(5)) { + node.specifiers = this.parseExportSpecifiers(true); + this.parseExportFrom(node); + return null; + } else { + return this.flowParseTypeAlias(declarationNode); + } + } else if (this.isContextual(121)) { + node.exportKind = "type"; + const declarationNode = this.startNode(); + this.next(); + return this.flowParseOpaqueType(declarationNode, false); + } else if (this.isContextual(119)) { + node.exportKind = "type"; + const declarationNode = this.startNode(); + this.next(); + return this.flowParseInterface(declarationNode); + } else if (this.shouldParseEnums() && this.isContextual(116)) { + node.exportKind = "value"; + const declarationNode = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(declarationNode); + } else { + return super.parseExportDeclaration(node); + } + } + + eatExportStar(node) { + if (super.eatExportStar(...arguments)) return true; + + if (this.isContextual(120) && this.lookahead().type === 49) { + node.exportKind = "type"; + this.next(); + this.next(); + return true; + } + + return false; + } + + maybeParseExportNamespaceSpecifier(node) { + const pos = this.state.start; + const hasNamespace = super.maybeParseExportNamespaceSpecifier(node); + + if (hasNamespace && node.exportKind === "type") { + this.unexpected(pos); + } + + return hasNamespace; + } + + parseClassId(node, isStatement, optionalId) { + super.parseClassId(node, isStatement, optionalId); + + if (this.match(43)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } + } + + parseClassMember(classBody, member, state) { + const pos = this.state.start; + + if (this.isContextual(115)) { + if (this.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(pos, FlowErrors.DeclareClassElement); + } else if (member.value) { + this.raise(member.value.start, FlowErrors.DeclareClassFieldInitializer); + } + } + } + + isIterator(word) { + return word === "iterator" || word === "asyncIterator"; + } + + readIterator() { + const word = super.readWord1(); + const fullWord = "@@" + word; + + if (!this.isIterator(word) || !this.state.inType) { + this.raise(this.state.pos, ErrorMessages.InvalidIdentifier, fullWord); + } + + this.finishToken(122, fullWord); + } + + getTokenFromCode(code) { + const next = this.input.charCodeAt(this.state.pos + 1); + + if (code === 123 && next === 124) { + return this.finishOp(6, 2); + } else if (this.state.inType && (code === 62 || code === 60)) { + return this.finishOp(code === 62 ? 44 : 43, 1); + } else if (this.state.inType && code === 63) { + if (next === 46) { + return this.finishOp(18, 2); + } + + return this.finishOp(17, 1); + } else if (isIteratorStart(code, next)) { + this.state.pos += 2; + return this.readIterator(); + } else { + return 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 (node.type === "TypeCastExpression") { + return super.toAssignable(this.typeCastToParameter(node), isLHS); + } else { + return super.toAssignable(node, isLHS); + } + } + + toAssignableList(exprList, trailingCommaPos, 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); + } + } + + return super.toAssignableList(exprList, trailingCommaPos, 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(expr.typeAnnotation.start, FlowErrors.TypeCastInPattern); + } + } + + 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; + } + + checkLVal(expr, ...args) { + if (expr.type !== "TypeCastExpression") { + return super.checkLVal(expr, ...args); + } + } + + 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(43) || 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.start); + } + + delete method.variance; + + if (this.match(43)) { + 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(method.start, FlowErrors.ThisParamBannedInConstructor); + } + } else if (method.type === "MethodDefinition" && isConstructor && method.value.params) { + const params = method.value.params; + + if (params.length > 0 && this.isThisParam(params[0])) { + this.raise(method.start, FlowErrors.ThisParamBannedInConstructor); + } + } + } + + pushClassPrivateMethod(classBody, method, isGenerator, isAsync) { + if (method.variance) { + this.unexpected(method.variance.start); + } + + delete method.variance; + + if (this.match(43)) { + method.typeParameters = this.flowParseTypeParameterDeclaration(); + } + + super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync); + } + + parseClassSuper(node) { + super.parseClassSuper(node); + + if (node.superClass && this.match(43)) { + node.superTypeParameters = this.flowParseTypeParameterInstantiation(); + } + + if (this.isContextual(104)) { + this.next(); + const implemented = node.implements = []; + + do { + const node = this.startNode(); + node.id = this.flowParseRestrictedIdentifier(true); + + if (this.match(43)) { + 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(param.start, FlowErrors.GetterMayNotHaveThisParam); + } else if (this.isThisParam(param)) { + this.raise(param.start, FlowErrors.SetterMayNotHaveThisParam); + } + } + } + + parsePropertyNamePrefixOperator(node) { + node.variance = this.flowParseVariance(); + } + + parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) { + if (prop.variance) { + this.unexpected(prop.variance.start); + } + + delete prop.variance; + let typeParameters; + + if (this.match(43) && !isAccessor) { + typeParameters = this.flowParseTypeParameterDeclaration(); + if (!this.match(10)) this.unexpected(); + } + + super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors); + + if (typeParameters) { + (prop.value || prop).typeParameters = typeParameters; + } + } + + parseAssignableListItemTypes(param) { + if (this.eat(17)) { + if (param.type !== "Identifier") { + this.raise(param.start, FlowErrors.PatternIsOptional); + } + + if (this.isThisParam(param)) { + this.raise(param.start, FlowErrors.ThisParamMayNotBeOptional); + } + + param.optional = true; + } + + if (this.match(14)) { + param.typeAnnotation = this.flowParseTypeAnnotation(); + } else if (this.isThisParam(param)) { + this.raise(param.start, FlowErrors.ThisParamAnnotationRequired); + } + + if (this.match(27) && this.isThisParam(param)) { + this.raise(param.start, FlowErrors.ThisParamNoDefault); + } + + this.resetEndLocation(param); + return param; + } + + parseMaybeDefault(startPos, startLoc, left) { + const node = super.parseMaybeDefault(startPos, startLoc, left); + + if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) { + this.raise(node.typeAnnotation.start, FlowErrors.TypeBeforeInitializer); + } + + return node; + } + + shouldParseDefaultImport(node) { + if (!hasTypeImportKind(node)) { + return super.shouldParseDefaultImport(node); + } + + return isMaybeDefaultImport(this.state.type); + } + + parseImportSpecifierLocal(node, specifier, type, contextDescription) { + specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier(true, true) : this.parseIdentifier(); + this.checkLVal(specifier.local, contextDescription, BIND_LEXICAL); + node.specifiers.push(this.finishNode(specifier, type)); + } + + maybeParseDefaultImportSpecifier(node) { + node.importKind = "value"; + let kind = null; + + if (this.match(81)) { + kind = "typeof"; + } else if (this.isContextual(120)) { + kind = "type"; + } + + if (kind) { + const lh = this.lookahead(); + const { + type + } = lh; + + if (kind === "type" && type === 49) { + this.unexpected(lh.start); + } + + if (isMaybeDefaultImport(type) || type === 5 || type === 49) { + this.next(); + node.importKind = kind; + } + } + + return super.maybeParseDefaultImportSpecifier(node); + } + + parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) { + 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(87) && !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(specifier.start, ErrorMessages.ImportBindingIsString, firstIdent.value); + } + + specifier.imported = firstIdent; + specifier.importKind = null; + } + + if (this.eatContextual(87)) { + specifier.local = this.parseIdentifier(); + } else { + isBinding = true; + specifier.local = cloneIdentifier(specifier.imported); + } + } + + const specifierIsTypeImport = hasTypeImportKind(specifier); + + if (isInTypeOnlyImport && specifierIsTypeImport) { + this.raise(specifier.start, FlowErrors.ImportTypeShorthandOnlyInPureImport); + } + + if (isInTypeOnlyImport || specifierIsTypeImport) { + this.checkReservedType(specifier.local.name, specifier.local.start, true); + } + + if (isBinding && !isInTypeOnlyImport && !specifierIsTypeImport) { + this.checkReservedWord(specifier.local.name, specifier.start, true, true); + } + + this.checkLVal(specifier.local, "import specifier", BIND_LEXICAL); + return this.finishNode(specifier, "ImportSpecifier"); + } + + parseBindingAtom() { + switch (this.state.type) { + case 72: + return this.parseIdentifier(true); + + default: + return super.parseBindingAtom(); + } + } + + parseFunctionParams(node, allowModifiers) { + const kind = node.kind; + + if (kind !== "get" && kind !== "set" && this.match(43)) { + node.typeParameters = this.flowParseTypeParameterDeclaration(); + } + + super.parseFunctionParams(node, allowModifiers); + } + + 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(132) || this.match(43))) { + state = this.state.clone(); + jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state); + if (!jsx.error) return jsx.node; + const { + context + } = this.state; + const curContext = context[context.length - 1]; + + if (curContext === types.j_oTag) { + context.length -= 2; + } else if (curContext === types.j_expr) { + context.length -= 1; + } + } + + if ((_jsx = jsx) != null && _jsx.error || this.match(43)) { + 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(typeParameters.start, FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction); + } + + 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(typeParameters.start, FlowErrors.UnexpectedTokenAfterTypeParameter); + } + + 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) { + 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(node.params[i].start, FlowErrors.ThisParamMustBeFirst); + } + } + + return super.checkParams(...arguments); + } + + parseParenAndDistinguishExpression(canBeArrow) { + return super.parseParenAndDistinguishExpression(canBeArrow && this.state.noArrowAt.indexOf(this.state.start) === -1); + } + + parseSubscripts(base, startPos, startLoc, noCalls) { + if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.indexOf(startPos) !== -1) { + this.next(); + const node = this.startNodeAt(startPos, startLoc); + node.callee = base; + node.arguments = this.parseCallExpressionArguments(11, false); + base = this.finishNode(node, "CallExpression"); + } else if (base.type === "Identifier" && base.name === "async" && this.match(43)) { + const state = this.state.clone(); + const arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startPos, startLoc) || abort(), state); + if (!arrow.error && !arrow.aborted) return arrow.node; + const result = this.tryParse(() => super.parseSubscripts(base, startPos, 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, startPos, startLoc, noCalls); + } + + parseSubscript(base, startPos, 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(startPos, 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(43)) { + const node = this.startNodeAt(startPos, startLoc); + node.callee = base; + const result = this.tryParse(() => { + node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew(); + this.expect(10); + node.arguments = this.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, startPos, startLoc, noCalls, subscriptState); + } + + parseNewArguments(node) { + let targs = null; + + if (this.shouldParseTypes() && this.match(43)) { + targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node; + } + + node.typeArguments = targs; + super.parseNewArguments(node); + } + + parseAsyncArrowWithTypeParameters(startPos, startLoc) { + const node = this.startNodeAt(startPos, startLoc); + this.parseFunctionParams(node); + if (!this.parseArrow(node)) return; + return this.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(this.state.pos, FlowErrors.UnterminatedFlowComment); + } + + return fileNode; + } + + skipBlockComment() { + if (this.hasPlugin("flowComments") && this.skipFlowComment()) { + if (this.state.hasFlowComment) { + this.unexpected(null, FlowErrors.NestedFlowComment); + } + + this.hasFlowCommentCompletion(); + this.state.pos += this.skipFlowComment(); + this.state.hasFlowComment = true; + return; + } + + if (this.state.hasFlowComment) { + const end = this.input.indexOf("*-/", this.state.pos += 2); + + if (end === -1) { + throw this.raise(this.state.pos - 2, ErrorMessages.UnterminatedComment); + } + + this.state.pos = end + 3; + return; + } + + return super.skipBlockComment(); + } + + 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(this.state.pos, ErrorMessages.UnterminatedComment); + } + } + + flowEnumErrorBooleanMemberNotInitialized(pos, { + enumName, + memberName + }) { + this.raise(pos, FlowErrors.EnumBooleanMemberNotInitialized, memberName, enumName); + } + + flowEnumErrorInvalidMemberName(pos, { + enumName, + memberName + }) { + const suggestion = memberName[0].toUpperCase() + memberName.slice(1); + this.raise(pos, FlowErrors.EnumInvalidMemberName, memberName, suggestion, enumName); + } + + flowEnumErrorDuplicateMemberName(pos, { + enumName, + memberName + }) { + this.raise(pos, FlowErrors.EnumDuplicateMemberName, memberName, enumName); + } + + flowEnumErrorInconsistentMemberValues(pos, { + enumName + }) { + this.raise(pos, FlowErrors.EnumInconsistentMemberValues, enumName); + } + + flowEnumErrorInvalidExplicitType(pos, { + enumName, + suppliedType + }) { + return this.raise(pos, suppliedType === null ? FlowErrors.EnumInvalidExplicitTypeUnknownSupplied : FlowErrors.EnumInvalidExplicitType, enumName, suppliedType); + } + + flowEnumErrorInvalidMemberInitializer(pos, { + enumName, + explicitType, + memberName + }) { + let message = null; + + switch (explicitType) { + case "boolean": + case "number": + case "string": + message = FlowErrors.EnumInvalidMemberInitializerPrimaryType; + break; + + case "symbol": + message = FlowErrors.EnumInvalidMemberInitializerSymbolType; + break; + + default: + message = FlowErrors.EnumInvalidMemberInitializerUnknownType; + } + + return this.raise(pos, message, enumName, memberName, explicitType); + } + + flowEnumErrorNumberMemberNotInitialized(pos, { + enumName, + memberName + }) { + this.raise(pos, FlowErrors.EnumNumberMemberNotInitialized, enumName, memberName); + } + + flowEnumErrorStringMemberInconsistentlyInitailized(pos, { + enumName + }) { + this.raise(pos, FlowErrors.EnumStringMemberInconsistentlyInitailized, enumName); + } + + flowEnumMemberInit() { + const startPos = this.state.start; + + const endOfInit = () => this.match(12) || this.match(8); + + switch (this.state.type) { + case 124: + { + const literal = this.parseNumericLiteral(this.state.value); + + if (endOfInit()) { + return { + type: "number", + pos: literal.start, + value: literal + }; + } + + return { + type: "invalid", + pos: startPos + }; + } + + case 123: + { + const literal = this.parseStringLiteral(this.state.value); + + if (endOfInit()) { + return { + type: "string", + pos: literal.start, + value: literal + }; + } + + return { + type: "invalid", + pos: startPos + }; + } + + case 79: + case 80: + { + const literal = this.parseBooleanLiteral(this.match(79)); + + if (endOfInit()) { + return { + type: "boolean", + pos: literal.start, + value: literal + }; + } + + return { + type: "invalid", + pos: startPos + }; + } + + default: + return { + type: "invalid", + pos: startPos + }; + } + } + + flowEnumMemberRaw() { + const pos = this.state.start; + const id = this.parseIdentifier(true); + const init = this.eat(27) ? this.flowEnumMemberInit() : { + type: "none", + pos + }; + return { + id, + init + }; + } + + flowEnumCheckExplicitTypeMismatch(pos, context, expectedType) { + const { + explicitType + } = context; + + if (explicitType === null) { + return; + } + + if (explicitType !== expectedType) { + this.flowEnumErrorInvalidMemberInitializer(pos, 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.flowEnumErrorInvalidMemberName(id.start, { + enumName, + memberName + }); + } + + if (seenNames.has(memberName)) { + this.flowEnumErrorDuplicateMemberName(id.start, { + enumName, + memberName + }); + } + + seenNames.add(memberName); + const context = { + enumName, + explicitType, + memberName + }; + memberNode.id = id; + + switch (init.type) { + case "boolean": + { + this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "boolean"); + memberNode.init = init.value; + members.booleanMembers.push(this.finishNode(memberNode, "EnumBooleanMember")); + break; + } + + case "number": + { + this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "number"); + memberNode.init = init.value; + members.numberMembers.push(this.finishNode(memberNode, "EnumNumberMember")); + break; + } + + case "string": + { + this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "string"); + memberNode.init = init.value; + members.stringMembers.push(this.finishNode(memberNode, "EnumStringMember")); + break; + } + + case "invalid": + { + throw this.flowEnumErrorInvalidMemberInitializer(init.pos, context); + } + + case "none": + { + switch (explicitType) { + case "boolean": + this.flowEnumErrorBooleanMemberNotInitialized(init.pos, context); + break; + + case "number": + this.flowEnumErrorNumberMemberNotInitialized(init.pos, 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.flowEnumErrorStringMemberInconsistentlyInitailized(member.start, { + enumName + }); + } + + return defaultedMembers; + } else { + for (const member of defaultedMembers) { + this.flowEnumErrorStringMemberInconsistentlyInitailized(member.start, { + enumName + }); + } + + return initializedMembers; + } + } + + flowEnumParseExplicitType({ + enumName + }) { + if (this.eatContextual(95)) { + if (!tokenIsIdentifier(this.state.type)) { + throw this.flowEnumErrorInvalidExplicitType(this.state.start, { + enumName, + suppliedType: null + }); + } + + const { + value + } = this.state; + this.next(); + + if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") { + this.flowEnumErrorInvalidExplicitType(this.state.start, { + enumName, + suppliedType: value + }); + } + + return value; + } + + return null; + } + + flowEnumBody(node, { + enumName, + nameLoc + }) { + 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.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.start, { + enumName, + memberName: member.id.name + }); + } + + node.members = members.numberMembers; + this.expect(8); + return this.finishNode(node, "EnumNumberBody"); + } else { + this.flowEnumErrorInconsistentMemberValues(nameLoc, { + enumName + }); + return empty(); + } + } + } + } + + flowParseEnumDeclaration(node) { + const id = this.parseIdentifier(); + node.id = id; + node.body = this.flowEnumBody(this.startNode(), { + enumName: id.name, + nameLoc: id.start + }); + 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 = { + 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 HEX_NUMBER = /^[\da-fA-F]+$/; +const DECIMAL_NUMBER = /^\d+$/; +const JsxErrors = makeErrorTemplates({ + AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.", + MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>.", + MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.", + UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?", + 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 <>...?" +}, ErrorCodes.SyntaxError, "jsx"); +types.j_oTag = new TokContext("...", true); + +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 extends superClass { + jsxReadToken() { + let out = ""; + let chunkStart = this.state.pos; + + for (;;) { + if (this.state.pos >= this.length) { + throw this.raise(this.state.start, JsxErrors.UnterminatedJsxContent); + } + + 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; + return this.finishToken(132); + } + + return super.getTokenFromCode(ch); + } + + out += this.input.slice(chunkStart, this.state.pos); + return this.finishToken(131, out); + + 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(this.state.start, ErrorMessages.UnterminatedString); + } + + 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++); + return this.finishToken(123, out); + } + + jsxReadEntity() { + let str = ""; + let count = 0; + let entity; + let ch = this.input[this.state.pos]; + const startPos = ++this.state.pos; + + while (this.state.pos < this.length && count++ < 10) { + ch = this.input[this.state.pos++]; + + if (ch === ";") { + if (str[0] === "#") { + if (str[1] === "x") { + str = str.substr(2); + + if (HEX_NUMBER.test(str)) { + entity = String.fromCodePoint(parseInt(str, 16)); + } + } else { + str = str.substr(1); + + if (DECIMAL_NUMBER.test(str)) { + entity = String.fromCodePoint(parseInt(str, 10)); + } + } + } else { + entity = entities[str]; + } + + break; + } + + str += ch; + } + + if (!entity) { + this.state.pos = startPos; + return "&"; + } + + return entity; + } + + jsxReadWord() { + let ch; + const start = this.state.pos; + + do { + ch = this.input.charCodeAt(++this.state.pos); + } while (isIdentifierChar(ch) || ch === 45); + + return this.finishToken(130, this.input.slice(start, this.state.pos)); + } + + jsxParseIdentifier() { + const node = this.startNode(); + + if (this.match(130)) { + 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 startPos = this.state.start; + const startLoc = this.state.startLoc; + const name = this.jsxParseIdentifier(); + if (!this.eat(14)) return name; + const node = this.startNodeAt(startPos, startLoc); + node.namespace = name; + node.name = this.jsxParseIdentifier(); + return this.finishNode(node, "JSXNamespacedName"); + } + + jsxParseElementName() { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + let node = this.jsxParseNamespacedName(); + + if (node.type === "JSXNamespacedName") { + return node; + } + + while (this.eat(16)) { + const newNode = this.startNodeAt(startPos, 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.next(); + node = this.jsxParseExpressionContainer(node); + + if (node.expression.type === "JSXEmptyExpression") { + this.raise(node.start, JsxErrors.AttributeIsEmpty); + } + + return node; + + case 132: + case 123: + return this.parseExprAtom(); + + default: + throw this.raise(this.state.start, JsxErrors.UnsupportedJsxValue); + } + } + + jsxParseEmptyExpression() { + const node = this.startNodeAt(this.state.lastTokEnd, this.state.lastTokEndLoc); + return this.finishNodeAt(node, "JSXEmptyExpression", this.state.start, this.state.startLoc); + } + + jsxParseSpreadChild(node) { + this.next(); + node.expression = this.parseExpression(); + this.expect(8); + return this.finishNode(node, "JSXSpreadChild"); + } + + jsxParseExpressionContainer(node) { + if (this.match(8)) { + node.expression = this.jsxParseEmptyExpression(); + } else { + const expression = this.parseExpression(); + node.expression = expression; + } + + this.expect(8); + return this.finishNode(node, "JSXExpressionContainer"); + } + + jsxParseAttribute() { + const node = this.startNode(); + + if (this.eat(5)) { + this.expect(21); + node.argument = this.parseMaybeAssignAllowIn(); + this.expect(8); + return this.finishNode(node, "JSXSpreadAttribute"); + } + + node.name = this.jsxParseNamespacedName(); + node.value = this.eat(27) ? this.jsxParseAttributeValue() : null; + return this.finishNode(node, "JSXAttribute"); + } + + jsxParseOpeningElementAt(startPos, startLoc) { + const node = this.startNodeAt(startPos, startLoc); + + if (this.match(133)) { + this.expect(133); + return this.finishNode(node, "JSXOpeningFragment"); + } + + node.name = this.jsxParseElementName(); + return this.jsxParseOpeningElementAfterName(node); + } + + jsxParseOpeningElementAfterName(node) { + const attributes = []; + + while (!this.match(50) && !this.match(133)) { + attributes.push(this.jsxParseAttribute()); + } + + node.attributes = attributes; + node.selfClosing = this.eat(50); + this.expect(133); + return this.finishNode(node, "JSXOpeningElement"); + } + + jsxParseClosingElementAt(startPos, startLoc) { + const node = this.startNodeAt(startPos, startLoc); + + if (this.match(133)) { + this.expect(133); + return this.finishNode(node, "JSXClosingFragment"); + } + + node.name = this.jsxParseElementName(); + this.expect(133); + return this.finishNode(node, "JSXClosingElement"); + } + + jsxParseElementAt(startPos, startLoc) { + const node = this.startNodeAt(startPos, startLoc); + const children = []; + const openingElement = this.jsxParseOpeningElementAt(startPos, startLoc); + let closingElement = null; + + if (!openingElement.selfClosing) { + contents: for (;;) { + switch (this.state.type) { + case 132: + startPos = this.state.start; + startLoc = this.state.startLoc; + this.next(); + + if (this.eat(50)) { + closingElement = this.jsxParseClosingElementAt(startPos, startLoc); + break contents; + } + + children.push(this.jsxParseElementAt(startPos, startLoc)); + break; + + case 131: + children.push(this.parseExprAtom()); + break; + + case 5: + { + const node = this.startNode(); + this.next(); + + if (this.match(21)) { + children.push(this.jsxParseSpreadChild(node)); + } else { + children.push(this.jsxParseExpressionContainer(node)); + } + + break; + } + + default: + throw this.unexpected(); + } + } + + if (isFragment(openingElement) && !isFragment(closingElement)) { + this.raise(closingElement.start, JsxErrors.MissingClosingTagFragment); + } else if (!isFragment(openingElement) && isFragment(closingElement)) { + this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, getQualifiedJSXName(openingElement.name)); + } else if (!isFragment(openingElement) && !isFragment(closingElement)) { + if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) { + this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, 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(43)) { + throw this.raise(this.state.start, JsxErrors.UnwrappedAdjacentJSXElements); + } + + return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement"); + } + + jsxParseElement() { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + this.next(); + return this.jsxParseElementAt(startPos, startLoc); + } + + parseExprAtom(refExpressionErrors) { + if (this.match(131)) { + return this.parseLiteral(this.state.value, "JSXText"); + } else if (this.match(132)) { + return this.jsxParseElement(); + } else if (this.match(43) && this.input.charCodeAt(this.state.pos) !== 33) { + this.replaceToken(132); + return this.jsxParseElement(); + } else { + return super.parseExprAtom(refExpressionErrors); + } + } + + getTokenFromCode(code) { + const context = this.curContext(); + + if (context === types.j_expr) { + return this.jsxReadToken(); + } + + if (context === types.j_oTag || context === types.j_cTag) { + if (isIdentifierStart(code)) { + return this.jsxReadWord(); + } + + if (code === 62) { + ++this.state.pos; + return this.finishToken(133); + } + + if ((code === 34 || code === 39) && context === types.j_oTag) { + return this.jsxReadString(code); + } + } + + if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) { + ++this.state.pos; + return this.finishToken(132); + } + + return super.getTokenFromCode(code); + } + + updateContext(prevType) { + super.updateContext(prevType); + const { + context, + type + } = this.state; + + if (type === 50 && prevType === 132) { + context.splice(-2, 2, types.j_cTag); + this.state.canStartJSXElement = false; + } else if (type === 132) { + context.push(types.j_expr, types.j_oTag); + } else if (type === 133) { + const out = context.pop(); + + if (out === types.j_oTag && prevType === 50 || out === types.j_cTag) { + context.pop(); + this.state.canStartJSXElement = context[context.length - 1] === types.j_expr; + } else { + 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 { + createScope(flags) { + return new TypeScriptScope(flags); + } + + declareName(name, bindingType, pos) { + const scope = this.currentScope(); + + if (bindingType & BIND_FLAGS_TS_EXPORT_ONLY) { + this.maybeExportDefined(scope, name); + scope.exportOnlyBindings.add(name); + return; + } + + super.declareName(...arguments); + + if (bindingType & BIND_KIND_TYPE) { + if (!(bindingType & BIND_KIND_VALUE)) { + this.checkRedeclarationInScope(scope, name, bindingType, pos); + this.maybeExportDefined(scope, name); + } + + scope.types.add(name); + } + + if (bindingType & BIND_FLAGS_TS_ENUM) scope.enums.add(name); + if (bindingType & BIND_FLAGS_TS_CONST_ENUM) scope.constEnums.add(name); + if (bindingType & BIND_FLAGS_CLASS) scope.classes.add(name); + } + + isRedeclaredInScope(scope, name, bindingType) { + if (scope.enums.has(name)) { + if (bindingType & BIND_FLAGS_TS_ENUM) { + const isConst = !!(bindingType & BIND_FLAGS_TS_CONST_ENUM); + const wasConst = scope.constEnums.has(name); + return isConst !== wasConst; + } + + return true; + } + + if (bindingType & BIND_FLAGS_CLASS && scope.classes.has(name)) { + if (scope.lexical.has(name)) { + return !!(bindingType & BIND_KIND_VALUE); + } else { + return false; + } + } + + if (bindingType & BIND_KIND_TYPE && scope.types.has(name)) { + return true; + } + + return super.isRedeclaredInScope(...arguments); + } + + checkLocalExport(id) { + const topLevelScope = this.scopeStack[0]; + const { + name + } = id; + + if (!topLevelScope.types.has(name) && !topLevelScope.exportOnlyBindings.has(name)) { + super.checkLocalExport(id); + } + } + +} + +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 = makeErrorTemplates({ + AbstractMethodHasImplementation: "Method '%0' cannot have an implementation because it is marked abstract.", + AbstractPropertyHasInitializer: "Property '%0' 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.", + ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.", + ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.", + ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.", + DeclareAccessor: "'declare' is not allowed in %0ters.", + DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.", + DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.", + DuplicateAccessibilityModifier: "Accessibility modifier already seen.", + DuplicateModifier: "Duplicate modifier: '%0'.", + EmptyHeritageClauseType: "'%0' 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'.", + IncompatibleModifiers: "'%0' modifier cannot be used with '%1' modifier.", + IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.", + IndexSignatureHasAccessibility: "Index signatures cannot have an accessibility modifier ('%0').", + 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.", + InvalidModifierOnTypeMember: "'%0' modifier cannot appear on a type member.", + InvalidModifiersOrder: "'%0' modifier must precede '%1' modifier.", + 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: "Private elements cannot have an accessibility modifier ('%0').", + 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.", + StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.", + 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: "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got %0." +}, ErrorCodes.SyntaxError, "typescript"); + +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"; +} + +var typescript = (superClass => class extends superClass { + getScopeHandler() { + return TypeScriptScopeHandler; + } + + tsIsIdentifier() { + return tokenIsIdentifier(this.state.type); + } + + tsTokenCanFollowModifier() { + return (this.match(0) || this.match(5) || this.match(49) || this.match(21) || this.match(128) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak(); + } + + tsNextTokenCanFollowModifier() { + this.next(); + return this.tsTokenCanFollowModifier(); + } + + tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) { + if (!tokenIsIdentifier(this.state.type)) { + 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(modified, allowedModifiers, disallowedModifiers, errorTemplate, stopOnStartOfClassStaticBlock) { + const enforceOrder = (pos, modifier, before, after) => { + if (modifier === before && modified[after]) { + this.raise(pos, TSErrors.InvalidModifiersOrder, before, after); + } + }; + + const incompatible = (pos, modifier, mod1, mod2) => { + if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) { + this.raise(pos, TSErrors.IncompatibleModifiers, mod1, mod2); + } + }; + + for (;;) { + const startPos = this.state.start; + const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock); + if (!modifier) break; + + if (tsIsAccessModifier(modifier)) { + if (modified.accessibility) { + this.raise(startPos, TSErrors.DuplicateAccessibilityModifier); + } else { + enforceOrder(startPos, modifier, modifier, "override"); + enforceOrder(startPos, modifier, modifier, "static"); + enforceOrder(startPos, modifier, modifier, "readonly"); + modified.accessibility = modifier; + } + } else { + if (Object.hasOwnProperty.call(modified, modifier)) { + this.raise(startPos, TSErrors.DuplicateModifier, modifier); + } else { + enforceOrder(startPos, modifier, "static", "readonly"); + enforceOrder(startPos, modifier, "static", "override"); + enforceOrder(startPos, modifier, "override", "readonly"); + enforceOrder(startPos, modifier, "abstract", "override"); + incompatible(startPos, modifier, "declare", "override"); + incompatible(startPos, modifier, "static", "abstract"); + } + + modified[modifier] = true; + } + + if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) { + this.raise(startPos, errorTemplate, 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(44); + } + + throw new Error("Unreachable"); + } + + 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(43); + } + } + + const result = this.tsParseDelimitedList(kind, parseElement, refTrailingCommaPos); + + if (bracket) { + this.expect(3); + } else { + this.expect(44); + } + + return result; + } + + tsParseImportType() { + const node = this.startNode(); + this.expect(77); + this.expect(10); + + if (!this.match(123)) { + this.raise(this.state.start, TSErrors.UnsupportedImportTypeArgument); + } + + node.argument = this.parseExprAtom(); + this.expect(11); + + if (this.eat(16)) { + node.qualifier = this.tsParseEntityName(true); + } + + if (this.match(43)) { + node.typeParameters = this.tsParseTypeArguments(); + } + + return this.finishNode(node, "TSImportType"); + } + + tsParseEntityName(allowReservedWords) { + let entity = this.parseIdentifier(); + + 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(false); + + if (!this.hasPrecedingLineBreak() && this.match(43)) { + 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(81); + + if (this.match(77)) { + node.exprName = this.tsParseImportType(); + } else { + node.exprName = this.tsParseEntityName(true); + } + + return this.finishNode(node, "TSTypeQuery"); + } + + tsParseTypeParameter() { + const node = this.startNode(); + node.name = this.tsParseTypeParameterName(); + node.constraint = this.tsEatThenParseType(75); + node.default = this.tsEatThenParseType(27); + return this.finishNode(node, "TSTypeParameter"); + } + + tsTryParseTypeParameters() { + if (this.match(43)) { + return this.tsParseTypeParameters(); + } + } + + tsParseTypeParameters() { + const node = this.startNode(); + + if (this.match(43) || this.match(132)) { + this.next(); + } else { + this.unexpected(); + } + + const refTrailingCommaPos = { + value: -1 + }; + node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), false, true, refTrailingCommaPos); + + if (node.params.length === 0) { + this.raise(node.start, TSErrors.EmptyTypeParameters); + } + + if (refTrailingCommaPos.value !== -1) { + this.addExtra(node, "trailingComma", refTrailingCommaPos.value); + } + + return this.finishNode(node, "TSTypeParameterDeclaration"); + } + + tsTryNextParseConstantContext() { + if (this.lookahead().type === 69) { + this.next(); + return this.tsParseTypeReference(); + } + + return null; + } + + tsFillSignature(returnToken, signature) { + const returnTokenRequired = returnToken === 19; + signature.typeParameters = this.tsTryParseTypeParameters(); + this.expect(10); + signature.parameters = this.tsParseBindingListForSignature(); + + if (returnTokenRequired) { + signature.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation(returnToken); + } else if (this.match(returnToken)) { + signature.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation(returnToken); + } + } + + tsParseBindingListForSignature() { + return this.parseBindingList(11, 41).map(pattern => { + if (pattern.type !== "Identifier" && pattern.type !== "RestElement" && pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern") { + this.raise(pattern.start, TSErrors.UnsupportedSignatureParameterKind, pattern.type); + } + + return pattern; + }); + } + + 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 undefined; + } + + 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(43)) { + if (readonly) { + this.raise(node.start, TSErrors.ReadonlyForMethodSignature); + } + + const method = nodeAny; + + if (method.kind && this.match(43)) { + this.raise(this.state.pos, TSErrors.AccesorCannotHaveTypeParameters); + } + + this.tsFillSignature(14, method); + this.tsParseTypeMemberSemicolon(); + + if (method.kind === "get") { + if (method.parameters.length > 0) { + this.raise(this.state.pos, ErrorMessages.BadGetterArity); + + if (this.isThisParam(method.parameters[0])) { + this.raise(this.state.pos, TSErrors.AccesorCannotDeclareThisParameter); + } + } + } else if (method.kind === "set") { + if (method.parameters.length !== 1) { + this.raise(this.state.pos, ErrorMessages.BadSetterArity); + } else { + const firstParameter = method.parameters[0]; + + if (this.isThisParam(firstParameter)) { + this.raise(this.state.pos, TSErrors.AccesorCannotDeclareThisParameter); + } + + if (firstParameter.type === "Identifier" && firstParameter.optional) { + this.raise(this.state.pos, TSErrors.SetAccesorCannotHaveOptionalParameter); + } + + if (firstParameter.type === "RestElement") { + this.raise(this.state.pos, TSErrors.SetAccesorCannotHaveRestParameter); + } + } + + if (method.typeAnnotation) { + this.raise(method.typeAnnotation.start, TSErrors.SetAccesorCannotHaveReturnType); + } + } 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(43)) { + return this.tsParseSignatureMember("TSCallSignatureDeclaration", node); + } + + if (this.match(71)) { + const id = this.startNode(); + this.next(); + + if (this.match(10) || this.match(43)) { + return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node); + } else { + node.key = this.createIdentifier(id, "new"); + return this.tsParsePropertyOrMethodSignature(node, false); + } + } + + this.tsParseModifiers(node, ["readonly"], ["declare", "abstract", "private", "protected", "public", "static", "override"], TSErrors.InvalidModifierOnTypeMember); + const idx = this.tsTryParseIndexSignature(node); + + if (idx) { + return idx; + } + + this.parsePropertyName(node); + + if (!node.computed && node.key.type === "Identifier" && (node.key.name === "get" || node.key.name === "set") && this.tsTokenCanFollowModifier()) { + node.kind = node.key.name; + this.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(47)) { + return this.isContextual(112); + } + + if (this.isContextual(112)) { + this.next(); + } + + if (!this.match(0)) { + return false; + } + + this.next(); + + if (!this.tsIsIdentifier()) { + return false; + } + + this.next(); + return this.match(52); + } + + tsParseMappedTypeParameter() { + const node = this.startNode(); + node.name = this.tsParseTypeParameterName(); + node.constraint = this.tsExpectThenParseType(52); + return this.finishNode(node, "TSTypeParameter"); + } + + tsParseMappedType() { + const node = this.startNode(); + this.expect(5); + + if (this.match(47)) { + node.readonly = this.state.value; + this.next(); + this.expectContextual(112); + } else if (this.eatContextual(112)) { + node.readonly = true; + } + + this.expect(0); + node.typeParameter = this.tsParseMappedTypeParameter(); + node.nameType = this.eatContextual(87) ? this.tsParseType() : null; + this.expect(3); + + if (this.match(47)) { + 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; + + let { + type + } = elementNode; + + if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) { + this.raise(elementNode.start, TSErrors.OptionalTypeBeforeRequired); + } + + seenOptionalElement = seenOptionalElement || type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType"; + + if (type === "TSRestType") { + elementNode = elementNode.typeAnnotation; + type = elementNode.type; + } + + const isLabeled = type === "TSNamedTupleMember"; + labeledElements = (_labeledElements = labeledElements) != null ? _labeledElements : isLabeled; + + if (labeledElements !== isLabeled) { + this.raise(elementNode.start, TSErrors.MixedLabeledAndUnlabeledElements); + } + }); + return this.finishNode(node, "TSTupleType"); + } + + tsParseTupleElementType() { + const { + start: startPos, + startLoc + } = this.state; + const rest = this.eat(21); + let type = this.tsParseType(); + const optional = this.eat(17); + const labeled = this.eat(14); + + if (labeled) { + const labeledNode = this.startNodeAtNode(type); + labeledNode.optional = optional; + + if (type.type === "TSTypeReference" && !type.typeParameters && type.typeName.type === "Identifier") { + labeledNode.label = type.typeName; + } else { + this.raise(type.start, TSErrors.InvalidTupleMemberLabel); + 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(startPos, 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.tsFillSignature(19, node); + return this.finishNode(node, type); + } + + tsParseLiteralTypeNode() { + const node = this.startNode(); + + node.literal = (() => { + switch (this.state.type) { + case 124: + case 125: + case 123: + case 79: + case 80: + return this.parseExprAtom(); + + default: + throw this.unexpected(); + } + })(); + + return this.finishNode(node, "TSLiteralType"); + } + + tsParseTemplateLiteralType() { + const node = this.startNode(); + node.literal = this.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(107) && !this.hasPrecedingLineBreak()) { + return this.tsParseThisTypePredicate(thisKeyword); + } else { + return thisKeyword; + } + } + + tsParseNonArrayType() { + switch (this.state.type) { + case 123: + case 124: + case 125: + case 79: + case 80: + return this.tsParseLiteralTypeNode(); + + case 47: + if (this.state.value === "-") { + const node = this.startNode(); + const nextToken = this.lookahead(); + + if (nextToken.type !== 124 && nextToken.type !== 125) { + throw this.unexpected(); + } + + node.literal = this.parseMaybeUnary(); + return this.finishNode(node, "TSLiteralType"); + } + + break; + + case 72: + return this.tsParseThisTypeOrThisTypePredicate(); + + case 81: + return this.tsParseTypeQuery(); + + case 77: + 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 22: + return this.tsParseTemplateLiteralType(); + + default: + { + const { + type + } = this.state; + + if (tokenIsIdentifier(type) || type === 82 || type === 78) { + const nodeType = type === 82 ? "TSVoidKeyword" : type === 78 ? "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(); + } + } + } + + throw 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(node.start, TSErrors.UnexpectedReadonly); + } + } + + tsParseInferType() { + const node = this.startNode(); + this.expectContextual(106); + const typeParameter = this.startNode(); + typeParameter.name = this.tsParseTypeParameterName(); + node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter"); + return this.finishNode(node, "TSInferType"); + } + + tsParseTypeOperatorOrHigher() { + const isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc; + return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(106) ? this.tsParseInferType() : 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), 41); + } + + tsParseUnionTypeOrHigher() { + return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 39); + } + + tsIsStartOfFunctionType() { + if (this.match(43)) { + return true; + } + + return this.match(10) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this)); + } + + tsSkipParameterStart() { + if (tokenIsIdentifier(this.state.type) || this.match(72)) { + this.next(); + return true; + } + + if (this.match(5)) { + let braceStackCounter = 1; + this.next(); + + while (braceStackCounter > 0) { + if (this.match(5)) { + ++braceStackCounter; + } else if (this.match(8)) { + --braceStackCounter; + } + + this.next(); + } + + return true; + } + + if (this.match(0)) { + let braceStackCounter = 1; + this.next(); + + while (braceStackCounter > 0) { + if (this.match(0)) { + ++braceStackCounter; + } else if (this.match(3)) { + --braceStackCounter; + } + + this.next(); + } + + return true; + } + + 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(27)) { + 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(72)) { + 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() { + return this.match(14) ? this.tsParseTypeOrTypePredicateAnnotation(14) : undefined; + } + + tsTryParseTypeAnnotation() { + return this.match(14) ? this.tsParseTypeAnnotation() : undefined; + } + + tsTryParseType() { + return this.tsEatThenParseType(14); + } + + tsParseTypePredicatePrefix() { + const id = this.parseIdentifier(); + + if (this.isContextual(107) && !this.hasPrecedingLineBreak()) { + this.next(); + return id; + } + } + + tsParseTypePredicateAsserts() { + if (this.state.type !== 100) { + return false; + } + + const containsEsc = this.state.containsEsc; + this.next(); + + if (!tokenIsIdentifier(this.state.type) && !this.match(72)) { + return false; + } + + if (containsEsc) { + this.raise(this.state.lastTokStart, ErrorMessages.InvalidEscapedReservedWord, "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.hasPrecedingLineBreak() || !this.eat(75)) { + return type; + } + + const node = this.startNodeAtNode(type); + node.checkType = type; + node.extendsType = this.tsParseNonConditionalType(); + this.expect(17); + node.trueType = this.tsParseType(); + this.expect(14); + node.falseType = this.tsParseType(); + return this.finishNode(node, "TSConditionalType"); + } + + isAbstractConstructorSignature() { + return this.isContextual(114) && this.lookahead().type === 71; + } + + tsParseNonConditionalType() { + if (this.tsIsStartOfFunctionType()) { + return this.tsParseFunctionOrConstructorType("TSFunctionType"); + } + + if (this.match(71)) { + return this.tsParseFunctionOrConstructorType("TSConstructorType"); + } else if (this.isAbstractConstructorSignature()) { + return this.tsParseFunctionOrConstructorType("TSConstructorType", true); + } + + return this.tsParseUnionTypeOrHigher(); + } + + tsParseTypeAssertion() { + if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) { + this.raise(this.state.start, TSErrors.ReservedTypeAssertion); + } + + const node = this.startNode(); + + const _const = this.tsTryNextParseConstantContext(); + + node.typeAnnotation = _const || this.tsNextThenParseType(); + this.expect(44); + node.expression = this.parseMaybeUnary(); + return this.finishNode(node, "TSTypeAssertion"); + } + + tsParseHeritageClause(descriptor) { + const originalStart = this.state.start; + const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", this.tsParseExpressionWithTypeArguments.bind(this)); + + if (!delimitedList.length) { + this.raise(originalStart, TSErrors.EmptyHeritageClauseType, descriptor); + } + + return delimitedList; + } + + tsParseExpressionWithTypeArguments() { + const node = this.startNode(); + node.expression = this.tsParseEntityName(false); + + if (this.match(43)) { + node.typeParameters = this.tsParseTypeArguments(); + } + + return this.finishNode(node, "TSExpressionWithTypeArguments"); + } + + tsParseInterfaceDeclaration(node) { + if (tokenIsIdentifier(this.state.type)) { + node.id = this.parseIdentifier(); + this.checkLVal(node.id, "typescript interface declaration", BIND_TS_INTERFACE); + } else { + node.id = null; + this.raise(this.state.start, TSErrors.MissingInterfaceName); + } + + node.typeParameters = this.tsTryParseTypeParameters(); + + if (this.eat(75)) { + 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.checkLVal(node.id, "typescript type alias", BIND_TS_TYPE); + node.typeParameters = this.tsTryParseTypeParameters(); + node.typeAnnotation = this.tsInType(() => { + this.expect(27); + + if (this.isContextual(105) && 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; + } + } + + tsEatThenParseType(token) { + return !this.match(token) ? undefined : this.tsNextThenParseType(); + } + + tsExpectThenParseType(token) { + return this.tsDoThenParseType(() => this.expect(token)); + } + + tsNextThenParseType() { + return this.tsDoThenParseType(() => this.next()); + } + + tsDoThenParseType(cb) { + return this.tsInType(() => { + cb(); + return this.tsParseType(); + }); + } + + tsParseEnumMember() { + const node = this.startNode(); + node.id = this.match(123) ? this.parseExprAtom() : this.parseIdentifier(true); + + if (this.eat(27)) { + node.initializer = this.parseMaybeAssignAllowIn(); + } + + return this.finishNode(node, "TSEnumMember"); + } + + tsParseEnumDeclaration(node, isConst) { + if (isConst) node.const = true; + node.id = this.parseIdentifier(); + this.checkLVal(node.id, "typescript enum declaration", isConst ? BIND_TS_CONST_ENUM : BIND_TS_ENUM); + 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(SCOPE_OTHER); + this.expect(5); + this.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.checkLVal(node.id, "module or namespace declaration", BIND_TS_NAMESPACE); + } + + if (this.eat(16)) { + const inner = this.startNode(); + this.tsParseModuleOrNamespaceDeclaration(inner, true); + node.body = inner; + } else { + this.scope.enter(SCOPE_TS_MODULE); + this.prodParam.enter(PARAM); + node.body = this.tsParseModuleBlock(); + this.prodParam.exit(); + this.scope.exit(); + } + + return this.finishNode(node, "TSModuleDeclaration"); + } + + tsParseAmbientExternalModuleDeclaration(node) { + if (this.isContextual(103)) { + node.global = true; + node.id = this.parseIdentifier(); + } else if (this.match(123)) { + node.id = this.parseExprAtom(); + } else { + this.unexpected(); + } + + if (this.match(5)) { + this.scope.enter(SCOPE_TS_MODULE); + this.prodParam.enter(PARAM); + node.body = this.tsParseModuleBlock(); + this.prodParam.exit(); + this.scope.exit(); + } else { + this.semicolon(); + } + + return this.finishNode(node, "TSModuleDeclaration"); + } + + tsParseImportEqualsDeclaration(node, isExport) { + node.isExport = isExport || false; + node.id = this.parseIdentifier(); + this.checkLVal(node.id, "import equals declaration", BIND_LEXICAL); + this.expect(27); + const moduleReference = this.tsParseModuleReference(); + + if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") { + this.raise(moduleReference.start, TSErrors.ImportAliasHasImportType); + } + + node.moduleReference = moduleReference; + this.semicolon(); + return this.finishNode(node, "TSImportEqualsDeclaration"); + } + + tsIsExternalModuleReference() { + return this.isContextual(110) && this.lookaheadCharCode() === 40; + } + + tsParseModuleReference() { + return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(false); + } + + tsParseExternalModuleReference() { + const node = this.startNode(); + this.expectContextual(110); + this.expect(10); + + if (!this.match(123)) { + throw this.unexpected(); + } + + node.expression = this.parseExprAtom(); + this.expect(11); + 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 undefined; + 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; + } else { + this.state = state; + return undefined; + } + } + + tsTryParseDeclare(nany) { + if (this.isLineTerminator()) { + return; + } + + let starttype = this.state.type; + let kind; + + if (this.isContextual(93)) { + starttype = 68; + kind = "let"; + } + + return this.tsInAmbientContext(() => { + switch (starttype) { + case 62: + nany.declare = true; + return this.parseFunctionStatement(nany, false, true); + + case 74: + nany.declare = true; + return this.parseClass(nany, true, false); + + case 69: + if (this.match(69) && this.isLookaheadContextual("enum")) { + this.expect(69); + this.expectContextual(116); + return this.tsParseEnumDeclaration(nany, true); + } + + case 68: + kind = kind || this.state.value; + return this.parseVarStatement(nany, kind); + + case 103: + return this.tsParseAmbientExternalModuleDeclaration(nany); + + default: + { + if (tokenIsIdentifier(starttype)) { + return this.tsParseDeclaration(nany, this.state.value, true); + } + } + } + }); + } + + tsTryParseExportDeclaration() { + return this.tsParseDeclaration(this.startNode(), this.state.value, true); + } + + tsParseExpressionStatement(node, expr) { + switch (expr.name) { + case "declare": + { + const declaration = this.tsTryParseDeclare(node); + + if (declaration) { + declaration.declare = true; + return declaration; + } + + break; + } + + case "global": + if (this.match(5)) { + this.scope.enter(SCOPE_TS_MODULE); + 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); + } + } + + tsParseDeclaration(node, value, next) { + switch (value) { + case "abstract": + if (this.tsCheckLineTerminator(next) && (this.match(74) || tokenIsIdentifier(this.state.type))) { + return this.tsParseAbstractDeclaration(node); + } + + break; + + case "enum": + if (next || tokenIsIdentifier(this.state.type)) { + if (next) this.next(); + return this.tsParseEnumDeclaration(node, false); + } + + break; + + case "interface": + if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) { + return this.tsParseInterfaceDeclaration(node); + } + + break; + + case "module": + if (this.tsCheckLineTerminator(next)) { + if (this.match(123)) { + 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(startPos, startLoc) { + if (!this.match(43)) { + return undefined; + } + + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + this.state.maybeInArrowParameters = true; + const res = this.tsTryParseAndCatch(() => { + const node = this.startNodeAt(startPos, startLoc); + node.typeParameters = this.tsParseTypeParameters(); + super.parseFunctionParams(node); + node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation(); + this.expect(19); + return node; + }); + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + + if (!res) { + return undefined; + } + + return this.parseArrowExpression(res, null, true); + } + + tsParseTypeArguments() { + const node = this.startNode(); + node.params = this.tsInType(() => this.tsInNoContext(() => { + this.expect(43); + return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this)); + })); + + if (node.params.length === 0) { + this.raise(node.start, TSErrors.EmptyTypeArguments); + } + + this.expect(44); + return this.finishNode(node, "TSTypeParameterInstantiation"); + } + + tsIsDeclarationStart() { + return tokenIsTSDeclarationStart(this.state.type); + } + + isExportDefaultSpecifier() { + if (this.tsIsDeclarationStart()) return false; + return super.isExportDefaultSpecifier(); + } + + parseAssignableListItem(allowModifiers, decorators) { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + let accessibility; + let readonly = false; + let override = false; + + if (allowModifiers !== undefined) { + const modified = {}; + this.tsParseModifiers(modified, ["public", "private", "protected", "override", "readonly"]); + accessibility = modified.accessibility; + override = modified.override; + readonly = modified.readonly; + + if (allowModifiers === false && (accessibility || readonly || override)) { + this.raise(startPos, TSErrors.UnexpectedParameterModifier); + } + } + + const left = this.parseMaybeDefault(); + this.parseAssignableListItemTypes(left); + const elt = this.parseMaybeDefault(left.start, left.loc.start, left); + + if (accessibility || readonly || override) { + const pp = this.startNodeAt(startPos, 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(pp.start, TSErrors.UnsupportedParameterPropertyKind); + } + + pp.parameter = elt; + return this.finishNode(pp, "TSParameterProperty"); + } + + if (decorators.length) { + left.decorators = decorators; + } + + return elt; + } + + 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()) { + this.finishNode(node, bodilessType); + return; + } + + if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) { + this.raise(node.start, TSErrors.DeclareFunctionHasImplementation); + + if (node.declare) { + super.parseFunctionBodyAndFinish(node, bodilessType, isMethod); + return; + } + } + + super.parseFunctionBodyAndFinish(node, type, isMethod); + } + + registerFunctionStatementId(node) { + if (!node.body && node.id) { + this.checkLVal(node.id, "function name", BIND_TS_AMBIENT); + } else { + super.registerFunctionStatementId(...arguments); + } + } + + tsCheckForInvalidTypeCasts(items) { + items.forEach(node => { + if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") { + this.raise(node.typeAnnotation.start, TSErrors.UnexpectedTypeAnnotation); + } + }); + } + + toReferencedList(exprList, isInParens) { + this.tsCheckForInvalidTypeCasts(exprList); + return exprList; + } + + parseArrayLike(...args) { + const node = super.parseArrayLike(...args); + + if (node.type === "ArrayExpression") { + this.tsCheckForInvalidTypeCasts(node.elements); + } + + return node; + } + + parseSubscript(base, startPos, startLoc, noCalls, state) { + if (!this.hasPrecedingLineBreak() && this.match(33)) { + this.state.canStartJSXElement = false; + this.next(); + const nonNullExpression = this.startNodeAt(startPos, 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(43)) { + let missingParenErrorPos; + const result = this.tsTryParseAndCatch(() => { + if (!noCalls && this.atPossibleAsyncArrow(base)) { + const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startPos, startLoc); + + if (asyncArrowFn) { + return asyncArrowFn; + } + } + + const node = this.startNodeAt(startPos, startLoc); + node.callee = base; + const typeArguments = this.tsParseTypeArguments(); + + if (typeArguments) { + if (isOptionalCall && !this.match(10)) { + missingParenErrorPos = this.state.pos; + this.unexpected(); + } + + if (!noCalls && this.eat(10)) { + 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); + } else if (this.match(22)) { + const result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state); + result.typeParameters = typeArguments; + return result; + } + } + + this.unexpected(); + }); + + if (missingParenErrorPos) { + this.unexpected(missingParenErrorPos, 10); + } + + if (result) return result; + } + + return super.parseSubscript(base, startPos, startLoc, noCalls, state); + } + + parseNewArguments(node) { + if (this.match(43)) { + const typeParameters = this.tsTryParseAndCatch(() => { + const args = this.tsParseTypeArguments(); + if (!this.match(10)) this.unexpected(); + return args; + }); + + if (typeParameters) { + node.typeParameters = typeParameters; + } + } + + super.parseNewArguments(node); + } + + parseExprOp(left, leftStartPos, leftStartLoc, minPrec) { + if (tokenOperatorPrecedence(52) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual(87)) { + const node = this.startNodeAt(leftStartPos, leftStartLoc); + node.expression = left; + + const _const = this.tsTryNextParseConstantContext(); + + if (_const) { + node.typeAnnotation = _const; + } else { + node.typeAnnotation = this.tsNextThenParseType(); + } + + this.finishNode(node, "TSAsExpression"); + this.reScan_lt_gt(); + return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec); + } + + return super.parseExprOp(left, leftStartPos, leftStartLoc, minPrec); + } + + checkReservedWord(word, startLoc, checkKeywords, isBinding) {} + + checkDuplicateExports() {} + + parseImport(node) { + node.importKind = "value"; + + if (tokenIsIdentifier(this.state.type) || this.match(49) || this.match(5)) { + let ahead = this.lookahead(); + + if (this.isContextual(120) && ahead.type !== 12 && ahead.type !== 91 && ahead.type !== 27) { + node.importKind = "type"; + this.next(); + ahead = this.lookahead(); + } + + if (tokenIsIdentifier(this.state.type) && ahead.type === 27) { + return this.tsParseImportEqualsDeclaration(node); + } + } + + const importNode = super.parseImport(node); + + if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") { + this.raise(importNode.start, TSErrors.TypeImportCannotSpecifyDefaultAndNamed); + } + + return importNode; + } + + parseExport(node) { + if (this.match(77)) { + this.next(); + + if (this.isContextual(120) && this.lookaheadCharCode() !== 61) { + node.importKind = "type"; + this.next(); + } else { + node.importKind = "value"; + } + + return this.tsParseImportEqualsDeclaration(node, true); + } else if (this.eat(27)) { + const assign = node; + assign.expression = this.parseExpression(); + this.semicolon(); + return this.finishNode(assign, "TSExportAssignment"); + } else if (this.eatContextual(87)) { + const decl = node; + this.expectContextual(118); + decl.id = this.parseIdentifier(); + this.semicolon(); + return this.finishNode(decl, "TSNamespaceExportDeclaration"); + } else { + if (this.isContextual(120) && this.lookahead().type === 5) { + this.next(); + node.exportKind = "type"; + } else { + node.exportKind = "value"; + } + + return super.parseExport(node); + } + } + + isAbstractClass() { + return this.isContextual(114) && this.lookahead().type === 74; + } + + parseExportDefaultExpression() { + if (this.isAbstractClass()) { + const cls = this.startNode(); + this.next(); + cls.abstract = true; + this.parseClass(cls, true, true); + return cls; + } + + if (this.match(119)) { + const interfaceNode = this.startNode(); + this.next(); + const result = this.tsParseInterfaceDeclaration(interfaceNode); + if (result) return result; + } + + return super.parseExportDefaultExpression(); + } + + parseStatementContent(context, topLevel) { + if (this.state.type === 69) { + const ahead = this.lookahead(); + + if (ahead.type === 116) { + const node = this.startNode(); + this.next(); + this.expectContextual(116); + return this.tsParseEnumDeclaration(node, true); + } + } + + return super.parseStatementContent(context, topLevel); + } + + 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(98) && this.lookaheadCharCode() === 123; + } + + parseClassMember(classBody, member, state) { + const modifiers = ["declare", "private", "public", "protected", "override", "abstract", "readonly", "static"]; + this.tsParseModifiers(member, modifiers, undefined, undefined, true); + + const callParseClassMemberWithIsStatic = () => { + if (this.tsIsStartOfStaticBlocks()) { + this.next(); + this.next(); + + if (this.tsHasSomeModifiers(member, modifiers)) { + this.raise(this.state.pos, TSErrors.StaticBlockCannotHaveModifier); + } + + this.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(member.start, TSErrors.IndexSignatureHasAbstract); + } + + if (member.accessibility) { + this.raise(member.start, TSErrors.IndexSignatureHasAccessibility, member.accessibility); + } + + if (member.declare) { + this.raise(member.start, TSErrors.IndexSignatureHasDeclare); + } + + if (member.override) { + this.raise(member.start, TSErrors.IndexSignatureHasOverride); + } + + return; + } + + if (!this.state.inAbstractClass && member.abstract) { + this.raise(member.start, TSErrors.NonAbstractClassHasAbstractMethod); + } + + if (member.override) { + if (!state.hadSuperClass) { + this.raise(member.start, TSErrors.OverrideNotInSubClass); + } + } + + 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(methodOrProp.start, TSErrors.ClassMethodHasReadonly); + } + + if (methodOrProp.declare && this.match(10)) { + this.raise(methodOrProp.start, TSErrors.ClassMethodHasDeclare); + } + } + + parseExpressionStatement(node, expr) { + const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr) : undefined; + return decl || super.parseExpressionStatement(node, expr); + } + + shouldParseExportDeclaration() { + if (this.tsIsDeclarationStart()) return true; + return super.shouldParseExportDeclaration(); + } + + parseConditional(expr, startPos, startLoc, refExpressionErrors) { + if (!this.state.maybeInArrowParameters || !this.match(17)) { + return super.parseConditional(expr, startPos, startLoc, refExpressionErrors); + } + + const result = this.tryParse(() => super.parseConditional(expr, startPos, 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, startPos, startLoc) { + node = super.parseParenItem(node, startPos, startLoc); + + if (this.eat(17)) { + node.optional = true; + this.resetEndLocation(node); + } + + if (this.match(14)) { + const typeCastNode = this.startNodeAt(startPos, startLoc); + typeCastNode.expression = node; + typeCastNode.typeAnnotation = this.tsParseTypeAnnotation(); + return this.finishNode(typeCastNode, "TSTypeCastExpression"); + } + + return node; + } + + parseExportDeclaration(node) { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + const isDeclare = this.eatContextual(115); + + if (isDeclare && (this.isContextual(115) || !this.shouldParseExportDeclaration())) { + throw this.raise(this.state.start, TSErrors.ExpectedAmbientAfterExportDeclare); + } + + let declaration; + + if (tokenIsIdentifier(this.state.type)) { + declaration = this.tsTryParseExportDeclaration(); + } + + if (!declaration) { + declaration = super.parseExportDeclaration(node); + } + + if (declaration && (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare)) { + node.exportKind = "type"; + } + + if (declaration && isDeclare) { + this.resetStartLocation(declaration, startPos, startLoc); + declaration.declare = true; + } + + return declaration; + } + + parseClassId(node, isStatement, optionalId) { + if ((!isStatement || optionalId) && this.isContextual(104)) { + return; + } + + super.parseClassId(node, isStatement, optionalId, node.declare ? BIND_TS_AMBIENT : BIND_CLASS); + const typeParameters = this.tsTryParseTypeParameters(); + if (typeParameters) node.typeParameters = typeParameters; + } + + parseClassPropertyAnnotation(node) { + if (!node.optional && this.eat(33)) { + node.definite = true; + } + + const type = this.tsTryParseTypeAnnotation(); + if (type) node.typeAnnotation = type; + } + + parseClassProperty(node) { + this.parseClassPropertyAnnotation(node); + + if (this.state.isAmbientContext && this.match(27)) { + this.raise(this.state.start, TSErrors.DeclareClassFieldHasInitializer); + } + + if (node.abstract && this.match(27)) { + const { + key + } = node; + this.raise(this.state.start, TSErrors.AbstractPropertyHasInitializer, 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(node.start, TSErrors.PrivateElementHasAbstract); + } + + if (node.accessibility) { + this.raise(node.start, TSErrors.PrivateElementHasAccessibility, node.accessibility); + } + + this.parseClassPropertyAnnotation(node); + return super.parseClassPrivateProperty(node); + } + + pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) { + const typeParameters = this.tsTryParseTypeParameters(); + + if (typeParameters && isConstructor) { + this.raise(typeParameters.start, TSErrors.ConstructorHasTypeParameters); + } + + if (method.declare && (method.kind === "get" || method.kind === "set")) { + this.raise(method.start, TSErrors.DeclareAccessor, method.kind); + } + + if (typeParameters) method.typeParameters = typeParameters; + super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper); + } + + pushClassPrivateMethod(classBody, method, isGenerator, isAsync) { + const typeParameters = this.tsTryParseTypeParameters(); + 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(43)) { + node.superTypeParameters = this.tsParseTypeArguments(); + } + + if (this.eatContextual(104)) { + node.implements = this.tsParseHeritageClause("implements"); + } + } + + parseObjPropValue(prop, ...args) { + const typeParameters = this.tsTryParseTypeParameters(); + if (typeParameters) prop.typeParameters = typeParameters; + super.parseObjPropValue(prop, ...args); + } + + parseFunctionParams(node, allowModifiers) { + const typeParameters = this.tsTryParseTypeParameters(); + if (typeParameters) node.typeParameters = typeParameters; + super.parseFunctionParams(node, allowModifiers); + } + + parseVarId(decl, kind) { + super.parseVarId(decl, kind); + + if (decl.id.type === "Identifier" && this.eat(33)) { + 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(...args) { + var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3; + + let state; + let jsx; + let typeCast; + + if (this.hasPlugin("jsx") && (this.match(132) || this.match(43))) { + state = this.state.clone(); + jsx = this.tryParse(() => super.parseMaybeAssign(...args), state); + if (!jsx.error) return jsx.node; + const { + context + } = this.state; + + if (context[context.length - 1] === types.j_oTag) { + context.length -= 2; + } else if (context[context.length - 1] === types.j_expr) { + context.length -= 1; + } + } + + if (!((_jsx = jsx) != null && _jsx.error) && !this.match(43)) { + return super.parseMaybeAssign(...args); + } + + let typeParameters; + state = state || this.state.clone(); + const arrow = this.tryParse(abort => { + var _expr$extra, _typeParameters; + + typeParameters = this.tsParseTypeParameters(); + const expr = super.parseMaybeAssign(...args); + + 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(...args), 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; + } + + if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error; + if (arrow.thrown) throw arrow.error; + if ((_typeCast2 = typeCast) != null && _typeCast2.thrown) throw typeCast.error; + throw ((_jsx4 = jsx) == null ? void 0 : _jsx4.error) || arrow.error || ((_typeCast3 = typeCast) == null ? void 0 : _typeCast3.error); + } + + reportReservedArrowTypeParam(node) { + var _node$extra; + + if (node.params.length === 1 && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) { + this.raise(node.start, TSErrors.ReservedArrowTypeParam); + } + } + + parseMaybeUnary(refExpressionErrors) { + if (!this.hasPlugin("jsx") && this.match(43)) { + return this.tsParseTypeAssertion(); + } else { + return super.parseMaybeUnary(refExpressionErrors); + } + } + + 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) { + if (this.eat(17)) { + if (param.type !== "Identifier" && !this.state.isAmbientContext && !this.state.inType) { + this.raise(param.start, TSErrors.PatternIsOptional); + } + + 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 "TSTypeCastExpression": + return super.toAssignable(this.typeCastToParameter(node), isLHS); + + case "TSParameterProperty": + return super.toAssignable(node, isLHS); + + case "ParenthesizedExpression": + return this.toAssignableParenthesizedExpression(node, isLHS); + + case "TSAsExpression": + case "TSNonNullExpression": + case "TSTypeAssertion": + node.expression = this.toAssignable(node.expression, isLHS); + return node; + + default: + return super.toAssignable(node, isLHS); + } + } + + toAssignableParenthesizedExpression(node, isLHS) { + switch (node.expression.type) { + case "TSAsExpression": + case "TSNonNullExpression": + case "TSTypeAssertion": + case "ParenthesizedExpression": + node.expression = this.toAssignable(node.expression, isLHS); + return node; + + default: + return super.toAssignable(node, isLHS); + } + } + + checkLVal(expr, contextDescription, ...args) { + var _expr$extra2; + + switch (expr.type) { + case "TSTypeCastExpression": + return; + + case "TSParameterProperty": + this.checkLVal(expr.parameter, "parameter property", ...args); + return; + + case "TSAsExpression": + case "TSTypeAssertion": + if (!args[0] && contextDescription !== "parenthesized expression" && !((_expr$extra2 = expr.extra) != null && _expr$extra2.parenthesized)) { + this.raise(expr.start, ErrorMessages.InvalidLhs, contextDescription); + break; + } + + this.checkLVal(expr.expression, "parenthesized expression", ...args); + return; + + case "TSNonNullExpression": + this.checkLVal(expr.expression, contextDescription, ...args); + return; + + default: + super.checkLVal(expr, contextDescription, ...args); + return; + } + } + + parseBindingAtom() { + switch (this.state.type) { + case 72: + return this.parseIdentifier(true); + + default: + return super.parseBindingAtom(); + } + } + + parseMaybeDecoratorArguments(expr) { + if (this.match(43)) { + const typeArguments = this.tsParseTypeArguments(); + + if (this.match(10)) { + const call = super.parseMaybeDecoratorArguments(expr); + call.typeParameters = typeArguments; + return call; + } + + this.unexpected(this.state.start, 10); + } + + return super.parseMaybeDecoratorArguments(expr); + } + + checkCommaAfterRest(close) { + if (this.state.isAmbientContext && this.match(12) && this.lookaheadCharCode() === close) { + this.next(); + } else { + super.checkCommaAfterRest(close); + } + } + + isClassMethod() { + return this.match(43) || super.isClassMethod(); + } + + isClassProperty() { + return this.match(33) || this.match(14) || super.isClassProperty(); + } + + parseMaybeDefault(...args) { + const node = super.parseMaybeDefault(...args); + + if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) { + this.raise(node.typeAnnotation.start, TSErrors.TypeAnnotationAfterAssign); + } + + return node; + } + + getTokenFromCode(code) { + if (this.state.inType) { + if (code === 62) { + return this.finishOp(44, 1); + } + + if (code === 60) { + return this.finishOp(43, 1); + } + } + + return super.getTokenFromCode(code); + } + + reScan_lt_gt() { + const { + type + } = this.state; + + if (type === 43) { + this.state.pos -= 1; + this.readToken_lt(); + } else if (type === 44) { + this.state.pos -= 1; + this.readToken_gt(); + } + } + + toAssignableList(exprList) { + for (let i = 0; i < exprList.length; i++) { + const expr = exprList[i]; + if (!expr) continue; + + switch (expr.type) { + case "TSTypeCastExpression": + exprList[i] = this.typeCastToParameter(expr); + break; + + case "TSAsExpression": + case "TSTypeAssertion": + if (!this.state.maybeInArrowParameters) { + exprList[i] = this.typeCastToParameter(expr); + } else { + this.raise(expr.start, TSErrors.UnexpectedTypeCastInParameter); + } + + break; + } + } + + return super.toAssignableList(...arguments); + } + + typeCastToParameter(node) { + node.expression.typeAnnotation = node.typeAnnotation; + this.resetEndLocation(node.expression, node.typeAnnotation.end, 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(43)) { + const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArguments()); + 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, ...args) { + const oldInAbstractClass = this.state.inAbstractClass; + this.state.inAbstractClass = !!node.abstract; + + try { + return super.parseClass(node, ...args); + } finally { + this.state.inAbstractClass = oldInAbstractClass; + } + } + + tsParseAbstractDeclaration(node) { + if (this.match(74)) { + node.abstract = true; + return this.parseClass(node, true, false); + } else if (this.isContextual(119)) { + if (!this.hasFollowingLineBreak()) { + node.abstract = true; + this.raise(node.start, TSErrors.NonClassMethodPropertyHasAbstractModifer); + this.next(); + return this.tsParseInterfaceDeclaration(node); + } + } else { + this.unexpected(null, 74); + } + } + + parseMethod(...args) { + const method = super.parseMethod(...args); + + if (method.abstract) { + const hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body; + + if (hasBody) { + const { + key + } = method; + this.raise(method.start, TSErrors.AbstractMethodHasImplementation, 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) { + if (!importedIsString && isMaybeTypeOnly) { + this.parseTypeOnlyImportExportSpecifier(specifier, true, isInTypeOnlyImport); + return this.finishNode(specifier, "ImportSpecifier"); + } + + specifier.importKind = "value"; + return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly); + } + + 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 pos = leftOfAs.start; + + if (this.isContextual(87)) { + const firstAs = this.parseIdentifier(); + + if (this.isContextual(87)) { + const secondAs = this.parseIdentifier(); + + if (tokenIsKeywordOrIdentifier(this.state.type)) { + hasTypeSpecifier = true; + leftOfAs = firstAs; + rightOfAs = this.parseIdentifier(); + canParseAsKeyword = false; + } else { + rightOfAs = secondAs; + canParseAsKeyword = false; + } + } else if (tokenIsKeywordOrIdentifier(this.state.type)) { + canParseAsKeyword = false; + rightOfAs = this.parseIdentifier(); + } else { + hasTypeSpecifier = true; + leftOfAs = firstAs; + } + } else if (tokenIsKeywordOrIdentifier(this.state.type)) { + hasTypeSpecifier = true; + leftOfAs = this.parseIdentifier(); + } + + if (hasTypeSpecifier && isInTypeOnlyImportExport) { + this.raise(pos, isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports); + } + + node[leftOfAsKey] = leftOfAs; + node[rightOfAsKey] = rightOfAs; + const kindKey = isImport ? "importKind" : "exportKind"; + node[kindKey] = hasTypeSpecifier ? "type" : "value"; + + if (canParseAsKeyword && this.eatContextual(87)) { + node[rightOfAsKey] = isImport ? this.parseIdentifier() : this.parseModuleExportName(); + } + + if (!node[rightOfAsKey]) { + node[rightOfAsKey] = cloneIdentifier(node[leftOfAsKey]); + } + + if (isImport) { + this.checkLVal(node[rightOfAsKey], "import specifier", BIND_LEXICAL); + } + } + +}); + +const PlaceHolderErrors = makeErrorTemplates({ + ClassNameIsRequired: "A class name is required." +}, ErrorCodes.SyntaxError); +var placeholders = (superClass => class extends superClass { + parsePlaceholder(expectedNode) { + if (this.match(134)) { + const node = this.startNode(); + this.next(); + this.assertNoSpace("Unexpected space in placeholder."); + node.name = super.parseIdentifier(true); + this.assertNoSpace("Unexpected space in placeholder."); + this.expect(134); + 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) { + return this.finishOp(134, 2); + } + + return super.getTokenFromCode(...arguments); + } + + parseExprAtom() { + return this.parsePlaceholder("Expression") || super.parseExprAtom(...arguments); + } + + parseIdentifier() { + return this.parsePlaceholder("Identifier") || super.parseIdentifier(...arguments); + } + + checkReservedWord(word) { + if (word !== undefined) super.checkReservedWord(...arguments); + } + + parseBindingAtom() { + return this.parsePlaceholder("Pattern") || super.parseBindingAtom(...arguments); + } + + checkLVal(expr) { + if (expr.type !== "Placeholder") super.checkLVal(...arguments); + } + + toAssignable(node) { + if (node && node.type === "Placeholder" && node.expectedNode === "Expression") { + node.expectedNode = "Pattern"; + return node; + } + + return super.toAssignable(...arguments); + } + + isLet(context) { + if (super.isLet(context)) { + return true; + } + + if (!this.isContextual(93)) { + return false; + } + + if (context) return false; + const nextToken = this.lookahead(); + + if (nextToken.type === 134) { + return true; + } + + return false; + } + + verifyBreakContinue(node) { + if (node.label && node.label.type === "Placeholder") return; + super.verifyBreakContinue(...arguments); + } + + parseExpressionStatement(node, expr) { + if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) { + return super.parseExpressionStatement(...arguments); + } + + if (this.match(14)) { + const stmt = node; + stmt.label = this.finishPlaceholder(expr, "Identifier"); + this.next(); + stmt.body = this.parseStatement("label"); + return this.finishNode(stmt, "LabeledStatement"); + } + + this.semicolon(); + node.name = expr.name; + return this.finishPlaceholder(node, "Statement"); + } + + parseBlock() { + return this.parsePlaceholder("BlockStatement") || super.parseBlock(...arguments); + } + + parseFunctionId() { + return this.parsePlaceholder("Identifier") || super.parseFunctionId(...arguments); + } + + parseClass(node, isStatement, optionalId) { + const type = isStatement ? "ClassDeclaration" : "ClassExpression"; + this.next(); + this.takeDecorators(node); + const oldStrict = this.state.strict; + const placeholder = this.parsePlaceholder("Identifier"); + + if (placeholder) { + if (this.match(75) || this.match(134) || 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 { + this.unexpected(null, PlaceHolderErrors.ClassNameIsRequired); + } + } else { + this.parseClassId(node, isStatement, optionalId); + } + + this.parseClassSuper(node); + node.body = this.parsePlaceholder("ClassBody") || this.parseClassBody(!!node.superClass, oldStrict); + return this.finishNode(node, type); + } + + parseExport(node) { + const placeholder = this.parsePlaceholder("Identifier"); + if (!placeholder) return super.parseExport(...arguments); + + if (!this.isContextual(91) && !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); + } + + isExportDefaultSpecifier() { + if (this.match(59)) { + const next = this.nextTokenStart(); + + if (this.isUnparsedContextual(next, "from")) { + if (this.input.startsWith(tokenLabelName(134), this.nextTokenStartSince(next + 4))) { + return true; + } + } + } + + return super.isExportDefaultSpecifier(); + } + + maybeParseExportDefaultSpecifier(node) { + if (node.specifiers && node.specifiers.length > 0) { + return true; + } + + return super.maybeParseExportDefaultSpecifier(...arguments); + } + + 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(...arguments); + node.specifiers = []; + + if (!this.isContextual(91) && !this.match(12)) { + node.source = this.finishPlaceholder(placeholder, "StringLiteral"); + this.semicolon(); + return this.finishNode(node, "ImportDeclaration"); + } + + const specifier = this.startNodeAtNode(placeholder); + specifier.local = placeholder; + this.finishNode(specifier, "ImportDefaultSpecifier"); + node.specifiers.push(specifier); + + if (this.eat(12)) { + const hasStarImport = this.maybeParseStarImportSpecifier(node); + if (!hasStarImport) this.parseNamedImportSpecifiers(node); + } + + this.expectContextual(91); + node.source = this.parseImportSource(); + this.semicolon(); + return this.finishNode(node, "ImportDeclaration"); + } + + parseImportSource() { + return this.parsePlaceholder("StringLiteral") || super.parseImportSource(...arguments); + } + +}); + +var v8intrinsic = (superClass => class extends superClass { + parseV8Intrinsic() { + if (this.match(48)) { + const v8IntrinsicStart = this.state.start; + const node = this.startNode(); + this.next(); + + if (tokenIsIdentifier(this.state.type)) { + const name = this.parseIdentifierName(this.state.start); + const identifier = this.createIdentifier(node, name); + identifier.type = "V8IntrinsicIdentifier"; + + if (this.match(10)) { + return identifier; + } + } + + this.unexpected(v8IntrinsicStart); + } + } + + parseExprAtom() { + return this.parseV8Intrinsic() || super.parseExprAtom(...arguments); + } + +}); + +function hasPlugin(plugins, name) { + return plugins.some(plugin => { + if (Array.isArray(plugin)) { + return plugin[0] === name; + } else { + return plugin === name; + } + }); +} +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)) { + 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) { + throw new Error("The 'decorators' plugin requires a 'decoratorsBeforeExport' option," + " whose value must be a boolean. If you are migrating from" + " Babylon/Babel 6 or want to use the old decorators proposal, you" + " should use the 'decorators-legacy' plugin instead of 'decorators'."); + } else if (typeof decoratorsBeforeExport !== "boolean") { + throw new Error("'decoratorsBeforeExport' 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") && getPluginOption(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")) { + throw new Error("Cannot combine importAssertions and moduleAttributes plugins."); + } + + const moduleAttributesVerionPluginOption = getPluginOption(plugins, "moduleAttributes", "version"); + + if (moduleAttributesVerionPluginOption !== "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, "recordAndTuple") && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) { + throw new Error("'recordAndTuple' requires 'syntaxType' option whose value should 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, + allowImportExportEverywhere: false, + allowSuperOutsideMethod: false, + allowUndeclaredExports: false, + plugins: [], + strictMode: null, + ranges: false, + tokens: false, + createParenthesizedExpressions: false, + errorRecovery: false, + attachComment: true +}; +function getOptions(opts) { + const options = {}; + + for (const key of Object.keys(defaultOptions)) { + options[key] = opts && opts[key] != null ? opts[key] : defaultOptions[key]; + } + + return options; +} + +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.recordParenthesizedIdentifierError(node.start, ErrorMessages.InvalidParenthesizedAssignment); + } else if (parenthesized.type !== "MemberExpression") { + this.raise(node.start, ErrorMessages.InvalidParenthesizedAssignment); + } + } else { + this.raise(node.start, ErrorMessages.InvalidParenthesizedAssignment); + } + } + + 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.trailingComma) { + this.raiseRestNotLast(node.extra.trailingComma); + } + } + + break; + + case "ObjectProperty": + this.toAssignable(node.value, isLHS); + break; + + case "SpreadElement": + { + this.checkToRestConversion(node); + node.type = "RestElement"; + const arg = node.argument; + this.toAssignable(arg, isLHS); + break; + } + + case "ArrayExpression": + node.type = "ArrayPattern"; + this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingComma, isLHS); + break; + + case "AssignmentExpression": + if (node.operator !== "=") { + this.raise(node.left.end, ErrorMessages.MissingEqInAssignment); + } + + node.type = "AssignmentPattern"; + delete node.operator; + this.toAssignable(node.left, isLHS); + break; + + case "ParenthesizedExpression": + this.toAssignable(parenthesized, isLHS); + break; + } + + return node; + } + + toAssignableObjectExpressionProp(prop, isLast, isLHS) { + if (prop.type === "ObjectMethod") { + const error = prop.kind === "get" || prop.kind === "set" ? ErrorMessages.PatternHasAccessor : ErrorMessages.PatternHasMethod; + this.raise(prop.key.start, error); + } else if (prop.type === "SpreadElement" && !isLast) { + this.raiseRestNotLast(prop.start); + } else { + this.toAssignable(prop, isLHS); + } + } + + toAssignableList(exprList, trailingCommaPos, isLHS) { + let end = exprList.length; + + if (end) { + const last = exprList[end - 1]; + + if ((last == null ? void 0 : last.type) === "RestElement") { + --end; + } else if ((last == null ? void 0 : last.type) === "SpreadElement") { + last.type = "RestElement"; + let arg = last.argument; + this.toAssignable(arg, isLHS); + arg = unwrapParenthesizedExpression(arg); + + if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern" && arg.type !== "ObjectPattern") { + this.unexpected(arg.start); + } + + if (trailingCommaPos) { + this.raiseTrailingCommaAfterRest(trailingCommaPos); + } + + --end; + } + } + + for (let i = 0; i < end; i++) { + const elt = exprList[i]; + + if (elt) { + this.toAssignable(elt, isLHS); + + if (elt.type === "RestElement") { + this.raiseRestNotLast(elt.start); + } + } + } + + return exprList; + } + + 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, refNeedsArrowPos) { + const node = this.startNode(); + this.next(); + node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined, refNeedsArrowPos); + 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, true); + return this.finishNode(node, "ArrayPattern"); + } + + case 5: + return this.parseObjectLike(8, true); + } + + return this.parseIdentifier(); + } + + parseBindingList(close, closeCharCode, allowEmpty, allowModifiers) { + 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())); + this.checkCommaAfterRest(closeCharCode); + this.expect(close); + break; + } else { + const decorators = []; + + if (this.match(24) && this.hasPlugin("decorators")) { + this.raise(this.state.start, ErrorMessages.UnsupportedParameterDecorator); + } + + while (this.match(24)) { + decorators.push(this.parseDecorator()); + } + + elts.push(this.parseAssignableListItem(allowModifiers, 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, + start: startPos, + startLoc + } = this.state; + + if (type === 21) { + return this.parseBindingRestProperty(prop); + } else { + this.parsePropertyName(prop); + } + + prop.method = false; + this.parseObjPropValue(prop, startPos, startLoc, false, false, true, false); + return prop; + } + + parseAssignableListItem(allowModifiers, decorators) { + const left = this.parseMaybeDefault(); + this.parseAssignableListItemTypes(left); + const elt = this.parseMaybeDefault(left.start, left.loc.start, left); + + if (decorators.length) { + left.decorators = decorators; + } + + return elt; + } + + parseAssignableListItemTypes(param) { + return param; + } + + parseMaybeDefault(startPos, startLoc, left) { + var _startLoc, _startPos, _left; + + startLoc = (_startLoc = startLoc) != null ? _startLoc : this.state.startLoc; + startPos = (_startPos = startPos) != null ? _startPos : this.state.start; + left = (_left = left) != null ? _left : this.parseBindingAtom(); + if (!this.eat(27)) return left; + const node = this.startNodeAt(startPos, startLoc); + node.left = left; + node.right = this.parseMaybeAssignAllowIn(); + return this.finishNode(node, "AssignmentPattern"); + } + + checkLVal(expr, contextDescription, bindingType = BIND_NONE, checkClashes, disallowLetBinding, strictModeChanged = false) { + switch (expr.type) { + case "Identifier": + { + const { + name + } = expr; + + if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(name, this.inModule) : isStrictBindOnlyReservedWord(name))) { + this.raise(expr.start, bindingType === BIND_NONE ? ErrorMessages.StrictEvalArguments : ErrorMessages.StrictEvalArgumentsBinding, name); + } + + if (checkClashes) { + if (checkClashes.has(name)) { + this.raise(expr.start, ErrorMessages.ParamDupe); + } else { + checkClashes.add(name); + } + } + + if (disallowLetBinding && name === "let") { + this.raise(expr.start, ErrorMessages.LetInLexicalBinding); + } + + if (!(bindingType & BIND_NONE)) { + this.scope.declareName(name, bindingType, expr.start); + } + + break; + } + + case "MemberExpression": + if (bindingType !== BIND_NONE) { + this.raise(expr.start, ErrorMessages.InvalidPropertyBindingPattern); + } + + break; + + case "ObjectPattern": + for (let prop of expr.properties) { + if (this.isObjectProperty(prop)) prop = prop.value;else if (this.isObjectMethod(prop)) continue; + this.checkLVal(prop, "object destructuring pattern", bindingType, checkClashes, disallowLetBinding); + } + + break; + + case "ArrayPattern": + for (const elem of expr.elements) { + if (elem) { + this.checkLVal(elem, "array destructuring pattern", bindingType, checkClashes, disallowLetBinding); + } + } + + break; + + case "AssignmentPattern": + this.checkLVal(expr.left, "assignment pattern", bindingType, checkClashes); + break; + + case "RestElement": + this.checkLVal(expr.argument, "rest element", bindingType, checkClashes); + break; + + case "ParenthesizedExpression": + this.checkLVal(expr.expression, "parenthesized expression", bindingType, checkClashes); + break; + + default: + { + this.raise(expr.start, bindingType === BIND_NONE ? ErrorMessages.InvalidLhs : ErrorMessages.InvalidLhsBinding, contextDescription); + } + } + } + + checkToRestConversion(node) { + if (node.argument.type !== "Identifier" && node.argument.type !== "MemberExpression") { + this.raise(node.argument.start, ErrorMessages.InvalidRestAssignmentPattern); + } + } + + checkCommaAfterRest(close) { + if (this.match(12)) { + if (this.lookaheadCharCode() === close) { + this.raiseTrailingCommaAfterRest(this.state.start); + } else { + this.raiseRestNotLast(this.state.start); + } + } + } + + raiseRestNotLast(pos) { + throw this.raise(pos, ErrorMessages.ElementAfterRest); + } + + raiseTrailingCommaAfterRest(pos) { + this.raise(pos, ErrorMessages.RestTrailingComma); + } + +} + +const invalidHackPipeBodies = new Map([["ArrowFunctionExpression", "arrow function"], ["AssignmentExpression", "assignment"], ["ConditionalExpression", "conditional"], ["YieldExpression", "yield"]]); +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(key.start, ErrorMessages.RecordNoProto); + return; + } + + if (protoRef.used) { + if (refExpressionErrors) { + if (refExpressionErrors.doubleProto === -1) { + refExpressionErrors.doubleProto = key.start; + } + } else { + this.raise(key.start, ErrorMessages.DuplicateProto); + } + } + + 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(129)) { + 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 startPos = this.state.start; + const startLoc = this.state.startLoc; + const expr = this.parseMaybeAssign(refExpressionErrors); + + if (this.match(12)) { + const node = this.startNodeAt(startPos, 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$pos; + + refExpressionErrors.optionalParameters = (_resultError$pos = resultError == null ? void 0 : resultError.pos) != null ? _resultError$pos : this.state.start; + } + + parseMaybeAssign(refExpressionErrors, afterLeftParse) { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + + if (this.isContextual(99)) { + if (this.prodParam.hasYield) { + let left = this.parseYield(); + + if (afterLeftParse) { + left = afterLeftParse.call(this, left, startPos, 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, startPos, startLoc); + } + + if (tokenIsAssignment(this.state.type)) { + const node = this.startNodeAt(startPos, startLoc); + const operator = this.state.value; + node.operator = operator; + + if (this.match(27)) { + node.left = this.toAssignable(left, true); + + if (refExpressionErrors.doubleProto >= startPos) { + refExpressionErrors.doubleProto = -1; + } + + if (refExpressionErrors.shorthandAssign >= startPos) { + refExpressionErrors.shorthandAssign = -1; + } + } else { + node.left = left; + } + + this.checkLVal(left, "assignment expression"); + this.next(); + node.right = this.parseMaybeAssign(); + return this.finishNode(node, "AssignmentExpression"); + } else if (ownExpressionErrors) { + this.checkExpressionErrors(refExpressionErrors, true); + } + + return left; + } + + parseMaybeConditional(refExpressionErrors) { + const startPos = this.state.start; + 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, startPos, startLoc, refExpressionErrors); + } + + parseConditional(expr, startPos, startLoc, refExpressionErrors) { + if (this.eat(17)) { + const node = this.startNodeAt(startPos, 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(128) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors); + } + + parseExprOps(refExpressionErrors) { + const startPos = this.state.start; + 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, startPos, startLoc, -1); + } + + parseExprOp(left, leftStartPos, leftStartLoc, minPrec) { + if (this.isPrivateName(left)) { + const value = this.getPrivateNameSV(left); + const { + start + } = left; + + if (minPrec >= tokenOperatorPrecedence(52) || !this.prodParam.hasIn || !this.match(52)) { + this.raise(start, ErrorMessages.PrivateInExpectedIn, value); + } + + this.classScope.usePrivateName(value, start); + } + + const op = this.state.type; + + if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(52))) { + let prec = tokenOperatorPrecedence(op); + + if (prec > minPrec) { + if (op === 35) { + this.expectPlugin("pipelineOperator"); + + if (this.state.inFSharpPipelineDirectBody) { + return left; + } + + this.checkPipelineAtInfixOperator(left, leftStartPos); + } + + const node = this.startNodeAt(leftStartPos, leftStartLoc); + node.left = left; + node.operator = this.state.value; + const logical = op === 37 || op === 38; + const coalesce = op === 36; + + if (coalesce) { + prec = tokenOperatorPrecedence(38); + } + + this.next(); + + if (op === 35 && this.getPluginOption("pipelineOperator", "proposal") === "minimal") { + if (this.state.type === 90 && this.prodParam.hasAwait) { + throw this.raise(this.state.start, ErrorMessages.UnexpectedAwaitAfterPipelineBody); + } + } + + node.right = this.parseExprOpRightExpr(op, prec); + this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression"); + const nextOp = this.state.type; + + if (coalesce && (nextOp === 37 || nextOp === 38) || logical && nextOp === 36) { + throw this.raise(this.state.start, ErrorMessages.MixingCoalesceWithLogical); + } + + return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec); + } + } + + return left; + } + + parseExprOpRightExpr(op, prec) { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + + switch (op) { + case 35: + switch (this.getPluginOption("pipelineOperator", "proposal")) { + case "hack": + return this.withTopicBindingContext(() => { + return this.parseHackPipeBody(); + }); + + case "smart": + return this.withTopicBindingContext(() => { + if (this.prodParam.hasYield && this.isContextual(99)) { + throw this.raise(this.state.start, ErrorMessages.PipeBodyIsTighter, this.state.value); + } + + return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startPos, startLoc); + }); + + case "fsharp": + return this.withSoloAwaitPermittingContext(() => { + return this.parseFSharpPipelineBody(prec); + }); + } + + default: + return this.parseExprOpBaseRightExpr(op, prec); + } + } + + parseExprOpBaseRightExpr(op, prec) { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startPos, startLoc, tokenIsRightAssociative(op) ? prec - 1 : prec); + } + + parseHackPipeBody() { + var _body$extra; + + const { + start + } = this.state; + const body = this.parseMaybeAssign(); + + if (invalidHackPipeBodies.has(body.type) && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) { + this.raise(start, ErrorMessages.PipeUnparenthesizedBody, invalidHackPipeBodies.get(body.type)); + } + + if (!this.topicReferenceWasUsedInCurrentContext()) { + this.raise(start, ErrorMessages.PipeTopicUnused); + } + + return body; + } + + checkExponentialAfterUnary(node) { + if (this.match(51)) { + this.raise(node.argument.start, ErrorMessages.UnexpectedTokenUnaryExponentiation); + } + } + + parseMaybeUnary(refExpressionErrors, sawUnary) { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + const isAwait = this.isContextual(90); + + if (isAwait && this.isAwaitAllowed()) { + this.next(); + const expr = this.parseAwait(startPos, startLoc); + if (!sawUnary) this.checkExponentialAfterUnary(expr); + return expr; + } + + const update = this.match(32); + const node = this.startNode(); + + if (tokenIsPrefix(this.state.type)) { + node.operator = this.state.value; + node.prefix = true; + + if (this.match(66)) { + this.expectPlugin("throwExpressions"); + } + + const isDelete = this.match(83); + 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(node.start, ErrorMessages.StrictDelete); + } else if (this.hasPropertyAsPrivateName(arg)) { + this.raise(node.start, ErrorMessages.DeletePrivateField); + } + } + + 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(48); + + if (startsExpr && !this.isAmbiguousAwait()) { + this.raiseOverwrite(startPos, ErrorMessages.AwaitNotInAsyncContext); + return this.parseAwait(startPos, startLoc); + } + } + + return expr; + } + + parseUpdate(node, update, refExpressionErrors) { + if (update) { + this.checkLVal(node.argument, "prefix operation"); + return this.finishNode(node, "UpdateExpression"); + } + + const startPos = this.state.start; + 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(startPos, startLoc); + node.operator = this.state.value; + node.prefix = false; + node.argument = expr; + this.checkLVal(expr, "postfix operation"); + this.next(); + expr = this.finishNode(node, "UpdateExpression"); + } + + return expr; + } + + parseExprSubscripts(refExpressionErrors) { + const startPos = this.state.start; + 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, startPos, startLoc); + } + + parseSubscripts(base, startPos, startLoc, noCalls) { + const state = { + optionalChainMember: false, + maybeAsyncArrow: this.atPossibleAsyncArrow(base), + stop: false + }; + + do { + base = this.parseSubscript(base, startPos, startLoc, noCalls, state); + state.maybeAsyncArrow = false; + } while (!state.stop); + + return base; + } + + parseSubscript(base, startPos, startLoc, noCalls, state) { + if (!noCalls && this.eat(15)) { + return this.parseBind(base, startPos, startLoc, noCalls, state); + } else if (this.match(22)) { + return this.parseTaggedTemplateExpression(base, startPos, startLoc, state); + } + + let optional = false; + + if (this.match(18)) { + if (noCalls && this.lookaheadCharCode() === 40) { + state.stop = true; + return base; + } + + state.optionalChainMember = optional = true; + this.next(); + } + + if (!noCalls && this.match(10)) { + return this.parseCoverCallAndAsyncArrowHead(base, startPos, startLoc, state, optional); + } else { + const computed = this.eat(0); + + if (computed || optional || this.eat(16)) { + return this.parseMember(base, startPos, startLoc, state, computed, optional); + } else { + state.stop = true; + return base; + } + } + } + + parseMember(base, startPos, startLoc, state, computed, optional) { + const node = this.startNodeAt(startPos, startLoc); + node.object = base; + node.computed = computed; + const privateName = !computed && this.match(128) && this.state.value; + const property = computed ? this.parseExpression() : privateName ? this.parsePrivateName() : this.parseIdentifier(true); + + if (privateName !== false) { + if (node.object.type === "Super") { + this.raise(startPos, ErrorMessages.SuperPrivateField); + } + + this.classScope.usePrivateName(privateName, property.start); + } + + node.property = property; + + if (computed) { + this.expect(3); + } + + if (state.optionalChainMember) { + node.optional = optional; + return this.finishNode(node, "OptionalMemberExpression"); + } else { + return this.finishNode(node, "MemberExpression"); + } + } + + parseBind(base, startPos, startLoc, noCalls, state) { + const node = this.startNodeAt(startPos, startLoc); + node.object = base; + node.callee = this.parseNoCallExpr(); + state.stop = true; + return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls); + } + + parseCoverCallAndAsyncArrowHead(base, startPos, startLoc, state, optional) { + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + let refExpressionErrors = null; + this.state.maybeInArrowParameters = true; + this.next(); + let node = this.startNodeAt(startPos, startLoc); + node.callee = base; + + if (state.maybeAsyncArrow) { + this.expressionScope.enter(newAsyncArrowScope()); + refExpressionErrors = new ExpressionErrors(); + } + + if (state.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); + } + + this.finishCallExpression(node, state.optionalChainMember); + + if (state.maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) { + state.stop = true; + this.expressionScope.validateAsPattern(); + this.expressionScope.exit(); + node = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), node); + } else { + if (state.maybeAsyncArrow) { + this.checkExpressionErrors(refExpressionErrors, true); + this.expressionScope.exit(); + } + + this.toReferencedArguments(node); + } + + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + return node; + } + + toReferencedArguments(node, isParenthesizedExpr) { + this.toReferencedListDeep(node.arguments, isParenthesizedExpr); + } + + parseTaggedTemplateExpression(base, startPos, startLoc, state) { + const node = this.startNodeAt(startPos, startLoc); + node.tag = base; + node.quasi = this.parseTemplate(true); + + if (state.optionalChainMember) { + this.raise(startPos, ErrorMessages.OptionalChainingNoTemplate); + } + + return this.finishNode(node, "TaggedTemplateExpression"); + } + + atPossibleAsyncArrow(base) { + return base.type === "Identifier" && base.name === "async" && this.state.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && base.start === this.state.potentialArrowAt; + } + + finishCallExpression(node, optional) { + if (node.callee.type === "Import") { + if (node.arguments.length === 2) { + { + if (!this.hasPlugin("moduleAttributes")) { + this.expectPlugin("importAssertions"); + } + } + } + + if (node.arguments.length === 0 || node.arguments.length > 2) { + this.raise(node.start, ErrorMessages.ImportCallArity, this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? "one or two arguments" : "one argument"); + } else { + for (const arg of node.arguments) { + if (arg.type === "SpreadElement") { + this.raise(arg.start, ErrorMessages.ImportCallSpreadArgument); + } + } + } + } + + 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("importAssertions") && !this.hasPlugin("moduleAttributes")) { + this.raise(this.state.lastTokStart, ErrorMessages.ImportCallArgumentTrailingComma); + } + + if (nodeForExtra) { + this.addExtra(nodeForExtra, "trailingComma", this.state.lastTokStart); + } + + 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.trailingComma); + + if (call.innerComments) { + setInnerComments(node, call.innerComments); + } + + if (call.callee.trailingComments) { + setInnerComments(node, call.callee.trailingComments); + } + + return node; + } + + parseNoCallExpr() { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); + } + + parseExprAtom(refExpressionErrors) { + let node; + const { + type + } = this.state; + + switch (type) { + case 73: + return this.parseSuper(); + + case 77: + node = this.startNode(); + this.next(); + + if (this.match(16)) { + return this.parseImportMetaProperty(node); + } + + if (!this.match(10)) { + this.raise(this.state.lastTokStart, ErrorMessages.UnsupportedImport); + } + + return this.finishNode(node, "Import"); + + case 72: + node = this.startNode(); + this.next(); + return this.finishNode(node, "ThisExpression"); + + case 84: + { + return this.parseDo(this.startNode(), false); + } + + case 50: + case 29: + { + this.readRegexp(); + return this.parseRegExpLiteral(this.state.value); + } + + case 124: + return this.parseNumericLiteral(this.state.value); + + case 125: + return this.parseBigIntLiteral(this.state.value); + + case 126: + return this.parseDecimalLiteral(this.state.value); + + case 123: + return this.parseStringLiteral(this.state.value); + + case 78: + return this.parseNullLiteral(); + + case 79: + return this.parseBooleanLiteral(true); + + case 80: + 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 62: + return this.parseFunctionOrFunctionSent(); + + case 24: + this.parseDecorators(); + + case 74: + node = this.startNode(); + this.takeDecorators(node); + return this.parseClass(node, false); + + case 71: + return this.parseNewOrNewTarget(); + + case 22: + 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(callee.start, ErrorMessages.UnsupportedBind); + } + } + + case 128: + { + this.raise(this.state.start, ErrorMessages.PrivateInExpectedIn, this.state.value); + return this.parsePrivateName(); + } + + case 31: + { + return this.parseTopicReferenceThenEqualsSign(48, "%"); + } + + case 30: + { + return this.parseTopicReferenceThenEqualsSign(40, "^"); + } + + case 40: + case 48: + case 25: + { + const pipeProposal = this.getPluginOption("pipelineOperator", "proposal"); + + if (pipeProposal) { + return this.parseTopicReference(pipeProposal); + } else { + throw this.unexpected(); + } + } + + case 43: + { + const lookaheadCh = this.input.codePointAt(this.nextTokenStart()); + + if (isIdentifierStart(lookaheadCh) || lookaheadCh === 62) { + this.expectOnePlugin(["jsx", "flow", "typescript"]); + break; + } else { + throw this.unexpected(); + } + } + + default: + if (tokenIsIdentifier(type)) { + if (this.isContextual(117) && this.lookaheadCharCode() === 123 && !this.hasFollowingLineBreak()) { + 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 === 62) { + this.resetPreviousNodeTrailingComments(id); + this.next(); + return this.parseFunction(this.startNodeAtNode(id), undefined, true); + } else if (tokenIsIdentifier(type)) { + if (this.lookaheadCharCode() === 61) { + return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(id)); + } else { + return id; + } + } else if (type === 84) { + 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 { + throw 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.column--; + return this.parseTopicReference(pipeProposal); + } else { + throw this.unexpected(); + } + } + + parseTopicReference(pipeProposal) { + const node = this.startNode(); + const start = this.state.start; + const tokenType = this.state.type; + this.next(); + return this.finishTopicReference(node, start, pipeProposal, tokenType); + } + + finishTopicReference(node, start, pipeProposal, tokenType) { + if (this.testTopicReferenceConfiguration(pipeProposal, start, tokenType)) { + let nodeType; + + if (pipeProposal === "smart") { + nodeType = "PipelinePrimaryTopicReference"; + } else { + nodeType = "TopicReference"; + } + + if (!this.topicReferenceIsAllowedInCurrentContext()) { + if (pipeProposal === "smart") { + this.raise(start, ErrorMessages.PrimaryTopicNotAllowed); + } else { + this.raise(start, ErrorMessages.PipeTopicUnbound); + } + } + + this.registerTopicReference(); + return this.finishNode(node, nodeType); + } else { + throw this.raise(start, ErrorMessages.PipeTopicUnconfiguredToken, tokenLabelName(tokenType)); + } + } + + testTopicReferenceConfiguration(pipeProposal, start, tokenType) { + switch (pipeProposal) { + case "hack": + { + const pluginTopicToken = this.getPluginOption("pipelineOperator", "topicToken"); + return tokenLabelName(tokenType) === pluginTopicToken; + } + + case "smart": + return tokenType === 25; + + default: + throw this.raise(start, ErrorMessages.PipeTopicRequiresHackPipes); + } + } + + parseAsyncArrowUnaryFunction(node) { + this.prodParam.enter(functionFlags(true, this.prodParam.hasYield)); + const params = [this.parseIdentifier()]; + this.prodParam.exit(); + + if (this.hasPrecedingLineBreak()) { + this.raise(this.state.pos, ErrorMessages.LineTerminatorBeforeArrow); + } + + this.expect(19); + this.parseArrowExpression(node, params, true); + return node; + } + + 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(node.start, ErrorMessages.SuperNotAllowed); + } else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) { + this.raise(node.start, ErrorMessages.UnexpectedSuper); + } + + if (!this.match(10) && !this.match(0) && !this.match(16)) { + this.raise(node.start, ErrorMessages.UnsupportedSuper); + } + + return this.finishNode(node, "Super"); + } + + parsePrivateName() { + const node = this.startNode(); + const id = this.startNodeAt(this.state.start + 1, new Position(this.state.curLine, this.state.start + 1 - this.state.lineStart)); + 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(96)) { + 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(node.property.start, ErrorMessages.UnsupportedMetaProperty, meta.name, propertyName); + } + + return this.finishNode(node, "MetaProperty"); + } + + parseImportMetaProperty(node) { + const id = this.createIdentifier(this.startNodeAtNode(node), "import"); + this.next(); + + if (this.isContextual(94)) { + if (!this.inModule) { + this.raise(id.start, SourceTypeModuleErrorMessages.ImportMetaOutsideModule); + } + + 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 startPos = this.state.start; + 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 innerStartPos = this.state.start; + const innerStartLoc = this.state.startLoc; + const exprList = []; + const refExpressionErrors = new ExpressionErrors(); + let first = true; + let spreadStart; + let optionalCommaStart; + + while (!this.match(11)) { + if (first) { + first = false; + } else { + this.expect(12, refExpressionErrors.optionalParameters === -1 ? null : refExpressionErrors.optionalParameters); + + if (this.match(11)) { + optionalCommaStart = this.state.start; + break; + } + } + + if (this.match(21)) { + const spreadNodeStartPos = this.state.start; + const spreadNodeStartLoc = this.state.startLoc; + spreadStart = this.state.start; + exprList.push(this.parseParenItem(this.parseRestBinding(), spreadNodeStartPos, spreadNodeStartLoc)); + this.checkCommaAfterRest(41); + break; + } else { + exprList.push(this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem)); + } + } + + const innerEndPos = this.state.lastTokEnd; + const innerEndLoc = this.state.lastTokEndLoc; + this.expect(11); + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; + let arrowNode = this.startNodeAt(startPos, startLoc); + + if (canBeArrow && this.shouldParseArrow(exprList) && (arrowNode = this.parseArrow(arrowNode))) { + this.expressionScope.validateAsPattern(); + this.expressionScope.exit(); + this.parseArrowExpression(arrowNode, exprList, false); + return arrowNode; + } + + this.expressionScope.exit(); + + if (!exprList.length) { + this.unexpected(this.state.lastTokStart); + } + + if (optionalCommaStart) this.unexpected(optionalCommaStart); + if (spreadStart) this.unexpected(spreadStart); + this.checkExpressionErrors(refExpressionErrors, true); + this.toReferencedListDeep(exprList, true); + + if (exprList.length > 1) { + val = this.startNodeAt(innerStartPos, innerStartLoc); + val.expressions = exprList; + this.finishNode(val, "SequenceExpression"); + this.resetEndLocation(val, innerEndPos, innerEndLoc); + } else { + val = exprList[0]; + } + + if (!this.options.createParenthesizedExpressions) { + this.addExtra(val, "parenthesized", true); + this.addExtra(val, "parenStart", startPos); + this.takeSurroundingComments(val, startPos, this.state.lastTokEnd); + return val; + } + + const parenExpression = this.startNodeAt(startPos, startLoc); + parenExpression.expression = val; + this.finishNode(parenExpression, "ParenthesizedExpression"); + return parenExpression; + } + + shouldParseArrow(params) { + return !this.canInsertSemicolon(); + } + + parseArrow(node) { + if (this.eat(19)) { + return node; + } + } + + parseParenItem(node, startPos, 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.raise(metaProp.start, ErrorMessages.UnexpectedNewTarget); + } + + return metaProp; + } + + return this.parseNew(node); + } + + parseNew(node) { + node.callee = this.parseNoCallExpr(); + + if (node.callee.type === "Import") { + this.raise(node.callee.start, ErrorMessages.ImportCallNotNewExpression); + } else if (this.isOptionalChain(node.callee)) { + this.raise(this.state.lastTokEnd, ErrorMessages.OptionalChainingNoNew); + } else if (this.eat(18)) { + this.raise(this.state.start, ErrorMessages.OptionalChainingNoNew); + } + + this.parseNewArguments(node); + return this.finishNode(node, "NewExpression"); + } + + parseNewArguments(node) { + if (this.eat(10)) { + const args = this.parseExprList(11); + this.toReferencedList(args); + node.arguments = args; + } else { + node.arguments = []; + } + } + + parseTemplateElement(isTagged) { + const elem = this.startNode(); + + if (this.state.value === null) { + if (!isTagged) { + this.raise(this.state.start + 1, ErrorMessages.InvalidEscapeSequenceTemplate); + } + } + + elem.value = { + raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"), + cooked: this.state.value + }; + this.next(); + elem.tail = this.match(22); + return this.finishNode(elem, "TemplateElement"); + } + + parseTemplate(isTagged) { + const node = this.startNode(); + this.next(); + node.expressions = []; + let curElt = this.parseTemplateElement(isTagged); + node.quasis = [curElt]; + + while (!curElt.tail) { + this.expect(23); + node.expressions.push(this.parseTemplateSubstitution()); + this.expect(8); + node.quasis.push(curElt = this.parseTemplateElement(isTagged)); + } + + this.next(); + 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.addExtra(node, "trailingComma", this.state.lastTokStart); + 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(prop.start, ErrorMessages.InvalidRecordProperty); + } + + 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); + } + + maybeAsyncOrAccessorProp(prop) { + return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(49)); + } + + parsePropertyDefinition(refExpressionErrors) { + let decorators = []; + + if (this.match(24)) { + if (this.hasPlugin("decorators")) { + this.raise(this.state.start, ErrorMessages.UnsupportedPropertyDecorator); + } + + while (this.match(24)) { + decorators.push(this.parseDecorator()); + } + } + + const prop = this.startNode(); + let isAsync = false; + let isAccessor = false; + let startPos; + 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) { + startPos = this.state.start; + startLoc = this.state.startLoc; + } + + let isGenerator = this.eat(49); + this.parsePropertyNamePrefixOperator(prop); + const containsEsc = this.state.containsEsc; + const key = this.parsePropertyName(prop); + + if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) { + const keyName = key.name; + + if (keyName === "async" && !this.hasPrecedingLineBreak()) { + isAsync = true; + this.resetPreviousNodeTrailingComments(key); + isGenerator = this.eat(49); + this.parsePropertyName(prop); + } + + if (keyName === "get" || keyName === "set") { + isAccessor = true; + this.resetPreviousNodeTrailingComments(key); + prop.kind = keyName; + + if (this.match(49)) { + isGenerator = true; + this.raise(this.state.pos, ErrorMessages.AccessorIsGenerator, keyName); + this.next(); + } + + this.parsePropertyName(prop); + } + } + + this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, false, isAccessor, refExpressionErrors); + return prop; + } + + 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); + const start = method.start; + + if (params.length !== paramCount) { + if (method.kind === "get") { + this.raise(start, ErrorMessages.BadGetterArity); + } else { + this.raise(start, ErrorMessages.BadSetterArity); + } + } + + if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") { + this.raise(start, ErrorMessages.BadSetterRestParameter); + } + } + + parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) { + if (isAccessor) { + this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod"); + this.checkGetterSetterParams(prop); + return prop; + } + + 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, startPos, startLoc, isPattern, refExpressionErrors) { + prop.shorthand = false; + + if (this.eat(14)) { + prop.value = isPattern ? this.parseMaybeDefault(this.state.start, 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.start, true, false); + + if (isPattern) { + prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key)); + } else if (this.match(27) && refExpressionErrors) { + if (refExpressionErrors.shorthandAssign === -1) { + refExpressionErrors.shorthandAssign = this.state.start; + } + + prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key)); + } else { + prop.value = cloneIdentifier(prop.key); + } + + prop.shorthand = true; + return this.finishNode(prop, "ObjectProperty"); + } + } + + parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) { + const node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) || this.parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors); + if (!node) this.unexpected(); + return node; + } + + parsePropertyName(prop) { + 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 124: + key = this.parseNumericLiteral(value); + break; + + case 123: + key = this.parseStringLiteral(value); + break; + + case 125: + key = this.parseBigIntLiteral(value); + break; + + case 126: + key = this.parseDecimalLiteral(value); + break; + + case 128: + { + const privateKeyPos = this.state.start + 1; + this.raise(privateKeyPos, ErrorMessages.UnexpectedPrivateField); + key = this.parsePrivateName(); + break; + } + + default: + throw this.unexpected(); + } + } + + prop.key = key; + + if (type !== 128) { + 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; + const allowModifiers = isConstructor; + this.scope.enter(SCOPE_FUNCTION | SCOPE_SUPER | (inClassScope ? SCOPE_CLASS : 0) | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); + this.prodParam.enter(functionFlags(isAsync, node.generator)); + this.parseFunctionParams(node, allowModifiers); + this.parseFunctionBodyAndFinish(node, type, true); + this.prodParam.exit(); + this.scope.exit(); + return node; + } + + 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, trailingCommaPos) { + this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW); + let flags = functionFlags(isAsync, false); + + if (!this.match(0) && 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, trailingCommaPos); + } + + 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, trailingCommaPos) { + node.params = this.toAssignableList(params, trailingCommaPos, false); + } + + parseFunctionBodyAndFinish(node, type, isMethod = false) { + this.parseFunctionBody(node, false, isMethod); + 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) { + const errorPos = (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.end : node.start; + this.raise(errorPos, ErrorMessages.IllegalLanguageModeDirective); + } + + const strictModeChanged = !oldStrict && this.state.strict; + this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged); + + if (this.state.strict && node.id) { + this.checkLVal(node.id, "function name", BIND_OUTSIDE, undefined, undefined, strictModeChanged); + } + }); + this.prodParam.exit(); + this.state.labels = oldLabels; + } + + this.expressionScope.exit(); + } + + isSimpleParamList(params) { + for (let i = 0, len = params.length; i < len; i++) { + if (params[i].type !== "Identifier") return false; + } + + return true; + } + + checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) { + const checkClashes = new Set(); + + for (const param of node.params) { + this.checkLVal(param, "function parameter list", BIND_VAR, allowDuplicates ? null : checkClashes, undefined, 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.addExtra(nodeForExtra, "trailingComma", this.state.lastTokStart); + } + + 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(this.state.pos, ErrorMessages.UnexpectedToken, ","); + } + + elt = null; + } else if (this.match(21)) { + const spreadNodeStartPos = this.state.start; + const spreadNodeStartLoc = this.state.startLoc; + elt = this.parseParenItem(this.parseSpread(refExpressionErrors), spreadNodeStartPos, spreadNodeStartLoc); + } else if (this.match(17)) { + this.expectPlugin("partialApplication"); + + if (!allowPlaceholder) { + this.raise(this.state.start, ErrorMessages.UnexpectedArgumentPlaceholder); + } + + 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(node.start, liberal); + return this.createIdentifier(node, name); + } + + createIdentifier(node, name) { + node.name = name; + node.loc.identifierName = name; + return this.finishNode(node, "Identifier"); + } + + parseIdentifierName(pos, liberal) { + let name; + const { + start, + type + } = this.state; + + if (tokenIsKeywordOrIdentifier(type)) { + name = this.state.value; + } else { + throw this.unexpected(); + } + + const tokenIsKeyword = tokenKeywordOrIdentifierIsKeyword(type); + + if (liberal) { + if (tokenIsKeyword) { + this.replaceToken(122); + } + } else { + this.checkReservedWord(name, start, tokenIsKeyword, false); + } + + this.next(); + return name; + } + + checkReservedWord(word, startLoc, checkKeywords, isBinding) { + if (word.length > 10) { + return; + } + + if (!canBeReservedWord(word)) { + return; + } + + if (word === "yield") { + if (this.prodParam.hasYield) { + this.raise(startLoc, ErrorMessages.YieldBindingIdentifier); + return; + } + } else if (word === "await") { + if (this.prodParam.hasAwait) { + this.raise(startLoc, ErrorMessages.AwaitBindingIdentifier); + return; + } else if (this.scope.inStaticBlock) { + this.raise(startLoc, ErrorMessages.AwaitBindingIdentifierInStaticBlock); + return; + } else { + this.expressionScope.recordAsyncArrowParametersError(startLoc, ErrorMessages.AwaitBindingIdentifier); + } + } else if (word === "arguments") { + if (this.scope.inClassAndNotInNonArrowFunction) { + this.raise(startLoc, ErrorMessages.ArgumentsInClass); + return; + } + } + + if (checkKeywords && isKeyword(word)) { + this.raise(startLoc, ErrorMessages.UnexpectedKeyword, word); + return; + } + + const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord; + + if (reservedTest(word, this.inModule)) { + this.raise(startLoc, ErrorMessages.UnexpectedReservedWord, word); + } + } + + isAwaitAllowed() { + if (this.prodParam.hasAwait) return true; + + if (this.options.allowAwaitOutsideFunction && !this.scope.inFunction) { + return true; + } + + return false; + } + + parseAwait(startPos, startLoc) { + const node = this.startNodeAt(startPos, startLoc); + this.expressionScope.recordParameterInitializerError(node.start, ErrorMessages.AwaitExpressionFormalParameter); + + if (this.eat(49)) { + this.raise(node.start, ErrorMessages.ObsoleteAwaitStar); + } + + 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() { + return this.hasPrecedingLineBreak() || this.match(47) || this.match(10) || this.match(0) || this.match(22) || this.match(127) || this.match(50) || this.hasPlugin("v8intrinsic") && this.match(48); + } + + parseYield() { + const node = this.startNode(); + this.expressionScope.recordParameterInitializerError(node.start, ErrorMessages.YieldInParameter); + this.next(); + let delegating = false; + let argument = null; + + if (!this.hasPrecedingLineBreak()) { + delegating = this.eat(49); + + switch (this.state.type) { + case 13: + case 129: + 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, leftStartPos) { + if (this.getPluginOption("pipelineOperator", "proposal") === "smart") { + if (left.type === "SequenceExpression") { + this.raise(leftStartPos, ErrorMessages.PipelineHeadSequenceExpression); + } + } + } + + checkHackPipeBodyEarlyErrors(startPos) { + if (!this.topicReferenceWasUsedInCurrentContext()) { + this.raise(startPos, ErrorMessages.PipeTopicUnused); + } + } + + parseSmartPipelineBodyInStyle(childExpr, startPos, startLoc) { + const bodyNode = this.startNodeAt(startPos, startLoc); + + if (this.isSimpleReference(childExpr)) { + bodyNode.callee = childExpr; + return this.finishNode(bodyNode, "PipelineBareFunction"); + } else { + this.checkSmartPipeTopicBodyEarlyErrors(startPos); + 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(startPos) { + if (this.match(19)) { + throw this.raise(this.state.start, ErrorMessages.PipelineBodyNoArrow); + } else if (!this.topicReferenceWasUsedInCurrentContext()) { + this.raise(startPos, ErrorMessages.PipelineTopicUnused); + } + } + + withTopicBindingContext(callback) { + const outerContextTopicState = this.state.topicContext; + this.state.topicContext = { + maxNumOfResolvableTopics: 1, + maxTopicIndex: null + }; + + try { + return callback(); + } finally { + this.state.topicContext = outerContextTopicState; + } + } + + withSmartMixTopicForbiddingContext(callback) { + const proposal = this.getPluginOption("pipelineOperator", "proposal"); + + if (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 startPos = this.state.start; + 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(), startPos, startLoc, prec); + this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; + return ret; + } + + parseModuleExpression() { + this.expectPlugin("moduleBlocks"); + const node = this.startNode(); + this.next(); + this.eat(5); + const revertScopes = this.initializeScopes(true); + this.enterInitialScopes(); + const program = this.startNode(); + + try { + node.body = this.parseProgram(program, 8, "module"); + } finally { + revertScopes(); + } + + this.eat(8); + return this.finishNode(node, "ModuleExpression"); + } + + parsePropertyNamePrefixOperator(prop) {} + +} + +const loopLabel = { + kind: "loop" +}, + switchLabel = { + kind: "switch" +}; +const FUNC_NO_FLAGS = 0b000, + FUNC_STATEMENT = 0b001, + FUNC_HANGING_STATEMENT = 0b010, + FUNC_NULLABLE_ID = 0b100; +const loneSurrogate = /[\uD800-\uDFFF]/u; +const keywordRelationalOperator = /in(?:stanceof)?/y; + +function babel7CompatTokens(tokens) { + for (let i = 0; i < tokens.length; i++) { + const token = tokens[i]; + const { + type + } = token; + + if (type === 128) { + { + const { + loc, + start, + value, + end + } = token; + const hashEndPos = start + 1; + const hashEndLoc = new Position(loc.start.line, loc.start.column + 1); + tokens.splice(i, 1, new Token({ + type: getExportedToken(25), + value: "#", + start: start, + end: hashEndPos, + startLoc: loc.start, + endLoc: hashEndLoc + }), new Token({ + type: getExportedToken(122), + value: value, + start: hashEndPos, + end: end, + startLoc: hashEndLoc, + endLoc: loc.end + })); + i++; + continue; + } + } + + if (typeof type === "number") { + 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); + return this.finishNode(file, "File"); + } + + parseProgram(program, end = 129, 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 [name] of Array.from(this.scope.undefinedExports)) { + const pos = this.scope.undefinedExports.get(name); + this.raise(pos, ErrorMessages.ModuleExportUndefined, name); + } + } + + return this.finishNode(program, "Program"); + } + + 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(26)) { + return null; + } + + const node = this.startNode(); + node.value = this.state.value; + this.next(); + return this.finishNode(node, "InterpreterDirective"); + } + + isLet(context) { + if (!this.isContextual(93)) { + return false; + } + + return this.isLetKeyword(context); + } + + isLetKeyword(context) { + const next = this.nextTokenStart(); + const nextCh = this.codePointAtPos(next); + + if (nextCh === 92 || nextCh === 91) { + return true; + } + + if (context) return false; + if (nextCh === 123) return true; + + if (isIdentifierStart(nextCh)) { + keywordRelationalOperator.lastIndex = next; + + if (keywordRelationalOperator.test(this.input)) { + const endCh = this.codePointAtPos(keywordRelationalOperator.lastIndex); + + if (!isIdentifierChar(endCh) && endCh !== 92) { + return false; + } + } + + return true; + } + + return false; + } + + parseStatement(context, topLevel) { + if (this.match(24)) { + this.parseDecorators(true); + } + + return this.parseStatementContent(context, topLevel); + } + + parseStatementContent(context, topLevel) { + let starttype = this.state.type; + const node = this.startNode(); + let kind; + + if (this.isLet(context)) { + starttype = 68; + kind = "let"; + } + + switch (starttype) { + case 54: + return this.parseBreakContinueStatement(node, true); + + case 57: + return this.parseBreakContinueStatement(node, false); + + case 58: + return this.parseDebuggerStatement(node); + + case 84: + return this.parseDoStatement(node); + + case 85: + return this.parseForStatement(node); + + case 62: + if (this.lookaheadCharCode() === 46) break; + + if (context) { + if (this.state.strict) { + this.raise(this.state.start, ErrorMessages.StrictFunction); + } else if (context !== "if" && context !== "label") { + this.raise(this.state.start, ErrorMessages.SloppyFunction); + } + } + + return this.parseFunctionStatement(node, false, !context); + + case 74: + if (context) this.unexpected(); + return this.parseClass(node, true); + + case 63: + return this.parseIfStatement(node); + + case 64: + return this.parseReturnStatement(node); + + case 65: + return this.parseSwitchStatement(node); + + case 66: + return this.parseThrowStatement(node); + + case 67: + return this.parseTryStatement(node); + + case 69: + case 68: + kind = kind || this.state.value; + + if (context && kind !== "var") { + this.raise(this.state.start, ErrorMessages.UnexpectedLexicalDeclaration); + } + + return this.parseVarStatement(node, kind); + + case 86: + return this.parseWhileStatement(node); + + case 70: + return this.parseWithStatement(node); + + case 5: + return this.parseBlock(); + + case 13: + return this.parseEmptyStatement(node); + + case 77: + { + const nextTokenCharCode = this.lookaheadCharCode(); + + if (nextTokenCharCode === 40 || nextTokenCharCode === 46) { + break; + } + } + + case 76: + { + if (!this.options.allowImportExportEverywhere && !topLevel) { + this.raise(this.state.start, ErrorMessages.UnexpectedImportExport); + } + + this.next(); + let result; + + if (starttype === 77) { + result = this.parseImport(node); + + if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) { + this.sawUnambiguousESM = true; + } + } else { + result = this.parseExport(node); + + 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(node); + return result; + } + + default: + { + if (this.isAsyncFunction()) { + if (context) { + this.raise(this.state.start, ErrorMessages.AsyncFunctionInSingleStatementContext); + } + + this.next(); + return this.parseFunctionStatement(node, true, !context); + } + } + } + + const maybeName = this.state.value; + const expr = this.parseExpression(); + + if (tokenIsIdentifier(starttype) && expr.type === "Identifier" && this.eat(14)) { + return this.parseLabeledStatement(node, maybeName, expr, context); + } else { + return this.parseExpressionStatement(node, expr); + } + } + + assertModuleNodeAllowed(node) { + if (!this.options.allowImportExportEverywhere && !this.inModule) { + this.raise(node.start, SourceTypeModuleErrorMessages.ImportOutsideModule); + } + } + + takeDecorators(node) { + const decorators = this.state.decoratorStack[this.state.decoratorStack.length - 1]; + + if (decorators.length) { + node.decorators = decorators; + this.resetStartLocationFromNode(node, decorators[0]); + this.state.decoratorStack[this.state.decoratorStack.length - 1] = []; + } + } + + canHaveLeadingDecorator() { + return this.match(74); + } + + parseDecorators(allowExport) { + const currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1]; + + while (this.match(24)) { + const decorator = this.parseDecorator(); + currentContextDecorators.push(decorator); + } + + if (this.match(76)) { + if (!allowExport) { + this.unexpected(); + } + + if (this.hasPlugin("decorators") && !this.getPluginOption("decorators", "decoratorsBeforeExport")) { + this.raise(this.state.start, ErrorMessages.DecoratorExportClass); + } + } else if (!this.canHaveLeadingDecorator()) { + throw this.raise(this.state.start, ErrorMessages.UnexpectedLeadingDecorator); + } + } + + parseDecorator() { + this.expectOnePlugin(["decorators-legacy", "decorators"]); + const node = this.startNode(); + this.next(); + + if (this.hasPlugin("decorators")) { + this.state.decoratorStack.push([]); + const startPos = this.state.start; + const startLoc = this.state.startLoc; + let expr; + + if (this.eat(10)) { + expr = this.parseExpression(); + this.expect(11); + } else { + expr = this.parseIdentifier(false); + + while (this.eat(16)) { + const node = this.startNodeAt(startPos, startLoc); + node.object = expr; + node.property = this.parseIdentifier(true); + node.computed = false; + expr = this.finishNode(node, "MemberExpression"); + } + } + + node.expression = this.parseMaybeDecoratorArguments(expr); + this.state.decoratorStack.pop(); + } 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) { + this.raise(node.start, ErrorMessages.IllegalBreakContinue, isBreak ? "break" : "continue"); + } + } + + parseDebuggerStatement(node) { + this.next(); + this.semicolon(); + return this.finishNode(node, "DebuggerStatement"); + } + + parseHeaderExpression() { + this.expect(10); + const val = this.parseExpression(); + this.expect(11); + return val; + } + + parseDoStatement(node) { + this.next(); + this.state.labels.push(loopLabel); + node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("do")); + this.state.labels.pop(); + this.expect(86); + node.test = this.parseHeaderExpression(); + this.eat(13); + return this.finishNode(node, "DoWhileStatement"); + } + + parseForStatement(node) { + this.next(); + this.state.labels.push(loopLabel); + let awaitAt = -1; + + if (this.isAwaitAllowed() && this.eatContextual(90)) { + awaitAt = this.state.lastTokStart; + } + + this.scope.enter(SCOPE_OTHER); + this.expect(10); + + if (this.match(13)) { + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + + return this.parseFor(node, null); + } + + const startsWithLet = this.isContextual(93); + const isLet = startsWithLet && this.isLetKeyword(); + + if (this.match(68) || this.match(69) || isLet) { + const init = this.startNode(); + const kind = isLet ? "let" : this.state.value; + this.next(); + this.parseVar(init, true, kind); + this.finishNode(init, "VariableDeclaration"); + + if ((this.match(52) || this.isContextual(95)) && init.declarations.length === 1) { + return this.parseForIn(node, init, awaitAt); + } + + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + + return this.parseFor(node, init); + } + + const startsWithAsync = this.isContextual(89); + const refExpressionErrors = new ExpressionErrors(); + const init = this.parseExpression(true, refExpressionErrors); + const isForOf = this.isContextual(95); + + if (isForOf) { + if (startsWithLet) { + this.raise(init.start, ErrorMessages.ForOfLet); + } else if (awaitAt === -1 && startsWithAsync && init.type === "Identifier") { + this.raise(init.start, ErrorMessages.ForOfAsync); + } + } + + if (isForOf || this.match(52)) { + this.toAssignable(init, true); + const description = isForOf ? "for-of statement" : "for-in statement"; + this.checkLVal(init, description); + return this.parseForIn(node, init, awaitAt); + } else { + this.checkExpressionErrors(refExpressionErrors, true); + } + + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + + return this.parseFor(node, init); + } + + parseFunctionStatement(node, isAsync, declarationPosition) { + this.next(); + return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), isAsync); + } + + parseIfStatement(node) { + this.next(); + node.test = this.parseHeaderExpression(); + node.consequent = this.parseStatement("if"); + node.alternate = this.eat(60) ? this.parseStatement("if") : null; + return this.finishNode(node, "IfStatement"); + } + + parseReturnStatement(node) { + if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) { + this.raise(this.state.start, ErrorMessages.IllegalReturn); + } + + 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(SCOPE_OTHER); + let cur; + + for (let sawDefault; !this.match(8);) { + if (this.match(55) || this.match(59)) { + const isCase = this.match(55); + 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(this.state.lastTokStart, ErrorMessages.MultipleDefaultsInSwitch); + } + + sawDefault = true; + cur.test = null; + } + + this.expect(14); + } else { + if (cur) { + cur.consequent.push(this.parseStatement(null)); + } 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(this.state.lastTokEnd, ErrorMessages.NewlineAfterThrow); + } + + node.argument = this.parseExpression(); + this.semicolon(); + return this.finishNode(node, "ThrowStatement"); + } + + parseCatchClauseParam() { + const param = this.parseBindingAtom(); + const simple = param.type === "Identifier"; + this.scope.enter(simple ? SCOPE_SIMPLE_CATCH : 0); + this.checkLVal(param, "catch clause", BIND_LEXICAL); + return param; + } + + parseTryStatement(node) { + this.next(); + node.block = this.parseBlock(); + node.handler = null; + + if (this.match(56)) { + 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(SCOPE_OTHER); + } + + clause.body = this.withSmartMixTopicForbiddingContext(() => this.parseBlock(false, false)); + this.scope.exit(); + node.handler = this.finishNode(clause, "CatchClause"); + } + + node.finalizer = this.eat(61) ? this.parseBlock() : null; + + if (!node.handler && !node.finalizer) { + this.raise(node.start, ErrorMessages.NoCatchOrFinally); + } + + return this.finishNode(node, "TryStatement"); + } + + parseVarStatement(node, kind) { + this.next(); + this.parseVar(node, false, kind); + 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("while")); + this.state.labels.pop(); + return this.finishNode(node, "WhileStatement"); + } + + parseWithStatement(node) { + if (this.state.strict) { + this.raise(this.state.start, ErrorMessages.StrictWith); + } + + this.next(); + node.object = this.parseHeaderExpression(); + node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("with")); + return this.finishNode(node, "WithStatement"); + } + + parseEmptyStatement(node) { + this.next(); + return this.finishNode(node, "EmptyStatement"); + } + + parseLabeledStatement(node, maybeName, expr, context) { + for (const label of this.state.labels) { + if (label.name === maybeName) { + this.raise(expr.start, ErrorMessages.LabelRedeclaration, maybeName); + } + } + + const kind = tokenIsLoop(this.state.type) ? "loop" : this.match(65) ? "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 = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); + this.state.labels.pop(); + node.label = expr; + return this.finishNode(node, "LabeledStatement"); + } + + parseExpressionStatement(node, expr) { + 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(SCOPE_OTHER); + } + + 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 = this.parseStatement(null, topLevel); + + 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); + } + + if (afterBlockParse) { + 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("for")); + this.scope.exit(); + this.state.labels.pop(); + return this.finishNode(node, "ForStatement"); + } + + parseForIn(node, init, awaitAt) { + const isForIn = this.match(52); + this.next(); + + if (isForIn) { + if (awaitAt > -1) this.unexpected(awaitAt); + } else { + node.await = awaitAt > -1; + } + + if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { + this.raise(init.start, ErrorMessages.ForInOfLoopInitializer, isForIn ? "for-in" : "for-of"); + } else if (init.type === "AssignmentPattern") { + this.raise(init.start, ErrorMessages.InvalidLhs, "for-loop"); + } + + node.left = init; + node.right = isForIn ? this.parseExpression() : this.parseMaybeAssignAllowIn(); + this.expect(11); + node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("for")); + this.scope.exit(); + this.state.labels.pop(); + return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement"); + } + + parseVar(node, isFor, kind) { + const declarations = node.declarations = []; + const isTypescript = this.hasPlugin("typescript"); + node.kind = kind; + + for (;;) { + const decl = this.startNode(); + this.parseVarId(decl, kind); + + if (this.eat(27)) { + decl.init = isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn(); + } else { + if (kind === "const" && !(this.match(52) || this.isContextual(95))) { + if (!isTypescript) { + this.raise(this.state.lastTokEnd, ErrorMessages.DeclarationMissingInitializer, "Const declarations"); + } + } else if (decl.id.type !== "Identifier" && !(isFor && (this.match(52) || this.isContextual(95)))) { + this.raise(this.state.lastTokEnd, ErrorMessages.DeclarationMissingInitializer, "Complex binding patterns"); + } + + decl.init = null; + } + + declarations.push(this.finishNode(decl, "VariableDeclarator")); + if (!this.eat(12)) break; + } + + return node; + } + + parseVarId(decl, kind) { + decl.id = this.parseBindingAtom(); + this.checkLVal(decl.id, "variable declaration", kind === "var" ? BIND_VAR : BIND_LEXICAL, undefined, kind !== "var"); + } + + parseFunction(node, statement = FUNC_NO_FLAGS, isAsync = false) { + const isStatement = statement & FUNC_STATEMENT; + const isHangingStatement = statement & FUNC_HANGING_STATEMENT; + const requireId = !!isStatement && !(statement & FUNC_NULLABLE_ID); + this.initFunction(node, isAsync); + + if (this.match(49) && isHangingStatement) { + this.raise(this.state.start, ErrorMessages.GeneratorInSingleStatementContext); + } + + node.generator = this.eat(49); + + if (isStatement) { + node.id = this.parseFunctionId(requireId); + } + + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + this.state.maybeInArrowParameters = false; + this.scope.enter(SCOPE_FUNCTION); + this.prodParam.enter(functionFlags(isAsync, node.generator)); + + if (!isStatement) { + node.id = this.parseFunctionId(); + } + + this.parseFunctionParams(node, false); + this.withSmartMixTopicForbiddingContext(() => { + this.parseFunctionBodyAndFinish(node, isStatement ? "FunctionDeclaration" : "FunctionExpression"); + }); + this.prodParam.exit(); + this.scope.exit(); + + if (isStatement && !isHangingStatement) { + this.registerFunctionStatementId(node); + } + + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + return node; + } + + parseFunctionId(requireId) { + return requireId || tokenIsIdentifier(this.state.type) ? this.parseIdentifier() : null; + } + + parseFunctionParams(node, allowModifiers) { + this.expect(10); + this.expressionScope.enter(newParameterDeclarationScope()); + node.params = this.parseBindingList(11, 41, false, allowModifiers); + this.expressionScope.exit(); + } + + registerFunctionStatementId(node) { + if (!node.id) return; + this.scope.declareName(node.id.name, this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION, node.id.start); + } + + parseClass(node, isStatement, optionalId) { + this.next(); + this.takeDecorators(node); + 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(27) || 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(this.state.lastTokEnd, ErrorMessages.DecoratorSemicolon); + } + + continue; + } + + if (this.match(24)) { + 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(member.start, ErrorMessages.DecoratorConstructor); + } + } + }); + this.state.strict = oldStrict; + this.next(); + + if (decorators.length) { + throw this.raise(this.state.start, ErrorMessages.TrailingDecorator); + } + + 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(98); + + 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 method = publicMethod; + const publicMember = publicMethod; + member.static = isStatic; + this.parsePropertyNamePrefixOperator(member); + + if (this.eat(49)) { + method.kind = "method"; + const isPrivateName = this.match(128); + this.parseClassElementName(method); + + if (isPrivateName) { + this.pushClassPrivateMethod(classBody, privateMethod, true, false); + return; + } + + if (this.isNonstaticConstructor(publicMethod)) { + this.raise(publicMethod.key.start, ErrorMessages.ConstructorIsGenerator); + } + + this.pushClassMethod(classBody, publicMethod, true, false, false, false); + return; + } + + const isContextual = tokenIsIdentifier(this.state.type) && !this.state.containsEsc; + const isPrivate = this.match(128); + const key = this.parseClassElementName(member); + const maybeQuestionTokenStart = this.state.start; + 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(key.start, ErrorMessages.DuplicateConstructor); + } + + if (isConstructor && this.hasPlugin("typescript") && member.override) { + this.raise(key.start, ErrorMessages.OverrideOnConstructor); + } + + 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(49); + + if (publicMember.optional) { + this.unexpected(maybeQuestionTokenStart); + } + + method.kind = "method"; + const isPrivate = this.match(128); + this.parseClassElementName(method); + this.parsePostMemberNameModifiers(publicMember); + + if (isPrivate) { + this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true); + } else { + if (this.isNonstaticConstructor(publicMethod)) { + this.raise(publicMethod.key.start, ErrorMessages.ConstructorIsAsync); + } + + this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false); + } + } else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(49) && this.isLineTerminator())) { + this.resetPreviousNodeTrailingComments(key); + method.kind = key.name; + const isPrivate = this.match(128); + this.parseClassElementName(publicMethod); + + if (isPrivate) { + this.pushClassPrivateMethod(classBody, privateMethod, false, false); + } else { + if (this.isNonstaticConstructor(publicMethod)) { + this.raise(publicMethod.key.start, ErrorMessages.ConstructorIsAccessor); + } + + this.pushClassMethod(classBody, publicMethod, false, false, false, false); + } + + this.checkGetterSetterParams(publicMethod); + } else if (this.isLineTerminator()) { + if (isPrivate) { + this.pushClassPrivateProperty(classBody, privateProp); + } else { + this.pushClassProperty(classBody, publicProp); + } + } else { + this.unexpected(); + } + } + + parseClassElementName(member) { + const { + type, + value, + start + } = this.state; + + if ((type === 122 || type === 123) && member.static && value === "prototype") { + this.raise(start, ErrorMessages.StaticPrototype); + } + + if (type === 128) { + if (value === "constructor") { + this.raise(start, ErrorMessages.ConstructorClassPrivateField); + } + + const key = this.parsePrivateName(); + member.key = key; + return key; + } + + return this.parsePropertyName(member); + } + + parseClassStaticBlock(classBody, member) { + var _member$decorators; + + this.scope.enter(SCOPE_CLASS | SCOPE_STATIC_BLOCK | SCOPE_SUPER); + 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(member.start, ErrorMessages.DecoratorStaticBlock); + } + } + + pushClassProperty(classBody, prop) { + if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) { + this.raise(prop.key.start, ErrorMessages.ConstructorClassField); + } + + 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), CLASS_ELEMENT_OTHER, node.key.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 ? CLASS_ELEMENT_STATIC_GETTER : CLASS_ELEMENT_INSTANCE_GETTER : node.kind === "set" ? node.static ? CLASS_ELEMENT_STATIC_SETTER : CLASS_ELEMENT_INSTANCE_SETTER : CLASS_ELEMENT_OTHER; + this.declareClassPrivateMethodInScope(node, kind); + } + + declareClassPrivateMethodInScope(node, kind) { + this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.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"); + } + + parseInitializer(node) { + this.scope.enter(SCOPE_CLASS | SCOPE_SUPER); + this.expressionScope.enter(newExpressionScope()); + this.prodParam.enter(PARAM); + node.value = this.eat(27) ? this.parseMaybeAssignAllowIn() : null; + this.expressionScope.exit(); + this.prodParam.exit(); + this.scope.exit(); + } + + parseClassId(node, isStatement, optionalId, bindingType = BIND_CLASS) { + if (tokenIsIdentifier(this.state.type)) { + node.id = this.parseIdentifier(); + + if (isStatement) { + this.checkLVal(node.id, "class name", bindingType); + } + } else { + if (optionalId || !isStatement) { + node.id = null; + } else { + this.unexpected(null, ErrorMessages.MissingClassName); + } + } + } + + parseClassSuper(node) { + node.superClass = this.eat(75) ? this.parseExprSubscripts() : null; + } + + parseExport(node) { + const hasDefault = this.maybeParseExportDefaultSpecifier(node); + 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(); + this.parseExportFrom(node, true); + return this.finishNode(node, "ExportAllDeclaration"); + } + + const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node); + + if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers || hasNamespace && parseAfterNamespace && !hasSpecifiers) { + throw this.unexpected(null, 5); + } + + let hasDeclaration; + + if (isFromRequired || hasSpecifiers) { + hasDeclaration = false; + this.parseExportFrom(node, isFromRequired); + } else { + hasDeclaration = this.maybeParseExportDeclaration(node); + } + + if (isFromRequired || hasSpecifiers || hasDeclaration) { + this.checkExport(node, true, false, !!node.source); + return this.finishNode(node, "ExportNamedDeclaration"); + } + + if (this.eat(59)) { + node.declaration = this.parseExportDefaultExpression(); + this.checkExport(node, true, true); + return this.finishNode(node, "ExportDefaultDeclaration"); + } + + throw this.unexpected(null, 5); + } + + eatExportStar(node) { + return this.eat(49); + } + + maybeParseExportDefaultSpecifier(node) { + if (this.isExportDefaultSpecifier()) { + this.expectPlugin("exportDefaultFrom"); + const specifier = this.startNode(); + specifier.exported = this.parseIdentifier(true); + node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")]; + return true; + } + + return false; + } + + maybeParseExportNamespaceSpecifier(node) { + if (this.isContextual(87)) { + if (!node.specifiers) node.specifiers = []; + const specifier = this.startNodeAt(this.state.lastTokStart, 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(89)) return false; + const next = this.nextTokenStart(); + return !lineBreak.test(this.input.slice(this.state.pos, next)) && this.isUnparsedContextual(next, "function"); + } + + parseExportDefaultExpression() { + const expr = this.startNode(); + const isAsync = this.isAsyncFunction(); + + if (this.match(62) || isAsync) { + this.next(); + + if (isAsync) { + this.next(); + } + + return this.parseFunction(expr, FUNC_STATEMENT | FUNC_NULLABLE_ID, isAsync); + } else if (this.match(74)) { + return this.parseClass(expr, true, true); + } else if (this.match(24)) { + if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport")) { + this.raise(this.state.start, ErrorMessages.DecoratorBeforeExport); + } + + this.parseDecorators(false); + return this.parseClass(expr, true, true); + } else if (this.match(69) || this.match(68) || this.isLet()) { + throw this.raise(this.state.start, ErrorMessages.UnsupportedDefaultExport); + } else { + const res = this.parseMaybeAssignAllowIn(); + this.semicolon(); + return res; + } + } + + parseExportDeclaration(node) { + return this.parseStatement(null); + } + + isExportDefaultSpecifier() { + const { + type + } = this.state; + + if (tokenIsIdentifier(type)) { + if (type === 89 && !this.state.containsEsc || type === 93) { + return false; + } + + if ((type === 120 || type === 119) && !this.state.containsEsc) { + const { + type: nextType + } = this.lookahead(); + + if (tokenIsIdentifier(nextType) && nextType !== 91 || nextType === 5) { + this.expectOnePlugin(["flow", "typescript"]); + return false; + } + } + } else if (!this.match(59)) { + 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(59) && hasFrom) { + const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4)); + return nextAfterFrom === 34 || nextAfterFrom === 39; + } + + return false; + } + + parseExportFrom(node, expect) { + if (this.eatContextual(91)) { + node.source = this.parseImportSource(); + this.checkExport(node); + const assertions = this.maybeParseImportAssertions(); + + if (assertions) { + node.assertions = assertions; + } + } else if (expect) { + this.unexpected(); + } + + this.semicolon(); + } + + shouldParseExportDeclaration() { + const { + type + } = this.state; + + if (type === 24) { + this.expectOnePlugin(["decorators", "decorators-legacy"]); + + if (this.hasPlugin("decorators")) { + if (this.getPluginOption("decorators", "decoratorsBeforeExport")) { + this.unexpected(this.state.start, ErrorMessages.DecoratorBeforeExport); + } else { + return true; + } + } + } + + return type === 68 || type === 69 || type === 62 || type === 74 || this.isLet() || this.isAsyncFunction(); + } + + checkExport(node, checkNames, isDefault, isFrom) { + if (checkNames) { + 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(declaration.start, ErrorMessages.ExportDefaultFromAsIdentifier); + } + } + } else if (node.specifiers && node.specifiers.length) { + for (const specifier of node.specifiers) { + const { + exported + } = specifier; + const exportedName = exported.type === "Identifier" ? exported.name : exported.value; + this.checkDuplicateExports(specifier, exportedName); + + if (!isFrom && specifier.local) { + const { + local + } = specifier; + + if (local.type !== "Identifier") { + this.raise(specifier.start, ErrorMessages.ExportBindingIsString, local.value, exportedName); + } else { + this.checkReservedWord(local.name, local.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); + } + } + } + } + + const currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1]; + + if (currentContextDecorators.length) { + throw this.raise(node.start, ErrorMessages.UnsupportedDecoratorExport); + } + } + + 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, name) { + if (this.exportedIdentifiers.has(name)) { + this.raise(node.start, name === "default" ? ErrorMessages.DuplicateDefaultExport : ErrorMessages.DuplicateExport, name); + } + + this.exportedIdentifiers.add(name); + } + + 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(120); + const isString = this.match(123); + 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(87)) { + 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(123)) { + const result = this.parseStringLiteral(this.state.value); + const surrogate = result.value.match(loneSurrogate); + + if (surrogate) { + this.raise(result.start, ErrorMessages.ModuleExportNameHasLoneSurrogate, surrogate[0].charCodeAt(0).toString(16)); + } + + return result; + } + + return this.parseIdentifier(true); + } + + parseImport(node) { + node.specifiers = []; + + if (!this.match(123)) { + const hasDefault = this.maybeParseDefaultImportSpecifier(node); + const parseNext = !hasDefault || this.eat(12); + const hasStar = parseNext && this.maybeParseStarImportSpecifier(node); + if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node); + this.expectContextual(91); + } + + node.source = this.parseImportSource(); + const assertions = this.maybeParseImportAssertions(); + + if (assertions) { + node.assertions = assertions; + } else { + const attributes = this.maybeParseModuleAttributes(); + + if (attributes) { + node.attributes = attributes; + } + } + + this.semicolon(); + return this.finishNode(node, "ImportDeclaration"); + } + + parseImportSource() { + if (!this.match(123)) this.unexpected(); + return this.parseExprAtom(); + } + + shouldParseDefaultImport(node) { + return tokenIsIdentifier(this.state.type); + } + + parseImportSpecifierLocal(node, specifier, type, contextDescription) { + specifier.local = this.parseIdentifier(); + this.checkLVal(specifier.local, contextDescription, BIND_LEXICAL); + node.specifiers.push(this.finishNode(specifier, type)); + } + + parseAssertEntries() { + 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(this.state.start, ErrorMessages.ModuleAttributesWithDuplicateKeys, keyName); + } + + attrNames.add(keyName); + + if (this.match(123)) { + node.key = this.parseStringLiteral(keyName); + } else { + node.key = this.parseIdentifier(true); + } + + this.expect(14); + + if (!this.match(123)) { + throw this.unexpected(this.state.start, ErrorMessages.ModuleAttributeInvalidValue); + } + + node.value = this.parseStringLiteral(this.state.value); + this.finishNode(node, "ImportAttribute"); + attrs.push(node); + } while (this.eat(12)); + + return attrs; + } + + maybeParseModuleAttributes() { + if (this.match(70) && !this.hasPrecedingLineBreak()) { + this.expectPlugin("moduleAttributes"); + this.next(); + } else { + if (this.hasPlugin("moduleAttributes")) return []; + return null; + } + + const attrs = []; + const attributes = new Set(); + + do { + const node = this.startNode(); + node.key = this.parseIdentifier(true); + + if (node.key.name !== "type") { + this.raise(node.key.start, ErrorMessages.ModuleAttributeDifferentFromType, node.key.name); + } + + if (attributes.has(node.key.name)) { + this.raise(node.key.start, ErrorMessages.ModuleAttributesWithDuplicateKeys, node.key.name); + } + + attributes.add(node.key.name); + this.expect(14); + + if (!this.match(123)) { + throw this.unexpected(this.state.start, ErrorMessages.ModuleAttributeInvalidValue); + } + + node.value = this.parseStringLiteral(this.state.value); + this.finishNode(node, "ImportAttribute"); + attrs.push(node); + } while (this.eat(12)); + + return attrs; + } + + maybeParseImportAssertions() { + if (this.isContextual(88) && !this.hasPrecedingLineBreak()) { + this.expectPlugin("importAssertions"); + this.next(); + } else { + if (this.hasPlugin("importAssertions")) return []; + return null; + } + + this.eat(5); + const attrs = this.parseAssertEntries(); + this.eat(8); + return attrs; + } + + maybeParseDefaultImportSpecifier(node) { + if (this.shouldParseDefaultImport(node)) { + this.parseImportSpecifierLocal(node, this.startNode(), "ImportDefaultSpecifier", "default import specifier"); + return true; + } + + return false; + } + + maybeParseStarImportSpecifier(node) { + if (this.match(49)) { + const specifier = this.startNode(); + this.next(); + this.expectContextual(87); + this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier", "import namespace specifier"); + 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(this.state.start, ErrorMessages.DestructureNamedImport); + } + + this.expect(12); + if (this.eat(8)) break; + } + + const specifier = this.startNode(); + const importedIsString = this.match(123); + const isMaybeTypeOnly = this.isContextual(120); + specifier.imported = this.parseModuleExportName(); + const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly); + node.specifiers.push(importSpecifier); + } + } + + parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) { + if (this.eatContextual(87)) { + specifier.local = this.parseIdentifier(); + } else { + const { + imported + } = specifier; + + if (importedIsString) { + throw this.raise(specifier.start, ErrorMessages.ImportBindingIsString, imported.value); + } + + this.checkReservedWord(imported.name, specifier.start, true, true); + + if (!specifier.local) { + specifier.local = cloneIdentifier(imported); + } + } + + this.checkLVal(specifier.local, "import specifier", BIND_LEXICAL); + return this.finishNode(specifier, "ImportSpecifier"); + } + + 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 diff --git a/src/main/resources/static/node_modules/@babel/parser/lib/index.js.map b/src/main/resources/static/node_modules/@babel/parser/lib/index.js.map new file mode 100644 index 0000000..f678464 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/parser/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../src/util/whitespace.js","../src/util/location.js","../src/parser/base.js","../src/parser/comments.js","../src/parser/error-codes.js","../src/parser/error-message.js","../src/parser/error.js","../src/plugins/estree.js","../src/tokenizer/context.js","../src/tokenizer/types.js","../../babel-helper-validator-identifier/src/identifier.ts","../../babel-helper-validator-identifier/src/keyword.ts","../src/util/identifier.js","../src/util/scopeflags.js","../src/util/scope.js","../src/plugins/flow/scope.js","../src/tokenizer/state.js","../src/tokenizer/index.js","../src/util/class-scope.js","../src/util/expression-scope.js","../src/util/production-parameter.js","../src/parser/util.js","../src/parser/node.js","../src/plugins/flow/index.js","../src/plugins/jsx/xhtml.js","../src/plugins/jsx/index.js","../src/plugins/typescript/scope.js","../src/plugins/typescript/index.js","../src/plugins/placeholders.js","../src/plugins/v8intrinsic.js","../src/plugin-utils.js","../src/options.js","../src/parser/lval.js","../src/parser/expression.js","../src/parser/statement.js","../src/parser/index.js","../src/index.js"],"sourcesContent":["// @flow\n\nimport * as charCodes from \"charcodes\";\n\n// Matches a whole line break (where CRLF is considered a single\n// line break). Used to count lines.\nexport const lineBreak = /\\r\\n?|[\\n\\u2028\\u2029]/;\nexport const lineBreakG = new RegExp(lineBreak.source, \"g\");\n\n// https://tc39.github.io/ecma262/#sec-line-terminators\nexport function isNewLine(code: number): boolean {\n switch (code) {\n case charCodes.lineFeed:\n case charCodes.carriageReturn:\n case charCodes.lineSeparator:\n case charCodes.paragraphSeparator:\n return true;\n\n default:\n return false;\n }\n}\n\nexport const skipWhiteSpace = /(?:\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/g;\n\nexport const skipWhiteSpaceInLine =\n /(?:[^\\S\\n\\r\\u2028\\u2029]|\\/\\/.*|\\/\\*.*?\\*\\/)*/y;\n\n// Skip whitespace and single-line comments, including /* no newline here */.\n// After this RegExp matches, its lastIndex points to a line terminator, or\n// the start of multi-line comment (which is effectively a line terminator),\n// or the end of string.\nexport const skipWhiteSpaceToLineBreak = new RegExp(\n // Unfortunately JS doesn't support Perl's atomic /(?>pattern)/ or\n // possessive quantifiers, so we use a trick to prevent backtracking\n // when the look-ahead for line terminator fails.\n \"(?=(\" +\n // Capture the whitespace and comments that should be skipped inside\n // a look-ahead assertion, and then re-match the group as a unit.\n skipWhiteSpaceInLine.source +\n \"))\\\\1\" +\n // Look-ahead for either line terminator, start of multi-line comment,\n // or end of string.\n /(?=[\\n\\r\\u2028\\u2029]|\\/\\*(?!.*?\\*\\/)|$)/.source,\n \"y\", // sticky\n);\n\n// https://tc39.github.io/ecma262/#sec-white-space\nexport function isWhitespace(code: number): boolean {\n switch (code) {\n case 0x0009: // CHARACTER TABULATION\n case 0x000b: // LINE TABULATION\n case 0x000c: // FORM FEED\n case charCodes.space:\n case charCodes.nonBreakingSpace:\n case charCodes.oghamSpaceMark:\n case 0x2000: // EN QUAD\n case 0x2001: // EM QUAD\n case 0x2002: // EN SPACE\n case 0x2003: // EM SPACE\n case 0x2004: // THREE-PER-EM SPACE\n case 0x2005: // FOUR-PER-EM SPACE\n case 0x2006: // SIX-PER-EM SPACE\n case 0x2007: // FIGURE SPACE\n case 0x2008: // PUNCTUATION SPACE\n case 0x2009: // THIN SPACE\n case 0x200a: // HAIR SPACE\n case 0x202f: // NARROW NO-BREAK SPACE\n case 0x205f: // MEDIUM MATHEMATICAL SPACE\n case 0x3000: // IDEOGRAPHIC SPACE\n case 0xfeff: // ZERO WIDTH NO-BREAK SPACE\n return true;\n\n default:\n return false;\n }\n}\n","// @flow\n\nimport { lineBreakG } from \"./whitespace\";\n\nexport type Pos = {\n start: number,\n};\n\n// These are used when `options.locations` is on, for the\n// `startLoc` and `endLoc` properties.\n\nexport class Position {\n line: number;\n column: number;\n\n constructor(line: number, col: number) {\n this.line = line;\n this.column = col;\n }\n}\n\nexport class SourceLocation {\n start: Position;\n end: Position;\n filename: string;\n identifierName: ?string;\n\n constructor(start: Position, end?: Position) {\n this.start = start;\n // $FlowIgnore (may start as null, but initialized later)\n this.end = end;\n }\n}\n\n// The `getLineInfo` function is mostly useful when the\n// `locations` option is off (for performance reasons) and you\n// want to find the line/column position for a given character\n// offset. `input` should be the code string that the offset refers\n// into.\n\nexport function getLineInfo(input: string, offset: number): Position {\n let line = 1;\n let lineStart = 0;\n let match;\n lineBreakG.lastIndex = 0;\n while ((match = lineBreakG.exec(input)) && match.index < offset) {\n line++;\n lineStart = lineBreakG.lastIndex;\n }\n\n return new Position(line, offset - lineStart);\n}\n","// @flow\n\nimport type { Options } from \"../options\";\nimport type State from \"../tokenizer/state\";\nimport type { PluginsMap } from \"./index\";\nimport type ScopeHandler from \"../util/scope\";\nimport type ExpressionScopeHandler from \"../util/expression-scope\";\nimport type ClassScopeHandler from \"../util/class-scope\";\nimport type ProductionParameterHandler from \"../util/production-parameter\";\n\nexport default class BaseParser {\n // Properties set by constructor in index.js\n declare options: Options;\n declare inModule: boolean;\n declare scope: ScopeHandler<*>;\n declare classScope: ClassScopeHandler;\n declare prodParam: ProductionParameterHandler;\n declare expressionScope: ExpressionScopeHandler;\n declare plugins: PluginsMap;\n declare filename: ?string;\n // Names of exports store. `default` is stored as a name for both\n // `export default foo;` and `export { foo as default };`.\n declare exportedIdentifiers: Set;\n sawUnambiguousESM: boolean = false;\n ambiguousScriptDifferentAst: boolean = false;\n\n // Initialized by Tokenizer\n declare state: State;\n // input and length are not in state as they are constant and we do\n // not want to ever copy them, which happens if state gets cloned\n declare input: string;\n declare length: number;\n\n hasPlugin(name: string): boolean {\n return this.plugins.has(name);\n }\n\n getPluginOption(plugin: string, name: string) {\n // $FlowIssue\n if (this.hasPlugin(plugin)) return this.plugins.get(plugin)[name];\n }\n}\n","// @flow\n\n/*:: declare var invariant; */\n\nimport BaseParser from \"./base\";\nimport type { Comment, Node } from \"../types\";\nimport * as charCodes from \"charcodes\";\n\n/**\n * A whitespace token containing comments\n * @typedef CommentWhitespace\n * @type {object}\n * @property {number} start - the start of the whitespace token.\n * @property {number} end - the end of the whitespace token.\n * @property {Array} comments - the containing comments\n * @property {Node | null} leadingNode - the immediately preceding AST node of the whitespace token\n * @property {Node | null} trailingNode - the immediately following AST node of the whitespace token\n * @property {Node | null} containingNode - the innermost AST node containing the whitespace\n * with minimal size (|end - start|)\n */\nexport type CommentWhitespace = {\n start: number,\n end: number,\n comments: Array,\n leadingNode: Node | null,\n trailingNode: Node | null,\n containingNode: Node | null,\n};\n\n/**\n * Merge comments with node's trailingComments or assign comments to be\n * trailingComments. New comments will be placed before old comments\n * because the commentStack is enumerated reversely.\n *\n * @param {Node} node\n * @param {Array} comments\n */\nfunction setTrailingComments(node: Node, comments: Array) {\n if (node.trailingComments === undefined) {\n node.trailingComments = comments;\n } else {\n node.trailingComments.unshift(...comments);\n }\n}\n\n/**\n * Merge comments with node's leadingComments or assign comments to be\n * leadingComments. New comments will be placed before old comments\n * because the commentStack is enumerated reversely.\n *\n * @param {Node} node\n * @param {Array} comments\n */\nfunction setLeadingComments(node: Node, comments: Array) {\n if (node.leadingComments === undefined) {\n node.leadingComments = comments;\n } else {\n node.leadingComments.unshift(...comments);\n }\n}\n\n/**\n * Merge comments with node's innerComments or assign comments to be\n * innerComments. New comments will be placed before old comments\n * because the commentStack is enumerated reversely.\n *\n * @param {Node} node\n * @param {Array} comments\n */\nexport function setInnerComments(node: Node, comments: Array) {\n if (node.innerComments === undefined) {\n node.innerComments = comments;\n } else {\n node.innerComments.unshift(...comments);\n }\n}\n\n/**\n * Given node and elements array, if elements has non-null element,\n * merge comments to its trailingComments, otherwise merge comments\n * to node's innerComments\n *\n * @param {Node} node\n * @param {Array} elements\n * @param {Array} comments\n */\nfunction adjustInnerComments(\n node: Node,\n elements: Array,\n commentWS: CommentWhitespace,\n) {\n let lastElement = null;\n let i = elements.length;\n while (lastElement === null && i > 0) {\n lastElement = elements[--i];\n }\n if (lastElement === null || lastElement.start > commentWS.start) {\n setInnerComments(node, commentWS.comments);\n } else {\n setTrailingComments(lastElement, commentWS.comments);\n }\n}\n\n/** @class CommentsParser */\nexport default class CommentsParser extends BaseParser {\n addComment(comment: Comment): void {\n if (this.filename) comment.loc.filename = this.filename;\n this.state.comments.push(comment);\n }\n\n /**\n * Given a newly created AST node _n_, attach _n_ to a comment whitespace _w_ if applicable\n * {@see {@link CommentWhitespace}}\n *\n * @param {Node} node\n * @returns {void}\n * @memberof CommentsParser\n */\n processComment(node: Node): void {\n const { commentStack } = this.state;\n const commentStackLength = commentStack.length;\n if (commentStackLength === 0) return;\n let i = commentStackLength - 1;\n const lastCommentWS = commentStack[i];\n\n if (lastCommentWS.start === node.end) {\n lastCommentWS.leadingNode = node;\n i--;\n }\n\n const { start: nodeStart } = node;\n // invariant: for all 0 <= j <= i, let c = commentStack[j], c must satisfy c.end < node.end\n for (; i >= 0; i--) {\n const commentWS = commentStack[i];\n const commentEnd = commentWS.end;\n if (commentEnd > nodeStart) {\n // by definition of commentWhiteSpace, this implies commentWS.start > nodeStart\n // so node can be a containingNode candidate. At this time we can finalize the comment\n // whitespace, because\n // 1) its leadingNode or trailingNode, if exists, will not change\n // 2) its containingNode have been assigned and will not change because it is the\n // innermost minimal-sized AST node\n commentWS.containingNode = node;\n this.finalizeComment(commentWS);\n commentStack.splice(i, 1);\n } else {\n if (commentEnd === nodeStart) {\n commentWS.trailingNode = node;\n }\n // stop the loop when commentEnd <= nodeStart\n break;\n }\n }\n }\n\n /**\n * Assign the comments of comment whitespaces to related AST nodes.\n * Also adjust innerComments following trailing comma.\n *\n * @memberof CommentsParser\n */\n finalizeComment(commentWS: CommentWhitespace) {\n const { comments } = commentWS;\n if (commentWS.leadingNode !== null || commentWS.trailingNode !== null) {\n if (commentWS.leadingNode !== null) {\n setTrailingComments(commentWS.leadingNode, comments);\n }\n if (commentWS.trailingNode !== null) {\n setLeadingComments(commentWS.trailingNode, comments);\n }\n } else {\n /*:: invariant(commentWS.containingNode !== null) */\n const { containingNode: node, start: commentStart } = commentWS;\n if (this.input.charCodeAt(commentStart - 1) === charCodes.comma) {\n // If a commentWhitespace follows a comma and the containingNode allows\n // list structures with trailing comma, merge it to the trailingComment\n // of the last non-null list element\n switch (node.type) {\n case \"ObjectExpression\":\n case \"ObjectPattern\":\n case \"RecordExpression\":\n adjustInnerComments(node, node.properties, commentWS);\n break;\n case \"CallExpression\":\n case \"OptionalCallExpression\":\n adjustInnerComments(node, node.arguments, commentWS);\n break;\n case \"FunctionDeclaration\":\n case \"FunctionExpression\":\n case \"ArrowFunctionExpression\":\n case \"ObjectMethod\":\n case \"ClassMethod\":\n case \"ClassPrivateMethod\":\n adjustInnerComments(node, node.params, commentWS);\n break;\n case \"ArrayExpression\":\n case \"ArrayPattern\":\n case \"TupleExpression\":\n adjustInnerComments(node, node.elements, commentWS);\n break;\n case \"ExportNamedDeclaration\":\n case \"ImportDeclaration\":\n adjustInnerComments(node, node.specifiers, commentWS);\n break;\n default: {\n setInnerComments(node, comments);\n }\n }\n } else {\n setInnerComments(node, comments);\n }\n }\n }\n\n /**\n * Drains remaning commentStack and applies finalizeComment\n * to each comment whitespace. Used only in parseExpression\n * where the top level AST node is _not_ Program\n * {@see {@link CommentsParser#finalizeComment}}\n *\n * @memberof CommentsParser\n */\n finalizeRemainingComments() {\n const { commentStack } = this.state;\n for (let i = commentStack.length - 1; i >= 0; i--) {\n this.finalizeComment(commentStack[i]);\n }\n this.state.commentStack = [];\n }\n\n /**\n * Reset previous node trailing comments. Used in object / class\n * property parsing. We parse `async`, `static`, `set` and `get`\n * as an identifier but may reinterepret it into an async/static/accessor\n * method later. In this case the identifier is not part of the AST and we\n * should sync the knowledge to commentStacks\n *\n * For example, when parsing */\n // async /* 1 */ function f() {}\n /*\n * the comment whitespace \"* 1 *\" has leading node Identifier(async). When\n * we see the function token, we create a Function node and mark \"* 1 *\" as\n * inner comments. So \"* 1 *\" should be detached from the Identifier node.\n *\n * @param {N.Node} node the last finished AST node _before_ current token\n * @returns\n * @memberof CommentsParser\n */\n resetPreviousNodeTrailingComments(node: Node) {\n const { commentStack } = this.state;\n const { length } = commentStack;\n if (length === 0) return;\n const commentWS = commentStack[length - 1];\n if (commentWS.leadingNode === node) {\n commentWS.leadingNode = null;\n }\n }\n\n /**\n * Attach a node to the comment whitespaces right before/after\n * the given range.\n *\n * This is used to properly attach comments around parenthesized\n * expressions as leading/trailing comments of the inner expression.\n *\n * @param {Node} node\n * @param {number} start\n * @param {number} end\n */\n takeSurroundingComments(node: Node, start: number, end: number) {\n const { commentStack } = this.state;\n const commentStackLength = commentStack.length;\n if (commentStackLength === 0) return;\n let i = commentStackLength - 1;\n\n for (; i >= 0; i--) {\n const commentWS = commentStack[i];\n const commentEnd = commentWS.end;\n const commentStart = commentWS.start;\n\n if (commentStart === end) {\n commentWS.leadingNode = node;\n } else if (commentEnd === start) {\n commentWS.trailingNode = node;\n } else if (commentEnd < start) {\n break;\n }\n }\n }\n}\n","// @flow\n\nexport const ErrorCodes = Object.freeze({\n SyntaxError: \"BABEL_PARSER_SYNTAX_ERROR\",\n SourceTypeModuleError: \"BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED\",\n});\n\nexport type ErrorCode = $Values;\n","// @flow\n\nimport { makeErrorTemplates, ErrorCodes } from \"./error\";\n\n/* eslint sort-keys: \"error\" */\n\n/**\n * @module parser/error-message\n */\n\n// The Errors key follows https://cs.chromium.org/chromium/src/v8/src/common/message-template.h unless it does not exist\nexport const ErrorMessages = makeErrorTemplates(\n {\n AccessorIsGenerator: \"A %0ter cannot be a generator.\",\n ArgumentsInClass:\n \"'arguments' is only allowed in functions and class methods.\",\n AsyncFunctionInSingleStatementContext:\n \"Async functions can only be declared at the top level or inside a block.\",\n AwaitBindingIdentifier:\n \"Can not use 'await' as identifier inside an async function.\",\n AwaitBindingIdentifierInStaticBlock:\n \"Can not use 'await' as identifier inside a static block.\",\n AwaitExpressionFormalParameter:\n \"'await' is not allowed in async function parameters.\",\n AwaitNotInAsyncContext:\n \"'await' is only allowed within async functions and at the top levels of modules.\",\n AwaitNotInAsyncFunction: \"'await' is only allowed within async functions.\",\n BadGetterArity: \"A 'get' accesor must not have any formal parameters.\",\n BadSetterArity: \"A 'set' accesor must have exactly one formal parameter.\",\n BadSetterRestParameter:\n \"A 'set' accesor function argument must not be a rest parameter.\",\n ConstructorClassField: \"Classes may not have a field named 'constructor'.\",\n ConstructorClassPrivateField:\n \"Classes may not have a private field named '#constructor'.\",\n ConstructorIsAccessor: \"Class constructor may not be an accessor.\",\n ConstructorIsAsync: \"Constructor can't be an async function.\",\n ConstructorIsGenerator: \"Constructor can't be a generator.\",\n DeclarationMissingInitializer: \"'%0' require an initialization value.\",\n DecoratorBeforeExport:\n \"Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax.\",\n DecoratorConstructor:\n \"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?\",\n DecoratorExportClass:\n \"Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.\",\n DecoratorSemicolon: \"Decorators must not be followed by a semicolon.\",\n DecoratorStaticBlock: \"Decorators can't be used with a static block.\",\n DeletePrivateField: \"Deleting a private field is not allowed.\",\n DestructureNamedImport:\n \"ES2015 named imports do not destructure. Use another statement for destructuring after the import.\",\n DuplicateConstructor: \"Duplicate constructor in the same class.\",\n DuplicateDefaultExport: \"Only one default export allowed per module.\",\n DuplicateExport:\n \"`%0` has already been exported. Exported identifiers must be unique.\",\n DuplicateProto: \"Redefinition of __proto__ property.\",\n DuplicateRegExpFlags: \"Duplicate regular expression flag.\",\n ElementAfterRest: \"Rest element must be last element.\",\n EscapedCharNotAnIdentifier: \"Invalid Unicode escape.\",\n ExportBindingIsString:\n \"A string literal cannot be used as an exported binding without `from`.\\n- Did you mean `export { '%0' as '%1' } from 'some-module'`?\",\n ExportDefaultFromAsIdentifier:\n \"'from' is not allowed as an identifier after 'export default'.\",\n ForInOfLoopInitializer:\n \"'%0' loop variable declaration may not have an initializer.\",\n ForOfAsync: \"The left-hand side of a for-of loop may not be 'async'.\",\n ForOfLet: \"The left-hand side of a for-of loop may not start with 'let'.\",\n GeneratorInSingleStatementContext:\n \"Generators can only be declared at the top level or inside a block.\",\n IllegalBreakContinue: \"Unsyntactic %0.\",\n IllegalLanguageModeDirective:\n \"Illegal 'use strict' directive in function with non-simple parameter list.\",\n IllegalReturn: \"'return' outside of function.\",\n ImportBindingIsString:\n 'A string literal cannot be used as an imported binding.\\n- Did you mean `import { \"%0\" as foo }`?',\n ImportCallArgumentTrailingComma:\n \"Trailing comma is disallowed inside import(...) arguments.\",\n ImportCallArity: \"`import()` requires exactly %0.\",\n ImportCallNotNewExpression: \"Cannot use new with import(...).\",\n ImportCallSpreadArgument: \"`...` is not allowed in `import()`.\",\n InvalidBigIntLiteral: \"Invalid BigIntLiteral.\",\n InvalidCodePoint: \"Code point out of bounds.\",\n InvalidDecimal: \"Invalid decimal.\",\n InvalidDigit: \"Expected number in radix %0.\",\n InvalidEscapeSequence: \"Bad character escape sequence.\",\n InvalidEscapeSequenceTemplate: \"Invalid escape sequence in template.\",\n InvalidEscapedReservedWord: \"Escape sequence in keyword %0.\",\n InvalidIdentifier: \"Invalid identifier %0.\",\n InvalidLhs: \"Invalid left-hand side in %0.\",\n InvalidLhsBinding: \"Binding invalid left-hand side in %0.\",\n InvalidNumber: \"Invalid number.\",\n InvalidOrMissingExponent:\n \"Floating-point numbers require a valid exponent after the 'e'.\",\n InvalidOrUnexpectedToken: \"Unexpected character '%0'.\",\n InvalidParenthesizedAssignment: \"Invalid parenthesized assignment pattern.\",\n InvalidPrivateFieldResolution: \"Private name #%0 is not defined.\",\n InvalidPropertyBindingPattern: \"Binding member expression.\",\n InvalidRecordProperty:\n \"Only properties and spread elements are allowed in record definitions.\",\n InvalidRestAssignmentPattern: \"Invalid rest operator's argument.\",\n LabelRedeclaration: \"Label '%0' is already declared.\",\n LetInLexicalBinding:\n \"'let' is not allowed to be used as a name in 'let' or 'const' declarations.\",\n LineTerminatorBeforeArrow: \"No line break is allowed before '=>'.\",\n MalformedRegExpFlags: \"Invalid regular expression flag.\",\n MissingClassName: \"A class name is required.\",\n MissingEqInAssignment:\n \"Only '=' operator can be used for specifying default value.\",\n MissingSemicolon: \"Missing semicolon.\",\n MissingUnicodeEscape: \"Expecting Unicode escape sequence \\\\uXXXX.\",\n MixingCoalesceWithLogical:\n \"Nullish coalescing operator(??) requires parens when mixing with logical operators.\",\n ModuleAttributeDifferentFromType:\n \"The only accepted module attribute is `type`.\",\n ModuleAttributeInvalidValue:\n \"Only string literals are allowed as module attribute values.\",\n ModuleAttributesWithDuplicateKeys:\n 'Duplicate key \"%0\" is not allowed in module attributes.',\n ModuleExportNameHasLoneSurrogate:\n \"An export name cannot include a lone surrogate, found '\\\\u%0'.\",\n ModuleExportUndefined: \"Export '%0' is not defined.\",\n MultipleDefaultsInSwitch: \"Multiple default clauses.\",\n NewlineAfterThrow: \"Illegal newline after throw.\",\n NoCatchOrFinally: \"Missing catch or finally clause.\",\n NumberIdentifier: \"Identifier directly after number.\",\n NumericSeparatorInEscapeSequence:\n \"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.\",\n ObsoleteAwaitStar:\n \"'await*' has been removed from the async functions proposal. Use Promise.all() instead.\",\n OptionalChainingNoNew:\n \"Constructors in/after an Optional Chain are not allowed.\",\n OptionalChainingNoTemplate:\n \"Tagged Template Literals are not allowed in optionalChain.\",\n OverrideOnConstructor:\n \"'override' modifier cannot appear on a constructor declaration.\",\n ParamDupe: \"Argument name clash.\",\n PatternHasAccessor: \"Object pattern can't contain getter or setter.\",\n PatternHasMethod: \"Object pattern can't contain methods.\",\n // This error is only used by the smart-mix proposal\n PipeBodyIsTighter:\n \"Unexpected %0 after pipeline body; any %0 expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.\",\n PipeTopicRequiresHackPipes:\n 'Topic reference is used, but the pipelineOperator plugin was not passed a \"proposal\": \"hack\" or \"smart\" option.',\n PipeTopicUnbound:\n \"Topic reference is unbound; it must be inside a pipe body.\",\n PipeTopicUnconfiguredToken:\n 'Invalid topic token %0. In order to use %0 as a topic reference, the pipelineOperator plugin must be configured with { \"proposal\": \"hack\", \"topicToken\": \"%0\" }.',\n PipeTopicUnused:\n \"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.\",\n PipeUnparenthesizedBody:\n \"Hack-style pipe body cannot be an unparenthesized %0 expression; please wrap it in parentheses.\",\n\n // Messages whose codes start with “Pipeline” or “PrimaryTopic”\n // are retained for backwards compatibility\n // with the deprecated smart-mix pipe operator proposal plugin.\n // They are subject to removal in a future major version.\n PipelineBodyNoArrow:\n 'Unexpected arrow \"=>\" after pipeline body; arrow function in pipeline body must be parenthesized.',\n PipelineBodySequenceExpression:\n \"Pipeline body may not be a comma-separated sequence expression.\",\n PipelineHeadSequenceExpression:\n \"Pipeline head should not be a comma-separated sequence expression.\",\n PipelineTopicUnused:\n \"Pipeline is in topic style but does not use topic reference.\",\n PrimaryTopicNotAllowed:\n \"Topic reference was used in a lexical context without topic binding.\",\n PrimaryTopicRequiresSmartPipeline:\n 'Topic reference is used, but the pipelineOperator plugin was not passed a \"proposal\": \"hack\" or \"smart\" option.',\n\n PrivateInExpectedIn:\n \"Private names are only allowed in property accesses (`obj.#%0`) or in `in` expressions (`#%0 in obj`).\",\n PrivateNameRedeclaration: \"Duplicate private name #%0.\",\n RecordExpressionBarIncorrectEndSyntaxType:\n \"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.\",\n RecordExpressionBarIncorrectStartSyntaxType:\n \"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.\",\n RecordExpressionHashIncorrectStartSyntaxType:\n \"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.\",\n RecordNoProto: \"'__proto__' is not allowed in Record expressions.\",\n RestTrailingComma: \"Unexpected trailing comma after rest element.\",\n SloppyFunction:\n \"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.\",\n StaticPrototype: \"Classes may not have static property named prototype.\",\n StrictDelete: \"Deleting local variable in strict mode.\",\n StrictEvalArguments: \"Assigning to '%0' in strict mode.\",\n StrictEvalArgumentsBinding: \"Binding '%0' in strict mode.\",\n StrictFunction:\n \"In strict mode code, functions can only be declared at top level or inside a block.\",\n StrictNumericEscape:\n \"The only valid numeric escape in strict mode is '\\\\0'.\",\n StrictOctalLiteral: \"Legacy octal literals are not allowed in strict mode.\",\n StrictWith: \"'with' in strict mode.\",\n SuperNotAllowed:\n \"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?\",\n SuperPrivateField: \"Private fields can't be accessed on super.\",\n TrailingDecorator: \"Decorators must be attached to a class element.\",\n TupleExpressionBarIncorrectEndSyntaxType:\n \"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.\",\n TupleExpressionBarIncorrectStartSyntaxType:\n \"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.\",\n TupleExpressionHashIncorrectStartSyntaxType:\n \"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.\",\n UnexpectedArgumentPlaceholder: \"Unexpected argument placeholder.\",\n UnexpectedAwaitAfterPipelineBody:\n 'Unexpected \"await\" after pipeline body; await must have parentheses in minimal proposal.',\n UnexpectedDigitAfterHash: \"Unexpected digit after hash token.\",\n UnexpectedImportExport:\n \"'import' and 'export' may only appear at the top level.\",\n UnexpectedKeyword: \"Unexpected keyword '%0'.\",\n UnexpectedLeadingDecorator:\n \"Leading decorators must be attached to a class declaration.\",\n UnexpectedLexicalDeclaration:\n \"Lexical declaration cannot appear in a single-statement context.\",\n UnexpectedNewTarget:\n \"`new.target` can only be used in functions or class properties.\",\n UnexpectedNumericSeparator:\n \"A numeric separator is only allowed between two digits.\",\n UnexpectedPrivateField:\n \"Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\\n or a property of member expression (i.e. this.#p).\",\n UnexpectedReservedWord: \"Unexpected reserved word '%0'.\",\n UnexpectedSuper: \"'super' is only allowed in object methods and classes.\",\n UnexpectedToken: \"Unexpected token '%0'.\",\n UnexpectedTokenUnaryExponentiation:\n \"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.\",\n UnsupportedBind: \"Binding should be performed on object property.\",\n UnsupportedDecoratorExport:\n \"A decorated export must export a class declaration.\",\n UnsupportedDefaultExport:\n \"Only expressions, functions or classes are allowed as the `default` export.\",\n UnsupportedImport:\n \"`import` can only be used in `import()` or `import.meta`.\",\n UnsupportedMetaProperty: \"The only valid meta property for %0 is %0.%1.\",\n UnsupportedParameterDecorator:\n \"Decorators cannot be used to decorate parameters.\",\n UnsupportedPropertyDecorator:\n \"Decorators cannot be used to decorate object literal properties.\",\n UnsupportedSuper:\n \"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).\",\n UnterminatedComment: \"Unterminated comment.\",\n UnterminatedRegExp: \"Unterminated regular expression.\",\n UnterminatedString: \"Unterminated string constant.\",\n UnterminatedTemplate: \"Unterminated template.\",\n VarRedeclaration: \"Identifier '%0' has already been declared.\",\n YieldBindingIdentifier:\n \"Can not use 'yield' as identifier inside a generator.\",\n YieldInParameter: \"Yield expression is not allowed in formal parameters.\",\n ZeroDigitNumericSeparator:\n \"Numeric separator can not be used after leading 0.\",\n },\n /* code */ ErrorCodes.SyntaxError,\n);\n\nexport const SourceTypeModuleErrorMessages = makeErrorTemplates(\n {\n ImportMetaOutsideModule: `import.meta may appear only with 'sourceType: \"module\"'`,\n ImportOutsideModule: `'import' and 'export' may appear only with 'sourceType: \"module\"'`,\n },\n /* code */ ErrorCodes.SourceTypeModuleError,\n);\n","// @flow\n/* eslint sort-keys: \"error\" */\nimport { getLineInfo, type Position } from \"../util/location\";\nimport CommentsParser from \"./comments\";\nimport { type ErrorCode, ErrorCodes } from \"./error-codes\";\n\n// This function is used to raise exceptions on parse errors. It\n// takes an offset integer (into the current `input`) to indicate\n// the location of the error, attaches the position to the end\n// of the error message, and then raises a `SyntaxError` with that\n// message.\n\ntype ErrorContext = {\n pos: number,\n loc: Position,\n missingPlugin?: Array,\n code?: string,\n reasonCode?: String,\n};\nexport type ParsingError = SyntaxError & ErrorContext;\n\nexport type ErrorTemplate = {\n code: ErrorCode,\n template: string,\n reasonCode: string,\n};\nexport type ErrorTemplates = {\n [key: string]: ErrorTemplate,\n};\n\ntype SyntaxPlugin = \"flow\" | \"typescript\" | \"jsx\" | typeof undefined;\n\nfunction keepReasonCodeCompat(reasonCode: string, syntaxPlugin: SyntaxPlugin) {\n if (!process.env.BABEL_8_BREAKING) {\n // For consistency in TypeScript and Flow error codes\n if (syntaxPlugin === \"flow\" && reasonCode === \"PatternIsOptional\") {\n return \"OptionalBindingPattern\";\n }\n }\n return reasonCode;\n}\n\nexport function makeErrorTemplates(\n messages: {\n [key: string]: string,\n },\n code: ErrorCode,\n syntaxPlugin?: SyntaxPlugin,\n): ErrorTemplates {\n const templates: ErrorTemplates = {};\n Object.keys(messages).forEach(reasonCode => {\n templates[reasonCode] = Object.freeze({\n code,\n reasonCode: keepReasonCodeCompat(reasonCode, syntaxPlugin),\n template: messages[reasonCode],\n });\n });\n return Object.freeze(templates);\n}\n\nexport { ErrorCodes };\nexport {\n ErrorMessages as Errors,\n SourceTypeModuleErrorMessages as SourceTypeModuleErrors,\n} from \"./error-message\";\n\nexport type raiseFunction = (number, ErrorTemplate, ...any) => void;\n\nexport default class ParserError extends CommentsParser {\n // Forward-declaration: defined in tokenizer/index.js\n /*::\n +isLookahead: boolean;\n */\n\n getLocationForPosition(pos: number): Position {\n let loc;\n if (pos === this.state.start) loc = this.state.startLoc;\n else if (pos === this.state.lastTokStart) loc = this.state.lastTokStartLoc;\n else if (pos === this.state.end) loc = this.state.endLoc;\n else if (pos === this.state.lastTokEnd) loc = this.state.lastTokEndLoc;\n else loc = getLineInfo(this.input, pos);\n\n return loc;\n }\n\n raise(\n pos: number,\n { code, reasonCode, template }: ErrorTemplate,\n ...params: any\n ): Error | empty {\n return this.raiseWithData(pos, { code, reasonCode }, template, ...params);\n }\n\n /**\n * Raise a parsing error on given position pos. If errorRecovery is true,\n * it will first search current errors and overwrite the error thrown on the exact\n * position before with the new error message. If errorRecovery is false, it\n * fallbacks to `raise`.\n *\n * @param {number} pos\n * @param {string} errorTemplate\n * @param {...any} params\n * @returns {(Error | empty)}\n * @memberof ParserError\n */\n raiseOverwrite(\n pos: number,\n { code, template }: ErrorTemplate,\n ...params: any\n ): Error | empty {\n const loc = this.getLocationForPosition(pos);\n const message =\n template.replace(/%(\\d+)/g, (_, i: number) => params[i]) +\n ` (${loc.line}:${loc.column})`;\n if (this.options.errorRecovery) {\n const errors = this.state.errors;\n for (let i = errors.length - 1; i >= 0; i--) {\n const error = errors[i];\n if (error.pos === pos) {\n return Object.assign(error, { message });\n } else if (error.pos < pos) {\n break;\n }\n }\n }\n return this._raise({ code, loc, pos }, message);\n }\n\n raiseWithData(\n pos: number,\n data?: {\n missingPlugin?: Array,\n code?: string,\n },\n errorTemplate: string,\n ...params: any\n ): Error | empty {\n const loc = this.getLocationForPosition(pos);\n const message =\n errorTemplate.replace(/%(\\d+)/g, (_, i: number) => params[i]) +\n ` (${loc.line}:${loc.column})`;\n return this._raise(Object.assign(({ loc, pos }: Object), data), message);\n }\n\n _raise(errorContext: ErrorContext, message: string): Error | empty {\n // $FlowIgnore\n const err: SyntaxError & ErrorContext = new SyntaxError(message);\n Object.assign(err, errorContext);\n if (this.options.errorRecovery) {\n if (!this.isLookahead) this.state.errors.push(err);\n return err;\n } else {\n throw err;\n }\n }\n}\n","// @flow\n\nimport { type TokenType } from \"../tokenizer/types\";\nimport type Parser from \"../parser\";\nimport type { ExpressionErrors } from \"../parser/util\";\nimport * as N from \"../types\";\nimport type { Position } from \"../util/location\";\nimport { Errors } from \"../parser/error\";\n\nexport default (superClass: Class): Class =>\n class extends superClass {\n parseRegExpLiteral({ pattern, flags }): N.Node {\n let regex = null;\n try {\n regex = new RegExp(pattern, flags);\n } catch (e) {\n // In environments that don't support these flags value will\n // be null as the regex can't be represented natively.\n }\n const node = this.estreeParseLiteral(regex);\n node.regex = { pattern, flags };\n\n return node;\n }\n\n parseBigIntLiteral(value: any): N.Node {\n // https://github.com/estree/estree/blob/master/es2020.md#bigintliteral\n let bigInt;\n try {\n // $FlowIgnore\n bigInt = BigInt(value);\n } catch {\n bigInt = null;\n }\n const node = this.estreeParseLiteral(bigInt);\n node.bigint = String(node.value || value);\n\n return node;\n }\n\n parseDecimalLiteral(value: any): N.Node {\n // https://github.com/estree/estree/blob/master/experimental/decimal.md\n // todo: use BigDecimal when node supports it.\n const decimal = null;\n const node = this.estreeParseLiteral(decimal);\n node.decimal = String(node.value || value);\n\n return node;\n }\n\n estreeParseLiteral(value: any) {\n return this.parseLiteral(value, \"Literal\");\n }\n\n parseStringLiteral(value: any): N.Node {\n return this.estreeParseLiteral(value);\n }\n\n parseNumericLiteral(value: any): any {\n return this.estreeParseLiteral(value);\n }\n\n parseNullLiteral(): N.Node {\n return this.estreeParseLiteral(null);\n }\n\n parseBooleanLiteral(value: boolean): N.BooleanLiteral {\n return this.estreeParseLiteral(value);\n }\n\n directiveToStmt(directive: N.Directive): N.ExpressionStatement {\n const directiveLiteral = directive.value;\n\n const stmt = this.startNodeAt(directive.start, directive.loc.start);\n const expression = this.startNodeAt(\n directiveLiteral.start,\n directiveLiteral.loc.start,\n );\n\n expression.value = directiveLiteral.extra.expressionValue;\n expression.raw = directiveLiteral.extra.raw;\n\n stmt.expression = this.finishNodeAt(\n expression,\n \"Literal\",\n directiveLiteral.end,\n directiveLiteral.loc.end,\n );\n stmt.directive = directiveLiteral.extra.raw.slice(1, -1);\n\n return this.finishNodeAt(\n stmt,\n \"ExpressionStatement\",\n directive.end,\n directive.loc.end,\n );\n }\n\n // ==================================\n // Overrides\n // ==================================\n\n initFunction(\n node: N.BodilessFunctionOrMethodBase,\n isAsync: ?boolean,\n ): void {\n super.initFunction(node, isAsync);\n node.expression = false;\n }\n\n checkDeclaration(node: N.Pattern | N.ObjectProperty): void {\n if (node != null && this.isObjectProperty(node)) {\n this.checkDeclaration(((node: any): N.EstreeProperty).value);\n } else {\n super.checkDeclaration(node);\n }\n }\n\n getObjectOrClassMethodParams(method: N.ObjectMethod | N.ClassMethod) {\n return ((method: any): N.EstreeProperty | N.EstreeMethodDefinition).value\n .params;\n }\n\n isValidDirective(stmt: N.Statement): boolean {\n return (\n stmt.type === \"ExpressionStatement\" &&\n stmt.expression.type === \"Literal\" &&\n typeof stmt.expression.value === \"string\" &&\n !stmt.expression.extra?.parenthesized\n );\n }\n\n parseBlockBody(\n node: N.BlockStatementLike,\n ...args: [?boolean, boolean, TokenType, void | (boolean => void)]\n ): void {\n super.parseBlockBody(node, ...args);\n\n const directiveStatements = node.directives.map(d =>\n this.directiveToStmt(d),\n );\n node.body = directiveStatements.concat(node.body);\n // $FlowIgnore - directives isn't optional in the type definition\n delete node.directives;\n }\n\n pushClassMethod(\n classBody: N.ClassBody,\n method: N.ClassMethod,\n isGenerator: boolean,\n isAsync: boolean,\n isConstructor: boolean,\n allowsDirectSuper: boolean,\n ): void {\n this.parseMethod(\n method,\n isGenerator,\n isAsync,\n isConstructor,\n allowsDirectSuper,\n \"ClassMethod\",\n true,\n );\n if (method.typeParameters) {\n // $FlowIgnore\n method.value.typeParameters = method.typeParameters;\n delete method.typeParameters;\n }\n classBody.body.push(method);\n }\n\n parsePrivateName(): any {\n const node = super.parsePrivateName();\n if (!process.env.BABEL_8_BREAKING) {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return node;\n }\n }\n return this.convertPrivateNameToPrivateIdentifier(node);\n }\n\n convertPrivateNameToPrivateIdentifier(\n node: N.PrivateName,\n ): N.EstreePrivateIdentifier {\n const name = super.getPrivateNameSV(node);\n node = (node: any);\n delete node.id;\n node.name = name;\n node.type = \"PrivateIdentifier\";\n return node;\n }\n\n isPrivateName(node: N.Node): boolean {\n if (!process.env.BABEL_8_BREAKING) {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return super.isPrivateName(node);\n }\n }\n return node.type === \"PrivateIdentifier\";\n }\n\n getPrivateNameSV(node: N.Node): string {\n if (!process.env.BABEL_8_BREAKING) {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return super.getPrivateNameSV(node);\n }\n }\n return node.name;\n }\n\n parseLiteral(value: any, type: $ElementType): T {\n const node = super.parseLiteral(value, type);\n node.raw = node.extra.raw;\n delete node.extra;\n\n return node;\n }\n\n parseFunctionBody(\n node: N.Function,\n allowExpression: ?boolean,\n isMethod?: boolean = false,\n ): void {\n super.parseFunctionBody(node, allowExpression, isMethod);\n node.expression = node.body.type !== \"BlockStatement\";\n }\n\n parseMethod(\n node: T,\n isGenerator: boolean,\n isAsync: boolean,\n isConstructor: boolean,\n allowDirectSuper: boolean,\n type: string,\n inClassScope: boolean = false,\n ): T {\n let funcNode = this.startNode();\n funcNode.kind = node.kind; // provide kind, so super method correctly sets state\n funcNode = super.parseMethod(\n funcNode,\n isGenerator,\n isAsync,\n isConstructor,\n allowDirectSuper,\n type,\n inClassScope,\n );\n funcNode.type = \"FunctionExpression\";\n delete funcNode.kind;\n // $FlowIgnore\n node.value = funcNode;\n if (type === \"ClassPrivateMethod\") {\n // $FlowIgnore\n node.computed = false;\n }\n type = \"MethodDefinition\";\n return this.finishNode(node, type);\n }\n\n parseClassProperty(...args: [N.ClassProperty]): any {\n const propertyNode = (super.parseClassProperty(...args): any);\n if (!process.env.BABEL_8_BREAKING) {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return (propertyNode: N.EstreePropertyDefinition);\n }\n }\n propertyNode.type = \"PropertyDefinition\";\n return (propertyNode: N.EstreePropertyDefinition);\n }\n\n parseClassPrivateProperty(...args: [N.ClassPrivateProperty]): any {\n const propertyNode = (super.parseClassPrivateProperty(...args): any);\n if (!process.env.BABEL_8_BREAKING) {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return (propertyNode: N.EstreePropertyDefinition);\n }\n }\n propertyNode.type = \"PropertyDefinition\";\n propertyNode.computed = false;\n return (propertyNode: N.EstreePropertyDefinition);\n }\n\n parseObjectMethod(\n prop: N.ObjectMethod,\n isGenerator: boolean,\n isAsync: boolean,\n isPattern: boolean,\n isAccessor: boolean,\n ): ?N.ObjectMethod {\n const node: N.EstreeProperty = (super.parseObjectMethod(\n prop,\n isGenerator,\n isAsync,\n isPattern,\n isAccessor,\n ): any);\n\n if (node) {\n node.type = \"Property\";\n if (((node: any): N.ClassMethod).kind === \"method\") node.kind = \"init\";\n node.shorthand = false;\n }\n\n return (node: any);\n }\n\n parseObjectProperty(\n prop: N.ObjectProperty,\n startPos: ?number,\n startLoc: ?Position,\n isPattern: boolean,\n refExpressionErrors: ?ExpressionErrors,\n ): ?N.ObjectProperty {\n const node: N.EstreeProperty = (super.parseObjectProperty(\n prop,\n startPos,\n startLoc,\n isPattern,\n refExpressionErrors,\n ): any);\n\n if (node) {\n node.kind = \"init\";\n node.type = \"Property\";\n }\n\n return (node: any);\n }\n\n isAssignable(node: N.Node, isBinding?: boolean): boolean {\n if (node != null && this.isObjectProperty(node)) {\n return this.isAssignable(node.value, isBinding);\n }\n return super.isAssignable(node, isBinding);\n }\n\n toAssignable(node: N.Node, isLHS: boolean = false): N.Node {\n if (node != null && this.isObjectProperty(node)) {\n this.toAssignable(node.value, isLHS);\n\n return node;\n }\n\n return super.toAssignable(node, isLHS);\n }\n\n toAssignableObjectExpressionProp(prop: N.Node, ...args) {\n if (prop.kind === \"get\" || prop.kind === \"set\") {\n this.raise(prop.key.start, Errors.PatternHasAccessor);\n } else if (prop.method) {\n this.raise(prop.key.start, Errors.PatternHasMethod);\n } else {\n super.toAssignableObjectExpressionProp(prop, ...args);\n }\n }\n\n finishCallExpression(\n node: T,\n optional: boolean,\n ): N.Expression {\n super.finishCallExpression(node, optional);\n\n if (node.callee.type === \"Import\") {\n ((node: N.Node): N.EstreeImportExpression).type = \"ImportExpression\";\n ((node: N.Node): N.EstreeImportExpression).source = node.arguments[0];\n if (this.hasPlugin(\"importAssertions\")) {\n ((node: N.Node): N.EstreeImportExpression).attributes =\n node.arguments[1] ?? null;\n }\n // $FlowIgnore - arguments isn't optional in the type definition\n delete node.arguments;\n // $FlowIgnore - callee isn't optional in the type definition\n delete node.callee;\n }\n\n return node;\n }\n\n toReferencedArguments(\n node:\n | N.CallExpression\n | N.OptionalCallExpression\n | N.EstreeImportExpression,\n /* isParenthesizedExpr?: boolean, */\n ) {\n // ImportExpressions do not have an arguments array.\n if (node.type === \"ImportExpression\") {\n return;\n }\n\n super.toReferencedArguments(node);\n }\n\n parseExport(node: N.Node) {\n super.parseExport(node);\n\n switch (node.type) {\n case \"ExportAllDeclaration\":\n node.exported = null;\n break;\n\n case \"ExportNamedDeclaration\":\n if (\n node.specifiers.length === 1 &&\n node.specifiers[0].type === \"ExportNamespaceSpecifier\"\n ) {\n node.type = \"ExportAllDeclaration\";\n node.exported = node.specifiers[0].exported;\n delete node.specifiers;\n }\n\n break;\n }\n\n return node;\n }\n\n parseSubscript(\n base: N.Expression,\n startPos: number,\n startLoc: Position,\n noCalls: ?boolean,\n state: N.ParseSubscriptState,\n ) {\n const node = super.parseSubscript(\n base,\n startPos,\n startLoc,\n noCalls,\n state,\n );\n\n if (state.optionalChainMember) {\n // https://github.com/estree/estree/blob/master/es2020.md#chainexpression\n if (\n node.type === \"OptionalMemberExpression\" ||\n node.type === \"OptionalCallExpression\"\n ) {\n node.type = node.type.substring(8); // strip Optional prefix\n }\n if (state.stop) {\n const chain = this.startNodeAtNode(node);\n chain.expression = node;\n return this.finishNode(chain, \"ChainExpression\");\n }\n } else if (\n node.type === \"MemberExpression\" ||\n node.type === \"CallExpression\"\n ) {\n node.optional = false;\n }\n\n return node;\n }\n\n hasPropertyAsPrivateName(node: N.Node): boolean {\n if (node.type === \"ChainExpression\") {\n node = node.expression;\n }\n return super.hasPropertyAsPrivateName(node);\n }\n\n isOptionalChain(node: N.Node): boolean {\n return node.type === \"ChainExpression\";\n }\n\n isObjectProperty(node: N.Node): boolean {\n return node.type === \"Property\" && node.kind === \"init\" && !node.method;\n }\n\n isObjectMethod(node: N.Node): boolean {\n return node.method || node.kind === \"get\" || node.kind === \"set\";\n }\n };\n","// @flow\n\n// The token context is used to track whether the apostrophe \"`\"\n// starts or ends a string template\n\nexport class TokContext {\n constructor(token: string, preserveSpace?: boolean) {\n this.token = token;\n this.preserveSpace = !!preserveSpace;\n }\n\n token: string;\n preserveSpace: boolean;\n}\n\nexport const types: {\n [key: string]: TokContext,\n} = {\n brace: new TokContext(\"{\"),\n template: new TokContext(\"`\", true),\n};\n","// @flow\nimport { types as tc, type TokContext } from \"./context\";\n// ## Token types\n\n// The assignment of fine-grained, information-carrying type objects\n// allows the tokenizer to store the information it has about a\n// token in a way that is very cheap for the parser to look up.\n\n// All token type variables start with an underscore, to make them\n// easy to recognize.\n\n// The `beforeExpr` property is used to disambiguate between 1) binary\n// expression (<) and JSX Tag start (); 2) object literal and JSX\n// texts. It is set on the `updateContext` function in the JSX plugin.\n\n// The `startsExpr` property is used to determine whether an expression\n// may be the “argument” subexpression of a `yield` expression or\n// `yield` statement. It is set on all token types that may be at the\n// start of a subexpression.\n\n// `isLoop` marks a keyword as starting a loop, which is important\n// to know when parsing a label, in order to allow or disallow\n// continue jumps to that label.\n\nconst beforeExpr = true;\nconst startsExpr = true;\nconst isLoop = true;\nconst isAssign = true;\nconst prefix = true;\nconst postfix = true;\n\ntype TokenOptions = {\n keyword?: string,\n beforeExpr?: boolean,\n startsExpr?: boolean,\n rightAssociative?: boolean,\n isLoop?: boolean,\n isAssign?: boolean,\n prefix?: boolean,\n postfix?: boolean,\n binop?: ?number,\n};\n\n// Internally the tokenizer stores token as a number\nexport opaque type TokenType = number;\n\n// The `ExportedTokenType` is exported via `tokTypes` and accessible\n// when `tokens: true` is enabled. Unlike internal token type, it provides\n// metadata of the tokens.\nexport class ExportedTokenType {\n label: string;\n keyword: ?string;\n beforeExpr: boolean;\n startsExpr: boolean;\n rightAssociative: boolean;\n isLoop: boolean;\n isAssign: boolean;\n prefix: boolean;\n postfix: boolean;\n binop: ?number;\n // todo(Babel 8): remove updateContext from exposed token layout\n declare updateContext: ?(context: Array) => void;\n\n constructor(label: string, conf: TokenOptions = {}) {\n this.label = label;\n this.keyword = conf.keyword;\n this.beforeExpr = !!conf.beforeExpr;\n this.startsExpr = !!conf.startsExpr;\n this.rightAssociative = !!conf.rightAssociative;\n this.isLoop = !!conf.isLoop;\n this.isAssign = !!conf.isAssign;\n this.prefix = !!conf.prefix;\n this.postfix = !!conf.postfix;\n this.binop = conf.binop != null ? conf.binop : null;\n if (!process.env.BABEL_8_BREAKING) {\n this.updateContext = null;\n }\n }\n}\n\n// A map from keyword/keyword-like string value to the token type\nexport const keywords = new Map();\n\nfunction createKeyword(name: string, options: TokenOptions = {}): TokenType {\n options.keyword = name;\n const token = createToken(name, options);\n keywords.set(name, token);\n return token;\n}\n\nfunction createBinop(name: string, binop: number) {\n return createToken(name, { beforeExpr, binop });\n}\n\nlet tokenTypeCounter = -1;\nexport const tokenTypes: ExportedTokenType[] = [];\nconst tokenLabels: string[] = [];\nconst tokenBinops: number[] = [];\nconst tokenBeforeExprs: boolean[] = [];\nconst tokenStartsExprs: boolean[] = [];\nconst tokenPrefixes: boolean[] = [];\n\nfunction createToken(name: string, options: TokenOptions = {}): TokenType {\n ++tokenTypeCounter;\n tokenLabels.push(name);\n tokenBinops.push(options.binop ?? -1);\n tokenBeforeExprs.push(options.beforeExpr ?? false);\n tokenStartsExprs.push(options.startsExpr ?? false);\n tokenPrefixes.push(options.prefix ?? false);\n tokenTypes.push(new ExportedTokenType(name, options));\n\n return tokenTypeCounter;\n}\n\nfunction createKeywordLike(\n name: string,\n options: TokenOptions = {},\n): TokenType {\n ++tokenTypeCounter;\n keywords.set(name, tokenTypeCounter);\n tokenLabels.push(name);\n tokenBinops.push(options.binop ?? -1);\n tokenBeforeExprs.push(options.beforeExpr ?? false);\n tokenStartsExprs.push(options.startsExpr ?? false);\n tokenPrefixes.push(options.prefix ?? false);\n // In the exported token type, we set the label as \"name\" for backward compatibility with Babel 7\n tokenTypes.push(new ExportedTokenType(\"name\", options));\n\n return tokenTypeCounter;\n}\n\n// For performance the token type helpers depend on the following declarations order.\n// When adding new token types, please also check if the token helpers need update.\n\nexport const tt: { [name: string]: TokenType } = {\n // Punctuation token types.\n bracketL: createToken(\"[\", { beforeExpr, startsExpr }),\n bracketHashL: createToken(\"#[\", { beforeExpr, startsExpr }),\n bracketBarL: createToken(\"[|\", { beforeExpr, startsExpr }),\n bracketR: createToken(\"]\"),\n bracketBarR: createToken(\"|]\"),\n braceL: createToken(\"{\", { beforeExpr, startsExpr }),\n braceBarL: createToken(\"{|\", { beforeExpr, startsExpr }),\n braceHashL: createToken(\"#{\", { beforeExpr, startsExpr }),\n braceR: createToken(\"}\", { beforeExpr }),\n braceBarR: createToken(\"|}\"),\n parenL: createToken(\"(\", { beforeExpr, startsExpr }),\n parenR: createToken(\")\"),\n comma: createToken(\",\", { beforeExpr }),\n semi: createToken(\";\", { beforeExpr }),\n colon: createToken(\":\", { beforeExpr }),\n doubleColon: createToken(\"::\", { beforeExpr }),\n dot: createToken(\".\"),\n question: createToken(\"?\", { beforeExpr }),\n questionDot: createToken(\"?.\"),\n arrow: createToken(\"=>\", { beforeExpr }),\n template: createToken(\"template\"),\n ellipsis: createToken(\"...\", { beforeExpr }),\n backQuote: createToken(\"`\", { startsExpr }),\n dollarBraceL: createToken(\"${\", { beforeExpr, startsExpr }),\n at: createToken(\"@\"),\n hash: createToken(\"#\", { startsExpr }),\n\n // Special hashbang token.\n interpreterDirective: createToken(\"#!...\"),\n\n // Operators. These carry several kinds of properties to help the\n // parser use them properly (the presence of these properties is\n // what categorizes them as operators).\n //\n // `binop`, when present, specifies that this operator is a binary\n // operator, and will refer to its precedence.\n //\n // `prefix` and `postfix` mark the operator as a prefix or postfix\n // unary operator.\n //\n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as\n // binary operators with a very low precedence, that should result\n // in AssignmentExpression nodes.\n\n // start: isAssign\n eq: createToken(\"=\", { beforeExpr, isAssign }),\n assign: createToken(\"_=\", { beforeExpr, isAssign }),\n slashAssign: createToken(\"_=\", { beforeExpr, isAssign }),\n // These are only needed to support % and ^ as a Hack-pipe topic token. When the\n // proposal settles on a token, the others can be merged with tt.assign.\n xorAssign: createToken(\"_=\", { beforeExpr, isAssign }),\n moduloAssign: createToken(\"_=\", { beforeExpr, isAssign }),\n // end: isAssign\n\n incDec: createToken(\"++/--\", { prefix, postfix, startsExpr }),\n bang: createToken(\"!\", { beforeExpr, prefix, startsExpr }),\n tilde: createToken(\"~\", { beforeExpr, prefix, startsExpr }),\n // start: isBinop\n pipeline: createBinop(\"|>\", 0),\n nullishCoalescing: createBinop(\"??\", 1),\n logicalOR: createBinop(\"||\", 1),\n logicalAND: createBinop(\"&&\", 2),\n bitwiseOR: createBinop(\"|\", 3),\n bitwiseXOR: createBinop(\"^\", 4),\n bitwiseAND: createBinop(\"&\", 5),\n equality: createBinop(\"==/!=/===/!==\", 6),\n lt: createBinop(\"/<=/>=\", 7),\n gt: createBinop(\"/<=/>=\", 7),\n relational: createBinop(\"/<=/>=\", 7),\n bitShift: createBinop(\"<>/>>>\", 8),\n plusMin: createToken(\"+/-\", { beforeExpr, binop: 9, prefix, startsExpr }),\n // startsExpr: required by v8intrinsic plugin\n modulo: createToken(\"%\", { binop: 10, startsExpr }),\n // unset `beforeExpr` as it can be `function *`\n star: createToken(\"*\", { binop: 10 }),\n slash: createBinop(\"/\", 10),\n exponent: createToken(\"**\", {\n beforeExpr,\n binop: 11,\n rightAssociative: true,\n }),\n\n // Keywords\n // Don't forget to update packages/babel-helper-validator-identifier/src/keyword.js\n // when new keywords are added\n // start: isLiteralPropertyName\n // start: isKeyword\n _in: createKeyword(\"in\", { beforeExpr, binop: 7 }),\n _instanceof: createKeyword(\"instanceof\", { beforeExpr, binop: 7 }),\n // end: isBinop\n _break: createKeyword(\"break\"),\n _case: createKeyword(\"case\", { beforeExpr }),\n _catch: createKeyword(\"catch\"),\n _continue: createKeyword(\"continue\"),\n _debugger: createKeyword(\"debugger\"),\n _default: createKeyword(\"default\", { beforeExpr }),\n _else: createKeyword(\"else\", { beforeExpr }),\n _finally: createKeyword(\"finally\"),\n _function: createKeyword(\"function\", { startsExpr }),\n _if: createKeyword(\"if\"),\n _return: createKeyword(\"return\", { beforeExpr }),\n _switch: createKeyword(\"switch\"),\n _throw: createKeyword(\"throw\", { beforeExpr, prefix, startsExpr }),\n _try: createKeyword(\"try\"),\n _var: createKeyword(\"var\"),\n _const: createKeyword(\"const\"),\n _with: createKeyword(\"with\"),\n _new: createKeyword(\"new\", { beforeExpr, startsExpr }),\n _this: createKeyword(\"this\", { startsExpr }),\n _super: createKeyword(\"super\", { startsExpr }),\n _class: createKeyword(\"class\", { startsExpr }),\n _extends: createKeyword(\"extends\", { beforeExpr }),\n _export: createKeyword(\"export\"),\n _import: createKeyword(\"import\", { startsExpr }),\n _null: createKeyword(\"null\", { startsExpr }),\n _true: createKeyword(\"true\", { startsExpr }),\n _false: createKeyword(\"false\", { startsExpr }),\n _typeof: createKeyword(\"typeof\", { beforeExpr, prefix, startsExpr }),\n _void: createKeyword(\"void\", { beforeExpr, prefix, startsExpr }),\n _delete: createKeyword(\"delete\", { beforeExpr, prefix, startsExpr }),\n // start: isLoop\n _do: createKeyword(\"do\", { isLoop, beforeExpr }),\n _for: createKeyword(\"for\", { isLoop }),\n _while: createKeyword(\"while\", { isLoop }),\n // end: isLoop\n // end: isKeyword\n\n // Primary literals\n // start: isIdentifier\n _as: createKeywordLike(\"as\", { startsExpr }),\n _assert: createKeywordLike(\"assert\", { startsExpr }),\n _async: createKeywordLike(\"async\", { startsExpr }),\n _await: createKeywordLike(\"await\", { startsExpr }),\n _from: createKeywordLike(\"from\", { startsExpr }),\n _get: createKeywordLike(\"get\", { startsExpr }),\n _let: createKeywordLike(\"let\", { startsExpr }),\n _meta: createKeywordLike(\"meta\", { startsExpr }),\n _of: createKeywordLike(\"of\", { startsExpr }),\n _sent: createKeywordLike(\"sent\", { startsExpr }),\n _set: createKeywordLike(\"set\", { startsExpr }),\n _static: createKeywordLike(\"static\", { startsExpr }),\n _yield: createKeywordLike(\"yield\", { startsExpr }),\n\n // Flow and TypeScript Keywordlike\n _asserts: createKeywordLike(\"asserts\", { startsExpr }),\n _checks: createKeywordLike(\"checks\", { startsExpr }),\n _exports: createKeywordLike(\"exports\", { startsExpr }),\n _global: createKeywordLike(\"global\", { startsExpr }),\n _implements: createKeywordLike(\"implements\", { startsExpr }),\n _intrinsic: createKeywordLike(\"intrinsic\", { startsExpr }),\n _infer: createKeywordLike(\"infer\", { startsExpr }),\n _is: createKeywordLike(\"is\", { startsExpr }),\n _mixins: createKeywordLike(\"mixins\", { startsExpr }),\n _proto: createKeywordLike(\"proto\", { startsExpr }),\n _require: createKeywordLike(\"require\", { startsExpr }),\n // start: isTSTypeOperator\n _keyof: createKeywordLike(\"keyof\", { startsExpr }),\n _readonly: createKeywordLike(\"readonly\", { startsExpr }),\n _unique: createKeywordLike(\"unique\", { startsExpr }),\n // end: isTSTypeOperator\n // start: isTSDeclarationStart\n _abstract: createKeywordLike(\"abstract\", { startsExpr }),\n _declare: createKeywordLike(\"declare\", { startsExpr }),\n _enum: createKeywordLike(\"enum\", { startsExpr }),\n _module: createKeywordLike(\"module\", { startsExpr }),\n _namespace: createKeywordLike(\"namespace\", { startsExpr }),\n // start: isFlowInterfaceOrTypeOrOpaque\n _interface: createKeywordLike(\"interface\", { startsExpr }),\n _type: createKeywordLike(\"type\", { startsExpr }),\n // end: isTSDeclarationStart\n _opaque: createKeywordLike(\"opaque\", { startsExpr }),\n // end: isFlowInterfaceOrTypeOrOpaque\n name: createToken(\"name\", { startsExpr }),\n // end: isIdentifier\n\n string: createToken(\"string\", { startsExpr }),\n num: createToken(\"num\", { startsExpr }),\n bigint: createToken(\"bigint\", { startsExpr }),\n decimal: createToken(\"decimal\", { startsExpr }),\n // end: isLiteralPropertyName\n regexp: createToken(\"regexp\", { startsExpr }),\n privateName: createToken(\"#name\", { startsExpr }),\n eof: createToken(\"eof\"),\n\n // jsx plugin\n jsxName: createToken(\"jsxName\"),\n jsxText: createToken(\"jsxText\", { beforeExpr: true }),\n jsxTagStart: createToken(\"jsxTagStart\", { startsExpr: true }),\n jsxTagEnd: createToken(\"jsxTagEnd\"),\n\n // placeholder plugin\n placeholder: createToken(\"%%\", { startsExpr: true }),\n};\n\nexport function tokenIsIdentifier(token: TokenType): boolean {\n return token >= tt._as && token <= tt.name;\n}\n\nexport function tokenKeywordOrIdentifierIsKeyword(token: TokenType): boolean {\n // we can remove the token >= tt._in check when we\n // know a token is either keyword or identifier\n return token <= tt._while;\n}\n\nexport function tokenIsKeywordOrIdentifier(token: TokenType): boolean {\n return token >= tt._in && token <= tt.name;\n}\n\nexport function tokenIsLiteralPropertyName(token: TokenType): boolean {\n return token >= tt._in && token <= tt.decimal;\n}\n\nexport function tokenComesBeforeExpression(token: TokenType): boolean {\n return tokenBeforeExprs[token];\n}\n\nexport function tokenCanStartExpression(token: TokenType): boolean {\n return tokenStartsExprs[token];\n}\n\nexport function tokenIsAssignment(token: TokenType): boolean {\n return token >= tt.eq && token <= tt.moduloAssign;\n}\n\nexport function tokenIsFlowInterfaceOrTypeOrOpaque(token: TokenType): boolean {\n return token >= tt._interface && token <= tt._opaque;\n}\n\nexport function tokenIsLoop(token: TokenType): boolean {\n return token >= tt._do && token <= tt._while;\n}\n\nexport function tokenIsKeyword(token: TokenType): boolean {\n return token >= tt._in && token <= tt._while;\n}\n\nexport function tokenIsOperator(token: TokenType): boolean {\n return token >= tt.pipeline && token <= tt._instanceof;\n}\n\nexport function tokenIsPostfix(token: TokenType): boolean {\n return token === tt.incDec;\n}\n\nexport function tokenIsPrefix(token: TokenType): boolean {\n return tokenPrefixes[token];\n}\n\nexport function tokenIsTSTypeOperator(token: TokenType): boolean {\n return token >= tt._keyof && token <= tt._unique;\n}\n\nexport function tokenIsTSDeclarationStart(token: TokenType): boolean {\n return token >= tt._abstract && token <= tt._type;\n}\n\nexport function tokenLabelName(token: TokenType): string {\n return tokenLabels[token];\n}\n\nexport function tokenOperatorPrecedence(token: TokenType): number {\n return tokenBinops[token];\n}\n\nexport function tokenIsRightAssociative(token: TokenType): boolean {\n return token === tt.exponent;\n}\n\nexport function getExportedToken(token: TokenType): ExportedTokenType {\n return tokenTypes[token];\n}\n\nexport function isTokenType(obj: any): boolean {\n return typeof obj === \"number\";\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n tokenTypes[tt.braceR].updateContext = context => {\n context.pop();\n };\n\n tokenTypes[tt.braceL].updateContext =\n tokenTypes[tt.braceHashL].updateContext =\n tokenTypes[tt.dollarBraceL].updateContext =\n context => {\n context.push(tc.brace);\n };\n\n tokenTypes[tt.backQuote].updateContext = context => {\n if (context[context.length - 1] === tc.template) {\n context.pop();\n } else {\n context.push(tc.template);\n }\n };\n\n tokenTypes[tt.jsxTagStart].updateContext = context => {\n context.push(tc.j_expr, tc.j_oTag);\n };\n}\n","import * as charCodes from \"charcodes\";\n\n// ## Character categories\n\n// Big ugly regular expressions that match characters in the\n// whitespace, identifier, and identifier-start categories. These\n// are only applied when a character is found to actually have a\n// code point between 0x80 and 0xffff.\n// Generated by `scripts/generate-identifier-regex.js`.\n\n/* prettier-ignore */\nlet 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\";\n/* prettier-ignore */\nlet 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\\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-\\u0ecd\\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\";\n\nconst nonASCIIidentifierStart = new RegExp(\n \"[\" + nonASCIIidentifierStartChars + \"]\",\n);\nconst nonASCIIidentifier = new RegExp(\n \"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\",\n);\n\nnonASCIIidentifierStartChars = nonASCIIidentifierChars = null;\n\n// These are a run-length and offset-encoded representation of the\n// >0xffff code points that are a valid part of identifiers. The\n// offset starts at 0x10000, and each pair of numbers represents an\n// offset to the next range, and then a size of the range. They were\n// generated by `scripts/generate-identifier-regex.js`.\n/* prettier-ignore */\nconst 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,85,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,190,0,80,921,103,110,18,195,2637,96,16,1070,4050,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,46,2,18,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,482,44,11,6,17,0,322,29,19,43,1269,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,4152,8,221,3,5761,15,7472,3104,541,1507,4938];\n/* prettier-ignore */\nconst 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,154,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,161,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,19306,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,262,6,10,9,357,0,62,13,1495,6,110,6,6,9,4759,9,787719,239];\n\n// This has a complexity linear to the value of the code. The\n// assumption is that looking up astral identifier characters is\n// rare.\nfunction isInAstralSet(code: number, set: readonly number[]): boolean {\n let pos = 0x10000;\n for (let i = 0, length = set.length; i < length; i += 2) {\n pos += set[i];\n if (pos > code) return false;\n\n pos += set[i + 1];\n if (pos >= code) return true;\n }\n return false;\n}\n\n// Test whether a given character code starts an identifier.\n\nexport function isIdentifierStart(code: number): boolean {\n if (code < charCodes.uppercaseA) return code === charCodes.dollarSign;\n if (code <= charCodes.uppercaseZ) return true;\n if (code < charCodes.lowercaseA) return code === charCodes.underscore;\n if (code <= charCodes.lowercaseZ) return true;\n if (code <= 0xffff) {\n return (\n code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code))\n );\n }\n return isInAstralSet(code, astralIdentifierStartCodes);\n}\n\n// Test whether a given character is part of an identifier.\n\nexport function isIdentifierChar(code: number): boolean {\n if (code < charCodes.digit0) return code === charCodes.dollarSign;\n if (code < charCodes.colon) return true;\n if (code < charCodes.uppercaseA) return false;\n if (code <= charCodes.uppercaseZ) return true;\n if (code < charCodes.lowercaseA) return code === charCodes.underscore;\n if (code <= charCodes.lowercaseZ) return true;\n if (code <= 0xffff) {\n return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n }\n return (\n isInAstralSet(code, astralIdentifierStartCodes) ||\n isInAstralSet(code, astralIdentifierCodes)\n );\n}\n\n// Test whether a given string is a valid identifier name\n\nexport function isIdentifierName(name: string): boolean {\n let isFirst = true;\n for (let i = 0; i < name.length; i++) {\n // The implementation is based on\n // https://source.chromium.org/chromium/chromium/src/+/master:v8/src/builtins/builtins-string-gen.cc;l=1455;drc=221e331b49dfefadbc6fa40b0c68e6f97606d0b3;bpv=0;bpt=1\n // We reimplement `codePointAt` because `codePointAt` is a V8 builtin which is not inlined by TurboFan (as of M91)\n // since `name` is mostly ASCII, an inlined `charCodeAt` wins here\n let cp = name.charCodeAt(i);\n if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {\n const trail = name.charCodeAt(++i);\n if ((trail & 0xfc00) === 0xdc00) {\n cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);\n }\n }\n if (isFirst) {\n isFirst = false;\n if (!isIdentifierStart(cp)) {\n return false;\n }\n } else if (!isIdentifierChar(cp)) {\n return false;\n }\n }\n return !isFirst;\n}\n","const reservedWords = {\n keyword: [\n \"break\",\n \"case\",\n \"catch\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"do\",\n \"else\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"return\",\n \"switch\",\n \"throw\",\n \"try\",\n \"var\",\n \"const\",\n \"while\",\n \"with\",\n \"new\",\n \"this\",\n \"super\",\n \"class\",\n \"extends\",\n \"export\",\n \"import\",\n \"null\",\n \"true\",\n \"false\",\n \"in\",\n \"instanceof\",\n \"typeof\",\n \"void\",\n \"delete\",\n ],\n strict: [\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n \"yield\",\n ],\n strictBind: [\"eval\", \"arguments\"],\n};\nconst keywords = new Set(reservedWords.keyword);\nconst reservedWordsStrictSet = new Set(reservedWords.strict);\nconst reservedWordsStrictBindSet = new Set(reservedWords.strictBind);\n\n/**\n * Checks if word is a reserved word in non-strict mode\n */\nexport function isReservedWord(word: string, inModule: boolean): boolean {\n return (inModule && word === \"await\") || word === \"enum\";\n}\n\n/**\n * Checks if word is a reserved word in non-binding strict mode\n *\n * Includes non-strict reserved words\n */\nexport function isStrictReservedWord(word: string, inModule: boolean): boolean {\n return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode, but it is allowed as\n * a normal identifier.\n */\nexport function isStrictBindOnlyReservedWord(word: string): boolean {\n return reservedWordsStrictBindSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode\n *\n * Includes non-strict reserved words and non-binding strict reserved words\n */\nexport function isStrictBindReservedWord(\n word: string,\n inModule: boolean,\n): boolean {\n return (\n isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word)\n );\n}\n\nexport function isKeyword(word: string): boolean {\n return keywords.has(word);\n}\n","/* eslint max-len: 0 */\n\n// @flow\n\nimport * as charCodes from \"charcodes\";\n\nexport {\n isIdentifierStart,\n isIdentifierChar,\n isReservedWord,\n isStrictBindOnlyReservedWord,\n isStrictBindReservedWord,\n isStrictReservedWord,\n isKeyword,\n} from \"@babel/helper-validator-identifier\";\n\nexport const keywordRelationalOperator = /^in(stanceof)?$/;\n\n// Test whether a current state character code and next character code is @\n\nexport function isIteratorStart(current: number, next: number): boolean {\n return current === charCodes.atSign && next === charCodes.atSign;\n}\n\n// This is the comprehensive set of JavaScript reserved words\n// If a word is in this set, it could be a reserved word,\n// depending on sourceType/strictMode/binding info. In other words\n// if a word is not in this set, it is not a reserved word under\n// any circumstance.\nconst reservedWordLikeSet = new Set([\n \"break\",\n \"case\",\n \"catch\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"do\",\n \"else\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"return\",\n \"switch\",\n \"throw\",\n \"try\",\n \"var\",\n \"const\",\n \"while\",\n \"with\",\n \"new\",\n \"this\",\n \"super\",\n \"class\",\n \"extends\",\n \"export\",\n \"import\",\n \"null\",\n \"true\",\n \"false\",\n \"in\",\n \"instanceof\",\n \"typeof\",\n \"void\",\n \"delete\",\n // strict\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n \"yield\",\n // strictBind\n \"eval\",\n \"arguments\",\n // reservedWorkLike\n \"enum\",\n \"await\",\n]);\n\nexport function canBeReservedWord(word: string): boolean {\n return reservedWordLikeSet.has(word);\n}\n","// @flow\n\n// Each scope gets a bitset that may contain these flags\n// prettier-ignore\nexport const SCOPE_OTHER = 0b000000000,\n SCOPE_PROGRAM = 0b000000001,\n SCOPE_FUNCTION = 0b000000010,\n SCOPE_ARROW = 0b000000100,\n SCOPE_SIMPLE_CATCH = 0b000001000,\n SCOPE_SUPER = 0b000010000,\n SCOPE_DIRECT_SUPER = 0b000100000,\n SCOPE_CLASS = 0b001000000,\n SCOPE_STATIC_BLOCK = 0b010000000,\n SCOPE_TS_MODULE = 0b100000000,\n SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_TS_MODULE;\n\nexport type ScopeFlags =\n | typeof SCOPE_OTHER\n | typeof SCOPE_PROGRAM\n | typeof SCOPE_FUNCTION\n | typeof SCOPE_VAR\n | typeof SCOPE_ARROW\n | typeof SCOPE_SIMPLE_CATCH\n | typeof SCOPE_SUPER\n | typeof SCOPE_DIRECT_SUPER\n | typeof SCOPE_CLASS\n | typeof SCOPE_STATIC_BLOCK;\n\n// These flags are meant to be _only_ used inside the Scope class (or subclasses).\n// prettier-ignore\nexport const BIND_KIND_VALUE = 0b000000_0000_01,\n BIND_KIND_TYPE = 0b000000_0000_10,\n // Used in checkLVal and declareName to determine the type of a binding\n BIND_SCOPE_VAR = 0b000000_0001_00, // Var-style binding\n BIND_SCOPE_LEXICAL = 0b000000_0010_00, // Let- or const-style binding\n BIND_SCOPE_FUNCTION = 0b000000_0100_00, // Function declaration\n BIND_SCOPE_OUTSIDE = 0b000000_1000_00, // Special case for function names as\n // bound inside the function\n // Misc flags\n BIND_FLAGS_NONE = 0b000001_0000_00,\n BIND_FLAGS_CLASS = 0b000010_0000_00,\n BIND_FLAGS_TS_ENUM = 0b000100_0000_00,\n BIND_FLAGS_TS_CONST_ENUM = 0b001000_0000_00,\n BIND_FLAGS_TS_EXPORT_ONLY = 0b010000_0000_00,\n BIND_FLAGS_FLOW_DECLARE_FN = 0b100000_0000_00;\n\n// These flags are meant to be _only_ used by Scope consumers\n// prettier-ignore\n/* = is value? | is type? | scope | misc flags */\nexport const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS ,\n BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0 ,\n BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0 ,\n BIND_FUNCTION = BIND_KIND_VALUE | 0 | BIND_SCOPE_FUNCTION | 0 ,\n BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS ,\n BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0 ,\n BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM,\n BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,\n // These bindings don't introduce anything in the scope. They are used for assignments and\n // function expressions IDs.\n BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE ,\n BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE ,\n\n BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM,\n BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,\n\n BIND_FLOW_DECLARE_FN = BIND_FLAGS_FLOW_DECLARE_FN;\n\nexport type BindingTypes =\n | typeof BIND_NONE\n | typeof BIND_OUTSIDE\n | typeof BIND_VAR\n | typeof BIND_LEXICAL\n | typeof BIND_CLASS\n | typeof BIND_FUNCTION\n | typeof BIND_TS_INTERFACE\n | typeof BIND_TS_TYPE\n | typeof BIND_TS_ENUM\n | typeof BIND_TS_AMBIENT\n | typeof BIND_TS_NAMESPACE;\n\n// prettier-ignore\nexport const CLASS_ELEMENT_FLAG_STATIC = 0b1_00,\n CLASS_ELEMENT_KIND_GETTER = 0b0_10,\n CLASS_ELEMENT_KIND_SETTER = 0b0_01,\n CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER;\n\n// prettier-ignore\nexport const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC,\n CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC,\n CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_KIND_GETTER,\n CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_KIND_SETTER,\n CLASS_ELEMENT_OTHER = 0;\n\nexport type ClassElementTypes =\n | typeof CLASS_ELEMENT_STATIC_GETTER\n | typeof CLASS_ELEMENT_STATIC_SETTER\n | typeof CLASS_ELEMENT_INSTANCE_GETTER\n | typeof CLASS_ELEMENT_INSTANCE_SETTER\n | typeof CLASS_ELEMENT_OTHER;\n","// @flow\nimport {\n SCOPE_ARROW,\n SCOPE_DIRECT_SUPER,\n SCOPE_FUNCTION,\n SCOPE_SIMPLE_CATCH,\n SCOPE_SUPER,\n SCOPE_PROGRAM,\n SCOPE_VAR,\n SCOPE_CLASS,\n SCOPE_STATIC_BLOCK,\n BIND_SCOPE_FUNCTION,\n BIND_SCOPE_VAR,\n BIND_SCOPE_LEXICAL,\n BIND_KIND_VALUE,\n type ScopeFlags,\n type BindingTypes,\n} from \"./scopeflags\";\nimport * as N from \"../types\";\nimport { Errors, type raiseFunction } from \"../parser/error\";\n\n// Start an AST node, attaching a start offset.\nexport class Scope {\n declare flags: ScopeFlags;\n // A set of var-declared names in the current lexical scope\n var: Set = new Set();\n // A set of lexically-declared names in the current lexical scope\n lexical: Set = new Set();\n // A set of lexically-declared FunctionDeclaration names in the current lexical scope\n functions: Set = new Set();\n\n constructor(flags: ScopeFlags) {\n this.flags = flags;\n }\n}\n\n// The functions in this module keep track of declared variables in the\n// current scope in order to detect duplicate variable names.\nexport default class ScopeHandler {\n scopeStack: Array = [];\n declare raise: raiseFunction;\n declare inModule: boolean;\n undefinedExports: Map = new Map();\n undefinedPrivateNames: Map = new Map();\n\n constructor(raise: raiseFunction, inModule: boolean) {\n this.raise = raise;\n this.inModule = inModule;\n }\n\n get inFunction() {\n return (this.currentVarScopeFlags() & SCOPE_FUNCTION) > 0;\n }\n get allowSuper() {\n return (this.currentThisScopeFlags() & SCOPE_SUPER) > 0;\n }\n get allowDirectSuper() {\n return (this.currentThisScopeFlags() & SCOPE_DIRECT_SUPER) > 0;\n }\n get inClass() {\n return (this.currentThisScopeFlags() & SCOPE_CLASS) > 0;\n }\n get inClassAndNotInNonArrowFunction() {\n const flags = this.currentThisScopeFlags();\n return (flags & SCOPE_CLASS) > 0 && (flags & SCOPE_FUNCTION) === 0;\n }\n get inStaticBlock() {\n for (let i = this.scopeStack.length - 1; ; i--) {\n const { flags } = this.scopeStack[i];\n if (flags & SCOPE_STATIC_BLOCK) {\n return true;\n }\n if (flags & (SCOPE_VAR | SCOPE_CLASS)) {\n // function body, module body, class property initializers\n return false;\n }\n }\n }\n get inNonArrowFunction() {\n return (this.currentThisScopeFlags() & SCOPE_FUNCTION) > 0;\n }\n get treatFunctionsAsVar() {\n return this.treatFunctionsAsVarInScope(this.currentScope());\n }\n\n createScope(flags: ScopeFlags): Scope {\n return new Scope(flags);\n }\n // This method will be overwritten by subclasses\n /*:: +createScope: (flags: ScopeFlags) => IScope; */\n\n enter(flags: ScopeFlags) {\n this.scopeStack.push(this.createScope(flags));\n }\n\n exit() {\n this.scopeStack.pop();\n }\n\n // The spec says:\n // > At the top level of a function, or script, function declarations are\n // > treated like var declarations rather than like lexical declarations.\n treatFunctionsAsVarInScope(scope: IScope): boolean {\n return !!(\n scope.flags & SCOPE_FUNCTION ||\n (!this.inModule && scope.flags & SCOPE_PROGRAM)\n );\n }\n\n declareName(name: string, bindingType: BindingTypes, pos: number) {\n let scope = this.currentScope();\n if (bindingType & BIND_SCOPE_LEXICAL || bindingType & BIND_SCOPE_FUNCTION) {\n this.checkRedeclarationInScope(scope, name, bindingType, pos);\n\n if (bindingType & BIND_SCOPE_FUNCTION) {\n scope.functions.add(name);\n } else {\n scope.lexical.add(name);\n }\n\n if (bindingType & BIND_SCOPE_LEXICAL) {\n this.maybeExportDefined(scope, name);\n }\n } else if (bindingType & BIND_SCOPE_VAR) {\n for (let i = this.scopeStack.length - 1; i >= 0; --i) {\n scope = this.scopeStack[i];\n this.checkRedeclarationInScope(scope, name, bindingType, pos);\n scope.var.add(name);\n this.maybeExportDefined(scope, name);\n\n if (scope.flags & SCOPE_VAR) break;\n }\n }\n if (this.inModule && scope.flags & SCOPE_PROGRAM) {\n this.undefinedExports.delete(name);\n }\n }\n\n maybeExportDefined(scope: IScope, name: string) {\n if (this.inModule && scope.flags & SCOPE_PROGRAM) {\n this.undefinedExports.delete(name);\n }\n }\n\n checkRedeclarationInScope(\n scope: IScope,\n name: string,\n bindingType: BindingTypes,\n pos: number,\n ) {\n if (this.isRedeclaredInScope(scope, name, bindingType)) {\n this.raise(pos, Errors.VarRedeclaration, name);\n }\n }\n\n isRedeclaredInScope(\n scope: IScope,\n name: string,\n bindingType: BindingTypes,\n ): boolean {\n if (!(bindingType & BIND_KIND_VALUE)) return false;\n\n if (bindingType & BIND_SCOPE_LEXICAL) {\n return (\n scope.lexical.has(name) ||\n scope.functions.has(name) ||\n scope.var.has(name)\n );\n }\n\n if (bindingType & BIND_SCOPE_FUNCTION) {\n return (\n scope.lexical.has(name) ||\n (!this.treatFunctionsAsVarInScope(scope) && scope.var.has(name))\n );\n }\n\n return (\n (scope.lexical.has(name) &&\n !(\n scope.flags & SCOPE_SIMPLE_CATCH &&\n scope.lexical.values().next().value === name\n )) ||\n (!this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name))\n );\n }\n\n checkLocalExport(id: N.Identifier) {\n const { name } = id;\n const topLevelScope = this.scopeStack[0];\n if (\n !topLevelScope.lexical.has(name) &&\n !topLevelScope.var.has(name) &&\n // In strict mode, scope.functions will always be empty.\n // Modules are strict by default, but the `scriptMode` option\n // can overwrite this behavior.\n !topLevelScope.functions.has(name)\n ) {\n this.undefinedExports.set(name, id.start);\n }\n }\n\n currentScope(): IScope {\n return this.scopeStack[this.scopeStack.length - 1];\n }\n\n // $FlowIgnore\n currentVarScopeFlags(): ScopeFlags {\n for (let i = this.scopeStack.length - 1; ; i--) {\n const { flags } = this.scopeStack[i];\n if (flags & SCOPE_VAR) {\n return flags;\n }\n }\n }\n\n // Could be useful for `arguments`, `this`, `new.target`, `super()`, `super.property`, and `super[property]`.\n // $FlowIgnore\n currentThisScopeFlags(): ScopeFlags {\n for (let i = this.scopeStack.length - 1; ; i--) {\n const { flags } = this.scopeStack[i];\n if (flags & (SCOPE_VAR | SCOPE_CLASS) && !(flags & SCOPE_ARROW)) {\n return flags;\n }\n }\n }\n}\n","// @flow\n\nimport ScopeHandler, { Scope } from \"../../util/scope\";\nimport {\n BIND_FLAGS_FLOW_DECLARE_FN,\n type ScopeFlags,\n type BindingTypes,\n} from \"../../util/scopeflags\";\nimport * as N from \"../../types\";\n\n// Reference implementation: https://github.com/facebook/flow/blob/23aeb2a2ef6eb4241ce178fde5d8f17c5f747fb5/src/typing/env.ml#L536-L584\nclass FlowScope extends Scope {\n // declare function foo(): type;\n declareFunctions: Set = new Set();\n}\n\nexport default class FlowScopeHandler extends ScopeHandler {\n createScope(flags: ScopeFlags): FlowScope {\n return new FlowScope(flags);\n }\n\n declareName(name: string, bindingType: BindingTypes, pos: number) {\n const scope = this.currentScope();\n if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {\n this.checkRedeclarationInScope(scope, name, bindingType, pos);\n this.maybeExportDefined(scope, name);\n scope.declareFunctions.add(name);\n return;\n }\n\n super.declareName(...arguments);\n }\n\n isRedeclaredInScope(\n scope: FlowScope,\n name: string,\n bindingType: BindingTypes,\n ): boolean {\n if (super.isRedeclaredInScope(...arguments)) return true;\n\n if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {\n return (\n !scope.declareFunctions.has(name) &&\n (scope.lexical.has(name) || scope.functions.has(name))\n );\n }\n\n return false;\n }\n\n checkLocalExport(id: N.Identifier) {\n if (!this.scopeStack[0].declareFunctions.has(id.name)) {\n super.checkLocalExport(id);\n }\n }\n}\n","// @flow\n\nimport type { Options } from \"../options\";\nimport * as N from \"../types\";\nimport type { CommentWhitespace } from \"../parser/comments\";\nimport { Position } from \"../util/location\";\n\nimport { types as ct, type TokContext } from \"./context\";\nimport { tt, type TokenType } from \"./types\";\nimport type { ParsingError, ErrorTemplate } from \"../parser/error\";\n\ntype TopicContextState = {\n // When a topic binding has been currently established,\n // then this is 1. Otherwise, it is 0. This is forwards compatible\n // with a future plugin for multiple lexical topics.\n maxNumOfResolvableTopics: number,\n\n // When a topic binding has been currently established, and if that binding\n // has been used as a topic reference `#`, then this is 0. Otherwise, it is\n // `null`. This is forwards compatible with a future plugin for multiple\n // lexical topics.\n maxTopicIndex: null | 0,\n};\n\nexport default class State {\n strict: boolean;\n curLine: number;\n lineStart: number;\n\n // And, if locations are used, the {line, column} object\n // corresponding to those offsets\n startLoc: Position;\n endLoc: Position;\n\n init({ strictMode, sourceType, startLine, startColumn }: Options): void {\n this.strict =\n strictMode === false\n ? false\n : strictMode === true\n ? true\n : sourceType === \"module\";\n\n this.curLine = startLine;\n this.lineStart = -startColumn;\n this.startLoc = this.endLoc = new Position(startLine, startColumn);\n }\n\n errors: ParsingError[] = [];\n\n // Used to signify the start of a potential arrow function\n potentialArrowAt: number = -1;\n\n // Used to signify the start of an expression which looks like a\n // typed arrow function, but it isn't\n // e.g. a ? (b) : c => d\n // ^\n noArrowAt: number[] = [];\n\n // Used to signify the start of an expression whose params, if it looks like\n // an arrow function, shouldn't be converted to assignable nodes.\n // This is used to defer the validation of typed arrow functions inside\n // conditional expressions.\n // e.g. a ? (b) : c => d\n // ^\n noArrowParamsConversionAt: number[] = [];\n\n // Flags to track\n maybeInArrowParameters: boolean = false;\n inType: boolean = false;\n noAnonFunctionType: boolean = false;\n hasFlowComment: boolean = false;\n isAmbientContext: boolean = false;\n inAbstractClass: boolean = false;\n\n // For the Hack-style pipelines plugin\n topicContext: TopicContextState = {\n maxNumOfResolvableTopics: 0,\n maxTopicIndex: null,\n };\n\n // For the F#-style pipelines plugin\n soloAwait: boolean = false;\n inFSharpPipelineDirectBody: boolean = false;\n\n // Labels in scope.\n labels: Array<{\n kind: ?(\"loop\" | \"switch\"),\n name?: ?string,\n statementStart?: number,\n }> = [];\n\n // Leading decorators. Last element of the stack represents the decorators in current context.\n // Supports nesting of decorators, e.g. @foo(@bar class inner {}) class outer {}\n // where @foo belongs to the outer class and @bar to the inner\n decoratorStack: Array> = [[]];\n\n // Comment store for Program.comments\n comments: Array = [];\n\n // Comment attachment store\n commentStack: Array = [];\n\n // The current position of the tokenizer in the input.\n pos: number = 0;\n\n // Properties of the current token:\n // Its type\n type: TokenType = tt.eof;\n\n // For tokens that include more information than their type, the value\n value: any = null;\n\n // Its start and end offset\n start: number = 0;\n end: number = 0;\n\n // Position information for the previous token\n // $FlowIgnore this is initialized when generating the second token.\n lastTokEndLoc: Position = null;\n // $FlowIgnore this is initialized when generating the second token.\n lastTokStartLoc: Position = null;\n lastTokStart: number = 0;\n lastTokEnd: number = 0;\n\n // The context stack is used to track whether the apostrophe \"`\" starts\n // or ends a string template\n context: Array = [ct.brace];\n // Used to track whether a JSX element is allowed to form\n canStartJSXElement: boolean = true;\n\n // Used to signal to callers of `readWord1` whether the word\n // contained any escape sequences. This is needed because words with\n // escape sequences must not be interpreted as keywords.\n containsEsc: boolean = false;\n\n // This property is used to track the following errors\n // - StrictNumericEscape\n // - StrictOctalLiteral\n //\n // in a literal that occurs prior to/immediately after a \"use strict\" directive.\n\n // todo(JLHwung): set strictErrors to null and avoid recording string errors\n // after a non-directive is parsed\n strictErrors: Map = new Map();\n\n // Tokens length in token store\n tokensLength: number = 0;\n\n curPosition(): Position {\n return new Position(this.curLine, this.pos - this.lineStart);\n }\n\n clone(skipArrays?: boolean): State {\n const state = new State();\n const keys = Object.keys(this);\n for (let i = 0, length = keys.length; i < length; i++) {\n const key = keys[i];\n // $FlowIgnore\n let val = this[key];\n\n if (!skipArrays && Array.isArray(val)) {\n val = val.slice();\n }\n\n // $FlowIgnore\n state[key] = val;\n }\n\n return state;\n }\n}\n\nexport type LookaheadState = {\n pos: number,\n value: any,\n type: TokenType,\n start: number,\n end: number,\n /* Used only in readToken_mult_modulo */\n inType: boolean,\n};\n","// @flow\n\n/*:: declare var invariant; */\n\nimport type { Options } from \"../options\";\nimport * as N from \"../types\";\nimport * as charCodes from \"charcodes\";\nimport { isIdentifierStart, isIdentifierChar } from \"../util/identifier\";\nimport {\n tokenIsKeyword,\n tokenLabelName,\n tt,\n keywords as keywordTypes,\n type TokenType,\n} from \"./types\";\nimport { type TokContext, types as ct } from \"./context\";\nimport ParserErrors, { Errors, type ErrorTemplate } from \"../parser/error\";\nimport { SourceLocation } from \"../util/location\";\nimport {\n lineBreakG,\n isNewLine,\n isWhitespace,\n skipWhiteSpace,\n} from \"../util/whitespace\";\nimport State from \"./state\";\nimport type { LookaheadState } from \"./state\";\n\nconst VALID_REGEX_FLAGS = new Set([\n charCodes.lowercaseG,\n charCodes.lowercaseM,\n charCodes.lowercaseS,\n charCodes.lowercaseI,\n charCodes.lowercaseY,\n charCodes.lowercaseU,\n charCodes.lowercaseD,\n]);\n\n// The following character codes are forbidden from being\n// an immediate sibling of NumericLiteralSeparator _\n\nconst forbiddenNumericSeparatorSiblings = {\n decBinOct: [\n charCodes.dot,\n charCodes.uppercaseB,\n charCodes.uppercaseE,\n charCodes.uppercaseO,\n charCodes.underscore, // multiple separators are not allowed\n charCodes.lowercaseB,\n charCodes.lowercaseE,\n charCodes.lowercaseO,\n ],\n hex: [\n charCodes.dot,\n charCodes.uppercaseX,\n charCodes.underscore, // multiple separators are not allowed\n charCodes.lowercaseX,\n ],\n};\n\nconst allowedNumericSeparatorSiblings = {};\nallowedNumericSeparatorSiblings.bin = [\n // 0 - 1\n charCodes.digit0,\n charCodes.digit1,\n];\nallowedNumericSeparatorSiblings.oct = [\n // 0 - 7\n ...allowedNumericSeparatorSiblings.bin,\n\n charCodes.digit2,\n charCodes.digit3,\n charCodes.digit4,\n charCodes.digit5,\n charCodes.digit6,\n charCodes.digit7,\n];\nallowedNumericSeparatorSiblings.dec = [\n // 0 - 9\n ...allowedNumericSeparatorSiblings.oct,\n\n charCodes.digit8,\n charCodes.digit9,\n];\n\nallowedNumericSeparatorSiblings.hex = [\n // 0 - 9, A - F, a - f,\n ...allowedNumericSeparatorSiblings.dec,\n\n charCodes.uppercaseA,\n charCodes.uppercaseB,\n charCodes.uppercaseC,\n charCodes.uppercaseD,\n charCodes.uppercaseE,\n charCodes.uppercaseF,\n\n charCodes.lowercaseA,\n charCodes.lowercaseB,\n charCodes.lowercaseC,\n charCodes.lowercaseD,\n charCodes.lowercaseE,\n charCodes.lowercaseF,\n];\n\n// Object type used to represent tokens. Note that normally, tokens\n// simply exist as properties on the parser object. This is only\n// used for the onToken callback and the external tokenizer.\n\nexport class Token {\n constructor(state: State) {\n this.type = state.type;\n this.value = state.value;\n this.start = state.start;\n this.end = state.end;\n this.loc = new SourceLocation(state.startLoc, state.endLoc);\n }\n\n declare type: TokenType;\n declare value: any;\n declare start: number;\n declare end: number;\n declare loc: SourceLocation;\n}\n\n// ## Tokenizer\n\nexport default class Tokenizer extends ParserErrors {\n // Forward-declarations\n // parser/util.js\n /*::\n +hasPrecedingLineBreak: () => boolean;\n +unexpected: (pos?: ?number, messageOrType?: ErrorTemplate | TokenType) => empty;\n +expectPlugin: (name: string, pos?: ?number) => true;\n */\n\n isLookahead: boolean;\n\n // Token store.\n tokens: Array = [];\n\n constructor(options: Options, input: string) {\n super();\n this.state = new State();\n this.state.init(options);\n this.input = input;\n this.length = input.length;\n this.isLookahead = false;\n }\n\n pushToken(token: Token | N.Comment) {\n // Pop out invalid tokens trapped by try-catch parsing.\n // Those parsing branches are mainly created by typescript and flow plugins.\n this.tokens.length = this.state.tokensLength;\n this.tokens.push(token);\n ++this.state.tokensLength;\n }\n\n // Move to the next token\n\n next(): void {\n this.checkKeywordEscapes();\n if (this.options.tokens) {\n this.pushToken(new Token(this.state));\n }\n\n this.state.lastTokEnd = this.state.end;\n this.state.lastTokStart = this.state.start;\n this.state.lastTokEndLoc = this.state.endLoc;\n this.state.lastTokStartLoc = this.state.startLoc;\n this.nextToken();\n }\n\n // TODO\n\n eat(type: TokenType): boolean {\n if (this.match(type)) {\n this.next();\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Whether current token matches given type\n *\n * @param {TokenType} type\n * @returns {boolean}\n * @memberof Tokenizer\n */\n match(type: TokenType): boolean {\n return this.state.type === type;\n }\n\n /**\n * Create a LookaheadState from current parser state\n *\n * @param {State} state\n * @returns {LookaheadState}\n * @memberof Tokenizer\n */\n createLookaheadState(state: State): LookaheadState {\n return {\n pos: state.pos,\n value: null,\n type: state.type,\n start: state.start,\n end: state.end,\n lastTokEnd: state.end,\n context: [this.curContext()],\n inType: state.inType,\n };\n }\n\n /**\n * lookahead peeks the next token, skipping changes to token context and\n * comment stack. For performance it returns a limited LookaheadState\n * instead of full parser state.\n *\n * The { column, line } Loc info is not included in lookahead since such usage\n * is rare. Although it may return other location properties e.g. `curLine` and\n * `lineStart`, these properties are not listed in the LookaheadState interface\n * and thus the returned value is _NOT_ reliable.\n *\n * The tokenizer should make best efforts to avoid using any parser state\n * other than those defined in LookaheadState\n *\n * @returns {LookaheadState}\n * @memberof Tokenizer\n */\n lookahead(): LookaheadState {\n const old = this.state;\n // For performance we use a simpified tokenizer state structure\n // $FlowIgnore\n this.state = this.createLookaheadState(old);\n\n this.isLookahead = true;\n this.nextToken();\n this.isLookahead = false;\n\n const curr = this.state;\n this.state = old;\n return curr;\n }\n\n nextTokenStart(): number {\n return this.nextTokenStartSince(this.state.pos);\n }\n\n nextTokenStartSince(pos: number): number {\n skipWhiteSpace.lastIndex = pos;\n return skipWhiteSpace.test(this.input) ? skipWhiteSpace.lastIndex : pos;\n }\n\n lookaheadCharCode(): number {\n return this.input.charCodeAt(this.nextTokenStart());\n }\n\n codePointAtPos(pos: number): number {\n // The implementation is based on\n // https://source.chromium.org/chromium/chromium/src/+/master:v8/src/builtins/builtins-string-gen.cc;l=1455;drc=221e331b49dfefadbc6fa40b0c68e6f97606d0b3;bpv=0;bpt=1\n // We reimplement `codePointAt` because `codePointAt` is a V8 builtin which is not inlined by TurboFan (as of M91)\n // since `input` is mostly ASCII, an inlined `charCodeAt` wins here\n let cp = this.input.charCodeAt(pos);\n if ((cp & 0xfc00) === 0xd800 && ++pos < this.input.length) {\n const trail = this.input.charCodeAt(pos);\n if ((trail & 0xfc00) === 0xdc00) {\n cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);\n }\n }\n return cp;\n }\n\n // Toggle strict mode. Re-reads the next number or string to please\n // pedantic tests (`\"use strict\"; 010;` should fail).\n\n setStrict(strict: boolean): void {\n this.state.strict = strict;\n if (strict) {\n // Throw an error for any string decimal escape found before/immediately\n // after a \"use strict\" directive. Strict mode will be set at parse\n // time for any literals that occur after the next node of the strict\n // directive.\n this.state.strictErrors.forEach((message, pos) =>\n /* eslint-disable @babel/development-internal/dry-error-messages */\n this.raise(pos, message),\n );\n this.state.strictErrors.clear();\n }\n }\n\n curContext(): TokContext {\n return this.state.context[this.state.context.length - 1];\n }\n\n // Read a single token, updating the parser object's token-related\n // properties.\n\n nextToken(): void {\n const curContext = this.curContext();\n if (!curContext.preserveSpace) this.skipSpace();\n this.state.start = this.state.pos;\n if (!this.isLookahead) this.state.startLoc = this.state.curPosition();\n if (this.state.pos >= this.length) {\n this.finishToken(tt.eof);\n return;\n }\n\n if (curContext === ct.template) {\n this.readTmplToken();\n } else {\n this.getTokenFromCode(this.codePointAtPos(this.state.pos));\n }\n }\n\n skipBlockComment(): N.CommentBlock | void {\n let startLoc;\n if (!this.isLookahead) startLoc = this.state.curPosition();\n const start = this.state.pos;\n const end = this.input.indexOf(\"*/\", start + 2);\n if (end === -1) throw this.raise(start, Errors.UnterminatedComment);\n\n this.state.pos = end + 2;\n lineBreakG.lastIndex = start + 2;\n while (lineBreakG.test(this.input) && lineBreakG.lastIndex <= end) {\n ++this.state.curLine;\n this.state.lineStart = lineBreakG.lastIndex;\n }\n\n // If we are doing a lookahead right now we need to advance the position (above code)\n // but we do not want to push the comment to the state.\n if (this.isLookahead) return;\n /*:: invariant(startLoc) */\n\n const comment = {\n type: \"CommentBlock\",\n value: this.input.slice(start + 2, end),\n start,\n end: end + 2,\n loc: new SourceLocation(startLoc, this.state.curPosition()),\n };\n if (this.options.tokens) this.pushToken(comment);\n return comment;\n }\n\n skipLineComment(startSkip: number): N.CommentLine | void {\n const start = this.state.pos;\n let startLoc;\n if (!this.isLookahead) startLoc = this.state.curPosition();\n let ch = this.input.charCodeAt((this.state.pos += startSkip));\n if (this.state.pos < this.length) {\n while (!isNewLine(ch) && ++this.state.pos < this.length) {\n ch = this.input.charCodeAt(this.state.pos);\n }\n }\n\n // If we are doing a lookahead right now we need to advance the position (above code)\n // but we do not want to push the comment to the state.\n if (this.isLookahead) return;\n /*:: invariant(startLoc) */\n\n const end = this.state.pos;\n const value = this.input.slice(start + startSkip, end);\n\n const comment = {\n type: \"CommentLine\",\n value,\n start,\n end,\n loc: new SourceLocation(startLoc, this.state.curPosition()),\n };\n if (this.options.tokens) this.pushToken(comment);\n return comment;\n }\n\n // Called at the start of the parse and after every token. Skips\n // whitespace and comments, and.\n\n skipSpace(): void {\n const spaceStart = this.state.pos;\n const comments = [];\n loop: while (this.state.pos < this.length) {\n const ch = this.input.charCodeAt(this.state.pos);\n switch (ch) {\n case charCodes.space:\n case charCodes.nonBreakingSpace:\n case charCodes.tab:\n ++this.state.pos;\n break;\n case charCodes.carriageReturn:\n if (\n this.input.charCodeAt(this.state.pos + 1) === charCodes.lineFeed\n ) {\n ++this.state.pos;\n }\n // fall through\n case charCodes.lineFeed:\n case charCodes.lineSeparator:\n case charCodes.paragraphSeparator:\n ++this.state.pos;\n ++this.state.curLine;\n this.state.lineStart = this.state.pos;\n break;\n\n case charCodes.slash:\n switch (this.input.charCodeAt(this.state.pos + 1)) {\n case charCodes.asterisk: {\n const comment = this.skipBlockComment();\n if (comment !== undefined) {\n this.addComment(comment);\n if (this.options.attachComment) comments.push(comment);\n }\n break;\n }\n\n case charCodes.slash: {\n const comment = this.skipLineComment(2);\n if (comment !== undefined) {\n this.addComment(comment);\n if (this.options.attachComment) comments.push(comment);\n }\n break;\n }\n\n default:\n break loop;\n }\n break;\n\n default:\n if (isWhitespace(ch)) {\n ++this.state.pos;\n } else if (ch === charCodes.dash && !this.inModule) {\n const pos = this.state.pos;\n if (\n this.input.charCodeAt(pos + 1) === charCodes.dash &&\n this.input.charCodeAt(pos + 2) === charCodes.greaterThan &&\n (spaceStart === 0 || this.state.lineStart > spaceStart)\n ) {\n // A `-->` line comment\n const comment = this.skipLineComment(3);\n if (comment !== undefined) {\n this.addComment(comment);\n if (this.options.attachComment) comments.push(comment);\n }\n } else {\n break loop;\n }\n } else if (ch === charCodes.lessThan && !this.inModule) {\n const pos = this.state.pos;\n if (\n this.input.charCodeAt(pos + 1) === charCodes.exclamationMark &&\n this.input.charCodeAt(pos + 2) === charCodes.dash &&\n this.input.charCodeAt(pos + 3) === charCodes.dash\n ) {\n // ` + +> This module contains methods for building ASTs manually and for checking the types of AST nodes. + +## Install + +\`\`\`sh +npm install --save-dev @babel/types +\`\`\` + +## API`, +]; + +const customTypes = { + ClassMethod: { + key: "if computed then `Expression` else `Identifier | Literal`", + }, + Identifier: { + name: "`string`", + }, + MemberExpression: { + property: "if computed then `Expression` else `Identifier`", + }, + ObjectMethod: { + key: "if computed then `Expression` else `Identifier | Literal`", + }, + ObjectProperty: { + key: "if computed then `Expression` else `Identifier | Literal`", + }, + ClassPrivateMethod: { + computed: "'false'", + }, + ClassPrivateProperty: { + computed: "'false'", + }, +}; +const APIHistory = { + ClassProperty: [["v7.6.0", "Supports `static`"]], +}; +function formatHistory(historyItems) { + const lines = historyItems.map( + item => "| `" + item[0] + "` | " + item[1] + " |" + ); + return [ + "
", + " History", + "| Version | Changes |", + "| --- | --- |", + ...lines, + "
", + ]; +} +function printAPIHistory(key, readme) { + if (APIHistory[key]) { + readme.push(""); + readme.push(...formatHistory(APIHistory[key])); + } +} +function printNodeFields(key, readme) { + if (Object.keys(t.NODE_FIELDS[key]).length > 0) { + readme.push(""); + readme.push("AST Node `" + key + "` shape:"); + Object.keys(t.NODE_FIELDS[key]) + .sort(function (fieldA, fieldB) { + const indexA = t.BUILDER_KEYS[key].indexOf(fieldA); + const indexB = t.BUILDER_KEYS[key].indexOf(fieldB); + if (indexA === indexB) return fieldA < fieldB ? -1 : 1; + if (indexA === -1) return 1; + if (indexB === -1) return -1; + return indexA - indexB; + }) + .forEach(function (field) { + const defaultValue = t.NODE_FIELDS[key][field].default; + const fieldDescription = ["`" + field + "`"]; + const validator = t.NODE_FIELDS[key][field].validate; + if (customTypes[key] && customTypes[key][field]) { + fieldDescription.push(`: ${customTypes[key][field]}`); + } else if (validator) { + try { + fieldDescription.push( + ": `" + stringifyValidator(validator, "") + "`" + ); + } catch (ex) { + if (ex.code === "UNEXPECTED_VALIDATOR_TYPE") { + console.log( + "Unrecognised validator type for " + key + "." + field + ); + console.dir(ex.validator, { depth: 10, colors: true }); + } + } + } + if (defaultValue !== null || t.NODE_FIELDS[key][field].optional) { + fieldDescription.push( + " (default: `" + util.inspect(defaultValue) + "`" + ); + if (t.BUILDER_KEYS[key].indexOf(field) < 0) { + fieldDescription.push(", excluded from builder function"); + } + fieldDescription.push(")"); + } else { + fieldDescription.push(" (required)"); + } + readme.push("- " + fieldDescription.join("")); + }); + } +} + +function printAliasKeys(key, readme) { + if (t.ALIAS_KEYS[key] && t.ALIAS_KEYS[key].length) { + readme.push(""); + readme.push( + "Aliases: " + + t.ALIAS_KEYS[key] + .map(function (key) { + return "[`" + key + "`](#" + key.toLowerCase() + ")"; + }) + .join(", ") + ); + } +} +readme.push("### Node Builders"); +readme.push(""); +Object.keys(t.BUILDER_KEYS) + .sort() + .forEach(function (key) { + readme.push("#### " + toFunctionName(key)); + readme.push(""); + readme.push("```javascript"); + readme.push( + "t." + toFunctionName(key) + "(" + t.BUILDER_KEYS[key].join(", ") + ");" + ); + readme.push("```"); + printAPIHistory(key, readme); + readme.push(""); + readme.push( + "See also `t.is" + + key + + "(node, opts)` and `t.assert" + + key + + "(node, opts)`." + ); + + printNodeFields(key, readme); + printAliasKeys(key, readme); + + readme.push(""); + readme.push("---"); + readme.push(""); + }); + +function generateMapAliasToNodeTypes() { + const result = new Map(); + for (const nodeType of Object.keys(t.ALIAS_KEYS)) { + const aliases = t.ALIAS_KEYS[nodeType]; + if (!aliases) continue; + for (const alias of aliases) { + if (!result.has(alias)) { + result.set(alias, []); + } + const nodeTypes = result.get(alias); + nodeTypes.push(nodeType); + } + } + return result; +} +const aliasDescriptions = { + Binary: + "A cover of BinaryExpression and LogicalExpression, which share the same AST shape.", + Block: "Deprecated. Will be removed in Babel 8.", + BlockParent: + "A cover of AST nodes that start an execution context with new [LexicalEnvironment](https://tc39.es/ecma262/#table-additional-state-components-for-ecmascript-code-execution-contexts). In other words, they define the scope of `let` and `const` declarations.", + Class: + "A cover of ClassExpression and ClassDeclaration, which share the same AST shape.", + CompletionStatement: + "A statement that indicates the [completion records](https://tc39.es/ecma262/#sec-completion-record-specification-type). In other words, they define the control flow of the program, such as when should a loop break or an action throws critical errors.", + Conditional: + "A cover of ConditionalExpression and IfStatement, which share the same AST shape.", + Declaration: + "A cover of any [Declaration](https://tc39.es/ecma262/#prod-Declaration)s.", + EnumBody: "A cover of Flow enum bodies.", + EnumMember: "A cover of Flow enum membors.", + ExportDeclaration: + "A cover of any [ExportDeclaration](https://tc39.es/ecma262/#prod-ExportDeclaration)s.", + Expression: + "A cover of any [Expression](https://tc39.es/ecma262/#sec-ecmascript-language-expressions)s.", + ExpressionWrapper: + "A wrapper of expression that does not have runtime semantics.", + Flow: "A cover of AST nodes defined for Flow.", + FlowBaseAnnotation: "A cover of primary Flow type annotations.", + FlowDeclaration: "A cover of Flow declarations.", + FlowPredicate: "A cover of Flow predicates.", + FlowType: "A cover of Flow type annotations.", + For: "A cover of [ForStatement](https://tc39.es/ecma262/#sec-for-statement)s and [ForXStatement](#forxstatement)s.", + ForXStatement: + "A cover of [ForInStatements and ForOfStatements](https://tc39.es/ecma262/#sec-for-in-and-for-of-statements).", + Function: + "A cover of functions and [method](#method)s, the must have `body` and `params`. Note: `Function` is different to `FunctionParent`. For example, a `StaticBlock` is a `FunctionParent` but not `Function`.", + FunctionParent: + "A cover of AST nodes that start an execution context with new [VariableEnvironment](https://tc39.es/ecma262/#table-additional-state-components-for-ecmascript-code-execution-contexts). In other words, they define the scope of `var` declarations. FunctionParent did not include `Program` since Babel 7.", + Immutable: + "A cover of immutable objects and JSX elements. An object is [immutable](https://tc39.es/ecma262/#immutable-prototype-exotic-object) if no other properties can be defined once created.", + JSX: "A cover of AST nodes defined for [JSX](https://facebook.github.io/jsx/).", + LVal: "A cover of left hand side expressions used in the `left` of assignment expressions and [ForXStatement](#forxstatement)s. ", + Literal: + "A cover of [Literal](https://tc39.es/ecma262/#sec-primary-expression-literals)s, [Regular Expression Literal](https://tc39.es/ecma262/#sec-primary-expression-regular-expression-literals)s and [Template Literal](https://tc39.es/ecma262/#sec-template-literals)s.", + Loop: "A cover of loop statements.", + Method: "A cover of object methods and class methods.", + Miscellaneous: + "A cover of non-standard AST types that are sometimes useful for development.", + ModuleDeclaration: + "A cover of ImportDeclaration and [ExportDeclaration](#exportdeclaration)", + ModuleSpecifier: + "A cover of import and export specifiers. Note: It is _not_ the [ModuleSpecifier](https://tc39.es/ecma262/#prod-ModuleSpecifier) defined in the spec.", + ObjectMember: + "A cover of [members](https://tc39.es/ecma262/#prod-PropertyDefinitionList) in an object literal.", + Pattern: + "A cover of [BindingPattern](https://tc39.es/ecma262/#prod-BindingPattern) except Identifiers.", + PatternLike: + "A cover of [BindingPattern](https://tc39.es/ecma262/#prod-BindingPattern)s. ", + Private: "A cover of private class elements and private identifiers.", + Property: "A cover of object properties and class properties.", + Pureish: + "A cover of AST nodes which do not have side-effects. In other words, there is no observable behaviour changes if they are evaluated more than once.", + Scopable: + "A cover of [FunctionParent](#functionparent) and [BlockParent](#blockparent).", + Standardized: + "A cover of AST nodes which are part of an official ECMAScript specification.", + Statement: + "A cover of any [Statement](https://tc39.es/ecma262/#prod-Statement)s.", + TSBaseType: "A cover of primary TypeScript type annotations.", + TSEntityName: "A cover of ts entities.", + TSType: "A cover of TypeScript type annotations.", + TSTypeElement: "A cover of TypeScript type declarations.", + TypeScript: "A cover of AST nodes defined for TypeScript.", + Terminatorless: + "A cover of AST nodes whose semantic will change when a line terminator is inserted between the operator and the operand.", + UnaryLike: "A cover of UnaryExpression and SpreadElement.", + UserWhitespacable: "Deprecated. Will be removed in Babel 8.", + While: + "A cover of DoWhileStatement and WhileStatement, which share the same AST shape.", +}; +const mapAliasToNodeTypes = generateMapAliasToNodeTypes(); +readme.push("### Aliases"); +readme.push(""); +for (const alias of [...mapAliasToNodeTypes.keys()].sort()) { + const nodeTypes = mapAliasToNodeTypes.get(alias); + nodeTypes.sort(); + if (!(alias in aliasDescriptions)) { + throw new Error( + 'Missing alias descriptions of "' + + alias + + ", which covers " + + nodeTypes.join(",") + ); + } + readme.push("#### " + alias); + readme.push(""); + readme.push(aliasDescriptions[alias]); + readme.push("```javascript"); + readme.push("t.is" + alias + "(node);"); + readme.push("```"); + readme.push(""); + readme.push("Covered nodes: "); + for (const nodeType of nodeTypes) { + readme.push("- [`" + nodeType + "`](#" + nodeType.toLowerCase() + ")"); + } + readme.push(""); +} + +process.stdout.write(readme.join("\n")); diff --git a/src/main/resources/static/node_modules/@babel/types/scripts/generators/flow.js b/src/main/resources/static/node_modules/@babel/types/scripts/generators/flow.js new file mode 100644 index 0000000..7fabcc6 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/types/scripts/generators/flow.js @@ -0,0 +1,260 @@ +import t from "../../lib/index.js"; +import stringifyValidator from "../utils/stringifyValidator.js"; +import toFunctionName from "../utils/toFunctionName.js"; + +const NODE_PREFIX = "BabelNode"; + +let code = `// NOTE: This file is autogenerated. Do not modify. +// See packages/babel-types/scripts/generators/flow.js for script used. + +declare class ${NODE_PREFIX}Comment { + value: string; + start: number; + end: number; + loc: ${NODE_PREFIX}SourceLocation; +} + +declare class ${NODE_PREFIX}CommentBlock extends ${NODE_PREFIX}Comment { + type: "CommentBlock"; +} + +declare class ${NODE_PREFIX}CommentLine extends ${NODE_PREFIX}Comment { + type: "CommentLine"; +} + +declare class ${NODE_PREFIX}SourceLocation { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; +} + +declare class ${NODE_PREFIX} { + leadingComments?: Array<${NODE_PREFIX}Comment>; + innerComments?: Array<${NODE_PREFIX}Comment>; + trailingComments?: Array<${NODE_PREFIX}Comment>; + start: ?number; + end: ?number; + loc: ?${NODE_PREFIX}SourceLocation; + extra?: { [string]: mixed }; +}\n\n`; + +// + +const lines = []; + +for (const type in t.NODE_FIELDS) { + const fields = t.NODE_FIELDS[type]; + + const struct = ['type: "' + type + '";']; + const args = []; + const builderNames = t.BUILDER_KEYS[type]; + + Object.keys(t.NODE_FIELDS[type]) + .sort((fieldA, fieldB) => { + const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); + const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); + if (indexA === indexB) return fieldA < fieldB ? -1 : 1; + if (indexA === -1) return 1; + if (indexB === -1) return -1; + return indexA - indexB; + }) + .forEach(fieldName => { + const field = fields[fieldName]; + + let suffix = ""; + if (field.optional || field.default != null) suffix += "?"; + + let typeAnnotation = "any"; + + const validate = field.validate; + if (validate) { + typeAnnotation = stringifyValidator(validate, NODE_PREFIX); + } + + if (typeAnnotation) { + suffix += ": " + typeAnnotation; + } + if (builderNames.includes(fieldName)) { + args.push(t.toBindingIdentifierName(fieldName) + suffix); + } + + if (t.isValidIdentifier(fieldName)) { + struct.push(fieldName + suffix + ";"); + } + }); + + code += `declare class ${NODE_PREFIX}${type} extends ${NODE_PREFIX} { + ${struct.join("\n ").trim()} +}\n\n`; + + // Flow chokes on super() and import() :/ + if (type !== "Super" && type !== "Import") { + lines.push( + `declare export function ${toFunctionName(type)}(${args.join( + ", " + )}): ${NODE_PREFIX}${type};` + ); + } else { + const functionName = toFunctionName(type); + lines.push( + `declare function _${functionName}(${args.join( + ", " + )}): ${NODE_PREFIX}${type};`, + `declare export { _${functionName} as ${functionName} }` + ); + } +} + +for (const typeName of t.TYPES) { + const isDeprecated = !!t.DEPRECATED_KEYS[typeName]; + const realName = isDeprecated ? t.DEPRECATED_KEYS[typeName] : typeName; + + let decl = `declare export function is${typeName}(node: ?Object, opts?: ?Object): boolean`; + if (t.NODE_FIELDS[realName]) { + decl += ` %checks (node instanceof ${NODE_PREFIX}${realName})`; + } + lines.push(decl); + + lines.push( + `declare export function assert${typeName}(node: ?Object, opts?: ?Object): void` + ); +} + +lines.push( + `declare export var VISITOR_KEYS: { [type: string]: string[] }`, + + // assert/ + `declare export function assertNode(obj: any): void`, + + // builders/ + // eslint-disable-next-line max-len + `declare export function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): ${NODE_PREFIX}TypeAnnotation`, + // eslint-disable-next-line max-len + `declare export function createUnionTypeAnnotation(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, + // eslint-disable-next-line max-len + `declare export function createFlowUnionType(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, + // this smells like "internal API" + // eslint-disable-next-line max-len + `declare export function buildChildren(node: { children: Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment | ${NODE_PREFIX}JSXEmptyExpression> }): Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment>`, + + // clone/ + `declare export function clone(n: T): T;`, + `declare export function cloneDeep(n: T): T;`, + `declare export function cloneDeepWithoutLoc(n: T): T;`, + `declare export function cloneNode(n: T, deep?: boolean, withoutLoc?: boolean): T;`, + `declare export function cloneWithoutLoc(n: T): T;`, + + // comments/ + `declare type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`, + // eslint-disable-next-line max-len + `declare export function addComment(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, + // eslint-disable-next-line max-len + `declare export function addComments(node: T, type: CommentTypeShorthand, comments: Array): T`, + `declare export function inheritInnerComments(node: BabelNode, parent: BabelNode): void`, + `declare export function inheritLeadingComments(node: BabelNode, parent: BabelNode): void`, + `declare export function inheritsComments(node: T, parent: BabelNode): void`, + `declare export function inheritTrailingComments(node: BabelNode, parent: BabelNode): void`, + `declare export function removeComments(node: T): T`, + + // converters/ + `declare export function ensureBlock(node: ${NODE_PREFIX}, key: string): ${NODE_PREFIX}BlockStatement`, + `declare export function toBindingIdentifierName(name?: ?string): string`, + // eslint-disable-next-line max-len + `declare export function toBlock(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Expression, parent?: ${NODE_PREFIX}Function | null): ${NODE_PREFIX}BlockStatement`, + // eslint-disable-next-line max-len + `declare export function toComputedKey(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}Expression | ${NODE_PREFIX}Identifier): ${NODE_PREFIX}Expression`, + // eslint-disable-next-line max-len + `declare export function toExpression(node: ${NODE_PREFIX}ExpressionStatement | ${NODE_PREFIX}Expression | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function): ${NODE_PREFIX}Expression`, + `declare export function toIdentifier(name?: ?string): string`, + // eslint-disable-next-line max-len + `declare export function toKeyAlias(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}): string`, + // toSequenceExpression relies on types that aren't declared in flow + // eslint-disable-next-line max-len + `declare export function toStatement(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function | ${NODE_PREFIX}AssignmentExpression, ignore?: boolean): ${NODE_PREFIX}Statement | void`, + `declare export function valueToNode(value: any): ${NODE_PREFIX}Expression`, + + // modifications/ + // eslint-disable-next-line max-len + `declare export function removeTypeDuplicates(types: Array<${NODE_PREFIX}FlowType>): Array<${NODE_PREFIX}FlowType>`, + // eslint-disable-next-line max-len + `declare export function appendToMemberExpression(member: ${NODE_PREFIX}MemberExpression, append: ${NODE_PREFIX}, computed?: boolean): ${NODE_PREFIX}MemberExpression`, + // eslint-disable-next-line max-len + `declare export function inherits(child: T, parent: ${NODE_PREFIX} | null | void): T`, + // eslint-disable-next-line max-len + `declare export function prependToMemberExpression(member: ${NODE_PREFIX}MemberExpression, prepend: ${NODE_PREFIX}Expression): ${NODE_PREFIX}MemberExpression`, + `declare export function removeProperties(n: T, opts: ?{}): void;`, + `declare export function removePropertiesDeep(n: T, opts: ?{}): T;`, + + // retrievers/ + // eslint-disable-next-line max-len + `declare export var getBindingIdentifiers: { + (node: ${NODE_PREFIX}, duplicates?: boolean, outerOnly?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }, + keys: { [type: string]: string[] } + }`, + // eslint-disable-next-line max-len + `declare export function getOuterBindingIdentifiers(node: BabelNode, duplicates?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`, + + // traverse/ + `declare type TraversalAncestors = Array<{ + node: BabelNode, + key: string, + index?: number, + }>; + declare type TraversalHandler = (BabelNode, TraversalAncestors, T) => void; + declare type TraversalHandlers = { + enter?: TraversalHandler, + exit?: TraversalHandler, + };`.replace(/(^|\n) {2}/g, "$1"), + // eslint-disable-next-line + `declare export function traverse(n: BabelNode, TraversalHandler | TraversalHandlers, state?: T): void;`, + `declare export function traverseFast(n: BabelNode, h: TraversalHandler, state?: T): void;`, + + // utils/ + // cleanJSXElementLiteralChild is not exported + // inherit is not exported + `declare export function shallowEqual(actual: Object, expected: Object): boolean`, + + // validators/ + // eslint-disable-next-line max-len + `declare export function buildMatchMemberExpression(match: string, allowPartial?: boolean): (?BabelNode) => boolean`, + `declare export function is(type: string, n: BabelNode, opts: Object): boolean;`, + `declare export function isBinding(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, + `declare export function isBlockScoped(node: BabelNode): boolean`, + `declare export function isImmutable(node: BabelNode): boolean`, + `declare export function isLet(node: BabelNode): boolean`, + `declare export function isNode(node: ?Object): boolean`, + `declare export function isNodesEquivalent(a: any, b: any): boolean`, + `declare export function isPlaceholderType(placeholderType: string, targetType: string): boolean`, + `declare export function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, + `declare export function isScope(node: BabelNode, parent: BabelNode): boolean`, + `declare export function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean`, + `declare export function isType(nodetype: ?string, targetType: string): boolean`, + `declare export function isValidES3Identifier(name: string): boolean`, + `declare export function isValidES3Identifier(name: string): boolean`, + `declare export function isValidIdentifier(name: string): boolean`, + `declare export function isVar(node: BabelNode): boolean`, + // eslint-disable-next-line max-len + `declare export function matchesPattern(node: ?BabelNode, match: string | Array, allowPartial?: boolean): boolean`, + `declare export function validate(n: BabelNode, key: string, value: mixed): void;` +); + +for (const type in t.FLIPPED_ALIAS_KEYS) { + const types = t.FLIPPED_ALIAS_KEYS[type]; + code += `type ${NODE_PREFIX}${type} = ${types + .map(type => `${NODE_PREFIX}${type}`) + .join(" | ")};\n`; +} + +code += `\ndeclare module "@babel/types" { + ${lines.join("\n").replace(/\n/g, "\n ").trim()} +}\n`; + +// + +process.stdout.write(code); diff --git a/src/main/resources/static/node_modules/@babel/types/scripts/generators/typescript-legacy.js b/src/main/resources/static/node_modules/@babel/types/scripts/generators/typescript-legacy.js new file mode 100644 index 0000000..40da48f --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/types/scripts/generators/typescript-legacy.js @@ -0,0 +1,369 @@ +import t from "../../lib/index.js"; +import stringifyValidator from "../utils/stringifyValidator.js"; +import toFunctionName from "../utils/toFunctionName.js"; + +let code = `// NOTE: This file is autogenerated. Do not modify. +// See packages/babel-types/scripts/generators/typescript-legacy.js for script used. + +interface BaseComment { + value: string; + start: number; + end: number; + loc: SourceLocation; + type: "CommentBlock" | "CommentLine"; +} + +export interface CommentBlock extends BaseComment { + type: "CommentBlock"; +} + +export interface CommentLine extends BaseComment { + type: "CommentLine"; +} + +export type Comment = CommentBlock | CommentLine; + +export interface SourceLocation { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; +} + +interface BaseNode { + leadingComments: ReadonlyArray | null; + innerComments: ReadonlyArray | null; + trailingComments: ReadonlyArray | null; + start: number | null; + end: number | null; + loc: SourceLocation | null; + type: Node["type"]; + extra?: Record; +} + +export type Node = ${t.TYPES.sort().join(" | ")};\n\n`; + +// + +const lines = []; + +for (const type in t.NODE_FIELDS) { + const fields = t.NODE_FIELDS[type]; + const fieldNames = sortFieldNames(Object.keys(t.NODE_FIELDS[type]), type); + const builderNames = t.BUILDER_KEYS[type]; + + const struct = ['type: "' + type + '";']; + const args = []; + + fieldNames.forEach(fieldName => { + const field = fields[fieldName]; + // Future / annoying TODO: + // MemberExpression.property, ObjectProperty.key and ObjectMethod.key need special cases; either: + // - convert the declaration to chain() like ClassProperty.key and ClassMethod.key, + // - declare an alias type for valid keys, detect the case and reuse it here, + // - declare a disjoint union with, for example, ObjectPropertyBase, + // ObjectPropertyLiteralKey and ObjectPropertyComputedKey, and declare ObjectProperty + // as "ObjectPropertyBase & (ObjectPropertyLiteralKey | ObjectPropertyComputedKey)" + let typeAnnotation = stringifyValidator(field.validate, ""); + + if (isNullable(field) && !hasDefault(field)) { + typeAnnotation += " | null"; + } + + if (builderNames.includes(fieldName)) { + if (areAllRemainingFieldsNullable(fieldName, builderNames, fields)) { + args.push( + `${t.toBindingIdentifierName(fieldName)}${ + isNullable(field) ? "?:" : ":" + } ${typeAnnotation}` + ); + } else { + args.push( + `${t.toBindingIdentifierName(fieldName)}: ${typeAnnotation}${ + isNullable(field) ? " | undefined" : "" + }` + ); + } + } + + const alphaNumeric = /^\w+$/; + + if (t.isValidIdentifier(fieldName) || alphaNumeric.test(fieldName)) { + struct.push(`${fieldName}: ${typeAnnotation};`); + } else { + struct.push(`"${fieldName}": ${typeAnnotation};`); + } + }); + + code += `export interface ${type} extends BaseNode { + ${struct.join("\n ").trim()} +}\n\n`; + + // super and import are reserved words in JavaScript + if (type !== "Super" && type !== "Import") { + lines.push( + `export function ${toFunctionName(type)}(${args.join(", ")}): ${type};` + ); + } else { + const functionName = toFunctionName(type); + lines.push( + `declare function _${functionName}(${args.join(", ")}): ${type};`, + `export { _${functionName} as ${functionName}}` + ); + } +} + +for (const typeName of t.TYPES) { + const isDeprecated = !!t.DEPRECATED_KEYS[typeName]; + const realName = isDeprecated ? t.DEPRECATED_KEYS[typeName] : typeName; + + const result = + t.NODE_FIELDS[realName] || t.FLIPPED_ALIAS_KEYS[realName] + ? `node is ${realName}` + : "boolean"; + + if (isDeprecated) { + lines.push(`/** @deprecated Use \`is${realName}\` */`); + } + lines.push( + `export function is${typeName}(node: object | null | undefined, opts?: object | null): ${result};` + ); + + if (isDeprecated) { + lines.push(`/** @deprecated Use \`assert${realName}\` */`); + } + lines.push( + `export function assert${typeName}(node: object | null | undefined, opts?: object | null): void;` + ); +} + +lines.push( + // assert/ + `export function assertNode(obj: any): void`, + + // builders/ + // eslint-disable-next-line max-len + `export function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): StringTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | BooleanTypeAnnotation | GenericTypeAnnotation`, + `export function createUnionTypeAnnotation(types: [T]): T`, + `export function createFlowUnionType(types: [T]): T`, + // this probably misbehaves if there are 0 elements, and it's not a UnionTypeAnnotation if there's only 1 + // it is possible to require "2 or more" for this overload ([T, T, ...T[]]) but it requires typescript 3.0 + `export function createUnionTypeAnnotation(types: ReadonlyArray): UnionTypeAnnotation`, + `export function createFlowUnionType(types: ReadonlyArray): UnionTypeAnnotation`, + // this smells like "internal API" + // eslint-disable-next-line max-len + `export function buildChildren(node: { children: ReadonlyArray }): JSXElement['children']`, + + // clone/ + `export function clone(n: T): T;`, + `export function cloneDeep(n: T): T;`, + `export function cloneDeepWithoutLoc(n: T): T;`, + `export function cloneNode(n: T, deep?: boolean, withoutLoc?: boolean): T;`, + `export function cloneWithoutLoc(n: T): T;`, + + // comments/ + `export type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`, + // eslint-disable-next-line max-len + `export function addComment(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, + // eslint-disable-next-line max-len + `export function addComments(node: T, type: CommentTypeShorthand, comments: ReadonlyArray): T`, + `export function inheritInnerComments(node: Node, parent: Node): void`, + `export function inheritLeadingComments(node: Node, parent: Node): void`, + `export function inheritsComments(node: T, parent: Node): void`, + `export function inheritTrailingComments(node: Node, parent: Node): void`, + `export function removeComments(node: T): T`, + + // converters/ + // eslint-disable-next-line max-len + `export function ensureBlock(node: Extract): BlockStatement`, + // too complex? + // eslint-disable-next-line max-len + `export function ensureBlock = 'body'>(node: Extract>, key: K): BlockStatement`, + // gatherSequenceExpressions is not exported + `export function toBindingIdentifierName(name: { toString(): string } | null | undefined): string`, + `export function toBlock(node: Statement | Expression, parent?: Function | null): BlockStatement`, + // it is possible for `node` to be an arbitrary object if `key` is always provided, + // but that doesn't look like intended API + // eslint-disable-next-line max-len + `export function toComputedKey>(node: T, key?: Expression | Identifier): Expression`, + `export function toExpression(node: Function): FunctionExpression`, + `export function toExpression(node: Class): ClassExpression`, + `export function toExpression(node: ExpressionStatement | Expression | Class | Function): Expression`, + `export function toIdentifier(name: { toString(): string } | null | undefined): string`, + `export function toKeyAlias(node: Method | Property, key?: Node): string`, + // NOTE: this actually uses Scope from @babel/traverse, but we can't add a dependency on its types, + // as they live in @types. Declare the structural subset that is required. + // eslint-disable-next-line max-len + `export function toSequenceExpression(nodes: ReadonlyArray, scope: { push(value: { id: LVal; kind: 'var'; init?: Expression}): void; buildUndefinedNode(): Node }): SequenceExpression | undefined`, + `export function toStatement(node: AssignmentExpression, ignore?: boolean): ExpressionStatement`, + `export function toStatement(node: Statement | AssignmentExpression, ignore?: boolean): Statement`, + `export function toStatement(node: Class, ignore: true): ClassDeclaration | undefined`, + `export function toStatement(node: Class, ignore?: boolean): ClassDeclaration`, + `export function toStatement(node: Function, ignore: true): FunctionDeclaration | undefined`, + `export function toStatement(node: Function, ignore?: boolean): FunctionDeclaration`, + // eslint-disable-next-line max-len + `export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore: true): Statement | undefined`, + // eslint-disable-next-line max-len + `export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore?: boolean): Statement`, + // eslint-disable-next-line max-len + `export function valueToNode(value: undefined): Identifier`, // (should this not be a UnaryExpression to avoid shadowing?) + `export function valueToNode(value: boolean): BooleanLiteral`, + `export function valueToNode(value: null): NullLiteral`, + `export function valueToNode(value: string): StringLiteral`, + // Infinities and NaN need to use a BinaryExpression; negative values must be wrapped in UnaryExpression + `export function valueToNode(value: number): NumericLiteral | BinaryExpression | UnaryExpression`, + `export function valueToNode(value: RegExp): RegExpLiteral`, + // eslint-disable-next-line max-len + `export function valueToNode(value: ReadonlyArray): ArrayExpression`, + // this throws with objects that are not PlainObject according to lodash, + // or if there are non-valueToNode-able values + `export function valueToNode(value: object): ObjectExpression`, + // eslint-disable-next-line max-len + `export function valueToNode(value: undefined | boolean | null | string | number | RegExp | object): Expression`, + + // modifications/ + // eslint-disable-next-line max-len + `export function removeTypeDuplicates(types: ReadonlyArray): FlowType[]`, + // eslint-disable-next-line max-len + `export function appendToMemberExpression>(member: T, append: MemberExpression['property'], computed?: boolean): T`, + // eslint-disable-next-line max-len + `export function inherits(child: T, parent: Node | null | undefined): T`, + // eslint-disable-next-line max-len + `export function prependToMemberExpression>(member: T, prepend: MemberExpression['object']): T`, + `export function removeProperties( + n: Node, + opts?: { preserveComments: boolean } | null +): void;`, + `export function removePropertiesDeep( + n: T, + opts?: { preserveComments: boolean } | null +): T;`, + + // retrievers/ + // eslint-disable-next-line max-len + `export function getBindingIdentifiers(node: Node, duplicates: true, outerOnly?: boolean): Record>`, + // eslint-disable-next-line max-len + `export function getBindingIdentifiers(node: Node, duplicates?: false, outerOnly?: boolean): Record`, + // eslint-disable-next-line max-len + `export function getBindingIdentifiers(node: Node, duplicates: boolean, outerOnly?: boolean): Record>`, + // eslint-disable-next-line max-len + `export function getOuterBindingIdentifiers(node: Node, duplicates: true): Record>`, + `export function getOuterBindingIdentifiers(node: Node, duplicates?: false): Record`, + // eslint-disable-next-line max-len + `export function getOuterBindingIdentifiers(node: Node, duplicates: boolean): Record>`, + + // traverse/ + `export type TraversalAncestors = ReadonlyArray<{ + node: Node, + key: string, + index?: number, + }>; + export type TraversalHandler = ( + this: undefined, node: Node, parent: TraversalAncestors, type: T + ) => void; + export type TraversalHandlers = { + enter?: TraversalHandler, + exit?: TraversalHandler, + };`.replace(/(^|\n) {2}/g, "$1"), + // eslint-disable-next-line + `export function traverse(n: Node, h: TraversalHandler | TraversalHandlers, state?: T): void;`, + `export function traverseFast(n: Node, h: TraversalHandler, state?: T): void;`, + + // utils/ + // cleanJSXElementLiteralChild is not exported + // inherit is not exported + `export function shallowEqual(actual: object, expected: T): actual is T`, + + // validators/ + // eslint-disable-next-line max-len + `export function buildMatchMemberExpression(match: string, allowPartial?: boolean): (node: Node | null | undefined) => node is MemberExpression`, + // eslint-disable-next-line max-len + `export function is(type: T, n: Node | null | undefined, required?: undefined): n is Extract`, + // eslint-disable-next-line max-len + `export function is>(type: T, n: Node | null | undefined, required: Partial

): n is P`, + // eslint-disable-next-line max-len + `export function is

(type: string, n: Node | null | undefined, required: Partial

): n is P`, + `export function is(type: string, n: Node | null | undefined, required?: Partial): n is Node`, + `export function isBinding(node: Node, parent: Node, grandparent?: Node): boolean`, + // eslint-disable-next-line max-len + `export function isBlockScoped(node: Node): node is FunctionDeclaration | ClassDeclaration | VariableDeclaration`, + `export function isImmutable(node: Node): node is Immutable`, + `export function isLet(node: Node): node is VariableDeclaration`, + `export function isNode(node: object | null | undefined): node is Node`, + `export function isNodesEquivalent>(a: T, b: any): b is T`, + `export function isNodesEquivalent(a: any, b: any): boolean`, + `export function isPlaceholderType(placeholderType: Node['type'], targetType: Node['type']): boolean`, + `export function isReferenced(node: Node, parent: Node, grandparent?: Node): boolean`, + `export function isScope(node: Node, parent: Node): node is Scopable`, + `export function isSpecifierDefault(specifier: ModuleSpecifier): boolean`, + `export function isType(nodetype: string, targetType: T): nodetype is T`, + `export function isType(nodetype: string | null | undefined, targetType: string): boolean`, + `export function isValidES3Identifier(name: string): boolean`, + `export function isValidIdentifier(name: string): boolean`, + `export function isVar(node: Node): node is VariableDeclaration`, + // the MemberExpression implication is incidental, but it follows from the implementation + // eslint-disable-next-line max-len + `export function matchesPattern(node: Node | null | undefined, match: string | ReadonlyArray, allowPartial?: boolean): node is MemberExpression`, + // eslint-disable-next-line max-len + `export function validate(n: Node | null | undefined, key: K, value: T[K]): void;`, + `export function validate(n: Node, key: string, value: any): void;` +); + +for (const type in t.DEPRECATED_KEYS) { + code += `/** + * @deprecated Use \`${t.DEPRECATED_KEYS[type]}\` + */ +export type ${type} = ${t.DEPRECATED_KEYS[type]};\n +`; +} + +for (const type in t.FLIPPED_ALIAS_KEYS) { + const types = t.FLIPPED_ALIAS_KEYS[type]; + code += `export type ${type} = ${types + .map(type => `${type}`) + .join(" | ")};\n`; +} +code += "\n"; + +code += "export interface Aliases {\n"; +for (const type in t.FLIPPED_ALIAS_KEYS) { + code += ` ${type}: ${type};\n`; +} +code += "}\n\n"; + +code += lines.join("\n") + "\n"; + +// + +process.stdout.write(code); + +// + +function areAllRemainingFieldsNullable(fieldName, fieldNames, fields) { + const index = fieldNames.indexOf(fieldName); + return fieldNames.slice(index).every(_ => isNullable(fields[_])); +} + +function hasDefault(field) { + return field.default != null; +} + +function isNullable(field) { + return field.optional || hasDefault(field); +} + +function sortFieldNames(fields, type) { + return fields.sort((fieldA, fieldB) => { + const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); + const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); + if (indexA === indexB) return fieldA < fieldB ? -1 : 1; + if (indexA === -1) return 1; + if (indexB === -1) return -1; + return indexA - indexB; + }); +} diff --git a/src/main/resources/static/node_modules/@babel/types/scripts/generators/validators.js b/src/main/resources/static/node_modules/@babel/types/scripts/generators/validators.js new file mode 100644 index 0000000..acd6da6 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/types/scripts/generators/validators.js @@ -0,0 +1,87 @@ +import definitions from "../../lib/definitions/index.js"; + +const has = Function.call.bind(Object.prototype.hasOwnProperty); + +function joinComparisons(leftArr, right) { + return ( + leftArr.map(JSON.stringify).join(` === ${right} || `) + ` === ${right}` + ); +} + +function addIsHelper(type, aliasKeys, deprecated) { + const targetType = JSON.stringify(type); + let aliasSource = ""; + if (aliasKeys) { + aliasSource = joinComparisons(aliasKeys, "nodeType"); + } + + let placeholderSource = ""; + const placeholderTypes = []; + if ( + definitions.PLACEHOLDERS.includes(type) && + has(definitions.FLIPPED_ALIAS_KEYS, type) + ) { + placeholderTypes.push(type); + } + if (has(definitions.PLACEHOLDERS_FLIPPED_ALIAS, type)) { + placeholderTypes.push(...definitions.PLACEHOLDERS_FLIPPED_ALIAS[type]); + } + if (placeholderTypes.length > 0) { + placeholderSource = + ' || nodeType === "Placeholder" && (' + + joinComparisons( + placeholderTypes, + "(node as t.Placeholder).expectedNode" + ) + + ")"; + } + + const result = + definitions.NODE_FIELDS[type] || definitions.FLIPPED_ALIAS_KEYS[type] + ? `node is t.${type}` + : "boolean"; + + return `export function is${type}(node: object | null | undefined, opts?: object | null): ${result} { + ${deprecated || ""} + if (!node) return false; + + const nodeType = (node as t.Node).type; + if (${ + aliasSource ? aliasSource : `nodeType === ${targetType}` + }${placeholderSource}) { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; + } + `; +} + +export default function generateValidators() { + let output = `/* + * This file is auto-generated! Do not modify it directly. + * To re-generate run 'make build' + */ +import shallowEqual from "../../utils/shallowEqual"; +import type * as t from "../..";\n\n`; + + Object.keys(definitions.VISITOR_KEYS).forEach(type => { + output += addIsHelper(type); + }); + + Object.keys(definitions.FLIPPED_ALIAS_KEYS).forEach(type => { + output += addIsHelper(type, definitions.FLIPPED_ALIAS_KEYS[type]); + }); + + Object.keys(definitions.DEPRECATED_KEYS).forEach(type => { + const newType = definitions.DEPRECATED_KEYS[type]; + const deprecated = `console.trace("The node type ${type} has been renamed to ${newType}");`; + output += addIsHelper(type, null, deprecated); + }); + + return output; +} diff --git a/src/main/resources/static/node_modules/@babel/types/scripts/package.json b/src/main/resources/static/node_modules/@babel/types/scripts/package.json new file mode 100644 index 0000000..5ffd980 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/types/scripts/package.json @@ -0,0 +1 @@ +{ "type": "module" } diff --git a/src/main/resources/static/node_modules/@babel/types/scripts/utils/formatBuilderName.js b/src/main/resources/static/node_modules/@babel/types/scripts/utils/formatBuilderName.js new file mode 100644 index 0000000..f00a3c4 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/types/scripts/utils/formatBuilderName.js @@ -0,0 +1,8 @@ +const toLowerCase = Function.call.bind("".toLowerCase); + +export default function formatBuilderName(type) { + // FunctionExpression -> functionExpression + // JSXIdentifier -> jsxIdentifier + // V8IntrinsicIdentifier -> v8IntrinsicIdentifier + return type.replace(/^([A-Z](?=[a-z0-9])|[A-Z]+(?=[A-Z]))/, toLowerCase); +} diff --git a/src/main/resources/static/node_modules/@babel/types/scripts/utils/lowerFirst.js b/src/main/resources/static/node_modules/@babel/types/scripts/utils/lowerFirst.js new file mode 100644 index 0000000..012f252 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/types/scripts/utils/lowerFirst.js @@ -0,0 +1,3 @@ +export default function lowerFirst(string) { + return string[0].toLowerCase() + string.slice(1); +} diff --git a/src/main/resources/static/node_modules/@babel/types/scripts/utils/stringifyValidator.js b/src/main/resources/static/node_modules/@babel/types/scripts/utils/stringifyValidator.js new file mode 100644 index 0000000..4b8d29c --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/types/scripts/utils/stringifyValidator.js @@ -0,0 +1,66 @@ +export default function stringifyValidator(validator, nodePrefix) { + if (validator === undefined) { + return "any"; + } + + if (validator.each) { + return `Array<${stringifyValidator(validator.each, nodePrefix)}>`; + } + + if (validator.chainOf) { + return stringifyValidator(validator.chainOf[1], nodePrefix); + } + + if (validator.oneOf) { + return validator.oneOf.map(JSON.stringify).join(" | "); + } + + if (validator.oneOfNodeTypes) { + return validator.oneOfNodeTypes.map(_ => nodePrefix + _).join(" | "); + } + + if (validator.oneOfNodeOrValueTypes) { + return validator.oneOfNodeOrValueTypes + .map(_ => { + return isValueType(_) ? _ : nodePrefix + _; + }) + .join(" | "); + } + + if (validator.type) { + return validator.type; + } + + if (validator.shapeOf) { + return ( + "{ " + + Object.keys(validator.shapeOf) + .map(shapeKey => { + const propertyDefinition = validator.shapeOf[shapeKey]; + if (propertyDefinition.validate) { + const isOptional = + propertyDefinition.optional || propertyDefinition.default != null; + return ( + shapeKey + + (isOptional ? "?: " : ": ") + + stringifyValidator(propertyDefinition.validate) + ); + } + return null; + }) + .filter(Boolean) + .join(", ") + + " }" + ); + } + + return ["any"]; +} + +/** + * Heuristic to decide whether or not the given type is a value type (eg. "null") + * or a Node type (eg. "Expression"). + */ +function isValueType(type) { + return type.charAt(0).toLowerCase() === type.charAt(0); +} diff --git a/src/main/resources/static/node_modules/@babel/types/scripts/utils/toFunctionName.js b/src/main/resources/static/node_modules/@babel/types/scripts/utils/toFunctionName.js new file mode 100644 index 0000000..2b64578 --- /dev/null +++ b/src/main/resources/static/node_modules/@babel/types/scripts/utils/toFunctionName.js @@ -0,0 +1,4 @@ +export default function toFunctionName(typeName) { + const _ = typeName.replace(/^TS/, "ts").replace(/^JSX/, "jsx"); + return _.slice(0, 1).toLowerCase() + _.slice(1); +} diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/README.md b/src/main/resources/static/node_modules/@toast-ui/editor/README.md new file mode 100644 index 0000000..39738d8 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/README.md @@ -0,0 +1,176 @@ +# ![TOAST UI Editor](https://uicdn.toast.com/toastui/img/tui-editor-bi.png) + +[![npm](https://img.shields.io/npm/v/@toast-ui/editor.svg)](https://www.npmjs.com/package/@toast-ui/editor) + +## 🚩 Table of Contents + +- [Collect Statistics on the Use of Open Source](#Collect-statistics-on-the-use-of-open-source) +- [Documents](#-documents) +- [Install](#-install) +- [Usage](#-usage) +- [Tutorials](#-tutorials) + +## Collect Statistics on the Use of Open Source + +TOAST UI products apply Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Editor is used throughout the world. It also serves as important index to determine the future course of projects. `location.hostname` (e.g. ui.toast.com) is to be collected and the sole purpose is nothing but to measure statistics on the usage. + +To disable GA, use the following `usageStatistics` option when creating the instance. + +```js +const options = { + // ... + usageStatistics: false +}; + +const editor = new Editor(options); +``` + +## 📙 Documents + +- [Getting Started](https://github.com/nhn/tui.editor/blob/master/docs/en/getting-started.md) +- [APIs](https://nhn.github.io/tui.editor/latest/) +- v3.0 Migration Guide + - [English](https://github.com/nhn/tui.editor/blob/master/docs/v3.0-migration-guide.md) + - [한국어](https://github.com/nhn/tui.editor/blob/master/docs/v3.0-migration-guide-ko.md) + +You can also see the older versions of API page on the [releases page](https://github.com/nhn/tui.editor/releases). + +## 💾 Install + +TOAST UI products can be used by using the package manager or downloading the source directly. However, we highly recommend using the package manager. + +### Via Package Manager + +TOAST UI products are registered in two package managers, [npm](https://www.npmjs.com/). You can conveniently install it using the commands provided by the package manager. When using npm, be sure to use it in the environment [Node.js](https://nodejs.org/en/) is installed. + +#### npm + +```sh +$ npm install --save @toast-ui/editor # Latest Version +$ npm install --save @toast-ui/editor@ # Specific Version +``` + +### Via Contents Delivery Network (CDN) + +TOAST UI products are available over the CDN powered by [NHN Cloud](https://www.toast.com). + +You can use the CDN as below. + +```html +... + + ... + + +... +``` + +If you want to use a specific version, use the tag name instead of `latest` in the url's path. + +The CDN directory has the following structure: + +``` +- uicdn.toast.com/ + ├─ editor/ + │ ├─ latest/ + │ │ ├─ toastui-editor-all.js + │ │ ├─ toastui-editor-all.min.js + │ │ ├─ toastui-editor-viewer.js + │ │ ├─ toastui-editor-viewer.min.js + │ │ ├─ toastui-editor.css + │ │ ├─ toastui-editor.min.css + │ │ ├─ toastui-editor-viewer.css + │ │ ├─ toastui-editor-viewer.min.css + │ │ ├─ toastui-editor-only.css + │ │ ├─ toastui-editor-only.min.css + │ │ └─ theme/ + │ │ ├─ toastui-editor-dark.css + │ │ └─ toastui-editor-dark.min.css + │ │ └─ i18n/ + │ │ └─ ... + │ ├─ 2.0.0/ + │ │ └─ ... +``` + +## 🔨 Usage + +First, you need to add the container element where TOAST UI Editor (henceforth referred to as 'Editor') will be created. + +```html +... + +

+ +... +``` + +The editor can be used by creating an instance with the constructor function. To get the constructor function, you should import the module using one of the following ways depending on your environment. + +### Using Module Format in Node Environment + +- ES6 Modules + +```javascript +import Editor from '@toast-ui/editor'; +``` + +- CommonJS + +```javascript +const Editor = require('@toast-ui/editor'); +``` + +### Using Namespace in Browser Environment + +```javascript +const Editor = toastui.Editor; +``` + +Then, you need to add the CSS files needed for the Editor. Import CSS files in node environment, and add it to html file when using CDN. + +### Using in Node Environment + +```javascript +import '@toast-ui/editor/dist/toastui-editor.css'; // Editor's Style +``` + +### Using in Browser Environment by CDN + +```html +... + + ... + + + +... +``` + +Finally you can create an instance with options and call various API after creating an instance. + +```javascript +const editor = new Editor({ + el: document.querySelector('#editor'), + height: '500px', + initialEditType: 'markdown', + previewStyle: 'vertical' +}); + +editor.getMarkdown(); +``` + +### Default Options + +- `height`: Height in string or auto ex) `300px` | `auto` +- `initialEditType`: Initial type to show `markdown` | `wysiwyg` +- `initialValue`: Initial value. Set Markdown string +- `previewStyle`: Preview style of Markdown mode `tab` | `vertical` +- `usageStatistics`: Let us know the _hostname_. We want to learn from you how you are using the Editor. You are free to disable it. `true` | `false` + +Find out more options [here](https://nhn.github.io/tui.editor/latest/ToastUIEditor). + +## 🦄 Tutorials + +- [Viewer](https://github.com/nhn/tui.editor/blob/master/docs/en/viewer.md) +- [Plugins](https://github.com/nhn/tui.editor/blob/master/docs/en/plugin.md) +- [Internationalization (i18n)](https://github.com/nhn/tui.editor/blob/master/docs/en/i18n.md) diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ar.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ar.js new file mode 100644 index 0000000..cc31906 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ar.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Arabic + * @author Amira Salah + */ +Editor.setLanguage('ar', { + Markdown: 'لغة ترميز', + WYSIWYG: 'ما تراه هو ما تحصل عليه', + Write: 'يكتب', + Preview: 'عرض مسبق', + Headings: 'العناوين', + Paragraph: 'فقرة', + Bold: 'خط عريض', + Italic: 'خط مائل', + Strike: 'إضراب', + Code: 'رمز', + Line: 'خط', + Blockquote: 'فقرة مقتبسة', + 'Unordered list': 'قائمة غير مرتبة', + 'Ordered list': 'قائمة مرتبة', + Task: 'مهمة', + Indent: 'المسافة البادئة', + Outdent: 'المسافة الخارجة', + 'Insert link': 'أدخل الرابط', + 'Insert CodeBlock': 'أدخل الكود', + 'Insert table': 'أدخل جدول', + 'Insert image': 'أدخل صورة', + Heading: 'عنوان', + 'Image URL': 'رابط الصورة', + 'Select image file': 'حدد ملف الصورة', + 'Choose a file': 'اختيار الملف', + 'No file': 'لا ملف', + Description: 'وصف', + OK: 'موافقة', + More: 'أكثر', + Cancel: 'إلغاء', + File: 'ملف', + URL: 'رابط', + 'Link text': 'نص الرابط', + 'Add row to up': 'أضف صفًا لأعلى', + 'Add row to down': 'أضف صفًا إلى أسفل', + 'Add column to left': 'أضف العمود على اليسار', + 'Add column to right': 'أضف عمودًا إلى اليمين', + 'Remove row': 'حذف سطر', + 'Remove column': 'حذف عمود', + 'Align column to left': 'محاذاة اليسار', + 'Align column to center': 'محاذاة الوسط', + 'Align column to right': 'محاذاة اليمين', + 'Remove table': 'حذف الجدول', + 'Would you like to paste as table?': 'هل تريد اللصق كجدول', + 'Text color': 'لون النص', + 'Auto scroll enabled': 'التحريك التلقائي ممكّن', + 'Auto scroll disabled': 'التحريك التلقائي معطّل', + 'Choose language': 'اختر اللغة', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/cs-cz.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/cs-cz.js new file mode 100644 index 0000000..423e75a --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/cs-cz.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Czech + * @author Dmitrij Tkačenko + */ +Editor.setLanguage(['cs', 'cs-CZ'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Napsat', + Preview: 'Náhled', + Headings: 'Nadpisy', + Paragraph: 'Odstavec', + Bold: 'Tučné', + Italic: 'Kurzíva', + Strike: 'Přeškrtnuté', + Code: 'Kód', + Line: 'Vodorovná čára', + Blockquote: 'Citace', + 'Unordered list': 'Seznam s odrážkami', + 'Ordered list': 'Číslovaný seznam', + Task: 'Úkol', + Indent: 'Zvětšit odsazení', + Outdent: 'Zmenšit odsazení', + 'Insert link': 'Vložit odkaz', + 'Insert CodeBlock': 'Vložit blok kódu', + 'Insert table': 'Vložit tabulku', + 'Insert image': 'Vložit obrázek', + Heading: 'Nadpis', + 'Image URL': 'URL obrázku', + 'Select image file': 'Vybrat obrázek', + 'Choose a file': 'Vyberte soubor', + 'No file': 'Žádný soubor', + Description: 'Popis', + OK: 'OK', + More: 'Více', + Cancel: 'Zrušit', + File: 'Soubor', + URL: 'URL', + 'Link text': 'Text odkazu', + 'Add row to up': 'Přidejte řádek nahoru', + 'Add row to down': 'Přidejte řádek dolů', + 'Add column to left': 'Přidat sloupec vlevo', + 'Add column to right': 'Přidat sloupec doprava', + 'Remove row': 'Odebrat řádek', + 'Remove column': 'Odebrat sloupec', + 'Align column to left': 'Zarovnat vlevo', + 'Align column to center': 'Zarovnat na střed', + 'Align column to right': 'Zarovnat vpravo', + 'Remove table': 'Odstranit tabulku', + 'Would you like to paste as table?': 'Chcete vložit jako tabulku?', + 'Text color': 'Barva textu', + 'Auto scroll enabled': 'Automatické rolování zapnuto', + 'Auto scroll disabled': 'Automatické rolování vypnuto', + 'Choose language': 'Vybrat jazyk', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/de-de.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/de-de.js new file mode 100644 index 0000000..b98525c --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/de-de.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for German + * @author Jann-Niklas Kiepert + */ +Editor.setLanguage(['de', 'de-DE'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Verfassen', + Preview: 'Vorschau', + Headings: 'Überschriften', + Paragraph: 'Text', + Bold: 'Fett', + Italic: 'Kursiv', + Strike: 'Durchgestrichen', + Code: 'Code', + Line: 'Trennlinie', + Blockquote: 'Blocktext', + 'Unordered list': 'Aufzählung', + 'Ordered list': 'Nummerierte Aufzählung', + Task: 'Aufgabe', + Indent: 'Einrücken', + Outdent: 'Ausrücken', + 'Insert link': 'Link einfügen', + 'Insert CodeBlock': 'Codeblock einfügen', + 'Insert table': 'Tabelle einfügen', + 'Insert image': 'Grafik einfügen', + Heading: 'Titel', + 'Image URL': 'Bild URL', + 'Select image file': 'Grafik auswählen', + 'Choose a file': 'Wähle eine datei', + 'No file': 'Keine datei', + Description: 'Beschreibung', + OK: 'OK', + More: 'Mehr', + Cancel: 'Abbrechen', + File: 'Datei', + URL: 'URL', + 'Link text': 'Anzuzeigender Text', + 'Add row to up': 'Zeile nach oben hinzufügen', + 'Add row to down': 'Zeile nach unten hinzufügen', + 'Add column to left': 'Spalte links hinzufügen', + 'Add column to right': 'Spalte rechts hinzufügen', + 'Remove row': 'Zeile entfernen', + 'Remove column': 'Spalte entfernen', + 'Align column to left': 'Links ausrichten', + 'Align column to center': 'Zentrieren', + 'Align column to right': 'Rechts ausrichten', + 'Remove table': 'Tabelle entfernen', + 'Would you like to paste as table?': 'Möchten Sie eine Tabelle einfügen?', + 'Text color': 'Textfarbe', + 'Auto scroll enabled': 'Autoscrollen aktiviert', + 'Auto scroll disabled': 'Autoscrollen deaktiviert', + 'Choose language': 'Sprache auswählen', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/en-us.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/en-us.js new file mode 100644 index 0000000..b5b5135 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/en-us.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for English + * @author NHN FE Development Lab + */ +Editor.setLanguage(['en', 'en-US'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Write', + Preview: 'Preview', + Headings: 'Headings', + Paragraph: 'Paragraph', + Bold: 'Bold', + Italic: 'Italic', + Strike: 'Strike', + Code: 'Inline code', + Line: 'Line', + Blockquote: 'Blockquote', + 'Unordered list': 'Unordered list', + 'Ordered list': 'Ordered list', + Task: 'Task', + Indent: 'Indent', + Outdent: 'Outdent', + 'Insert link': 'Insert link', + 'Insert CodeBlock': 'Insert codeBlock', + 'Insert table': 'Insert table', + 'Insert image': 'Insert image', + Heading: 'Heading', + 'Image URL': 'Image URL', + 'Select image file': 'Select image file', + 'Choose a file': 'Choose a file', + 'No file': 'No file', + Description: 'Description', + OK: 'OK', + More: 'More', + Cancel: 'Cancel', + File: 'File', + URL: 'URL', + 'Link text': 'Link text', + 'Add row to up': 'Add row to up', + 'Add row to down': 'Add row to down', + 'Add column to left': 'Add column to left', + 'Add column to right': 'Add column to right', + 'Remove row': 'Remove row', + 'Remove column': 'Remove column', + 'Align column to left': 'Align column to left', + 'Align column to center': 'Align column to center', + 'Align column to right': 'Align column to right', + 'Remove table': 'Remove table', + 'Would you like to paste as table?': 'Would you like to paste as table?', + 'Text color': 'Text color', + 'Auto scroll enabled': 'Auto scroll enabled', + 'Auto scroll disabled': 'Auto scroll disabled', + 'Choose language': 'Choose language', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/es-es.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/es-es.js new file mode 100644 index 0000000..7a9203d --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/es-es.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Spanish + * @author Enrico Lamperti + */ +Editor.setLanguage(['es', 'es-ES'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Escribir', + Preview: 'Vista previa', + Headings: 'Encabezados', + Paragraph: 'Párrafo', + Bold: 'Negrita', + Italic: 'Itálica', + Strike: 'Tachado', + Code: 'Código', + Line: 'Línea', + Blockquote: 'Cita', + 'Unordered list': 'Lista desordenada', + 'Ordered list': 'Lista ordenada', + Task: 'Tarea', + Indent: 'Sangría', + Outdent: 'Saliendo', + 'Insert link': 'Insertar enlace', + 'Insert CodeBlock': 'Insertar bloque de código', + 'Insert table': 'Insertar tabla', + 'Insert image': 'Insertar imagen', + Heading: 'Encabezado', + 'Image URL': 'URL de la imagen', + 'Select image file': 'Seleccionar archivo de imagen', + 'Choose a file': 'Escoge un archivo', + 'No file': 'Ningún archivo', + Description: 'Descripción', + OK: 'Aceptar', + More: 'Más', + Cancel: 'Cancelar', + File: 'Archivo', + URL: 'URL', + 'Link text': 'Texto del enlace', + 'Add row to up': 'Agregar fila para subir', + 'Add row to down': 'Agregar fila hacia abajo', + 'Add column to left': 'Agregar columna a la izquierda', + 'Add column to right': 'Agregar columna a la derecha', + 'Remove row': 'Eliminar fila', + 'Remove column': 'Eliminar columna', + 'Align column to left': 'Alinear a la izquierda', + 'Align column to center': 'Centrar', + 'Align column to right': 'Alinear a la derecha', + 'Remove table': 'Eliminar tabla', + 'Would you like to paste as table?': '¿Desea pegar como tabla?', + 'Text color': 'Color del texto', + 'Auto scroll enabled': 'Desplazamiento automático habilitado', + 'Auto scroll disabled': 'Desplazamiento automático deshabilitado', + 'Choose language': 'Elegir idioma', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/fi-fi.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/fi-fi.js new file mode 100644 index 0000000..c46a1e8 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/fi-fi.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Finnish + * @author Tomi Mynttinen + */ +Editor.setLanguage(['fi', 'fi-FI'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Kirjoita', + Preview: 'Esikatselu', + Headings: 'Otsikot', + Paragraph: 'Kappale', + Bold: 'Lihavointi', + Italic: 'Kursivointi', + Strike: 'Yliviivaus', + Code: 'Koodi', + Line: 'Vaakaviiva', + Blockquote: 'Lainaus', + 'Unordered list': 'Luettelo', + 'Ordered list': 'Numeroitu luettelo', + Task: 'Tehtävä', + Indent: 'Suurenna sisennystä', + Outdent: 'Pienennä sisennystä', + 'Insert link': 'Lisää linkki', + 'Insert CodeBlock': 'Lisää koodia', + 'Insert table': 'Lisää taulukko', + 'Insert image': 'Lisää kuva', + Heading: 'Otsikko', + 'Image URL': 'Kuvan URL', + 'Select image file': 'Valitse kuvatiedosto', + 'Choose a file': 'Valitse tiedosto', + 'No file': 'Ei tiedosto', + Description: 'Kuvaus', + OK: 'OK', + More: 'Lisää', + Cancel: 'Peruuta', + File: 'Tiedosto', + URL: 'URL', + 'Link text': 'Linkkiteksti', + 'Add row to up': 'Lisää rivi ylöspäin', + 'Add row to down': 'Lisää rivi alaspäin', + 'Add column to left': 'Lisää sarake vasemmalla', + 'Add column to right': 'Lisää sarake oikealle', + 'Remove row': 'Poista rivi', + 'Remove column': 'Poista sarake', + 'Align column to left': 'Tasaus vasemmalle', + 'Align column to center': 'Keskitä', + 'Align column to right': 'Tasaus oikealle', + 'Remove table': 'Poista taulukko', + 'Would you like to paste as table?': 'Haluatko liittää taulukkomuodossa?', + 'Text color': 'Tekstin väri', + 'Auto scroll enabled': 'Automaattinen skrollaus käytössä', + 'Auto scroll disabled': 'Automaattinen skrollaus pois käytöstä', + 'Choose language': 'Valitse kieli', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/fr-fr.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/fr-fr.js new file mode 100644 index 0000000..9b47907 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/fr-fr.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for French + * @author Stanislas Michalak + */ +Editor.setLanguage(['fr', 'fr-FR'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Écrire', + Preview: 'Aperçu', + Headings: 'En-têtes', + Paragraph: 'Paragraphe', + Bold: 'Gras', + Italic: 'Italique', + Strike: 'Barré', + Code: 'Code en ligne', + Line: 'Ligne', + Blockquote: 'Citation', + 'Unordered list': 'Liste non-ordonnée', + 'Ordered list': 'Liste ordonnée', + Task: 'Tâche', + Indent: 'Retrait', + Outdent: 'Sortir', + 'Insert link': 'Insérer un lien', + 'Insert CodeBlock': 'Insérer un bloc de code', + 'Insert table': 'Insérer un tableau', + 'Insert image': 'Insérer une image', + Heading: 'En-tête', + 'Image URL': "URL de l'image", + 'Select image file': 'Sélectionnez un fichier image', + 'Choose a file': 'Choisissez un fichier', + 'No file': 'Pas de fichier', + Description: 'Description', + OK: 'OK', + More: 'de plus', + Cancel: 'Annuler', + File: 'Fichier', + URL: 'URL', + 'Link text': 'Texte du lien', + 'Add row to up': 'Ajouter une ligne vers le haut', + 'Add row to down': 'Ajouter une ligne vers le bas', + 'Add column to left': 'Ajouter une colonne à gauche', + 'Add column to right': 'Ajouter une colonne à droite', + 'Remove row': 'Supprimer une ligne', + 'Remove column': 'Supprimer une colonne', + 'Align column to left': 'Aligner à gauche', + 'Align column to center': 'Aligner au centre', + 'Align column to right': 'Aligner à droite', + 'Remove table': 'Supprimer le tableau', + 'Would you like to paste as table?': 'Voulez-vous coller ce contenu en tant que tableau ?', + 'Text color': 'Couleur du texte', + 'Auto scroll enabled': 'Défilement automatique activé', + 'Auto scroll disabled': 'Défilement automatique désactivé', + 'Choose language': 'Choix de la langue', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/gl-es.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/gl-es.js new file mode 100644 index 0000000..a7d975a --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/gl-es.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Spanish + * @author Aida Vidal + */ +Editor.setLanguage(['gl', 'gl-ES'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Escribir', + Preview: 'Vista previa', + Headings: 'Encabezados', + Paragraph: 'Parágrafo', + Bold: 'Negriña', + Italic: 'Cursiva', + Strike: 'Riscado', + Code: 'Código', + Line: 'Liña', + Blockquote: 'Cita', + 'Unordered list': 'Lista desordenada', + 'Ordered list': 'Lista ordenada', + Task: 'Tarefa', + Indent: 'Sangría', + Outdent: 'Anular sangría', + 'Insert link': 'Inserir enlace', + 'Insert CodeBlock': 'Inserir bloque de código', + 'Insert table': 'Inserir táboa', + 'Insert image': 'Inserir imaxe', + Heading: 'Encabezado', + 'Image URL': 'URL da imaxe', + 'Select image file': 'Seleccionar arquivo da imaxe', + 'Choose a file': 'Escoge un archivo', + 'No file': 'Ningún archivo', + Description: 'Descrición', + OK: 'Aceptar', + More: 'Máis', + Cancel: 'Cancelar', + File: 'Arquivo', + URL: 'URL', + 'Link text': 'Texto do enlace', + 'Add row to up': 'Engade fila para arriba', + 'Add row to down': 'Engade fila para abaixo', + 'Add column to left': 'Engade columna á esquerda', + 'Add column to right': 'Engade columna á dereita', + 'Remove row': 'Eliminar fila', + 'Remove column': 'Eliminar columna', + 'Align column to left': 'Aliñar á esquerda', + 'Align column to center': 'Centrar', + 'Align column to right': 'Aliñar á dereita', + 'Remove table': 'Eliminar táboa', + 'Would you like to paste as table?': 'Desexa pegar como táboa?', + 'Text color': 'Cor do texto', + 'Auto scroll enabled': 'Desprazamento automático habilitado', + 'Auto scroll disabled': 'Desprazamento automático deshabilitado', + 'Choose language': 'Elixir idioma', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/hr-hr.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/hr-hr.js new file mode 100644 index 0000000..362b2a9 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/hr-hr.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Croatian + * @author Hrvoje A. + */ +Editor.setLanguage(['hr', 'hr-HR'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Piši', + Preview: 'Pregled', + Headings: 'Naslovi', + Paragraph: 'Paragraf', + Bold: 'podebljano', + Italic: 'kurziv', + Strike: 'prcrtano', + Code: 'Uklopljeni kôd', + Line: 'Linija', + Blockquote: 'Blok citat', + 'Unordered list': 'Neporedana lista', + 'Ordered list': 'Poredana lista', + Task: 'Task', + Indent: 'Povećaj uvlaku', + Outdent: 'Smanji uvlaku', + 'Insert link': 'Umetni link', + 'Insert CodeBlock': 'Umetni blok kôda', + 'Insert table': 'Umetni tablicu', + 'Insert image': 'Umetni sliku', + Heading: 'Naslov', + 'Image URL': 'URL slike', + 'Select image file': 'Odaberi slikovnu datoteku', + 'Choose a file': 'Odaberite datoteka', + 'No file': 'Nema datoteka', + Description: 'Opis', + OK: 'OK', + More: 'Više', + Cancel: 'Odustani', + File: 'Datoteka', + URL: 'URL', + 'Link text': 'Tekst linka', + 'Add row to up': 'Dodaj redak prema gore', + 'Add row to down': 'Dodaj redak prema dolje', + 'Add column to left': 'Dodaj stupac s lijeve strane', + 'Add column to right': 'Dodajte stupac s desne strane', + 'Remove row': 'Ukloni redak', + 'Remove column': 'Remove stupac', + 'Align column to left': 'Poravnaj lijevo', + 'Align column to center': 'Poravnaj centrirano', + 'Align column to right': 'Poravnaj desno', + 'Remove table': 'Ukloni tablicu', + 'Would you like to paste as table?': 'Zalite li zalijepiti kao tablicu?', + 'Text color': 'Boja teksta', + 'Auto scroll enabled': 'Omogući auto klizanje', + 'Auto scroll disabled': 'Onemogući auto klizanje', + 'Choose language': 'Odabir jezika', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/i18n.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/i18n.js new file mode 100644 index 0000000..7430459 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/i18n.js @@ -0,0 +1,223 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +/** + * @fileoverview Extend the target object from other objects. + * @author NHN FE Development Lab + */ + +/** + * @module object + */ + +/** + * Extend the target object from other objects. + * @param {object} target - Object that will be extended + * @param {...object} objects - Objects as sources + * @returns {object} Extended object + * @memberof module:object + */ +function extend(target, objects) { // eslint-disable-line no-unused-vars + var hasOwnProp = Object.prototype.hasOwnProperty; + var source, prop, i, len; + + for (i = 1, len = arguments.length; i < len; i += 1) { + source = arguments[i]; + for (prop in source) { + if (hasOwnProp.call(source, prop)) { + target[prop] = source[prop]; + } + } + } + + return target; +} + +var extend_1 = extend; + +/** + * @fileoverview Check whether the given variable is an instance of Array or not. + * @author NHN FE Development Lab + */ + +/** + * Check whether the given variable is an instance of Array or not. + * If the given variable is an instance of Array, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is array instance? + * @memberof module:type + */ +function isArray$1(obj) { + return obj instanceof Array; +} + +var isArray_1 = isArray$1; + +/* eslint-disable complexity */ + +var isArray = isArray_1; + +/** + * @module array + */ + +/** + * Returns the first index at which a given element can be found in the array + * from start index(default 0), or -1 if it is not present. + * It compares searchElement to elements of the Array using strict equality + * (the same method used by the ===, or triple-equals, operator). + * @param {*} searchElement Element to locate in the array + * @param {Array} array Array that will be traversed. + * @param {number} startIndex Start index in array for searching (default 0) + * @returns {number} the First index at which a given element, or -1 if it is not present + * @memberof module:array + * @example + * // ES6 + * import inArray from 'tui-code-snippet/array/inArray'; + * + * // CommonJS + * const inArray = require('tui-code-snippet/array/inArray'); + * + * const arr = ['one', 'two', 'three', 'four']; + * const idx1 = inArray('one', arr, 3); // -1 + * const idx2 = inArray('one', arr); // 0 + */ +function inArray(searchElement, array, startIndex) { + var i; + var length; + startIndex = startIndex || 0; + + if (!isArray(array)) { + return -1; + } + + if (Array.prototype.indexOf) { + return Array.prototype.indexOf.call(array, searchElement, startIndex); + } + + length = array.length; + for (i = startIndex; startIndex >= 0 && i < length; i += 1) { + if (array[i] === searchElement) { + return i; + } + } + + return -1; +} + +var inArray_1 = inArray; + +/** + * @class + * @ignore + * @classdesc ES6 Map + */ +var Map = /** @class */ (function () { + function Map() { + this.keys = []; + this.values = []; + } + Map.prototype.getKeyIndex = function (key) { + return inArray_1(key, this.keys); + }; + Map.prototype.get = function (key) { + return this.values[this.getKeyIndex(key)]; + }; + Map.prototype.set = function (key, value) { + var keyIndex = this.getKeyIndex(key); + if (keyIndex > -1) { + this.values[keyIndex] = value; + } + else { + this.keys.push(key); + this.values.push(value); + } + return this; + }; + Map.prototype.has = function (key) { + return this.getKeyIndex(key) > -1; + }; + Map.prototype.delete = function (key) { + var keyIndex = this.getKeyIndex(key); + if (keyIndex > -1) { + this.keys.splice(keyIndex, 1); + this.values.splice(keyIndex, 1); + return true; + } + return false; + }; + Map.prototype.forEach = function (callback, thisArg) { + var _this = this; + if (thisArg === void 0) { thisArg = this; } + this.values.forEach(function (value, index) { + if (value && _this.keys[index]) { + callback.call(thisArg, value, _this.keys[index], _this); + } + }); + }; + Map.prototype.clear = function () { + this.keys = []; + this.values = []; + }; + return Map; +}()); + +/** + * @fileoverview Implements i18n + * @author NHN FE Development Lab + */ +var DEFAULT_CODE = 'en-US'; +/** + * Class I18n + * @ignore + */ +var I18n = /** @class */ (function () { + function I18n() { + this.code = DEFAULT_CODE; + this.langs = new Map(); + } + I18n.prototype.setCode = function (code) { + this.code = code || DEFAULT_CODE; + }; + /** + * Set language set + * @param {string|string[]} codes locale code + * @param {object} data language set + */ + I18n.prototype.setLanguage = function (codes, data) { + var _this = this; + codes = [].concat(codes); + codes.forEach(function (code) { + if (!_this.langs.has(code)) { + _this.langs.set(code, data); + } + else { + var langData = _this.langs.get(code); + _this.langs.set(code, extend_1(langData, data)); + } + }); + }; + I18n.prototype.get = function (key, code) { + if (!code) { + code = this.code; + } + var langSet = this.langs.get(code); + if (!langSet) { + langSet = this.langs.get(DEFAULT_CODE); + } + var text = langSet[key]; + if (!text) { + throw new Error("There is no text key \"" + key + "\" in " + code); + } + return text; + }; + return I18n; +}()); +var i18n = new I18n(); + +export default i18n; +export { I18n }; diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/it-it.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/it-it.js new file mode 100644 index 0000000..ede2c0f --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/it-it.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Italian + * @author Massimo Redaelli + */ +Editor.setLanguage(['it', 'it-IT'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Scrivere', + Preview: 'Anteprima', + Headings: 'Intestazioni', + Paragraph: 'Paragrafo', + Bold: 'Grassetto', + Italic: 'Corsivo', + Strike: 'Barrato', + Code: 'Codice', + Line: 'Linea', + Blockquote: 'Blocco citazione', + 'Unordered list': 'Lista puntata', + 'Ordered list': 'Lista numerata', + Task: 'Attività', + Indent: 'Aggiungi indentazione', + Outdent: 'Rimuovi indentazione', + 'Insert link': 'Inserisci link', + 'Insert CodeBlock': 'Inserisci blocco di codice', + 'Insert table': 'Inserisci tabella', + 'Insert image': 'Inserisci immagine', + Heading: 'Intestazione', + 'Image URL': 'URL immagine', + 'Select image file': 'Seleziona file immagine', + 'Choose a file': 'Scegli un file', + 'No file': 'Nessun file', + Description: 'Descrizione', + OK: 'OK', + More: 'Più', + Cancel: 'Cancella', + File: 'File', + URL: 'URL', + 'Link text': 'Testo del collegamento', + 'Add row to up': 'Aggiungi riga in alto', + 'Add row to down': 'Aggiungi riga in basso', + 'Add column to left': 'Aggiungi colonna a sinistra', + 'Add column to right': 'Aggiungi colonna a destra', + 'Remove row': 'Rimuovi riga', + 'Remove column': 'Rimuovi colonna', + 'Align column to left': 'Allinea a sinistra', + 'Align column to center': 'Allinea al centro', + 'Align column to right': 'Allinea a destra', + 'Remove table': 'Rimuovi tabella', + 'Would you like to paste as table?': 'Desideri incollare sotto forma di tabella?', + 'Text color': 'Colore del testo', + 'Auto scroll enabled': 'Scrolling automatico abilitato', + 'Auto scroll disabled': 'Scrolling automatico disabilitato', + 'Choose language': 'Scegli la lingua', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ja-jp.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ja-jp.js new file mode 100644 index 0000000..d53d86e --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ja-jp.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Japanese + * @author NHN FE Development Lab + */ +Editor.setLanguage(['ja', 'ja-JP'], { + Markdown: 'マークダウン', + WYSIWYG: 'WYSIWYG', + Write: '編集する', + Preview: 'プレビュー', + Headings: '見出し', + Paragraph: '本文', + Bold: '太字', + Italic: 'イタリック', + Strike: 'ストライク', + Code: 'インラインコード', + Line: 'ライン', + Blockquote: '引用', + 'Unordered list': '番号なしリスト', + 'Ordered list': '順序付きリスト', + Task: 'タスク', + Indent: 'インデント', + Outdent: 'アウトデント', + 'Insert link': 'リンク挿入', + 'Insert CodeBlock': 'コードブロック挿入', + 'Insert table': 'テーブル挿入', + 'Insert image': '画像挿入', + Heading: '見出し', + 'Image URL': 'イメージURL', + 'Select image file': '画像ファイル選択', + 'Choose a file': 'ファイルの選択', + 'No file': 'ファイルがない', + Description: 'ディスクリプション ', + OK: 'はい', + More: 'もっと', + Cancel: 'キャンセル', + File: 'ファイル', + URL: 'URL', + 'Link text': 'リンクテキスト', + 'Add row to up': '行を上に追加', + 'Add row to down': '下に行を追加', + 'Add column to left': '左側に列を追加', + 'Add column to right': '右側に列を追加', + 'Remove row': '行削除', + 'Remove column': '列削除', + 'Align column to left': '左揃え', + 'Align column to center': '中央揃え', + 'Align column to right': '右揃え', + 'Remove table': 'テーブル削除', + 'Would you like to paste as table?': 'テーブルを貼り付けますか?', + 'Text color': '文字色相', + 'Auto scroll enabled': '自動スクロールが有効', + 'Auto scroll disabled': '自動スクロールを無効に', + 'Choose language': '言語選択', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ko-kr.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ko-kr.js new file mode 100644 index 0000000..fda17af --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ko-kr.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Korean + * @author NHN FE Development Lab + */ +Editor.setLanguage(['ko', 'ko-KR'], { + Markdown: '마크다운', + WYSIWYG: '위지윅', + Write: '편집하기', + Preview: '미리보기', + Headings: '제목크기', + Paragraph: '본문', + Bold: '굵게', + Italic: '기울임꼴', + Strike: '취소선', + Code: '인라인 코드', + Line: '문단나눔', + Blockquote: '인용구', + 'Unordered list': '글머리 기호', + 'Ordered list': '번호 매기기', + Task: '체크박스', + Indent: '들여쓰기', + Outdent: '내어쓰기', + 'Insert link': '링크 삽입', + 'Insert CodeBlock': '코드블럭 삽입', + 'Insert table': '표 삽입', + 'Insert image': '이미지 삽입', + Heading: '제목', + 'Image URL': '이미지 주소', + 'Select image file': '이미지 파일을 선택하세요.', + 'Choose a file': '파일 선택', + 'No file': '선택된 파일 없음', + Description: '설명', + OK: '확인', + More: '더 보기', + Cancel: '취소', + File: '파일', + URL: '주소', + 'Link text': '링크 텍스트', + 'Add row to up': '위에 행 추가', + 'Add row to down': '아래에 행 추가', + 'Add column to left': '왼쪽에 열 추가', + 'Add column to right': '오른쪽에 열 추가', + 'Remove row': '행 삭제', + 'Remove column': '열 삭제', + 'Align column to left': '열 왼쪽 정렬', + 'Align column to center': '열 가운데 정렬', + 'Align column to right': '열 오른쪽 정렬', + 'Remove table': '표 삭제', + 'Would you like to paste as table?': '표형태로 붙여 넣겠습니까?', + 'Text color': '글자 색상', + 'Auto scroll enabled': '자동 스크롤 켜짐', + 'Auto scroll disabled': '자동 스크롤 꺼짐', + 'Choose language': '언어 선택', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/nb-no.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/nb-no.js new file mode 100644 index 0000000..abec0be --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/nb-no.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Norwegian + * @author Anton Reytarovskiy + */ +Editor.setLanguage(['nb', 'nb-NO'], { + Markdown: 'Funksjonaliteter', + WYSIWYG: 'WYSIWYG', + Write: 'Skriv', + Preview: 'Forhåndsvisning', + Headings: 'Overskrift', + Paragraph: 'Paragraf', + Bold: 'Fet skrift', + Italic: 'Italic', + Strike: 'Strike', + Code: 'Kode', + Line: 'Linje', + Blockquote: 'Blokksitat', + 'Unordered list': 'Usortert liste', + 'Ordered list': 'Sortert liste', + Task: 'Task', + Indent: 'Indent', + Outdent: 'Outdent', + 'Insert link': 'Sett inn lenke', + 'Insert CodeBlock': 'Sett inn CodeStreng', + 'Insert table': 'Sett inn diagram', + 'Insert image': 'Sett inn bilde', + Heading: 'Overskrift', + 'Image URL': 'BildeURL', + 'Select image file': 'Velg bildefil', + 'Choose a file': 'Velg en fil', + 'No file': 'Ingen fil', + Description: 'Beskrivelse', + OK: 'OK', + More: 'Mer', + Cancel: 'Angre', + File: 'Fil', + URL: 'URL', + 'Link text': 'Lenketekst', + 'Add row to up': 'Legg rad til opp', + 'Add row to down': 'Legg rad til ned', + 'Add column to left': 'Legg til kolonne til venstre', + 'Add column to right': 'Legg til kolonne til høyre', + 'Remove row': 'Fjern rad', + 'Remove column': 'Fjern kolonne', + 'Align column to left': 'Venstreorienter', + 'Align column to center': 'Senterorienter', + 'Align column to right': 'Høyreorienter', + 'Remove table': 'Fjern diagram', + 'Would you like to paste as table?': 'Ønsker du å lime inn som et diagram?', + 'Text color': 'Tekstfarge', + 'Auto scroll enabled': 'Auto-scroll aktivert', + 'Auto scroll disabled': 'Auto-scroll deaktivert', + 'Choose language': 'Velg språl', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/nl-nl.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/nl-nl.js new file mode 100644 index 0000000..2a74fad --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/nl-nl.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Dutch + * @author NHN FE Development Lab + */ +Editor.setLanguage(['nl', 'nl-NL'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Opslaan', + Preview: 'Voorbeeld', + Headings: 'Koppen', + Paragraph: 'Alinea', + Bold: 'Vet', + Italic: 'Cursief', + Strike: 'Doorhalen', + Code: 'Inline code', + Line: 'Regel', + Blockquote: 'Citaatblok', + 'Unordered list': 'Opsomming', + 'Ordered list': 'Genummerde opsomming', + Task: 'Taak', + Indent: 'Niveau verhogen', + Outdent: 'Niveau verlagen', + 'Insert link': 'Link invoegen', + 'Insert CodeBlock': 'Codeblok toevoegen', + 'Insert table': 'Tabel invoegen', + 'Insert image': 'Afbeelding invoegen', + Heading: 'Kop', + 'Image URL': 'Afbeelding URL', + 'Select image file': 'Selecteer een afbeelding', + 'Choose a file': 'Kies een bestand', + 'No file': 'Geen bestand', + Description: 'Omschrijving', + OK: 'OK', + More: 'Meer', + Cancel: 'Annuleren', + File: 'Bestand', + URL: 'URL', + 'Link text': 'Link tekst', + 'Add row to up': 'Voeg rij toe aan omhoog', + 'Add row to down': 'Rij naar beneden toevoegen', + 'Add column to left': 'Voeg kolom aan de linkerkant toe', + 'Add column to right': 'Voeg een kolom aan de rechterkant toe', + 'Remove row': 'Rij verwijderen', + 'Remove column': 'Kolom verwijderen', + 'Align column to left': 'Links uitlijnen', + 'Align column to center': 'Centreren', + 'Align column to right': 'Rechts uitlijnen', + 'Remove table': 'Verwijder tabel', + 'Would you like to paste as table?': 'Wil je dit als tabel plakken?', + 'Text color': 'Tekstkleur', + 'Auto scroll enabled': 'Autoscroll ingeschakeld', + 'Auto scroll disabled': 'Autoscroll uitgeschakeld', + 'Choose language': 'Kies een taal', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/pl-pl.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/pl-pl.js new file mode 100644 index 0000000..518a639 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/pl-pl.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Polish + * @author Marcin Mikołajczak + */ +Editor.setLanguage(['pl', 'pl-PL'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Napisz', + Preview: 'Podgląd', + Headings: 'Nagłówki', + Paragraph: 'Akapit', + Bold: 'Pogrubienie', + Italic: 'Kursywa', + Strike: 'Przekreślenie', + Code: 'Fragment kodu', + Line: 'Linia', + Blockquote: 'Cytat', + 'Unordered list': 'Lista nieuporządkowana', + 'Ordered list': 'Lista uporządkowana', + Task: 'Zadanie', + Indent: 'Utwórz wcięcie', + Outdent: 'Usuń wcięcie', + 'Insert link': 'Umieść odnośnik', + 'Insert CodeBlock': 'Umieść blok kodu', + 'Insert table': 'Umieść tabelę', + 'Insert image': 'Umieść obraz', + Heading: 'Nagłówek', + 'Image URL': 'Adres URL obrazu', + 'Select image file': 'Wybierz plik obrazu', + 'Choose a file': 'Wybierz plik', + 'No file': 'Brak plik', + Description: 'Opis', + OK: 'OK', + More: 'Więcej', + Cancel: 'Anuluj', + File: 'Plik', + URL: 'URL', + 'Link text': 'Tekst odnośnika', + 'Add row to up': 'Dodaj wiersz do góry', + 'Add row to down': 'Dodaj wiersz w dół', + 'Add column to left': 'Dodaj kolumnę po lewej stronie', + 'Add column to right': 'Dodaj kolumnę po prawej stronie', + 'Remove row': 'Usuń rząd', + 'Remove column': 'Usuń kolumnę', + 'Align column to left': 'Wyrównaj do lewej', + 'Align column to center': 'Wyśrodkuj', + 'Align column to right': 'Wyrównaj do prawej', + 'Remove table': 'Usuń tabelę', + 'Would you like to paste as table?': 'Czy chcesz wkleić tekst jako tabelę?', + 'Text color': 'Kolor tekstu', + 'Auto scroll enabled': 'Włączono automatyczne przewijanie', + 'Auto scroll disabled': 'Wyłączono automatyczne przewijanie', + 'Choose language': 'Wybierz język', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/pt-br.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/pt-br.js new file mode 100644 index 0000000..d5f10b0 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/pt-br.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Português + * @author Nícolas Huber + */ +Editor.setLanguage(['pt', 'pt-BR'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Escrever', + Preview: 'Pré-visualizar', + Headings: 'Cabeçalhos', + Paragraph: 'Parágrafo', + Bold: 'Negrito', + Italic: 'Itálico', + Strike: 'Traçado', + Code: 'Código', + Line: 'Linha', + Blockquote: 'Bloco de citação', + 'Unordered list': 'Lista não ordenada', + 'Ordered list': 'Lista ordenada', + Task: 'Tarefa', + Indent: 'Recuo à esquerda', + Outdent: 'Recuo à direita', + 'Insert link': 'Inserir link', + 'Insert CodeBlock': 'Inserir bloco de código', + 'Insert table': 'Inserir tabela', + 'Insert image': 'Inserir imagem', + Heading: 'Título', + 'Image URL': 'URL da imagem', + 'Select image file': 'Selecione um arquivo de imagem', + 'Choose a file': 'Escolha um arquivo', + 'No file': 'Nenhum arquivo', + Description: 'Descrição', + OK: 'OK', + More: 'Mais', + Cancel: 'Cancelar', + File: 'Arquivo', + URL: 'URL', + 'Link text': 'Link de texto', + 'Add row to up': 'Adicionar linha para cima', + 'Add row to down': 'Adicionar linha para baixo', + 'Add column to left': 'Adicionar coluna à esquerda', + 'Add column to right': 'Adicionar coluna à direita', + 'Remove row': 'Remover linha', + 'Remove column': 'Remover coluna', + 'Align column to left': 'Alinhar à esquerda', + 'Align column to center': 'Alinhar ao centro', + 'Align column to right': 'Alinhar à direita', + 'Remove table': 'Remover tabela', + 'Would you like to paste as table?': 'Você gostaria de colar como mesa?', + 'Text color': 'Cor do texto', + 'Auto scroll enabled': 'Rolagem automática habilitada', + 'Auto scroll disabled': 'Rolagem automática desabilitada', + 'Choose language': 'Escolher linguagem', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ru-ru.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ru-ru.js new file mode 100644 index 0000000..3e6f3d3 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/ru-ru.js @@ -0,0 +1,64 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Russian + * @author Stepan Samko + * @author Veaceslav Grimalschi + */ +Editor.setLanguage(['ru', 'ru-RU'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Редактор', + Preview: 'Просмотр', + Headings: 'Заголовки', + Paragraph: 'Абзац', + Bold: 'Жирный', + Italic: 'Курсив', + Strike: 'Зачеркнутый', + Code: 'Код', + Line: 'Линия', + Blockquote: 'Цитата', + 'Unordered list': 'Неупорядоченный список', + 'Ordered list': 'Упорядоченный список', + Task: 'Галочка', + Indent: 'Увеличить отступ', + Outdent: 'Уменьшить отступ', + 'Insert link': 'Вставить ссылку', + 'Insert CodeBlock': 'Вставить блок кода', + 'Insert table': 'Вставить таблицу', + 'Insert image': 'Вставить изображение', + Heading: 'Заголовок', + 'Image URL': 'URL изображения', + 'Select image file': 'Выбрать файл изображения', + 'Choose a file': 'Выбрать', + 'No file': 'Нет файла', + Description: 'Описание', + OK: 'Хорошо', + More: 'Еще', + Cancel: 'Отмена', + File: 'Файл', + URL: 'URL', + 'Link text': 'Текст ссылки', + 'Add row to up': 'Добавить строку вверх', + 'Add row to down': 'Добавить строку вниз', + 'Add column to left': 'Добавить столбец слева', + 'Add column to right': 'Добавить столбец справа', + 'Remove row': 'Удалить ряд', + 'Remove column': 'Удалить столбец', + 'Align column to left': 'Выровнять по левому краю', + 'Align column to center': 'Выровнять по центру', + 'Align column to right': 'Выровнять по правому краю', + 'Remove table': 'Удалить таблицу', + 'Would you like to paste as table?': 'Вы хотите вставить в виде таблицы?', + 'Text color': 'Цвет текста', + 'Auto scroll enabled': 'Автопрокрутка включена', + 'Auto scroll disabled': 'Автопрокрутка отключена', + 'Choose language': 'Выбрать язык', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/sv-se.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/sv-se.js new file mode 100644 index 0000000..33e0b54 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/sv-se.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Swedish + * @author Magnus Aspling + */ +Editor.setLanguage(['sv', 'sv-SE'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Skriv', + Preview: 'Förhandsgranska', + Headings: 'Överskrifter', + Paragraph: 'Paragraf', + Bold: 'Fet', + Italic: 'Kursiv', + Strike: 'Genomstruken', + Code: 'Kodrad', + Line: 'Linje', + Blockquote: 'Citatblock', + 'Unordered list': 'Punktlista', + 'Ordered list': 'Numrerad lista', + Task: 'Att göra', + Indent: 'Öka indrag', + Outdent: 'Minska indrag', + 'Insert link': 'Infoga länk', + 'Insert CodeBlock': 'Infoga kodblock', + 'Insert table': 'Infoga tabell', + 'Insert image': 'Infoga bild', + Heading: 'Överskrift', + 'Image URL': 'Bildadress', + 'Select image file': 'Välj en bildfil', + 'Choose a file': 'Välj en fil', + 'No file': 'Ingen fil', + Description: 'Beskrivning', + OK: 'OK', + More: 'Mer', + Cancel: 'Avbryt', + File: 'Fil', + URL: 'Adress', + 'Link text': 'Länktext', + 'Add row to up': 'Lägg till rad till upp', + 'Add row to down': 'Lägg till rad till ner', + 'Add column to left': 'Lägg till kolumn till vänster', + 'Add column to right': 'Lägg till kolumn till höger', + 'Remove row': 'Radera rad', + 'Remove column': 'Radera kolumn', + 'Align column to left': 'Vänsterjustera', + 'Align column to center': 'Centrera', + 'Align column to right': 'Högerjustera', + 'Remove table': 'Radera tabell', + 'Would you like to paste as table?': 'Vill du klistra in som en tabell?', + 'Text color': 'Textfärg', + 'Auto scroll enabled': 'Automatisk scroll aktiverad', + 'Auto scroll disabled': 'Automatisk scroll inaktiverad', + 'Choose language': 'Välj språk', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/tr-tr.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/tr-tr.js new file mode 100644 index 0000000..72859e2 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/tr-tr.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Turkish + * @author Mesut Gölcük + */ +Editor.setLanguage(['tr', 'tr-TR'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Düzenle', + Preview: 'Ön izleme', + Headings: 'Başlıklar', + Paragraph: 'Paragraf', + Bold: 'Kalın', + Italic: 'İtalik', + Strike: 'Altı çizgili', + Code: 'Satır içi kod', + Line: 'Çizgi', + Blockquote: 'Alıntı', + 'Unordered list': 'Sıralanmamış liste', + 'Ordered list': 'Sıralı liste', + Task: 'Görev kutusu', + Indent: 'Girintiyi arttır', + Outdent: 'Girintiyi azalt', + 'Insert link': 'Bağlantı ekle', + 'Insert CodeBlock': 'Kod bloku ekle', + 'Insert table': 'Tablo ekle', + 'Insert image': 'İmaj ekle', + Heading: 'Başlık', + 'Image URL': 'İmaj URL', + 'Select image file': 'İmaj dosyası seç', + 'Choose a file': 'Bir dosya seçin', + 'No file': 'Dosya yok', + Description: 'Açıklama', + OK: 'Onay', + More: 'Daha Fazla', + Cancel: 'İptal', + File: 'Dosya', + URL: 'URL', + 'Link text': 'Bağlantı yazısı', + 'Add row to up': 'Yukarı satır ekle', + 'Add row to down': 'Aşağı satır ekle', + 'Add column to left': 'Sola sütun ekleyin', + 'Add column to right': 'Sağa sütun ekle', + 'Remove row': 'Satır sil', + 'Remove column': 'Sütun sil', + 'Align column to left': 'Sola hizala', + 'Align column to center': 'Merkeze hizala', + 'Align column to right': 'Sağa hizala', + 'Remove table': 'Tabloyu kaldır', + 'Would you like to paste as table?': 'Tablo olarak yapıştırmak ister misiniz?', + 'Text color': 'Metin rengi', + 'Auto scroll enabled': 'Otomatik kaydırma açık', + 'Auto scroll disabled': 'Otomatik kaydırma kapalı', + 'Choose language': 'Dil seçiniz', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/uk-ua.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/uk-ua.js new file mode 100644 index 0000000..c29ab6c --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/uk-ua.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Ukrainian + * @author Nikolya + */ +Editor.setLanguage(['uk', 'uk-UA'], { + Markdown: 'Markdown', + WYSIWYG: 'WYSIWYG', + Write: 'Написати', + Preview: 'Попередній перегляд', + Headings: 'Заголовки', + Paragraph: 'Абзац', + Bold: 'Жирний', + Italic: 'Курсив', + Strike: 'Закреслений', + Code: 'Вбудований код', + Line: 'Лінія', + Blockquote: 'Блок цитування', + 'Unordered list': 'Невпорядкований список', + 'Ordered list': 'Упорядкований список', + Task: 'Завдання', + Indent: 'відступ', + Outdent: 'застарілий', + 'Insert link': 'Вставити посилання', + 'Insert CodeBlock': 'Вставити код', + 'Insert table': 'Вставити таблицю', + 'Insert image': 'Вставити зображення', + Heading: 'Заголовок', + 'Image URL': 'URL зображення', + 'Select image file': 'Вибрати файл зображення', + 'Choose a file': 'Виберіть файл', + 'No file': 'Немає файлу', + Description: 'Опис', + OK: 'OK', + More: 'ще', + Cancel: 'Скасувати', + File: 'Файл', + URL: 'URL', + 'Link text': 'Текст посилання', + 'Add row to up': 'Додати рядок вгору', + 'Add row to down': 'Додати рядок вниз', + 'Add column to left': 'Додайте стовпець зліва', + 'Add column to right': 'Додайте стовпець праворуч', + 'Remove row': 'Видалити ряд', + 'Remove column': 'Видалити стовпчик', + 'Align column to left': 'Вирівняти по лівому краю', + 'Align column to center': 'Вирівняти по центру', + 'Align column to right': 'Вирівняти по правому краю', + 'Remove table': 'Видалити таблицю', + 'Would you like to paste as table?': 'Ви хочете вставити у вигляді таблиці?', + 'Text color': 'Колір тексту', + 'Auto scroll enabled': 'Автоматична прокрутка включена', + 'Auto scroll disabled': 'Автоматична прокрутка відключена', + 'Choose language': 'Вибрати мову', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/zh-cn.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/zh-cn.js new file mode 100644 index 0000000..944be99 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/zh-cn.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Chinese + * @author NHN FE Development Lab + */ +Editor.setLanguage('zh-CN', { + Markdown: 'Markdown', + WYSIWYG: '所见即所得', + Write: '编辑', + Preview: '预览', + Headings: '标题', + Paragraph: '文本', + Bold: '加粗', + Italic: '斜体字', + Strike: '删除线', + Code: '内嵌代码', + Line: '水平线', + Blockquote: '引用块', + 'Unordered list': '无序列表', + 'Ordered list': '有序列表', + Task: '任务', + Indent: '缩进', + Outdent: '减少缩进', + 'Insert link': '插入链接', + 'Insert CodeBlock': '插入代码块', + 'Insert table': '插入表格', + 'Insert image': '插入图片', + Heading: '标题', + 'Image URL': '图片网址', + 'Select image file': '选择图片文件', + 'Choose a file': '选择一个文件', + 'No file': '没有文件', + Description: '说明', + OK: '确认', + More: '更多', + Cancel: '取消', + File: '文件', + URL: 'URL', + 'Link text': '链接文本', + 'Add row to up': '向上添加行', + 'Add row to down': '在下方添加行', + 'Add column to left': '在左侧添加列', + 'Add column to right': '在右侧添加列', + 'Remove row': '删除行', + 'Remove column': '删除列', + 'Align column to left': '左对齐', + 'Align column to center': '居中对齐', + 'Align column to right': '右对齐', + 'Remove table': '删除表格', + 'Would you like to paste as table?': '需要粘贴为表格吗?', + 'Text color': '文字颜色', + 'Auto scroll enabled': '自动滚动已启用', + 'Auto scroll disabled': '自动滚动已禁用', + 'Choose language': '选择语言', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/zh-tw.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/zh-tw.js new file mode 100644 index 0000000..17ef4a5 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/i18n/zh-tw.js @@ -0,0 +1,63 @@ +/** + * @toast-ui/editor : i18n + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import Editor from '@toast-ui/editor'; + +/** + * @fileoverview I18N for Traditional Chinese + * @author Tzu-Ray Su + */ +Editor.setLanguage('zh-TW', { + Markdown: 'Markdown', + WYSIWYG: '所見即所得', + Write: '編輯', + Preview: '預覽', + Headings: '標題', + Paragraph: '內文', + Bold: '粗體', + Italic: '斜體', + Strike: '刪除線', + Code: '內嵌程式碼', + Line: '分隔線', + Blockquote: '引言', + 'Unordered list': '項目符號清單', + 'Ordered list': '編號清單', + Task: '核取方塊清單', + Indent: '增加縮排', + Outdent: '減少縮排', + 'Insert link': '插入超連結', + 'Insert CodeBlock': '插入程式碼區塊', + 'Insert table': '插入表格', + 'Insert image': '插入圖片', + Heading: '標題', + 'Image URL': '圖片網址', + 'Select image file': '選擇圖片檔案', + 'Choose a file': '選擇一個文件', + 'No file': '沒有文件', + Description: '描述', + OK: '確認', + More: '更多', + Cancel: '取消', + File: '檔案', + URL: 'URL', + 'Link text': '超連結文字', + 'Add row to up': '向上添加行', + 'Add row to down': '在下方添加行', + 'Add column to left': '在左側添加列', + 'Add column to right': '在右側添加列', + 'Remove row': '刪除行', + 'Remove column': '刪除列', + 'Align column to left': '靠左對齊', + 'Align column to center': '置中', + 'Align column to right': '靠右對齊', + 'Remove table': '刪除表格', + 'Would you like to paste as table?': '您要以表格貼上嗎?', + 'Text color': '文字顏色', + 'Auto scroll enabled': '已啟用自動滾動', + 'Auto scroll disabled': '已停用自動滾動', + 'Choose language': '選擇語言', +}); diff --git a/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/index.js b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/index.js new file mode 100644 index 0000000..d54a056 --- /dev/null +++ b/src/main/resources/static/node_modules/@toast-ui/editor/dist/esm/index.js @@ -0,0 +1,25418 @@ +/** + * @toast-ui/editor + * @version 3.1.1 | Wed Oct 27 2021 + * @author NHN FE Development Lab + * @license MIT + */ + +import { Fragment, Schema, Slice, NodeRange, Mark as Mark$1, DOMParser, Node as Node$3 } from 'prosemirror-model'; +import { DecorationSet, Decoration, EditorView } from 'prosemirror-view'; +import { ReplaceAroundStep, liftTarget, canSplit, StepMap } from 'prosemirror-transform'; +import { TextSelection, Plugin, PluginKey, EditorState, AllSelection, Selection, SelectionRange, NodeSelection } from 'prosemirror-state'; +import { keymap } from 'prosemirror-keymap'; +import { deleteSelection, selectAll, baseKeymap, chainCommands, joinForward, newlineInCode, setBlockType, wrapIn, toggleMark as toggleMark$1, exitCode } from 'prosemirror-commands'; +import { InputRule, inputRules } from 'prosemirror-inputrules'; +import { undo, redo, history, undoDepth } from 'prosemirror-history'; + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics$1 = function(d, b) { + extendStatics$1 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics$1(d, b); +}; + +function __extends$1(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics$1(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var __assign$1 = function() { + __assign$1 = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign$1.apply(this, arguments); +}; + +function __spreadArray$1(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +} + +/** + * @fileoverview Execute the provided callback once for each property of object which actually exist. + * @author NHN FE Development Lab + */ + +/** + * Execute the provided callback once for each property of object which actually exist. + * If the callback function returns false, the loop will be stopped. + * Callback function(iteratee) is invoked with three arguments: + * 1) The value of the property + * 2) The name of the property + * 3) The object being traversed + * @param {Object} obj The object that will be traversed + * @param {function} iteratee Callback function + * @param {Object} [context] Context(this) of callback function + * @memberof module:collection + * @example + * // ES6 + * import forEachOwnProperties from 'tui-code-snippet/collection/forEachOwnProperties'; + * + * // CommonJS + * const forEachOwnProperties = require('tui-code-snippet/collection/forEachOwnProperties'); + * + * let sum = 0; + * + * forEachOwnProperties({a:1,b:2,c:3}, function(value){ + * sum += value; + * }); + * alert(sum); // 6 + */ +function forEachOwnProperties$2(obj, iteratee, context) { + var key; + + context = context || null; + + for (key in obj) { + if (obj.hasOwnProperty(key)) { + if (iteratee.call(context, obj[key], key, obj) === false) { + break; + } + } + } +} + +var forEachOwnProperties_1 = forEachOwnProperties$2; + +/** + * @fileoverview Extend the target object from other objects. + * @author NHN FE Development Lab + */ + +/** + * @module object + */ + +/** + * Extend the target object from other objects. + * @param {object} target - Object that will be extended + * @param {...object} objects - Objects as sources + * @returns {object} Extended object + * @memberof module:object + */ +function extend(target, objects) { // eslint-disable-line no-unused-vars + var hasOwnProp = Object.prototype.hasOwnProperty; + var source, prop, i, len; + + for (i = 1, len = arguments.length; i < len; i += 1) { + source = arguments[i]; + for (prop in source) { + if (hasOwnProp.call(source, prop)) { + target[prop] = source[prop]; + } + } + } + + return target; +} + +var extend_1 = extend; + +/** + * @fileoverview Check whether the given variable is a string or not. + * @author NHN FE Development Lab + */ + +/** + * Check whether the given variable is a string or not. + * If the given variable is a string, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is string? + * @memberof module:type + */ +function isString$3(obj) { + return typeof obj === 'string' || obj instanceof String; +} + +var isString_1 = isString$3; + +/** + * @fileoverview Check whether the given variable is an instance of Array or not. + * @author NHN FE Development Lab + */ + +/** + * Check whether the given variable is an instance of Array or not. + * If the given variable is an instance of Array, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is array instance? + * @memberof module:type + */ +function isArray$3(obj) { + return obj instanceof Array; +} + +var isArray_1 = isArray$3; + +/** + * @fileoverview Execute the provided callback once for each element present in the array(or Array-like object) in ascending order. + * @author NHN FE Development Lab + */ + +/** + * Execute the provided callback once for each element present + * in the array(or Array-like object) in ascending order. + * If the callback function returns false, the loop will be stopped. + * Callback function(iteratee) is invoked with three arguments: + * 1) The value of the element + * 2) The index of the element + * 3) The array(or Array-like object) being traversed + * @param {Array|Arguments|NodeList} arr The array(or Array-like object) that will be traversed + * @param {function} iteratee Callback function + * @param {Object} [context] Context(this) of callback function + * @memberof module:collection + * @example + * // ES6 + * import forEachArray from 'tui-code-snippet/collection/forEachArray'; + * + * // CommonJS + * const forEachArray = require('tui-code-snippet/collection/forEachArray'); + * + * let sum = 0; + * + * forEachArray([1,2,3], function(value){ + * sum += value; + * }); + * alert(sum); // 6 + */ +function forEachArray$3(arr, iteratee, context) { + var index = 0; + var len = arr.length; + + context = context || null; + + for (; index < len; index += 1) { + if (iteratee.call(context, arr[index], index, arr) === false) { + break; + } + } +} + +var forEachArray_1 = forEachArray$3; + +/** + * @fileoverview Execute the provided callback once for each property of object(or element of array) which actually exist. + * @author NHN FE Development Lab + */ + +var isArray$2 = isArray_1; +var forEachArray$2 = forEachArray_1; +var forEachOwnProperties$1 = forEachOwnProperties_1; + +/** + * @module collection + */ + +/** + * Execute the provided callback once for each property of object(or element of array) which actually exist. + * If the object is Array-like object(ex-arguments object), It needs to transform to Array.(see 'ex2' of example). + * If the callback function returns false, the loop will be stopped. + * Callback function(iteratee) is invoked with three arguments: + * 1) The value of the property(or The value of the element) + * 2) The name of the property(or The index of the element) + * 3) The object being traversed + * @param {Object} obj The object that will be traversed + * @param {function} iteratee Callback function + * @param {Object} [context] Context(this) of callback function + * @memberof module:collection + * @example + * // ES6 + * import forEach from 'tui-code-snippet/collection/forEach'; + * + * // CommonJS + * const forEach = require('tui-code-snippet/collection/forEach'); + * + * let sum = 0; + * + * forEach([1,2,3], function(value){ + * sum += value; + * }); + * alert(sum); // 6 + * + * // In case of Array-like object + * const array = Array.prototype.slice.call(arrayLike); // change to array + * forEach(array, function(value){ + * sum += value; + * }); + */ +function forEach$4(obj, iteratee, context) { + if (isArray$2(obj)) { + forEachArray$2(obj, iteratee, context); + } else { + forEachOwnProperties$1(obj, iteratee, context); + } +} + +var forEach_1 = forEach$4; + +/** + * @fileoverview Setting element style + * @author NHN FE Development Lab + */ + +var isString$2 = isString_1; +var forEach$3 = forEach_1; + +/** + * Setting element style + * @param {(HTMLElement|SVGElement)} element - element to setting style + * @param {(string|object)} key - style prop name or {prop: value} pair object + * @param {string} [value] - style value + * @memberof module:domUtil + */ +function css(element, key, value) { + var style = element.style; + + if (isString$2(key)) { + style[key] = value; + + return; + } + + forEach$3(key, function(v, k) { + style[k] = v; + }); +} + +var css_1 = css; + +/* eslint-disable complexity */ + +var isArray$1 = isArray_1; + +/** + * @module array + */ + +/** + * Returns the first index at which a given element can be found in the array + * from start index(default 0), or -1 if it is not present. + * It compares searchElement to elements of the Array using strict equality + * (the same method used by the ===, or triple-equals, operator). + * @param {*} searchElement Element to locate in the array + * @param {Array} array Array that will be traversed. + * @param {number} startIndex Start index in array for searching (default 0) + * @returns {number} the First index at which a given element, or -1 if it is not present + * @memberof module:array + * @example + * // ES6 + * import inArray from 'tui-code-snippet/array/inArray'; + * + * // CommonJS + * const inArray = require('tui-code-snippet/array/inArray'); + * + * const arr = ['one', 'two', 'three', 'four']; + * const idx1 = inArray('one', arr, 3); // -1 + * const idx2 = inArray('one', arr); // 0 + */ +function inArray$4(searchElement, array, startIndex) { + var i; + var length; + startIndex = startIndex || 0; + + if (!isArray$1(array)) { + return -1; + } + + if (Array.prototype.indexOf) { + return Array.prototype.indexOf.call(array, searchElement, startIndex); + } + + length = array.length; + for (i = startIndex; startIndex >= 0 && i < length; i += 1) { + if (array[i] === searchElement) { + return i; + } + } + + return -1; +} + +var inArray_1 = inArray$4; + +/** + * @fileoverview Check whether the given variable is undefined or not. + * @author NHN FE Development Lab + */ + +/** + * Check whether the given variable is undefined or not. + * If the given variable is undefined, returns true. + * @param {*} obj - Target for checking + * @returns {boolean} Is undefined? + * @memberof module:type + */ +function isUndefined$4(obj) { + return obj === undefined; // eslint-disable-line no-undefined +} + +var isUndefined_1 = isUndefined$4; + +/** + * @fileoverview Get HTML element's design classes. + * @author NHN FE Development Lab + */ + +var isUndefined$3 = isUndefined_1; + +/** + * Get HTML element's design classes. + * @param {(HTMLElement|SVGElement)} element target element + * @returns {string} element css class name + * @memberof module:domUtil + */ +function getClass$3(element) { + if (!element || !element.className) { + return ''; + } + + if (isUndefined$3(element.className.baseVal)) { + return element.className; + } + + return element.className.baseVal; +} + +var getClass_1 = getClass$3; + +/** + * @fileoverview Set className value + * @author NHN FE Development Lab + */ + +var isArray = isArray_1; +var isUndefined$2 = isUndefined_1; + +/** + * Set className value + * @param {(HTMLElement|SVGElement)} element - target element + * @param {(string|string[])} cssClass - class names + * @private + */ +function setClassName$2(element, cssClass) { + cssClass = isArray(cssClass) ? cssClass.join(' ') : cssClass; + + cssClass = cssClass.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + + if (isUndefined$2(element.className.baseVal)) { + element.className = cssClass; + + return; + } + + element.className.baseVal = cssClass; +} + +var _setClassName = setClassName$2; + +/** + * @fileoverview Add css class to element + * @author NHN FE Development Lab + */ + +var forEach$2 = forEach_1; +var inArray$3 = inArray_1; +var getClass$2 = getClass_1; +var setClassName$1 = _setClassName; + +/** + * domUtil module + * @module domUtil + */ + +/** + * Add css class to element + * @param {(HTMLElement|SVGElement)} element - target element + * @param {...string} cssClass - css classes to add + * @memberof module:domUtil + */ +function addClass(element) { + var cssClass = Array.prototype.slice.call(arguments, 1); + var classList = element.classList; + var newClass = []; + var origin; + + if (classList) { + forEach$2(cssClass, function(name) { + element.classList.add(name); + }); + + return; + } + + origin = getClass$2(element); + + if (origin) { + cssClass = [].concat(origin.split(/\s+/), cssClass); + } + + forEach$2(cssClass, function(cls) { + if (inArray$3(cls, newClass) < 0) { + newClass.push(cls); + } + }); + + setClassName$1(element, newClass); +} + +var addClass_1 = addClass; + +/** + * @fileoverview Remove css class from element + * @author NHN FE Development Lab + */ + +var forEachArray$1 = forEachArray_1; +var inArray$2 = inArray_1; +var getClass$1 = getClass_1; +var setClassName = _setClassName; + +/** + * Remove css class from element + * @param {(HTMLElement|SVGElement)} element - target element + * @param {...string} cssClass - css classes to remove + * @memberof module:domUtil + */ +function removeClass(element) { + var cssClass = Array.prototype.slice.call(arguments, 1); + var classList = element.classList; + var origin, newClass; + + if (classList) { + forEachArray$1(cssClass, function(name) { + classList.remove(name); + }); + + return; + } + + origin = getClass$1(element).split(/\s+/); + newClass = []; + forEachArray$1(origin, function(name) { + if (inArray$2(name, cssClass) < 0) { + newClass.push(name); + } + }); + + setClassName(element, newClass); +} + +var removeClass_1 = removeClass; + +/** + * @fileoverview Check whether the given variable is a number or not. + * @author NHN FE Development Lab + */ + +/** + * Check whether the given variable is a number or not. + * If the given variable is a number, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is number? + * @memberof module:type + */ +function isNumber(obj) { + return typeof obj === 'number' || obj instanceof Number; +} + +var isNumber_1 = isNumber; + +/** + * @fileoverview Check whether the given variable is null or not. + * @author NHN FE Development Lab + */ + +/** + * Check whether the given variable is null or not. + * If the given variable(arguments[0]) is null, returns true. + * @param {*} obj - Target for checking + * @returns {boolean} Is null? + * @memberof module:type + */ +function isNull$1(obj) { + return obj === null; +} + +var isNull_1 = isNull$1; + +/** + * @fileoverview Request image ping. + * @author NHN FE Development Lab + */ + +var forEachOwnProperties = forEachOwnProperties_1; + +/** + * @module request + */ + +/** + * Request image ping. + * @param {String} url url for ping request + * @param {Object} trackingInfo infos for make query string + * @returns {HTMLElement} + * @memberof module:request + * @example + * // ES6 + * import imagePing from 'tui-code-snippet/request/imagePing'; + * + * // CommonJS + * const imagePing = require('tui-code-snippet/request/imagePing'); + * + * imagePing('https://www.google-analytics.com/collect', { + * v: 1, + * t: 'event', + * tid: 'trackingid', + * cid: 'cid', + * dp: 'dp', + * dh: 'dh' + * }); + */ +function imagePing$1(url, trackingInfo) { + var trackingElement = document.createElement('img'); + var queryString = ''; + forEachOwnProperties(trackingInfo, function(value, key) { + queryString += '&' + key + '=' + value; + }); + queryString = queryString.substring(1); + + trackingElement.src = url + '?' + queryString; + + trackingElement.style.display = 'none'; + document.body.appendChild(trackingElement); + document.body.removeChild(trackingElement); + + return trackingElement; +} + +var imagePing_1 = imagePing$1; + +/** + * @fileoverview Send hostname on DOMContentLoaded. + * @author NHN FE Development Lab + */ + +var isUndefined$1 = isUndefined_1; +var imagePing = imagePing_1; + +var ms7days = 7 * 24 * 60 * 60 * 1000; + +/** + * Check if the date has passed 7 days + * @param {number} date - milliseconds + * @returns {boolean} + * @private + */ +function isExpired(date) { + var now = new Date().getTime(); + + return now - date > ms7days; +} + +/** + * Send hostname on DOMContentLoaded. + * To prevent hostname set tui.usageStatistics to false. + * @param {string} appName - application name + * @param {string} trackingId - GA tracking ID + * @ignore + */ +function sendHostname(appName, trackingId) { + var url = 'https://www.google-analytics.com/collect'; + var hostname = location.hostname; + var hitType = 'event'; + var eventCategory = 'use'; + var applicationKeyForStorage = 'TOAST UI ' + appName + ' for ' + hostname + ': Statistics'; + var date = window.localStorage.getItem(applicationKeyForStorage); + + // skip if the flag is defined and is set to false explicitly + if (!isUndefined$1(window.tui) && window.tui.usageStatistics === false) { + return; + } + + // skip if not pass seven days old + if (date && !isExpired(date)) { + return; + } + + window.localStorage.setItem(applicationKeyForStorage, new Date().getTime()); + + setTimeout(function() { + if (document.readyState === 'interactive' || document.readyState === 'complete') { + imagePing(url, { + v: 1, + t: hitType, + tid: trackingId, + cid: hostname, + dp: hostname, + dh: appName, + el: appName, + ec: eventCategory + }); + } + }, 1000); +} + +var sendHostname_1 = sendHostname; + +/Mac/.test(navigator.platform); +var reSpaceMoreThanOne = /[\u0020]+/g; +var reEscapeChars$1 = /[>(){}[\]+-.!#|]/g; +var reEscapeHTML = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\/>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>||<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g; +var reEscapeBackSlash = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g; +var reEscapePairedChars = /[*_~`]/g; +function sendHostName() { + sendHostname_1('editor', 'UA-129966929-1'); +} +function includes(arr, targetItem) { + return arr.indexOf(targetItem) !== -1; +} +var availableLinkAttributes = ['rel', 'target', 'hreflang', 'type']; +var reMarkdownTextToEscapeMap = { + codeblock: /(^ {4}[^\n]+\n*)+/, + thematicBreak: /^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */, + atxHeading: /^(#{1,6}) +[\s\S]+/, + seTextheading: /^([^\n]+)\n *(=|-){2,} */, + blockquote: /^( *>[^\n]+.*)+/, + list: /^ *(\*+|-+|\d+\.) [\s\S]+/, + def: /^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? */, + link: /!?\[.*\]\(.*\)/, + reflink: /!?\[.*\]\s*\[([^\]]*)\]/, + verticalBar: /\u007C/, + fencedCodeblock: /^((`|~){3,})/, +}; +function sanitizeLinkAttribute(attribute) { + if (!attribute) { + return null; + } + var linkAttributes = {}; + availableLinkAttributes.forEach(function (key) { + if (!isUndefined_1(attribute[key])) { + linkAttributes[key] = attribute[key]; + } + }); + return linkAttributes; +} +function repeat$1(text, count) { + var result = ''; + for (var i = 0; i < count; i += 1) { + result += text; + } + return result; +} +function isNeedEscapeText(text) { + var needEscape = false; + forEachOwnProperties_1(reMarkdownTextToEscapeMap, function (reMarkdownTextToEscape) { + if (reMarkdownTextToEscape.test(text)) { + needEscape = true; + } + return !needEscape; + }); + return needEscape; +} +function escape$1(text) { + var replacer = function (matched) { return "\\" + matched; }; + var escapedText = text.replace(reSpaceMoreThanOne, ' '); + if (reEscapeBackSlash.test(escapedText)) { + escapedText = escapedText.replace(reEscapeBackSlash, replacer); + } + escapedText = escapedText.replace(reEscapePairedChars, replacer); + if (reEscapeHTML.test(escapedText)) { + escapedText = escapedText.replace(reEscapeHTML, replacer); + } + if (isNeedEscapeText(escapedText)) { + escapedText = escapedText.replace(reEscapeChars$1, replacer); + } + return escapedText; +} +function quote(text) { + var result; + if (text.indexOf('"') === -1) { + result = '""'; + } + else { + result = text.indexOf("'") === -1 ? "''" : '()'; + } + return result[0] + text + result[1]; +} +function isNil(value) { + return isNull_1(value) || isUndefined_1(value); +} +function shallowEqual(o1, o2) { + if (o1 === null && o1 === o2) { + return true; + } + if (typeof o1 !== 'object' || typeof o2 !== 'object' || isNil(o1) || isNil(o2)) { + return o1 === o2; + } + for (var key in o1) { + if (o1[key] !== o2[key]) { + return false; + } + } + for (var key in o2) { + if (!(key in o1)) { + return false; + } + } + return true; +} +function last$1(arr) { + return arr[arr.length - 1]; +} +function between$1(value, min, max) { + return value >= min && value <= max; +} +function isObject$1(obj) { + return typeof obj === 'object' && obj !== null; +} +function deepMergedCopy(targetObj, obj) { + var resultObj = __assign$1({}, targetObj); + if (targetObj && obj) { + Object.keys(obj).forEach(function (prop) { + if (isObject$1(resultObj[prop])) { + if (Array.isArray(obj[prop])) { + resultObj[prop] = deepCopyArray(obj[prop]); + } + else if (resultObj.hasOwnProperty(prop)) { + resultObj[prop] = deepMergedCopy(resultObj[prop], obj[prop]); + } + else { + resultObj[prop] = deepCopy(obj[prop]); + } + } + else { + resultObj[prop] = obj[prop]; + } + }); + } + return resultObj; +} +function deepCopyArray(items) { + return items.map(function (item) { + if (isObject$1(item)) { + return Array.isArray(item) ? deepCopyArray(item) : deepCopy(item); + } + return item; + }); +} +function deepCopy(obj) { + var keys = Object.keys(obj); + if (!keys.length) { + return obj; + } + return keys.reduce(function (acc, prop) { + if (isObject$1(obj[prop])) { + acc[prop] = Array.isArray(obj[prop]) ? deepCopyArray(obj[prop]) : deepCopy(obj[prop]); + } + else { + acc[prop] = obj[prop]; + } + return acc; + }, {}); +} +function assign(targetObj, obj) { + if (obj === void 0) { obj = {}; } + Object.keys(obj).forEach(function (prop) { + if (targetObj.hasOwnProperty(prop) && typeof targetObj[prop] === 'object') { + if (Array.isArray(obj[prop])) { + targetObj[prop] = obj[prop]; + } + else { + assign(targetObj[prop], obj[prop]); + } + } + else { + targetObj[prop] = obj[prop]; + } + }); + return targetObj; +} +function getSortedNumPair(valueA, valueB) { + return valueA > valueB ? [valueB, valueA] : [valueA, valueB]; +} + +function createParagraph(schema, content) { + var paragraph = schema.nodes.paragraph; + if (!content) { + return paragraph.createAndFill(); + } + return paragraph.create(null, isString_1(content) ? schema.text(content) : content); +} +function createTextNode$1(schema, text, marks) { + return schema.text(text, marks); +} +function createTextSelection(tr, from, to) { + if (to === void 0) { to = from; } + var contentSize = tr.doc.content.size; + var size = contentSize > 0 ? contentSize - 1 : 1; + return TextSelection.create(tr.doc, Math.min(from, size), Math.min(to, size)); +} +function addParagraph(tr, _a, schema) { + var pos = _a.pos; + tr.replaceWith(pos, pos, createParagraph(schema)); + return tr.setSelection(createTextSelection(tr, pos + 1)); +} +function replaceTextNode(_a) { + var state = _a.state, from = _a.from, startIndex = _a.startIndex, endIndex = _a.endIndex, createText = _a.createText; + var tr = state.tr, doc = state.doc, schema = state.schema; + for (var i = startIndex; i <= endIndex; i += 1) { + var _b = doc.child(i), nodeSize = _b.nodeSize, textContent = _b.textContent, content = _b.content; + var text = createText(textContent); + var node = text ? createTextNode$1(schema, text) : Fragment.empty; + var mappedFrom = tr.mapping.map(from); + var mappedTo = mappedFrom + content.size; + tr.replaceWith(mappedFrom, mappedTo, node); + from += nodeSize; + } + return tr; +} +function splitAndExtendBlock(tr, pos, text, node) { + var textLen = text.length; + tr.split(pos) + .delete(pos - textLen, pos) + .insert(tr.mapping.map(pos), node) + .setSelection(createTextSelection(tr, tr.mapping.map(pos) - textLen)); +} + +function getMdStartLine(mdNode) { + return mdNode.sourcepos[0][0]; +} +function getMdEndLine(mdNode) { + return mdNode.sourcepos[1][0]; +} +function getMdStartCh(mdNode) { + return mdNode.sourcepos[0][1]; +} +function getMdEndCh(mdNode) { + return mdNode.sourcepos[1][1]; +} +function isHTMLNode(mdNode) { + var type = mdNode.type; + return type === 'htmlBlock' || type === 'htmlInline'; +} +function isStyledInlineNode(mdNode) { + var type = mdNode.type; + return (type === 'strike' || + type === 'strong' || + type === 'emph' || + type === 'code' || + type === 'link' || + type === 'image'); +} +function isCodeBlockNode(mdNode) { + return mdNode && mdNode.type === 'codeBlock'; +} +function isListNode$1(mdNode) { + return mdNode && (mdNode.type === 'item' || mdNode.type === 'list'); +} +function isOrderedListNode(mdNode) { + return isListNode$1(mdNode) && mdNode.listData.type === 'ordered'; +} +function isBulletListNode(mdNode) { + return isListNode$1(mdNode) && mdNode.listData.type !== 'ordered'; +} +function isTableCellNode(mdNode) { + return mdNode && (mdNode.type === 'tableCell' || mdNode.type === 'tableDelimCell'); +} +function isInlineNode$1(mdNode) { + switch (mdNode.type) { + case 'code': + case 'text': + case 'emph': + case 'strong': + case 'strike': + case 'link': + case 'image': + case 'htmlInline': + case 'linebreak': + case 'softbreak': + case 'customInline': + return true; + default: + return false; + } +} +function findClosestNode(mdNode, condition, includeSelf) { + if (includeSelf === void 0) { includeSelf = true; } + mdNode = includeSelf ? mdNode : mdNode.parent; + while (mdNode && mdNode.type !== 'document') { + if (condition(mdNode)) { + return mdNode; + } + mdNode = mdNode.parent; + } + return null; +} +function traverseParentNodes(mdNode, iteratee, includeSelf) { + if (includeSelf === void 0) { includeSelf = true; } + mdNode = includeSelf ? mdNode : mdNode.parent; + while (mdNode && mdNode.type !== 'document') { + iteratee(mdNode); + mdNode = mdNode.parent; + } +} +function addOffsetPos(originPos, offset) { + return [originPos[0], originPos[1] + offset]; +} +function setOffsetPos(originPos, newOffset) { + return [originPos[0], newOffset]; +} +function getInlineMarkdownText(mdNode) { + var text = mdNode.firstChild.literal; + switch (mdNode.type) { + case 'emph': + return "*" + text + "*"; + case 'strong': + return "**" + text + "**"; + case 'strike': + return "~~" + text + "~~"; + case 'code': + return "`" + text + "`"; + case 'link': + case 'image': + /* eslint-disable no-case-declarations */ + var _a = mdNode, destination = _a.destination, title = _a.title; + var delim = mdNode.type === 'link' ? '' : '!'; + return delim + "[" + text + "](" + destination + (title ? " \"" + title + "\"" : '') + ")"; + default: + return null; + } +} +function isContainer$2(node) { + switch (node.type) { + case 'document': + case 'blockQuote': + case 'list': + case 'item': + case 'paragraph': + case 'heading': + case 'emph': + case 'strong': + case 'strike': + case 'link': + case 'image': + case 'table': + case 'tableHead': + case 'tableBody': + case 'tableRow': + case 'tableCell': + case 'tableDelimRow': + case 'customInline': + return true; + default: + return false; + } +} +function getChildrenText$1(node) { + var buffer = []; + var walker = node.walker(); + var event = null; + while ((event = walker.next())) { + var childNode = event.node; + if (childNode.type === 'text') { + buffer.push(childNode.literal); + } + } + return buffer.join(''); +} + +var widgetRules = []; +var widgetRuleMap = {}; +var reWidgetPrefix = /\$\$widget\d+\s/; +function unwrapWidgetSyntax(text) { + var index = text.search(reWidgetPrefix); + if (index !== -1) { + var rest = text.substring(index); + var replaced = rest.replace(reWidgetPrefix, '').replace('$$', ''); + text = text.substring(0, index); + text += unwrapWidgetSyntax(replaced); + } + return text; +} +function createWidgetContent(info, text) { + return "$$" + info + " " + text + "$$"; +} +function widgetToDOM(info, text) { + var _a = widgetRuleMap[info], rule = _a.rule, toDOM = _a.toDOM; + text = unwrapWidgetSyntax(text).match(rule)[0]; + return toDOM(text); +} +function getWidgetRules() { + return widgetRules; +} +function setWidgetRules(rules) { + widgetRules = rules; + widgetRules.forEach(function (rule, index) { + widgetRuleMap["widget" + index] = rule; + }); +} +function mergeNodes(nodes, text, schema, ruleIndex) { + return nodes.concat(createNodesWithWidget(text, schema, ruleIndex)); +} +/** + * create nodes with plain text and replace text matched to the widget rules with the widget node + * For example, in case the text and widget rules as below + * + * text: $test plain text #test + * widget rules: [{ rule: /$.+/ }, { rule: /#.+/ }] + * + * The creating node process is recursive and is as follows. + * + * in first widget rule(/$.+/) + * $test -> widget node + * plain text -> match with next widget rule + * #test -> match with next widget rule + * + * in second widget rule(/#.+/) + * plain text -> text node(no rule for matching) + * #test -> widget node + */ +function createNodesWithWidget(text, schema, ruleIndex) { + if (ruleIndex === void 0) { ruleIndex = 0; } + var nodes = []; + var rule = (widgetRules[ruleIndex] || {}).rule; + var nextRuleIndex = ruleIndex + 1; + text = unwrapWidgetSyntax(text); + if (rule && rule.test(text)) { + var index = void 0; + while ((index = text.search(rule)) !== -1) { + var prev = text.substring(0, index); + // get widget node on first splitted text using next widget rule + if (prev) { + nodes = mergeNodes(nodes, prev, schema, nextRuleIndex); + } + // build widget node using current widget rule + text = text.substring(index); + var literal = text.match(rule)[0]; + var info = "widget" + ruleIndex; + nodes.push(schema.nodes.widget.create({ info: info }, schema.text(createWidgetContent(info, literal)))); + text = text.substring(literal.length); + } + // get widget node on last splitted text using next widget rule + if (text) { + nodes = mergeNodes(nodes, text, schema, nextRuleIndex); + } + } + else if (text) { + nodes = + ruleIndex < widgetRules.length - 1 + ? mergeNodes(nodes, text, schema, nextRuleIndex) + : [schema.text(text)]; + } + return nodes; +} +function getWidgetContent(widgetNode) { + var event; + var text = ''; + var walker = widgetNode.walker(); + while ((event = walker.next())) { + var node = event.node, entering = event.entering; + if (entering) { + if (node !== widgetNode && node.type !== 'text') { + text += getInlineMarkdownText(node); + // skip the children + walker.resumeAt(widgetNode, false); + walker.next(); + } + else if (node.type === 'text') { + text += node.literal; + } + } + } + return text; +} + +function getDefaultCommands() { + return { + deleteSelection: function () { return deleteSelection; }, + selectAll: function () { return selectAll; }, + undo: function () { return undo; }, + redo: function () { return redo; }, + }; +} + +function placeholder(options) { + return new Plugin({ + props: { + decorations: function (state) { + var doc = state.doc; + if (options.text && + doc.childCount === 1 && + doc.firstChild.isTextblock && + doc.firstChild.content.size === 0) { + var placeHolder = document.createElement('span'); + addClass_1(placeHolder, 'placeholder'); + if (options.className) { + addClass_1(placeHolder, options.className); + } + placeHolder.textContent = options.text; + return DecorationSet.create(doc, [Decoration.widget(1, placeHolder)]); + } + return null; + }, + }, + }); +} + +var pluginKey$1 = new PluginKey('widget'); +var PopupWidget = /** @class */ (function () { + function PopupWidget(eventEmitter) { + var _this = this; + this.popup = null; + this.removeWidget = function () { + if (_this.popup) { + document.body.removeChild(_this.popup); + _this.popup = null; + } + }; + this.eventEmitter = eventEmitter; + this.eventEmitter.listen('blur', this.removeWidget); + this.eventEmitter.listen('removePopupWidget', this.removeWidget); + } + PopupWidget.prototype.update = function (view) { + var widget = pluginKey$1.getState(view.state); + this.removeWidget(); + if (widget) { + var node = widget.node, style = widget.style; + var _a = view.coordsAtPos(widget.pos), top_1 = _a.top, left = _a.left, bottom = _a.bottom; + var height = bottom - top_1; + css_1(node, { position: 'absolute', left: left + "px", opacity: '0' }); + document.body.appendChild(node); + css_1(node, { + top: (style === 'bottom' ? top_1 + height : top_1 - node.clientHeight - height) + "px", + opacity: '1', + }); + this.popup = node; + view.focus(); + } + }; + PopupWidget.prototype.destroy = function () { + this.eventEmitter.removeEventHandler('blur', this.removeWidget); + }; + return PopupWidget; +}()); +function addWidget(eventEmitter) { + return new Plugin({ + key: pluginKey$1, + state: { + init: function () { + return null; + }, + apply: function (tr) { + return tr.getMeta('widget'); + }, + }, + view: function () { + return new PopupWidget(eventEmitter); + }, + }); +} + +/** + * @fileoverview Transform the Array-like object to Array. + * @author NHN FE Development Lab + */ + +var forEachArray = forEachArray_1; + +/** + * Transform the Array-like object to Array. + * In low IE (below 8), Array.prototype.slice.call is not perfect. So, try-catch statement is used. + * @param {*} arrayLike Array-like object + * @returns {Array} Array + * @memberof module:collection + * @example + * // ES6 + * import toArray from 'tui-code-snippet/collection/toArray'; + * + * // CommonJS + * const toArray = require('tui-code-snippet/collection/toArray'); + * + * const arrayLike = { + * 0: 'one', + * 1: 'two', + * 2: 'three', + * 3: 'four', + * length: 4 + * }; + * const result = toArray(arrayLike); + * + * alert(result instanceof Array); // true + * alert(result); // one,two,three,four + */ +function toArray$1(arrayLike) { + var arr; + try { + arr = Array.prototype.slice.call(arrayLike); + } catch (e) { + arr = []; + forEachArray(arrayLike, function(value) { + arr.push(value); + }); + } + + return arr; +} + +var toArray_1 = toArray$1; + +function addDefaultImageBlobHook(eventEmitter) { + eventEmitter.listen('addImageBlobHook', function (blob, callback) { + var reader = new FileReader(); + reader.onload = function (_a) { + var target = _a.target; + return callback(target.result); + }; + reader.readAsDataURL(blob); + }); +} +function emitImageBlobHook(eventEmitter, blob, type) { + var hook = function (imageUrl, altText) { + eventEmitter.emit('command', 'addImage', { + imageUrl: imageUrl, + altText: altText || blob.name || 'image', + }); + }; + eventEmitter.emit('addImageBlobHook', blob, hook, type); +} +function pasteImageOnly(items) { + var images = toArray_1(items).filter(function (_a) { + var type = _a.type; + return type.indexOf('image') !== -1; + }); + if (images.length === 1) { + var item = images[0]; + if (item) { + return item.getAsFile(); + } + } + return null; +} + +function dropImage(_a) { + var eventEmitter = _a.eventEmitter; + return new Plugin({ + props: { + handleDOMEvents: { + drop: function (_, ev) { + var _a; + var items = (_a = ev.dataTransfer) === null || _a === void 0 ? void 0 : _a.files; + if (items) { + forEachArray_1(items, function (item) { + if (item.type.indexOf('image') !== -1) { + ev.preventDefault(); + ev.stopPropagation(); + emitImageBlobHook(eventEmitter, item, ev.type); + return false; + } + return true; + }); + } + return true; + }, + }, + }, + }); +} + +var Node$2 = /** @class */ (function () { + function Node() { + } + Object.defineProperty(Node.prototype, "type", { + get: function () { + return 'node'; + }, + enumerable: false, + configurable: true + }); + Node.prototype.setContext = function (context) { + this.context = context; + }; + return Node; +}()); + +function widgetNodeView(pmNode) { + var dom = document.createElement('span'); + var node = widgetToDOM(pmNode.attrs.info, pmNode.textContent); + dom.className = 'tui-widget'; + dom.appendChild(node); + return { dom: dom }; +} +function isWidgetNode(pmNode) { + return pmNode.type.name === 'widget'; +} +var Widget = /** @class */ (function (_super) { + __extends$1(Widget, _super); + function Widget() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Widget.prototype, "name", { + get: function () { + return 'widget'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Widget.prototype, "schema", { + get: function () { + return { + attrs: { + info: { default: null }, + }, + group: 'inline', + inline: true, + content: 'text*', + selectable: false, + atom: true, + toDOM: function () { + return ['span', { class: 'tui-widget' }, 0]; + }, + parseDOM: [ + { + tag: 'span.tui-widget', + getAttrs: function (dom) { + var text = dom.textContent; + var _a = text.match(/\$\$(widget\d+)/), info = _a[1]; + return { info: info }; + }, + }, + ], + }; + }, + enumerable: false, + configurable: true + }); + return Widget; +}(Node$2)); + +var EditorBase = /** @class */ (function () { + function EditorBase(eventEmitter) { + this.el = document.createElement('div'); + this.el.className = 'toastui-editor'; + this.eventEmitter = eventEmitter; + this.placeholder = { text: '' }; + } + EditorBase.prototype.createState = function () { + return EditorState.create({ + schema: this.schema, + plugins: this.createPlugins(), + }); + }; + EditorBase.prototype.initEvent = function () { + var _a = this, eventEmitter = _a.eventEmitter, view = _a.view, editorType = _a.editorType; + view.dom.addEventListener('focus', function () { return eventEmitter.emit('focus', editorType); }); + view.dom.addEventListener('blur', function () { return eventEmitter.emit('blur', editorType); }); + }; + EditorBase.prototype.emitChangeEvent = function (tr) { + this.eventEmitter.emit('caretChange', this.editorType); + if (tr.docChanged) { + this.eventEmitter.emit('change', this.editorType); + } + }; + Object.defineProperty(EditorBase.prototype, "defaultPlugins", { + get: function () { + var _a = getDefaultCommands(), undo = _a.undo, redo = _a.redo; + var rules = this.createInputRules(); + var plugins = __spreadArray$1(__spreadArray$1([], this.keymaps), [ + keymap(__assign$1({ 'Mod-z': undo(), 'Shift-Mod-z': redo(), 'Shift-Enter': baseKeymap.Enter }, baseKeymap)), + history(), + placeholder(this.placeholder), + addWidget(this.eventEmitter), + dropImage(this.context), + ]); + return rules ? plugins.concat(rules) : plugins; + }, + enumerable: false, + configurable: true + }); + EditorBase.prototype.createInputRules = function () { + var widgetRules = getWidgetRules(); + var rules = widgetRules.map(function (_a) { + var rule = _a.rule; + return new InputRule(rule, function (state, match, start, end) { + var schema = state.schema, tr = state.tr, doc = state.doc; + var allMatched = match.input.match(new RegExp(rule, 'g')); + var pos = doc.resolve(start); + var parent = pos.parent; + var count = 0; + if (isWidgetNode(parent)) { + parent = pos.node(pos.depth - 1); + } + parent.forEach(function (child) { return isWidgetNode(child) && (count += 1); }); + // replace the content only if the count of matched rules in whole text is greater than current widget node count + if (allMatched.length > count) { + var content = last$1(allMatched); + var nodes = createNodesWithWidget(content, schema); + // adjust start position based on widget content + return tr.replaceWith(end - content.length + 1, end, nodes); + } + return null; + }); + }); + return rules.length ? inputRules({ rules: rules }) : null; + }; + EditorBase.prototype.createSchema = function () { + return new Schema({ + nodes: this.specs.nodes, + marks: this.specs.marks, + }); + }; + EditorBase.prototype.createKeymaps = function (useCommandShortcut) { + return useCommandShortcut ? this.specs.keymaps() : []; + }; + EditorBase.prototype.createCommands = function () { + return this.specs.commands(this.view); + }; + EditorBase.prototype.createPluginProps = function () { + var _this = this; + return this.extraPlugins.map(function (plugin) { return plugin(_this.eventEmitter); }); + }; + EditorBase.prototype.focus = function () { + var _this = this; + // prevent the error for IE11 + setTimeout(function () { + _this.view.focus(); + _this.view.dispatch(_this.view.state.tr.scrollIntoView()); + }); + }; + EditorBase.prototype.blur = function () { + this.view.dom.blur(); + }; + EditorBase.prototype.destroy = function () { + var _this = this; + this.view.destroy(); + Object.keys(this).forEach(function (prop) { + delete _this[prop]; + }); + }; + EditorBase.prototype.moveCursorToStart = function (focus) { + var tr = this.view.state.tr; + this.view.dispatch(tr.setSelection(createTextSelection(tr, 1)).scrollIntoView()); + if (focus) { + this.focus(); + } + }; + EditorBase.prototype.moveCursorToEnd = function (focus) { + var tr = this.view.state.tr; + this.view.dispatch(tr.setSelection(createTextSelection(tr, tr.doc.content.size - 1)).scrollIntoView()); + if (focus) { + this.focus(); + } + }; + EditorBase.prototype.setScrollTop = function (top) { + this.view.dom.scrollTop = top; + }; + EditorBase.prototype.getScrollTop = function () { + return this.view.dom.scrollTop; + }; + EditorBase.prototype.setPlaceholder = function (text) { + this.placeholder.text = text; + this.view.dispatch(this.view.state.tr.scrollIntoView()); + }; + EditorBase.prototype.setHeight = function (height) { + css_1(this.el, { height: height + "px" }); + }; + EditorBase.prototype.setMinHeight = function (minHeight) { + css_1(this.el, { minHeight: minHeight + "px" }); + }; + EditorBase.prototype.getElement = function () { + return this.el; + }; + return EditorBase; +}()); + +/** + * @fileoverview Check whether the given variable is a function or not. + * @author NHN FE Development Lab + */ + +/** + * Check whether the given variable is a function or not. + * If the given variable is a function, return true. + * @param {*} obj - Target for checking + * @returns {boolean} Is function? + * @memberof module:type + */ +function isFunction(obj) { + return obj instanceof Function; +} + +var isFunction_1 = isFunction; + +function execCommand(view, command, payload) { + view.focus(); + return command(payload)(view.state, view.dispatch, view); +} +var SpecManager = /** @class */ (function () { + function SpecManager(specs) { + this.specs = specs; + } + Object.defineProperty(SpecManager.prototype, "nodes", { + get: function () { + return this.specs + .filter(function (spec) { return spec.type === 'node'; }) + .reduce(function (nodes, _a) { + var _b; + var name = _a.name, schema = _a.schema; + return __assign$1(__assign$1({}, nodes), (_b = {}, _b[name] = schema, _b)); + }, {}); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SpecManager.prototype, "marks", { + get: function () { + return this.specs + .filter(function (spec) { return spec.type === 'mark'; }) + .reduce(function (marks, _a) { + var _b; + var name = _a.name, schema = _a.schema; + return __assign$1(__assign$1({}, marks), (_b = {}, _b[name] = schema, _b)); + }, {}); + }, + enumerable: false, + configurable: true + }); + SpecManager.prototype.commands = function (view, addedCommands) { + var specCommands = this.specs + .filter(function (_a) { + var commands = _a.commands; + return commands; + }) + .reduce(function (allCommands, spec) { + var commands = {}; + var specCommand = spec.commands(); + if (isFunction_1(specCommand)) { + commands[spec.name] = function (payload) { return execCommand(view, specCommand, payload); }; + } + else { + Object.keys(specCommand).forEach(function (name) { + commands[name] = function (payload) { return execCommand(view, specCommand[name], payload); }; + }); + } + return __assign$1(__assign$1({}, allCommands), commands); + }, {}); + var defaultCommands = getDefaultCommands(); + Object.keys(defaultCommands).forEach(function (name) { + specCommands[name] = function (payload) { return execCommand(view, defaultCommands[name], payload); }; + }); + if (addedCommands) { + Object.keys(addedCommands).forEach(function (name) { + specCommands[name] = function (payload) { return execCommand(view, addedCommands[name], payload); }; + }); + } + return specCommands; + }; + SpecManager.prototype.keymaps = function () { + var specKeymaps = this.specs.filter(function (spec) { return spec.keymaps; }).map(function (spec) { return spec.keymaps(); }); + return specKeymaps.map(function (keys) { return keymap(keys); }); + }; + SpecManager.prototype.setContext = function (context) { + this.specs.forEach(function (spec) { + spec.setContext(context); + }); + }; + return SpecManager; +}()); + +/** + * @fileoverview Check element has specific css class + * @author NHN FE Development Lab + */ + +var inArray$1 = inArray_1; +var getClass = getClass_1; + +/** + * Check element has specific css class + * @param {(HTMLElement|SVGElement)} element - target element + * @param {string} cssClass - css class + * @returns {boolean} + * @memberof module:domUtil + */ +function hasClass(element, cssClass) { + var origin; + + if (element.classList) { + return element.classList.contains(cssClass); + } + + origin = getClass(element).split(/\s+/); + + return inArray$1(cssClass, origin) > -1; +} + +var hasClass_1 = hasClass; + +/** + * @fileoverview Check element match selector + * @author NHN FE Development Lab + */ + +var inArray = inArray_1; +var toArray = toArray_1; + +var elProto = Element.prototype; +var matchSelector = elProto.matches || + elProto.webkitMatchesSelector || + elProto.mozMatchesSelector || + elProto.msMatchesSelector || + function(selector) { + var doc = this.document || this.ownerDocument; + + return inArray(this, toArray(doc.querySelectorAll(selector))) > -1; + }; + +/** + * Check element match selector + * @param {HTMLElement} element - element to check + * @param {string} selector - selector to check + * @returns {boolean} is selector matched to element? + * @memberof module:domUtil + */ +function matches(element, selector) { + return matchSelector.call(element, selector); +} + +var matches_1 = matches; + +var TAG_NAME = '[A-Za-z][A-Za-z0-9-]*'; +var ATTRIBUTE_NAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; +var UNQUOTED_VALUE = '[^"\'=<>`\\x00-\\x20]+'; +var SINGLE_QUOTED_VALUE = "'[^']*'"; +var DOUBLE_QUOTED_VALUE = '"[^"]*"'; +var ATTRIBUTE_VALUE = "(?:" + UNQUOTED_VALUE + "|" + SINGLE_QUOTED_VALUE + "|" + DOUBLE_QUOTED_VALUE + ")"; +var ATTRIBUTE_VALUE_SPEC = "" + '(?:\\s*=\\s*' + ATTRIBUTE_VALUE + ")"; +var ATTRIBUTE$1 = "" + '(?:\\s+' + ATTRIBUTE_NAME + ATTRIBUTE_VALUE_SPEC + "?)"; +var OPEN_TAG = "<(" + TAG_NAME + ")(" + ATTRIBUTE$1 + ")*\\s*/?>"; +var CLOSE_TAG = "]"; +var HTML_TAG = "(?:" + OPEN_TAG + "|" + CLOSE_TAG + ")"; +var reHTMLTag = new RegExp("^" + HTML_TAG, 'i'); +var reBR = //i; +var ALTERNATIVE_TAG_FOR_BR = '

'; + +function isPositionInBox(style, offsetX, offsetY) { + var left = parseInt(style.left, 10); + var top = parseInt(style.top, 10); + var width = parseInt(style.width, 10) + parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10); + var height = parseInt(style.height, 10) + parseInt(style.paddingTop, 10) + parseInt(style.paddingBottom, 10); + return offsetX >= left && offsetX <= left + width && offsetY >= top && offsetY <= top + height; +} +var CLS_PREFIX = 'toastui-editor-'; +function cls() { + var names = []; + for (var _i = 0; _i < arguments.length; _i++) { + names[_i] = arguments[_i]; + } + var result = []; + for (var _a = 0, names_1 = names; _a < names_1.length; _a++) { + var name_1 = names_1[_a]; + var className = void 0; + if (Array.isArray(name_1)) { + className = name_1[0] ? name_1[1] : null; + } + else { + className = name_1; + } + if (className) { + result.push("" + CLS_PREFIX + className); + } + } + return result.join(' '); +} +function clsWithMdPrefix() { + var names = []; + for (var _i = 0; _i < arguments.length; _i++) { + names[_i] = arguments[_i]; + } + return names.map(function (className) { return CLS_PREFIX + "md-" + className; }).join(' '); +} +function isTextNode(node) { + return (node === null || node === void 0 ? void 0 : node.nodeType) === Node.TEXT_NODE; +} +function isElemNode(node) { + return node && node.nodeType === Node.ELEMENT_NODE; +} +function findNodes(element, selector) { + var nodeList = toArray_1(element.querySelectorAll(selector)); + if (nodeList.length) { + return nodeList; + } + return []; +} +function appendNodes(node, nodesToAppend) { + nodesToAppend = isArray_1(nodesToAppend) ? toArray_1(nodesToAppend) : [nodesToAppend]; + nodesToAppend.forEach(function (nodeToAppend) { + node.appendChild(nodeToAppend); + }); +} +function insertBeforeNode(insertedNode, node) { + if (node.parentNode) { + node.parentNode.insertBefore(insertedNode, node); + } +} +function removeNode$1(node) { + if (node.parentNode) { + node.parentNode.removeChild(node); + } +} +function unwrapNode(node) { + var result = []; + while (node.firstChild) { + result.push(node.firstChild); + if (node.parentNode) { + node.parentNode.insertBefore(node.firstChild, node); + } + } + removeNode$1(node); + return result; +} +function toggleClass(element, className, state) { + if (isUndefined_1(state)) { + state = !hasClass_1(element, className); + } + var toggleFn = state ? addClass_1 : removeClass_1; + toggleFn(element, className); +} +function createElementWith(contents, target) { + var container = document.createElement('div'); + if (isString_1(contents)) { + container.innerHTML = contents; + } + else { + container.appendChild(contents); + } + var firstChild = container.firstChild; + if (target) { + target.appendChild(firstChild); + } + return firstChild; +} +function getOuterWidth(el) { + var computed = window.getComputedStyle(el); + return (['margin-left', 'margin-right'].reduce(function (acc, type) { return acc + parseInt(computed.getPropertyValue(type), 10); }, 0) + el.offsetWidth); +} +function closest(node, found) { + var condition; + if (isString_1(found)) { + condition = function (target) { return matches_1(target, found); }; + } + else { + condition = function (target) { return target === found; }; + } + while (node && node !== document) { + if (isElemNode(node) && condition(node)) { + return node; + } + node = node.parentNode; + } + return null; +} +function getTotalOffset(el, root) { + var offsetTop = 0; + var offsetLeft = 0; + while (el && el !== root) { + var top_1 = el.offsetTop, left = el.offsetLeft, offsetParent = el.offsetParent; + offsetTop += top_1; + offsetLeft += left; + if (offsetParent === root.offsetParent) { + break; + } + el = el.offsetParent; + } + return { offsetTop: offsetTop, offsetLeft: offsetLeft }; +} +function setAttributes(attributes, element) { + Object.keys(attributes).forEach(function (attrName) { + if (isNil(attributes[attrName])) { + element.removeAttribute(attrName); + } + else { + element.setAttribute(attrName, attributes[attrName]); + } + }); +} +function replaceBRWithEmptyBlock(html) { + // remove br in paragraph to compatible with markdown + var replacedHTML = html.replace(/

<\/p>/gi, '

'); + var reHTMLTag = new RegExp(HTML_TAG, 'ig'); + var htmlTagMatched = replacedHTML.match(reHTMLTag); + htmlTagMatched === null || htmlTagMatched === void 0 ? void 0 : htmlTagMatched.forEach(function (htmlTag, index) { + if (reBR.test(htmlTag)) { + var alternativeTag = ALTERNATIVE_TAG_FOR_BR; + if (index) { + var prevTag = htmlTagMatched[index - 1]; + var openTagMatched = prevTag.match(OPEN_TAG); + if (openTagMatched && !/br/i.test(openTagMatched[1])) { + var tagName = openTagMatched[1]; + alternativeTag = "<" + tagName + ">"; + } + } + replacedHTML = replacedHTML.replace(reBR, alternativeTag); + } + }); + return replacedHTML; +} + +function resolveSelectionPos(selection) { + var from = selection.from, to = selection.to; + if (selection instanceof AllSelection) { + return [from + 1, to - 1]; + } + return [from, to]; +} +function getMdLine(resolvedPos) { + return resolvedPos.index(0) + 1; +} +function getWidgetNodePos(node, chPos, direction) { + if (direction === void 0) { direction = 1; } + var additionalPos = 0; + node.forEach(function (child, pos) { + // add or subtract widget node tag + if (isWidgetNode(child) && pos + 2 < chPos) { + additionalPos += 2 * direction; + } + }); + return additionalPos; +} +function getEditorToMdPos(doc, from, to) { + if (to === void 0) { to = from; } + var collapsed = from === to; + var startResolvedPos = doc.resolve(from); + var startLine = getMdLine(startResolvedPos); + var endLine = startLine; + var startOffset = startResolvedPos.start(1); + var endOffset = startOffset; + if (!collapsed) { + // prevent the end offset from pointing to the root document position + var endResolvedPos = doc.resolve(to === doc.content.size ? to - 1 : to); + endOffset = endResolvedPos.start(1); + endLine = getMdLine(endResolvedPos); + // To resolve the end offset excluding document tag size + if (endResolvedPos.pos === doc.content.size) { + to = doc.content.size - 2; + } + } + var startCh = Math.max(from - startOffset + 1, 1); + var endCh = Math.max(to - endOffset + 1, 1); + return [ + [startLine, startCh + getWidgetNodePos(doc.child(startLine - 1), startCh, -1)], + [endLine, endCh + getWidgetNodePos(doc.child(endLine - 1), endCh, -1)], + ]; +} +function getStartPosListPerLine(doc, endIndex) { + var startPosListPerLine = []; + for (var i = 0, pos = 0; i < endIndex; i += 1) { + var child = doc.child(i); + startPosListPerLine[i] = pos; + pos += child.nodeSize; + } + return startPosListPerLine; +} +function getMdToEditorPos(doc, startPos, endPos) { + var startPosListPerLine = getStartPosListPerLine(doc, endPos[0]); + var startIndex = startPos[0] - 1; + var endIndex = endPos[0] - 1; + var startNode = doc.child(startIndex); + var endNode = doc.child(endIndex); + // calculate the position corresponding to the line + var from = startPosListPerLine[startIndex]; + var to = startPosListPerLine[endIndex]; + // calculate the position corresponding to the character offset of the line + from += startPos[1] + getWidgetNodePos(startNode, startPos[1] - 1); + to += endPos[1] + getWidgetNodePos(endNode, endPos[1] - 1); + return [from, Math.min(to, doc.content.size)]; +} +function getRangeInfo(selection) { + var $from = selection.$from, $to = selection.$to; + var from = selection.from, to = selection.to; + var doc = $from.doc; + if (selection instanceof AllSelection) { + $from = doc.resolve(from + 1); + $to = doc.resolve(to - 1); + } + if ($from.depth === 0) { + $from = doc.resolve(from - 1); + $to = $from; + } + return { + startFromOffset: $from.start(1), + endFromOffset: $to.start(1), + startToOffset: $from.end(1), + endToOffset: $to.end(1), + startIndex: $from.index(0), + endIndex: $to.index(0), + from: $from.pos, + to: $to.pos, + }; +} +function getNodeContentOffsetRange(doc, targetIndex) { + var startOffset = 1; + var endOffset = 1; + for (var i = 0, offset = 0; i < doc.childCount; i += 1) { + var nodeSize = doc.child(i).nodeSize; + // calculate content start, end offset(not node offset) + startOffset = offset + 1; + endOffset = offset + nodeSize - 1; + if (i === targetIndex) { + break; + } + offset += nodeSize; + } + return { startOffset: startOffset, endOffset: endOffset }; +} + +var HEADING = 'heading'; +var BLOCK_QUOTE = 'blockQuote'; +var LIST_ITEM = 'listItem'; +var TABLE = 'table'; +var TABLE_CELL = 'tableCell'; +var CODE_BLOCK = 'codeBlock'; +var THEMATIC_BREAK = 'thematicBreak'; +var LINK = 'link'; +var CODE = 'code'; +var META = 'meta'; +var DELIM = 'delimiter'; +var TASK_DELIM = 'taskDelimiter'; +var TEXT = 'markedText'; +var HTML = 'html'; +var CUSTOM_BLOCK = 'customBlock'; +var delimSize = { + strong: 2, + emph: 1, + strike: 2, +}; +function markInfo(start, end, type, attrs) { + return { start: start, end: end, spec: { type: type, attrs: attrs } }; +} +function heading$1(_a, start, end) { + var level = _a.level, headingType = _a.headingType; + var marks = [markInfo(start, end, HEADING, { level: level })]; + if (headingType === 'atx') { + marks.push(markInfo(start, addOffsetPos(start, level), DELIM)); + } + else { + marks.push(markInfo(setOffsetPos(end, 0), end, HEADING, { seText: true })); + } + return marks; +} +function emphasisAndStrikethrough(_a, start, end) { + var type = _a.type; + var startDelimPos = addOffsetPos(start, delimSize[type]); + var endDelimPos = addOffsetPos(end, -delimSize[type]); + return [ + markInfo(startDelimPos, endDelimPos, type), + markInfo(start, startDelimPos, DELIM), + markInfo(endDelimPos, end, DELIM), + ]; +} +function markLink(start, end, linkTextStart, lastChildCh) { + return [ + markInfo(start, end, LINK), + markInfo(setOffsetPos(start, linkTextStart[1] + 1), setOffsetPos(end, lastChildCh), LINK, { + desc: true, + }), + markInfo(setOffsetPos(end, lastChildCh + 2), addOffsetPos(end, -1), LINK, { url: true }), + ]; +} +function image$1(_a, start, end) { + var lastChild = _a.lastChild; + var lastChildCh = lastChild ? getMdEndCh(lastChild) + 1 : 3; // 3: length of '![]' + var linkTextEnd = addOffsetPos(start, 1); + return __spreadArray$1([markInfo(start, linkTextEnd, META)], markLink(start, end, linkTextEnd, lastChildCh)); +} +function link(_a, start, end) { + var lastChild = _a.lastChild, extendedAutolink = _a.extendedAutolink; + var lastChildCh = lastChild ? getMdEndCh(lastChild) + 1 : 2; // 2: length of '[]' + return extendedAutolink + ? [markInfo(start, end, LINK, { desc: true })] + : markLink(start, end, start, lastChildCh); +} +function code(_a, start, end) { + var tickCount = _a.tickCount; + var openDelimEnd = addOffsetPos(start, tickCount); + var closeDelimStart = addOffsetPos(end, -tickCount); + return [ + markInfo(start, end, CODE), + markInfo(start, openDelimEnd, CODE, { start: true }), + markInfo(openDelimEnd, closeDelimStart, CODE, { marked: true }), + markInfo(closeDelimStart, end, CODE, { end: true }), + ]; +} +function lineBackground(parent, start, end, prefix) { + var defaultBackground = { + start: start, + end: end, + spec: { + attrs: { className: prefix + "-line-background", codeStart: start[0], codeEnd: end[0] }, + }, + lineBackground: true, + }; + return parent.type !== 'item' && parent.type !== 'blockQuote' + ? [ + __assign$1(__assign$1({}, defaultBackground), { end: start, spec: { attrs: { className: prefix + "-line-background start" } } }), + __assign$1(__assign$1({}, defaultBackground), { start: [Math.min(start[0] + 1, end[0]), start[1]] }), + ] + : null; +} +function codeBlock$1(node, start, end, endLine) { + var fenceOffset = node.fenceOffset, fenceLength = node.fenceLength, fenceChar = node.fenceChar, info = node.info, infoPadding = node.infoPadding, parent = node.parent; + var fenceEnd = fenceOffset + fenceLength; + var marks = [markInfo(setOffsetPos(start, 1), end, CODE_BLOCK)]; + if (fenceChar) { + marks.push(markInfo(start, addOffsetPos(start, fenceEnd), DELIM)); + } + if (info) { + marks.push(markInfo(addOffsetPos(start, fenceLength), addOffsetPos(start, fenceLength + infoPadding + info.length), META)); + } + var codeBlockEnd = "^(\\s{0,4})(" + fenceChar + "{" + fenceLength + ",})"; + var reCodeBlockEnd = new RegExp(codeBlockEnd); + if (reCodeBlockEnd.test(endLine)) { + marks.push(markInfo(setOffsetPos(end, 1), end, DELIM)); + } + var lineBackgroundMarkInfo = lineBackground(parent, start, end, 'code-block'); + return lineBackgroundMarkInfo ? marks.concat(lineBackgroundMarkInfo) : marks; +} +function customBlock$2(node, start, end) { + var _a = node, offset = _a.offset, syntaxLength = _a.syntaxLength, info = _a.info, parent = _a.parent; + var syntaxEnd = offset + syntaxLength; + var marks = [markInfo(setOffsetPos(start, 1), end, CUSTOM_BLOCK)]; + marks.push(markInfo(start, addOffsetPos(start, syntaxEnd), DELIM)); + if (info) { + marks.push(markInfo(addOffsetPos(start, syntaxEnd), addOffsetPos(start, syntaxLength + info.length), META)); + } + marks.push(markInfo(setOffsetPos(end, 1), end, DELIM)); + var lineBackgroundMarkInfo = lineBackground(parent, start, end, 'custom-block'); + return lineBackgroundMarkInfo ? marks.concat(lineBackgroundMarkInfo) : marks; +} +function markListItemChildren(node, markType) { + var marks = []; + while (node) { + var type = node.type; + if (type === 'paragraph' || type === 'codeBlock') { + marks.push(markInfo([getMdStartLine(node), getMdStartCh(node) - 1], [getMdEndLine(node), getMdEndCh(node) + 1], markType)); + } + node = node.next; + } + return marks; +} +function markParagraphInBlockQuote(node) { + var marks = []; + while (node) { + marks.push(markInfo([getMdStartLine(node), getMdStartCh(node)], [getMdEndLine(node), getMdEndCh(node) + 1], TEXT)); + node = node.next; + } + return marks; +} +function blockQuote$2(node, start, end) { + var marks = node.parent && node.parent.type !== 'blockQuote' ? [markInfo(start, end, BLOCK_QUOTE)] : []; + if (node.firstChild) { + var childMarks = []; + if (node.firstChild.type === 'paragraph') { + childMarks = markParagraphInBlockQuote(node.firstChild.firstChild); + } + else if (node.firstChild.type === 'list') { + childMarks = markListItemChildren(node.firstChild, TEXT); + } + marks = __spreadArray$1(__spreadArray$1([], marks), childMarks); + } + return marks; +} +function getSpecOfListItemStyle(node) { + var depth = 0; + while (node.parent.parent && node.parent.parent.type === 'item') { + node = node.parent.parent; + depth += 1; + } + var attrs = [{ odd: true }, { even: true }][depth % 2]; + return [LIST_ITEM, __assign$1(__assign$1({}, attrs), { listStyle: true })]; +} +function item$1(node, start) { + var _a = node.listData, padding = _a.padding, task = _a.task; + var spec = getSpecOfListItemStyle(node); + var marks = [markInfo.apply(void 0, __spreadArray$1([start, addOffsetPos(start, padding)], spec))]; + if (task) { + marks.push(markInfo(addOffsetPos(start, padding), addOffsetPos(start, padding + 3), TASK_DELIM)); + marks.push(markInfo(addOffsetPos(start, padding + 1), addOffsetPos(start, padding + 2), META)); + } + return marks.concat(markListItemChildren(node.firstChild, TEXT)); +} +var markNodeFuncMap = { + heading: heading$1, + strong: emphasisAndStrikethrough, + emph: emphasisAndStrikethrough, + strike: emphasisAndStrikethrough, + link: link, + image: image$1, + code: code, + codeBlock: codeBlock$1, + blockQuote: blockQuote$2, + item: item$1, + customBlock: customBlock$2, +}; +var simpleMarkClassNameMap = { + thematicBreak: THEMATIC_BREAK, + table: TABLE, + tableCell: TABLE_CELL, + htmlInline: HTML, +}; +function getMarkInfo(node, start, end, endLine) { + var type = node.type; + if (isFunction_1(markNodeFuncMap[type])) { + // @ts-ignore + return markNodeFuncMap[type](node, start, end, endLine); + } + if (simpleMarkClassNameMap[type]) { + return [markInfo(start, end, simpleMarkClassNameMap[type])]; + } + return null; +} + +var removingBackgroundIndexMap = {}; +function syntaxHighlight(_a) { + var schema = _a.schema, toastMark = _a.toastMark; + return new Plugin({ + appendTransaction: function (transactions, _, newState) { + var tr = transactions[0]; + var newTr = newState.tr; + if (tr.docChanged) { + var markInfo_1 = []; + var editResult = tr.getMeta('editResult'); + editResult.forEach(function (result) { + var nodes = result.nodes, removedNodeRange = result.removedNodeRange; + if (nodes.length) { + markInfo_1 = markInfo_1.concat(getMarkForRemoving(newTr, nodes)); + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var parent_1 = nodes_1[_i]; + var walker = parent_1.walker(); + var event_1 = walker.next(); + while (event_1) { + var node = event_1.node, entering = event_1.entering; + if (entering) { + markInfo_1 = markInfo_1.concat(getMarkForAdding(node, toastMark)); + } + event_1 = walker.next(); + } + } + } + else if (removedNodeRange) { + var maxIndex = newTr.doc.childCount - 1; + var _a = removedNodeRange.line, startLine = _a[0], endLine = _a[1]; + var startIndex = Math.min(startLine, maxIndex); + var endIndex = Math.min(endLine, maxIndex); + // cache the index to remove code block, custom block background when there are no adding nodes + for (var i = startIndex; i <= endIndex; i += 1) { + removingBackgroundIndexMap[i] = true; + } + } + }); + appendMarkTr(newTr, schema, markInfo_1); + } + return newTr.setMeta('widget', tr.getMeta('widget')); + }, + }); +} +function isDifferentBlock(doc, index, attrs) { + return Object.keys(attrs).some(function (name) { return attrs[name] !== doc.child(index).attrs[name]; }); +} +function addLineBackground(tr, doc, paragraph, blockPosInfo, attrs) { + if (attrs === void 0) { attrs = {}; } + var startIndex = blockPosInfo.startIndex, endIndex = blockPosInfo.endIndex, from = blockPosInfo.from, to = blockPosInfo.to; + var shouldChangeBlockType = false; + for (var i = startIndex; i <= endIndex; i += 1) { + // prevent to remove background of the node that need to have background + delete removingBackgroundIndexMap[i]; + shouldChangeBlockType = isDifferentBlock(doc, i, attrs); + } + if (shouldChangeBlockType) { + tr.setBlockType(from, to, paragraph, attrs); + } +} +function appendMarkTr(tr, schema, marks) { + var doc = tr.doc; + var paragraph = schema.nodes.paragraph; + // get start position per line for lazy calculation + var startPosListPerLine = getStartPosListPerLine(doc, doc.childCount); + marks.forEach(function (_a) { + var start = _a.start, end = _a.end, spec = _a.spec, lineBackground = _a.lineBackground; + var startIndex = Math.min(start[0], doc.childCount) - 1; + var endIndex = Math.min(end[0], doc.childCount) - 1; + var startNode = doc.child(startIndex); + var endNode = doc.child(endIndex); + // calculate the position corresponding to the line + var from = startPosListPerLine[startIndex]; + var to = startPosListPerLine[endIndex]; + // calculate the position corresponding to the character offset of the line + from += start[1] + getWidgetNodePos(startNode, start[1] - 1); + to += end[1] + getWidgetNodePos(endNode, end[1] - 1); + if (spec) { + if (lineBackground) { + var posInfo = { from: from, to: to, startIndex: startIndex, endIndex: endIndex }; + addLineBackground(tr, doc, paragraph, posInfo, spec.attrs); + } + else { + tr.addMark(from, to, schema.mark(spec.type, spec.attrs)); + } + } + else { + tr.removeMark(from, to); + } + }); + removeBlockBackground(tr, startPosListPerLine, paragraph); +} +function removeBlockBackground(tr, startPosListPerLine, paragraph) { + Object.keys(removingBackgroundIndexMap).forEach(function (index) { + var startIndex = Number(index); + // get the end position of the current line with the next node start position. + var endIndex = Math.min(Number(index) + 1, tr.doc.childCount - 1); + var from = startPosListPerLine[startIndex]; + // subtract '1' for getting end position of the line + var to = startPosListPerLine[endIndex] - 1; + if (startIndex === endIndex) { + to += 2; + } + tr.setBlockType(from, to, paragraph); + }); +} +function cacheIndexToRemoveBackground(doc, start, end) { + var skipLines = []; + removingBackgroundIndexMap = {}; + for (var i = start[0] - 1; i < end[0]; i += 1) { + var node = doc.child(i); + var codeEnd = node.attrs.codeEnd; + var codeStart = node.attrs.codeStart; + if (codeStart && codeEnd && !includes(skipLines, codeStart)) { + skipLines.push(codeStart); + codeEnd = Math.min(codeEnd, doc.childCount); + // should subtract '1' to markdown line position + // because markdown parser has '1'(not zero) as the start number + var startIndex = codeStart - 1; + var endIndex = end[0]; + for (var index = startIndex; index < endIndex; index += 1) { + removingBackgroundIndexMap[index] = true; + } + } + } +} +function getMarkForRemoving(_a, nodes) { + var doc = _a.doc; + var start = nodes[0].sourcepos[0]; + var _b = last$1(nodes).sourcepos, end = _b[1]; + var startPos = [start[0], start[1]]; + var endPos = [end[0], end[1] + 1]; + var marks = []; + cacheIndexToRemoveBackground(doc, start, end); + marks.push({ start: startPos, end: endPos }); + return marks; +} +function getMarkForAdding(node, toastMark) { + var lineTexts = toastMark.getLineTexts(); + var startPos = [getMdStartLine(node), getMdStartCh(node)]; + var endPos = [getMdEndLine(node), getMdEndCh(node) + 1]; + var markInfo = getMarkInfo(node, startPos, endPos, lineTexts[endPos[0] - 1]); + return markInfo !== null && markInfo !== void 0 ? markInfo : []; +} + +function getToolbarStateType$1(mdNode) { + if (isListNode$1(mdNode)) { + if (mdNode.listData.task) { + return 'taskList'; + } + return mdNode.listData.type === 'ordered' ? 'orderedList' : 'bulletList'; + } + if (mdNode.type.indexOf('table') !== -1) { + return 'table'; + } + return mdNode.type; +} +function getToolbarState$1(targetNode) { + var toolbarState = {}; + var listEnabled = true; + traverseParentNodes(targetNode, function (mdNode) { + var type = getToolbarStateType$1(mdNode); + if (type === 'customBlock' || type === 'image' || type === 'link') { + return; + } + if (type === 'bulletList' || type === 'orderedList') { + if (listEnabled) { + toolbarState[type] = true; + listEnabled = false; + } + } + else { + toolbarState[type] = true; + } + }); + return toolbarState; +} +function previewHighlight(_a) { + var toastMark = _a.toastMark, eventEmitter = _a.eventEmitter; + return new Plugin({ + view: function () { + return { + update: function (view, prevState) { + var state = view.state; + var doc = state.doc, selection = state.selection; + if (prevState && prevState.doc.eq(doc) && prevState.selection.eq(selection)) { + return; + } + var from = selection.from; + var startChOffset = state.doc.resolve(from).start(); + var line = state.doc.content.findIndex(from).index + 1; + var ch = from - startChOffset; + if (from === startChOffset) { + ch += 1; + } + var cursorPos = [line, ch]; + var mdNode = toastMark.findNodeAtPosition(cursorPos); + var toolbarState = getToolbarState$1(mdNode); + eventEmitter.emit('changeToolbarState', { + cursorPos: cursorPos, + mdNode: mdNode, + toolbarState: toolbarState, + }); + eventEmitter.emit('setFocusedNode', mdNode); + }, + }; + }, + }); +} + +var Doc$1 = /** @class */ (function (_super) { + __extends$1(Doc, _super); + function Doc() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Doc.prototype, "name", { + get: function () { + return 'doc'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Doc.prototype, "schema", { + get: function () { + return { + content: 'block+', + }; + }, + enumerable: false, + configurable: true + }); + return Doc; +}(Node$2)); + +var Mark = /** @class */ (function () { + function Mark() { + } + Object.defineProperty(Mark.prototype, "type", { + get: function () { + return 'mark'; + }, + enumerable: false, + configurable: true + }); + Mark.prototype.setContext = function (context) { + this.context = context; + }; + return Mark; +}()); + +function getTextByMdLine(doc, mdLine) { + return getTextContent(doc, mdLine - 1); +} +function getTextContent(doc, index) { + return doc.child(index).textContent; +} + +var reBlockQuote = /^\s*> ?/; +var BlockQuote$1 = /** @class */ (function (_super) { + __extends$1(BlockQuote, _super); + function BlockQuote() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(BlockQuote.prototype, "name", { + get: function () { + return 'blockQuote'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlockQuote.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('block-quote') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + BlockQuote.prototype.createBlockQuoteText = function (text, isBlockQuote) { + return isBlockQuote ? text.replace(reBlockQuote, '').trim() : "> " + text.trim(); + }; + BlockQuote.prototype.extendBlockQuote = function () { + var _this = this; + return function (_a, dispatch) { + var selection = _a.selection, doc = _a.doc, tr = _a.tr, schema = _a.schema; + var _b = getRangeInfo(selection), endFromOffset = _b.endFromOffset, endToOffset = _b.endToOffset, endIndex = _b.endIndex, to = _b.to; + var textContent = getTextContent(doc, endIndex); + var isBlockQuote = reBlockQuote.test(textContent); + if (isBlockQuote && to > endFromOffset && selection.empty) { + var isEmpty = !textContent.replace(reBlockQuote, '').trim(); + if (isEmpty) { + tr.deleteRange(endFromOffset, endToOffset).split(tr.mapping.map(endToOffset)); + } + else { + var slicedText = textContent.slice(to - endFromOffset).trim(); + var node = createTextNode$1(schema, _this.createBlockQuoteText(slicedText)); + splitAndExtendBlock(tr, endToOffset, slicedText, node); + } + dispatch(tr); + return true; + } + return false; + }; + }; + BlockQuote.prototype.commands = function () { + var _this = this; + return function () { return function (state, dispatch) { + var selection = state.selection, doc = state.doc; + var _a = getRangeInfo(selection), startFromOffset = _a.startFromOffset, endToOffset = _a.endToOffset, startIndex = _a.startIndex, endIndex = _a.endIndex; + var isBlockQuote = reBlockQuote.test(getTextContent(doc, startIndex)); + var tr = replaceTextNode({ + state: state, + startIndex: startIndex, + endIndex: endIndex, + from: startFromOffset, + createText: function (textContent) { return _this.createBlockQuoteText(textContent, isBlockQuote); }, + }); + dispatch(tr.setSelection(createTextSelection(tr, tr.mapping.map(endToOffset)))); + return true; + }; }; + }; + BlockQuote.prototype.keymaps = function () { + var blockQuoteCommand = this.commands()(); + return { + 'alt-q': blockQuoteCommand, + 'alt-Q': blockQuoteCommand, + Enter: this.extendBlockQuote(), + }; + }; + return BlockQuote; +}(Mark)); + +var reList = /(^\s*)([-*+] |[\d]+\. )/; +var reOrderedList = /(^\s*)([\d])+\.( \[[ xX]])? /; +var reOrderedListGroup = /^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/; +var reCanBeTaskList = /(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /; +var reBulletListGroup = /^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/; +var reTaskList = /(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/; +var reBulletTaskList = /(^\s*)([-*+])( \[[ xX]]) /; +function getListType(text) { + return reOrderedList.test(text) ? 'ordered' : 'bullet'; +} +function getListDepth(mdNode) { + var depth = 0; + while (mdNode && mdNode.type !== 'document') { + if (mdNode.type === 'list') { + depth += 1; + } + mdNode = mdNode.parent; + } + return depth; +} +function findSameDepthList(toastMark, currentLine, depth, backward) { + var lineTexts = toastMark.getLineTexts(); + var lineLen = lineTexts.length; + var result = []; + var line = currentLine; + while (backward ? line < lineLen : line > 1) { + line = backward ? line + 1 : line - 1; + var mdNode = toastMark.findFirstNodeAtLine(line); + var currentListDepth = getListDepth(mdNode); + if (currentListDepth === depth) { + result.push({ line: line, depth: depth, mdNode: mdNode }); + } + else if (currentListDepth < depth) { + break; + } + } + return result; +} +function getSameDepthItems(_a) { + var toastMark = _a.toastMark, mdNode = _a.mdNode, line = _a.line; + var depth = getListDepth(mdNode); + var forwardList = findSameDepthList(toastMark, line, depth, false).reverse(); + var backwardList = findSameDepthList(toastMark, line, depth, true); + return forwardList.concat([{ line: line, depth: depth, mdNode: mdNode }]).concat(backwardList); +} +function textToBullet(text) { + if (!reList.test(text)) { + return "* " + text; + } + var type = getListType(text); + if (type === 'bullet' && reCanBeTaskList.test(text)) { + text = text.replace(reBulletTaskList, '$1$2 '); + } + else if (type === 'ordered') { + text = text.replace(reOrderedList, '$1* '); + } + return text; +} +function textToOrdered(text, ordinalNum) { + if (!reList.test(text)) { + return ordinalNum + ". " + text; + } + var type = getListType(text); + if (type === 'bullet' || (type === 'ordered' && reCanBeTaskList.test(text))) { + text = text.replace(reCanBeTaskList, "$1" + ordinalNum + ". "); + } + else if (type === 'ordered') { + // eslint-disable-next-line prefer-destructuring + var start = reOrderedListGroup.exec(text)[3]; + if (Number(start) !== ordinalNum) { + text = text.replace(reOrderedList, "$1" + ordinalNum + ". "); + } + } + return text; +} +function getChangedInfo(doc, sameDepthItems, type, start) { + if (start === void 0) { start = 0; } + var firstIndex = Number.MAX_VALUE; + var lastIndex = 0; + var changedResults = sameDepthItems.map(function (_a, index) { + var line = _a.line; + firstIndex = Math.min(line - 1, firstIndex); + lastIndex = Math.max(line - 1, lastIndex); + var text = getTextByMdLine(doc, line); + text = type === 'bullet' ? textToBullet(text) : textToOrdered(text, index + 1 + start); + return { text: text, line: line }; + }); + return { changedResults: changedResults, firstIndex: firstIndex, lastIndex: lastIndex }; +} +function getBulletOrOrdered(type, context) { + var sameDepthListInfo = getSameDepthItems(context); + return getChangedInfo(context.doc, sameDepthListInfo, type); +} +var otherListToList = { + bullet: function (context) { + return getBulletOrOrdered('bullet', context); + }, + ordered: function (context) { + return getBulletOrOrdered('ordered', context); + }, + task: function (_a) { + var mdNode = _a.mdNode, doc = _a.doc, line = _a.line; + var text = getTextByMdLine(doc, line); + if (mdNode.listData.task) { + text = text.replace(reTaskList, '$1$2'); + } + else if (isListNode$1(mdNode)) { + text = text.replace(reList, '$1$2[ ] '); + } + return { changedResults: [{ text: text, line: line }] }; + }, +}; +var otherNodeToList = { + bullet: function (_a) { + var doc = _a.doc, line = _a.line; + var lineText = getTextByMdLine(doc, line); + var changedResults = [{ text: "* " + lineText, line: line }]; + return { changedResults: changedResults }; + }, + ordered: function (_a) { + var toastMark = _a.toastMark, doc = _a.doc, line = _a.line, startLine = _a.startLine; + var lineText = getTextByMdLine(doc, line); + var firstOrderedListNum = 1; + var firstOrderedListLine = startLine; + var skipped = 0; + for (var i = startLine - 1; i > 0; i -= 1) { + var mdNode = toastMark.findFirstNodeAtLine(i); + var text = getTextByMdLine(doc, i); + var canBeListNode = text && !!findClosestNode(mdNode, function (targetNode) { return isListNode$1(targetNode); }); + var searchResult = reOrderedListGroup.exec(getTextByMdLine(doc, i)); + if (!searchResult && !canBeListNode) { + break; + } + if (!searchResult && canBeListNode) { + skipped += 1; + continue; + } + var _b = searchResult, indent = _b[1], start = _b[3]; + // basis on one depth list + if (!indent) { + firstOrderedListNum = Number(start); + firstOrderedListLine = i; + break; + } + } + var ordinalNum = firstOrderedListNum + line - firstOrderedListLine - skipped; + var changedResults = [{ text: ordinalNum + ". " + lineText, line: line }]; + return { changedResults: changedResults }; + }, + task: function (_a) { + var doc = _a.doc, line = _a.line; + var lineText = getTextByMdLine(doc, line); + var changedResults = [{ text: "* [ ] " + lineText, line: line }]; + return { changedResults: changedResults }; + }, +}; +var extendList = { + bullet: function (_a) { + var line = _a.line, doc = _a.doc; + var lineText = getTextByMdLine(doc, line); + var _b = reBulletListGroup.exec(lineText), indent = _b[1], delimiter = _b[2]; + return { listSyntax: "" + indent + delimiter }; + }, + ordered: function (_a) { + var toastMark = _a.toastMark, line = _a.line, mdNode = _a.mdNode, doc = _a.doc; + var depth = getListDepth(mdNode); + var lineText = getTextByMdLine(doc, line); + var _b = reOrderedListGroup.exec(lineText), indent = _b[1], start = _b[3], delimiter = _b[4]; + var ordinalNum = Number(start) + 1; + var listSyntax = "" + indent + ordinalNum + delimiter; + var backwardList = findSameDepthList(toastMark, line, depth, true); + var filteredList = backwardList.filter(function (info) { + var searchResult = reOrderedListGroup.exec(getTextByMdLine(doc, info.line)); + return (searchResult && + searchResult[1].length === indent.length && + !!findClosestNode(info.mdNode, function (targetNode) { return isOrderedListNode(targetNode); })); + }); + return __assign$1({ listSyntax: listSyntax }, getChangedInfo(doc, filteredList, 'ordered', ordinalNum)); + }, +}; +function getReorderedListInfo(doc, schema, line, ordinalNum, prevIndentLength) { + var nodes = []; + var lineText = getTextByMdLine(doc, line); + var searchResult = reOrderedListGroup.exec(lineText); + while (searchResult) { + var indent = searchResult[1], delimiter = searchResult[4], text = searchResult[5]; + var indentLength = indent.length; + if (indentLength === prevIndentLength) { + nodes.push(createTextNode$1(schema, "" + indent + ordinalNum + delimiter + text)); + ordinalNum += 1; + line += 1; + } + else if (indentLength > prevIndentLength) { + var nestedListInfo = getReorderedListInfo(doc, schema, line, 1, indentLength); + line = nestedListInfo.line; + nodes = nodes.concat(nestedListInfo.nodes); + } + if (indentLength < prevIndentLength || line > doc.childCount) { + break; + } + lineText = getTextByMdLine(doc, line); + searchResult = reOrderedListGroup.exec(lineText); + } + return { nodes: nodes, line: line }; +} + +var reStartSpace = /(^\s{1,4})(.*)/; +function isBlockUnit(from, to, text) { + return from < to || reList.test(text) || reBlockQuote.test(text); +} +function isInTableCellNode(doc, schema, selection) { + var $pos = selection.$from; + if ($pos.depth === 0) { + $pos = doc.resolve($pos.pos - 1); + } + var node = $pos.node(1); + var startOffset = $pos.start(1); + var contentSize = node.content.size; + return (node.rangeHasMark(0, contentSize, schema.marks.table) && + $pos.pos - startOffset !== contentSize && + $pos.pos !== startOffset); +} +function createSelection(tr, posInfo) { + var from = posInfo.from, to = posInfo.to; + if (posInfo.type === 'indent') { + var softTabLen = 4; + from += softTabLen; + to += (posInfo.lineLen + 1) * softTabLen; + } + else { + var spaceLenList = posInfo.spaceLenList; + from -= spaceLenList[0]; + for (var i = 0; i < spaceLenList.length; i += 1) { + to -= spaceLenList[i]; + } + } + return createTextSelection(tr, from, to); +} +var Paragraph$1 = /** @class */ (function (_super) { + __extends$1(Paragraph, _super); + function Paragraph() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Paragraph.prototype, "name", { + get: function () { + return 'paragraph'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Paragraph.prototype, "schema", { + get: function () { + return { + content: 'inline*', + attrs: { + className: { default: null }, + codeStart: { default: null }, + codeEnd: { default: null }, + }, + selectable: false, + group: 'block', + parseDOM: [{ tag: 'div' }], + toDOM: function (_a) { + var attrs = _a.attrs; + return attrs.className + ? ['div', { class: clsWithMdPrefix(attrs.className) }, 0] + : ['div', 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + Paragraph.prototype.reorderList = function (startLine, endLine) { + var _a = this.context, view = _a.view, toastMark = _a.toastMark, schema = _a.schema; + var _b = view.state, tr = _b.tr, selection = _b.selection, doc = _b.doc; + var mdNode = toastMark.findFirstNodeAtLine(startLine); + var topListNode = mdNode; + while (mdNode && !isBulletListNode(mdNode) && mdNode.parent.type !== 'document') { + mdNode = mdNode.parent; + if (isOrderedListNode(mdNode)) { + topListNode = mdNode; + break; + } + } + if (topListNode) { + startLine = topListNode.sourcepos[0][0]; + } + var _c = reOrderedListGroup.exec(getTextByMdLine(doc, startLine)), indent = _c[1], start = _c[3]; + var indentLen = indent.length; + var _d = getReorderedListInfo(doc, schema, startLine, Number(start), indentLen), line = _d.line, nodes = _d.nodes; + endLine = Math.max(endLine, line - 1); + var startOffset = getNodeContentOffsetRange(doc, startLine - 1).startOffset; + for (var i = startLine - 1; i <= endLine - 1; i += 1) { + var _e = doc.child(i), nodeSize = _e.nodeSize, content = _e.content; + var mappedFrom = tr.mapping.map(startOffset); + var mappedTo = mappedFrom + content.size; + tr.replaceWith(mappedFrom, mappedTo, nodes[i - startLine + 1]); + startOffset += nodeSize; + } + var newSelection = createTextSelection(tr, selection.from, selection.to); + view.dispatch(tr.setSelection(newSelection)); + }; + Paragraph.prototype.indent = function (tabKey) { + var _this = this; + if (tabKey === void 0) { tabKey = false; } + return function () { return function (state, dispatch) { + var schema = state.schema, selection = state.selection, doc = state.doc; + var _a = getRangeInfo(selection), from = _a.from, to = _a.to, startFromOffset = _a.startFromOffset, startIndex = _a.startIndex, endIndex = _a.endIndex; + if (tabKey && isInTableCellNode(doc, schema, selection)) { + return false; + } + var startLineText = getTextContent(doc, startIndex); + if ((tabKey && isBlockUnit(from, to, startLineText)) || + (!tabKey && reList.test(startLineText))) { + var tr = replaceTextNode({ + state: state, + from: startFromOffset, + startIndex: startIndex, + endIndex: endIndex, + createText: function (textContent) { return " " + textContent; }, + }); + var posInfo = { + type: 'indent', + from: from, + to: to, + lineLen: endIndex - startIndex, + }; + dispatch(tr.setSelection(createSelection(tr, posInfo))); + if (reOrderedListGroup.test(startLineText)) { + _this.reorderList(startIndex + 1, endIndex + 1); + } + } + else if (tabKey) { + dispatch(state.tr.insert(to, createTextNode$1(schema, ' '))); + } + return true; + }; }; + }; + Paragraph.prototype.outdent = function (tabKey) { + var _this = this; + if (tabKey === void 0) { tabKey = false; } + return function () { return function (state, dispatch) { + var selection = state.selection, doc = state.doc, schema = state.schema; + var _a = getRangeInfo(selection), from = _a.from, to = _a.to, startFromOffset = _a.startFromOffset, startIndex = _a.startIndex, endIndex = _a.endIndex; + if (tabKey && isInTableCellNode(doc, schema, selection)) { + return false; + } + var startLineText = getTextContent(doc, startIndex); + if ((tabKey && isBlockUnit(from, to, startLineText)) || + (!tabKey && reList.test(startLineText))) { + var spaceLenList_1 = []; + var tr = replaceTextNode({ + state: state, + from: startFromOffset, + startIndex: startIndex, + endIndex: endIndex, + createText: function (textContent) { + var searchResult = reStartSpace.exec(textContent); + spaceLenList_1.push(searchResult ? searchResult[1].length : 0); + return textContent.replace(reStartSpace, '$2'); + }, + }); + var posInfo = { type: 'outdent', from: from, to: to, spaceLenList: spaceLenList_1 }; + dispatch(tr.setSelection(createSelection(tr, posInfo))); + if (reOrderedListGroup.test(startLineText)) { + _this.reorderList(startIndex + 1, endIndex + 1); + } + } + else if (tabKey) { + var startText = startLineText.slice(0, to - startFromOffset); + var startTextWithoutSpace = startText.replace(/\s{1,4}$/, ''); + var deletStart = to - (startText.length - startTextWithoutSpace.length); + dispatch(state.tr.delete(deletStart, to)); + } + return true; + }; }; + }; + Paragraph.prototype.deleteLines = function () { + var _this = this; + return function (state, dispatch) { + var view = _this.context.view; + var _a = getRangeInfo(state.selection), startFromOffset = _a.startFromOffset, endToOffset = _a.endToOffset; + var deleteRange = function () { + dispatch(state.tr.deleteRange(startFromOffset, endToOffset)); + return true; + }; + return chainCommands(deleteRange, joinForward)(state, dispatch, view); + }; + }; + Paragraph.prototype.moveDown = function () { + return function (state, dispatch) { + var doc = state.doc, tr = state.tr, selection = state.selection, schema = state.schema; + var _a = getRangeInfo(selection), startFromOffset = _a.startFromOffset, endToOffset = _a.endToOffset, endIndex = _a.endIndex; + if (endIndex < doc.content.childCount - 1) { + var _b = doc.child(endIndex + 1), nodeSize = _b.nodeSize, textContent = _b.textContent; + tr.delete(endToOffset, endToOffset + nodeSize) + .split(startFromOffset) + // subtract 2(start, end tag length) to insert prev line + .insert(tr.mapping.map(startFromOffset) - 2, createTextNode$1(schema, textContent)); + dispatch(tr); + return true; + } + return false; + }; + }; + Paragraph.prototype.moveUp = function () { + return function (state, dispatch) { + var tr = state.tr, doc = state.doc, selection = state.selection, schema = state.schema; + var _a = getRangeInfo(selection), startFromOffset = _a.startFromOffset, endToOffset = _a.endToOffset, startIndex = _a.startIndex; + if (startIndex > 0) { + var _b = doc.child(startIndex - 1), nodeSize = _b.nodeSize, textContent = _b.textContent; + tr.delete(startFromOffset - nodeSize, startFromOffset) + .split(tr.mapping.map(endToOffset)) + .insert(tr.mapping.map(endToOffset), createTextNode$1(schema, textContent)); + dispatch(tr); + return true; + } + return false; + }; + }; + Paragraph.prototype.commands = function () { + return { + indent: this.indent(), + outdent: this.outdent(), + }; + }; + Paragraph.prototype.keymaps = function () { + return { + Tab: this.indent(true)(), + 'Shift-Tab': this.outdent(true)(), + 'Mod-d': this.deleteLines(), + 'Mod-D': this.deleteLines(), + 'Alt-ArrowUp': this.moveUp(), + 'Alt-ArrowDown': this.moveDown(), + }; + }; + return Paragraph; +}(Node$2)); + +var Text$1 = /** @class */ (function (_super) { + __extends$1(Text, _super); + function Text() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Text.prototype, "name", { + get: function () { + return 'text'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Text.prototype, "schema", { + get: function () { + return { + group: 'inline', + }; + }, + enumerable: false, + configurable: true + }); + return Text; +}(Node$2)); + +var reHeading = /^#{1,6}\s/; +var Heading$1 = /** @class */ (function (_super) { + __extends$1(Heading, _super); + function Heading() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Heading.prototype, "name", { + get: function () { + return 'heading'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Heading.prototype, "schema", { + get: function () { + return { + attrs: { + level: { default: 1 }, + seText: { default: false }, + }, + toDOM: function (_a) { + var attrs = _a.attrs; + var level = attrs.level, seText = attrs.seText; + var classNames = "heading|heading" + level; + if (seText) { + classNames += '|delimiter|setext'; + } + return ['span', { class: clsWithMdPrefix.apply(void 0, classNames.split('|')) }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + Heading.prototype.createHeadingText = function (level, text, curHeadingSyntax) { + var textContent = text.replace(curHeadingSyntax, '').trim(); + var headingText = ''; + while (level > 0) { + headingText += '#'; + level -= 1; + } + return headingText + " " + textContent; + }; + Heading.prototype.commands = function () { + var _this = this; + return function (payload) { return function (state, dispatch) { + var level = payload.level; + var _a = getRangeInfo(state.selection), startFromOffset = _a.startFromOffset, endToOffset = _a.endToOffset, startIndex = _a.startIndex, endIndex = _a.endIndex; + var tr = replaceTextNode({ + state: state, + from: startFromOffset, + startIndex: startIndex, + endIndex: endIndex, + createText: function (textContent) { + var matchedHeading = textContent.match(reHeading); + var curHeadingSyntax = matchedHeading ? matchedHeading[0] : ''; + return _this.createHeadingText(level, textContent, curHeadingSyntax); + }, + }); + dispatch(tr.setSelection(createTextSelection(tr, tr.mapping.map(endToOffset)))); + return true; + }; }; + }; + return Heading; +}(Mark)); + +var fencedCodeBlockSyntax = '```'; +var CodeBlock$1 = /** @class */ (function (_super) { + __extends$1(CodeBlock, _super); + function CodeBlock() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(CodeBlock.prototype, "name", { + get: function () { + return 'codeBlock'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(CodeBlock.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('code-block') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + CodeBlock.prototype.commands = function () { + return function () { return function (state, dispatch) { + var selection = state.selection, schema = state.schema, tr = state.tr; + var _a = getRangeInfo(selection), startFromOffset = _a.startFromOffset, endToOffset = _a.endToOffset; + var fencedNode = createTextNode$1(schema, fencedCodeBlockSyntax); + // add fenced start block + tr.insert(startFromOffset, fencedNode).split(startFromOffset + fencedCodeBlockSyntax.length); + // add fenced end block + tr.split(tr.mapping.map(endToOffset)).insert(tr.mapping.map(endToOffset), fencedNode); + dispatch(tr.setSelection( + // subtract fenced syntax length and open, close tag(2) + createTextSelection(tr, tr.mapping.map(endToOffset) - (fencedCodeBlockSyntax.length + 2)))); + return true; + }; }; + }; + CodeBlock.prototype.keepIndentation = function () { + var _this = this; + return function (_a, dispatch) { + var selection = _a.selection, tr = _a.tr, doc = _a.doc, schema = _a.schema; + var toastMark = _this.context.toastMark; + var _b = getRangeInfo(selection), startFromOffset = _b.startFromOffset, endToOffset = _b.endToOffset, endIndex = _b.endIndex, from = _b.from, to = _b.to; + var textContent = getTextContent(doc, endIndex); + if (from === to && textContent.trim()) { + var matched = textContent.match(/^\s+/); + var mdNode = toastMark.findFirstNodeAtLine(endIndex + 1); + if (isCodeBlockNode(mdNode) && matched) { + var spaces = matched[0]; + var slicedText = textContent.slice(to - startFromOffset); + var node = createTextNode$1(schema, spaces + slicedText); + splitAndExtendBlock(tr, endToOffset, slicedText, node); + dispatch(tr); + return true; + } + } + return false; + }; + }; + CodeBlock.prototype.keymaps = function () { + var codeBlockCommand = this.commands()(); + return { + 'Shift-Mod-p': codeBlockCommand, + 'Shift-Mod-P': codeBlockCommand, + Enter: this.keepIndentation(), + }; + }; + return CodeBlock; +}(Mark)); + +var reEmptyTable = /\||\s/g; +function createTableHeader(columnCount) { + return [createTableRow(columnCount), createTableRow(columnCount, true)]; +} +function createTableBody$1(columnCount, rowCount) { + var bodyRows = []; + for (var i = 0; i < rowCount; i += 1) { + bodyRows.push(createTableRow(columnCount)); + } + return bodyRows; +} +function createTableRow(columnCount, delim) { + var row = '|'; + for (var i = 0; i < columnCount; i += 1) { + row += delim ? ' --- |' : ' |'; + } + return row; +} +function createTargetTypes(moveNext) { + return moveNext + ? { type: 'next', parentType: 'tableHead', childType: 'firstChild' } + : { type: 'prev', parentType: 'tableBody', childType: 'lastChild' }; +} +var Table$1 = /** @class */ (function (_super) { + __extends$1(Table, _super); + function Table() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Table.prototype, "name", { + get: function () { + return 'table'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Table.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('table') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + Table.prototype.extendTable = function () { + var _this = this; + return function (_a, dispatch) { + var selection = _a.selection, doc = _a.doc, tr = _a.tr, schema = _a.schema; + if (!selection.empty) { + return false; + } + var _b = getRangeInfo(selection), endFromOffset = _b.endFromOffset, endToOffset = _b.endToOffset, endIndex = _b.endIndex, to = _b.to; + var textContent = getTextContent(doc, endIndex); + // should add `1` to line for the markdown parser + // because markdown parser has `1`(not zero) as the start number + var mdPos = [endIndex + 1, to - endFromOffset + 1]; + var mdNode = _this.context.toastMark.findNodeAtPosition(mdPos); + var cellNode = findClosestNode(mdNode, function (node) { + return isTableCellNode(node) && + (node.parent.type === 'tableDelimRow' || node.parent.parent.type === 'tableBody'); + }); + if (cellNode) { + var isEmpty = !textContent.replace(reEmptyTable, '').trim(); + var parent_1 = cellNode.parent; + var columnCount = parent_1.parent.parent.columns.length; + var row = createTableRow(columnCount); + if (isEmpty) { + tr.deleteRange(endFromOffset, endToOffset).split(tr.mapping.map(endToOffset)); + } + else { + tr + .split(endToOffset) + .insert(tr.mapping.map(endToOffset), createTextNode$1(schema, row)) + // should subtract `2` to selection end position considering ` |` text + .setSelection(createTextSelection(tr, tr.mapping.map(endToOffset) - 2)); + } + dispatch(tr); + return true; + } + return false; + }; + }; + Table.prototype.moveTableCell = function (moveNext) { + var _this = this; + return function (_a, dispatch) { + var selection = _a.selection, tr = _a.tr; + var _b = getRangeInfo(selection), endFromOffset = _b.endFromOffset, endIndex = _b.endIndex, to = _b.to; + var mdPos = [endIndex + 1, to - endFromOffset]; + var mdNode = _this.context.toastMark.findNodeAtPosition(mdPos); + var cellNode = findClosestNode(mdNode, function (node) { return isTableCellNode(node); }); + if (cellNode) { + var parent_2 = cellNode.parent; + var _c = createTargetTypes(moveNext), type = _c.type, parentType = _c.parentType, childType = _c.childType; + var chOffset = getMdEndCh(cellNode); + if (cellNode[type]) { + chOffset = getMdEndCh(cellNode[type]) - 1; + } + else { + var row = !parent_2[type] && parent_2.parent.type === parentType + ? parent_2.parent[type][childType] + : parent_2[type]; + if (type === 'next') { + // if there is next row, the base offset would be end position of the next row's first child. + // Otherwise, the base offset is zero. + var baseOffset = row ? getMdEndCh(row[childType]) : 0; + // calculate tag(open, close) position('2') for selection + chOffset += baseOffset + 2; + } + else if (type === 'prev') { + // if there is prev row, the target position would be '-4' for calculating ' |' characters and tag(open, close) + // Otherwise, the target position is zero. + chOffset = row ? -4 : 0; + } + } + dispatch(tr.setSelection(createTextSelection(tr, endFromOffset + chOffset))); + return true; + } + return false; + }; + }; + Table.prototype.addTable = function () { + return function (payload) { return function (_a, dispatch) { + var selection = _a.selection, tr = _a.tr, schema = _a.schema; + var _b = payload, columnCount = _b.columnCount, rowCount = _b.rowCount; + var endToOffset = getRangeInfo(selection).endToOffset; + var headerRows = createTableHeader(columnCount); + var bodyRows = createTableBody$1(columnCount, rowCount - 1); + var rows = __spreadArray$1(__spreadArray$1([], headerRows), bodyRows); + rows.forEach(function (row) { + tr.split(tr.mapping.map(endToOffset)).insert(tr.mapping.map(endToOffset), createTextNode$1(schema, row)); + }); + // should add `4` to selection position considering `| ` text and start block tag length + dispatch(tr.setSelection(createTextSelection(tr, endToOffset + 4))); + return true; + }; }; + }; + Table.prototype.commands = function () { + return { addTable: this.addTable() }; + }; + Table.prototype.keymaps = function () { + return { + Enter: this.extendTable(), + Tab: this.moveTableCell(true), + 'Shift-Tab': this.moveTableCell(false), + }; + }; + return Table; +}(Mark)); + +var thematicBreakSyntax = '***'; +var ThematicBreak$1 = /** @class */ (function (_super) { + __extends$1(ThematicBreak, _super); + function ThematicBreak() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ThematicBreak.prototype, "name", { + get: function () { + return 'thematicBreak'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ThematicBreak.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('thematic-break') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + ThematicBreak.prototype.hr = function () { + return function () { return function (state, dispatch) { + var selection = state.selection, schema = state.schema, tr = state.tr; + var _a = getRangeInfo(selection), from = _a.from, to = _a.to, endToOffset = _a.endToOffset; + var node = createTextNode$1(schema, thematicBreakSyntax); + tr + .split(from) + .replaceWith(tr.mapping.map(from), tr.mapping.map(to), node) + .split(tr.mapping.map(to)).setSelection(createTextSelection(tr, tr.mapping.map(endToOffset))); + dispatch(tr); + return true; + }; }; + }; + ThematicBreak.prototype.commands = function () { + return { hr: this.hr() }; + }; + ThematicBreak.prototype.keymaps = function () { + var lineCommand = this.hr()(); + return { 'Mod-l': lineCommand, 'Mod-L': lineCommand }; + }; + return ThematicBreak; +}(Mark)); + +function cannotBeListNode(_a) { + var type = _a.type; + return type === 'codeBlock' || type === 'heading' || type.indexOf('table') !== -1; +} +var ListItem$1 = /** @class */ (function (_super) { + __extends$1(ListItem, _super); + function ListItem() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ListItem.prototype, "name", { + get: function () { + return 'listItem'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ListItem.prototype, "schema", { + get: function () { + return { + attrs: { + odd: { default: false }, + even: { default: false }, + listStyle: { default: false }, + }, + toDOM: function (_a) { + var attrs = _a.attrs; + var odd = attrs.odd, even = attrs.even, listStyle = attrs.listStyle; + var classNames = 'list-item'; + if (listStyle) { + classNames += '|list-item-style'; + } + if (odd) { + classNames += '|list-item-odd'; + } + if (even) { + classNames += '|list-item-even'; + } + return ['span', { class: clsWithMdPrefix.apply(void 0, classNames.split('|')) }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + ListItem.prototype.extendList = function () { + var _this = this; + return function (_a, dispatch) { + var selection = _a.selection, doc = _a.doc, schema = _a.schema, tr = _a.tr; + var toastMark = _this.context.toastMark; + var _b = getRangeInfo(selection), to = _b.to, startFromOffset = _b.startFromOffset, endFromOffset = _b.endFromOffset, endIndex = _b.endIndex, endToOffset = _b.endToOffset; + var textContent = getTextContent(doc, endIndex); + var isList = reList.test(textContent); + if (!isList || selection.from === startFromOffset || !selection.empty) { + return false; + } + var isEmpty = !textContent.replace(reCanBeTaskList, '').trim(); + if (isEmpty) { + tr.deleteRange(endFromOffset, endToOffset).split(tr.mapping.map(endToOffset)); + } + else { + var commandType = getListType(textContent); + // should add `1` to line for the markdown parser + // because markdown parser has `1`(not zero) as the start number + var mdNode = toastMark.findFirstNodeAtLine(endIndex + 1); + var slicedText = textContent.slice(to - endFromOffset); + var context = { toastMark: toastMark, mdNode: mdNode, doc: doc, line: endIndex + 1 }; + var _c = extendList[commandType](context), listSyntax = _c.listSyntax, changedResults = _c.changedResults; + // change ordinal number of backward ordered list + if (changedResults === null || changedResults === void 0 ? void 0 : changedResults.length) { + // split the block + tr.split(to); + // set first ordered list info + changedResults.unshift({ text: listSyntax + slicedText, line: endIndex + 1 }); + _this.changeToListPerLine(tr, changedResults, { + from: to, + // don't subtract 1 because the line has increased through 'split' command. + startLine: changedResults[0].line, + endLine: last$1(changedResults).line, + }); + var pos = tr.mapping.map(endToOffset) - slicedText.length; + tr.setSelection(createTextSelection(tr, pos)); + } + else { + var node = createTextNode$1(schema, listSyntax + slicedText); + splitAndExtendBlock(tr, endToOffset, slicedText, node); + } + } + dispatch(tr); + return true; + }; + }; + ListItem.prototype.toList = function (commandType) { + var _this = this; + return function () { return function (_a, dispatch) { + var doc = _a.doc, tr = _a.tr, selection = _a.selection; + var toastMark = _this.context.toastMark; + var rangeInfo = getRangeInfo(selection); + // should add `1` to line for the markdown parser + // because markdown parser has `1`(not zero) as the start number + var startLine = rangeInfo.startIndex + 1; + var endLine = rangeInfo.endIndex + 1; + var endToOffset = rangeInfo.endToOffset; + var skipLines = []; + for (var line = startLine; line <= endLine; line += 1) { + var mdNode = toastMark.findFirstNodeAtLine(line); + if (mdNode && cannotBeListNode(mdNode)) { + break; + } + // to skip unnecessary processing + if (skipLines.indexOf(line) !== -1) { + continue; + } + var context = { toastMark: toastMark, mdNode: mdNode, doc: doc, line: line, startLine: startLine }; + var changedResults = (isListNode$1(mdNode) + ? otherListToList[commandType](context) + : otherNodeToList[commandType](context)).changedResults; + var endOffset = _this.changeToListPerLine(tr, changedResults, { + from: getNodeContentOffsetRange(doc, changedResults[0].line - 1).startOffset, + startLine: changedResults[0].line, + endLine: last$1(changedResults).line, + indexDiff: 1, + }); + endToOffset = Math.max(endOffset, endToOffset); + if (changedResults) { + skipLines = skipLines.concat(changedResults.map(function (info) { return info.line; })); + } + } + dispatch(tr.setSelection(createTextSelection(tr, tr.mapping.map(endToOffset)))); + return true; + }; }; + }; + ListItem.prototype.changeToListPerLine = function (tr, changedResults, _a) { + var from = _a.from, startLine = _a.startLine, endLine = _a.endLine, _b = _a.indexDiff, indexDiff = _b === void 0 ? 0 : _b; + var maxEndOffset = 0; + var _loop_1 = function (i) { + var _c = tr.doc.child(i), nodeSize = _c.nodeSize, content = _c.content; + var mappedFrom = tr.mapping.map(from); + var mappedTo = mappedFrom + content.size; + var changedResult = changedResults.filter(function (result) { return result.line - indexDiff === i; })[0]; + if (changedResult) { + tr.replaceWith(mappedFrom, mappedTo, createTextNode$1(this_1.context.schema, changedResult.text)); + maxEndOffset = Math.max(maxEndOffset, from + content.size); + } + from += nodeSize; + }; + var this_1 = this; + for (var i = startLine - indexDiff; i <= endLine - indexDiff; i += 1) { + _loop_1(i); + } + return maxEndOffset; + }; + ListItem.prototype.toggleTask = function () { + var _this = this; + return function (_a, dispatch) { + var selection = _a.selection, tr = _a.tr, doc = _a.doc, schema = _a.schema; + var toastMark = _this.context.toastMark; + var _b = getRangeInfo(selection), startIndex = _b.startIndex, endIndex = _b.endIndex; + var newTr = null; + for (var i = startIndex; i <= endIndex; i += 1) { + var mdNode = toastMark.findFirstNodeAtLine(i + 1); + if (isListNode$1(mdNode) && mdNode.listData.task) { + var _c = mdNode.listData, checked = _c.checked, padding = _c.padding; + var stateChar = checked ? ' ' : 'x'; + var mdPos = mdNode.sourcepos[0]; + var startOffset = getNodeContentOffsetRange(doc, mdPos[0] - 1).startOffset; + startOffset += mdPos[1] + padding; + newTr = tr.replaceWith(startOffset, startOffset + 1, schema.text(stateChar)); + } + } + if (newTr) { + dispatch(newTr); + return true; + } + return false; + }; + }; + ListItem.prototype.commands = function () { + return { + bulletList: this.toList('bullet'), + orderedList: this.toList('ordered'), + taskList: this.toList('task'), + }; + }; + ListItem.prototype.keymaps = function () { + var bulletCommand = this.toList('bullet')(); + var orderedCommand = this.toList('ordered')(); + var taskCommand = this.toList('task')(); + var togleTaskCommand = this.toggleTask(); + return { + 'Mod-u': bulletCommand, + 'Mod-U': bulletCommand, + 'Mod-o': orderedCommand, + 'Mod-O': orderedCommand, + 'alt-t': taskCommand, + 'alt-T': taskCommand, + 'Shift-Ctrl-x': togleTaskCommand, + 'Shift-Ctrl-X': togleTaskCommand, + Enter: this.extendList(), + }; + }; + return ListItem; +}(Mark)); + +function toggleMark(condition, syntax) { + return function () { return function (_a, dispatch) { + var tr = _a.tr, selection = _a.selection; + var conditionFn = !isFunction_1(condition) + ? function (text) { return condition.test(text); } + : condition; + var syntaxLen = syntax.length; + var doc = tr.doc; + var _b = resolveSelectionPos(selection), from = _b[0], to = _b[1]; + var prevPos = Math.max(from - syntaxLen, 1); + var nextPos = Math.min(to + syntaxLen, doc.content.size - 1); + var slice = selection.content(); + var textContent = slice.content.textBetween(0, slice.content.size, '\n'); + var prevText = doc.textBetween(prevPos, from, '\n'); + var nextText = doc.textBetween(to, nextPos, '\n'); + textContent = "" + prevText + textContent + nextText; + if (prevText && nextText && conditionFn(textContent)) { + tr.delete(nextPos - syntaxLen, nextPos).delete(prevPos, prevPos + syntaxLen); + } + else { + tr.insertText(syntax, to).insertText(syntax, from); + var newSelection = selection.empty + ? createTextSelection(tr, from + syntaxLen) + : createTextSelection(tr, from + syntaxLen, to + syntaxLen); + tr.setSelection(newSelection); + } + dispatch(tr); + return true; + }; }; +} + +var reStrong = /^(\*{2}|_{2}).*([\s\S]*)\1$/m; +var strongSyntax = '**'; +var Strong$1 = /** @class */ (function (_super) { + __extends$1(Strong, _super); + function Strong() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Strong.prototype, "name", { + get: function () { + return 'strong'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Strong.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('strong') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + Strong.prototype.bold = function () { + return toggleMark(reStrong, strongSyntax); + }; + Strong.prototype.commands = function () { + return { bold: this.bold() }; + }; + Strong.prototype.keymaps = function () { + var boldCommand = this.bold()(); + return { 'Mod-b': boldCommand, 'Mod-B': boldCommand }; + }; + return Strong; +}(Mark)); + +var reStrike = /^(~{2}).*([\s\S]*)\1$/m; +var strikeSyntax = '~~'; +var Strike$1 = /** @class */ (function (_super) { + __extends$1(Strike, _super); + function Strike() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Strike.prototype, "name", { + get: function () { + return 'strike'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Strike.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('strike') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + Strike.prototype.commands = function () { + return toggleMark(reStrike, strikeSyntax); + }; + Strike.prototype.keymaps = function () { + var strikeCommand = this.commands()(); + return { 'Mod-s': strikeCommand, 'Mod-S': strikeCommand }; + }; + return Strike; +}(Mark)); + +var reEmph = /^(\*|_).*([\s\S]*)\1$/m; +var emphSyntax = '*'; +var Emph$1 = /** @class */ (function (_super) { + __extends$1(Emph, _super); + function Emph() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Emph.prototype, "name", { + get: function () { + return 'emph'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Emph.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('emph') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + Emph.prototype.italic = function () { + return toggleMark(reEmph, emphSyntax); + }; + Emph.prototype.commands = function () { + return { italic: this.italic() }; + }; + Emph.prototype.keymaps = function () { + var italicCommand = this.italic()(); + return { 'Mod-i': italicCommand, 'Mod-I': italicCommand }; + }; + return Emph; +}(Mark)); + +var reCode = /^(`).*([\s\S]*)\1$/m; +var codeSyntax = '`'; +var Code$1 = /** @class */ (function (_super) { + __extends$1(Code, _super); + function Code() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Code.prototype, "name", { + get: function () { + return 'code'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Code.prototype, "schema", { + get: function () { + return { + attrs: { + start: { default: false }, + end: { default: false }, + marked: { default: false }, + }, + toDOM: function (mark) { + var _a = mark.attrs, start = _a.start, end = _a.end, marked = _a.marked; + var classNames = 'code'; + if (start) { + classNames += '|delimiter|start'; + } + if (end) { + classNames += '|delimiter|end'; + } + if (marked) { + classNames += '|marked-text'; + } + return ['span', { class: clsWithMdPrefix.apply(void 0, classNames.split('|')) }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + Code.prototype.commands = function () { + return toggleMark(reCode, codeSyntax); + }; + Code.prototype.keymaps = function () { + var codeCommand = this.commands()(); + return { 'Shift-Mod-c': codeCommand, 'Shift-Mod-C': codeCommand }; + }; + return Code; +}(Mark)); + +var encoderList = [ + { + regExp: /\(/g, + encoded: '%28', + escaped: '\\(', + }, + { + regExp: /\)/g, + encoded: '%29', + escaped: '\\)', + }, + { + regExp: /\[/g, + encoded: '%5B', + escaped: '\\[', + }, + { + regExp: /\]/g, + encoded: '%5D', + escaped: '\\]', + }, + { + regExp: //g, + encoded: '%3E', + escaped: '\\>', + }, + { + regExp: / /g, + encoded: '%20', + escaped: ' ', + }, +]; +function escapeMarkdownText(text) { + return encoderList.reduce(function (result, _a) { + var regExp = _a.regExp, escaped = _a.escaped; + return result.replace(regExp, escaped); + }, text); +} +function encodeMarkdownText(text) { + return encoderList.reduce(function (result, _a) { + var regExp = _a.regExp, encoded = _a.encoded; + return result.replace(regExp, encoded); + }, text); +} + +var Link$1 = /** @class */ (function (_super) { + __extends$1(Link, _super); + function Link() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Link.prototype, "name", { + get: function () { + return 'link'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Link.prototype, "schema", { + get: function () { + return { + attrs: { + url: { default: false }, + desc: { default: false }, + }, + toDOM: function (_a) { + var attrs = _a.attrs; + var url = attrs.url, desc = attrs.desc; + var classNames = 'link'; + if (url) { + classNames += '|link-url|marked-text'; + } + if (desc) { + classNames += '|link-desc|marked-text'; + } + return ['span', { class: clsWithMdPrefix.apply(void 0, classNames.split('|')) }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + Link.prototype.addLinkOrImage = function (commandType) { + return function (payload) { return function (_a, dispatch) { + var selection = _a.selection, tr = _a.tr, schema = _a.schema; + var _b = resolveSelectionPos(selection), from = _b[0], to = _b[1]; + var _c = payload, linkText = _c.linkText, altText = _c.altText, linkUrl = _c.linkUrl, imageUrl = _c.imageUrl; + var text = linkText; + var url = linkUrl; + var syntax = ''; + if (commandType === 'image') { + text = altText; + url = imageUrl; + syntax = '!'; + } + text = escapeMarkdownText(text); + url = encodeMarkdownText(url); + syntax += "[" + text + "](" + url + ")"; + dispatch(tr.replaceWith(from, to, createTextNode$1(schema, syntax))); + return true; + }; }; + }; + Link.prototype.commands = function () { + return { + addImage: this.addLinkOrImage('image'), + addLink: this.addLinkOrImage('link'), + }; + }; + return Link; +}(Mark)); + +var TaskDelimiter = /** @class */ (function (_super) { + __extends$1(TaskDelimiter, _super); + function TaskDelimiter() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(TaskDelimiter.prototype, "name", { + get: function () { + return 'taskDelimiter'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TaskDelimiter.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('delimiter', 'list-item') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + return TaskDelimiter; +}(Mark)); +var Delimiter = /** @class */ (function (_super) { + __extends$1(Delimiter, _super); + function Delimiter() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Delimiter.prototype, "name", { + get: function () { + return 'delimiter'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Delimiter.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('delimiter') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + return Delimiter; +}(Mark)); +var Meta = /** @class */ (function (_super) { + __extends$1(Meta, _super); + function Meta() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Meta.prototype, "name", { + get: function () { + return 'meta'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Meta.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('meta') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + return Meta; +}(Mark)); +var MarkedText = /** @class */ (function (_super) { + __extends$1(MarkedText, _super); + function MarkedText() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(MarkedText.prototype, "name", { + get: function () { + return 'markedText'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MarkedText.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('marked-text') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + return MarkedText; +}(Mark)); +var TableCell = /** @class */ (function (_super) { + __extends$1(TableCell, _super); + function TableCell() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(TableCell.prototype, "name", { + get: function () { + return 'tableCell'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TableCell.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('table-cell') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + return TableCell; +}(Mark)); + +var Html = /** @class */ (function (_super) { + __extends$1(Html, _super); + function Html() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Html.prototype, "name", { + get: function () { + return 'html'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Html.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('html') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + return Html; +}(Mark)); + +var CustomBlock$1 = /** @class */ (function (_super) { + __extends$1(CustomBlock, _super); + function CustomBlock() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(CustomBlock.prototype, "name", { + get: function () { + return 'customBlock'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(CustomBlock.prototype, "schema", { + get: function () { + return { + toDOM: function () { + return ['span', { class: clsWithMdPrefix('custom-block') }, 0]; + }, + }; + }, + enumerable: false, + configurable: true + }); + return CustomBlock; +}(Mark)); + +var reTaskMarkerKey = /x|backspace/i; +var reTaskMarker = /^\[(\s*)(x?)(\s*)\](?:\s+)/i; +function smartTask(_a) { + var schema = _a.schema, toastMark = _a.toastMark; + return new Plugin({ + props: { + handleDOMEvents: { + keyup: function (view, ev) { + var _a; + var _b = view.state, doc = _b.doc, tr = _b.tr, selection = _b.selection; + if (selection.empty && reTaskMarkerKey.test(ev.key)) { + var _c = getRangeInfo(selection), startIndex = _c.startIndex, startFromOffset = _c.startFromOffset, from = _c.from; + // should add `1` to line for the markdown parser + // because markdown parser has `1`(not zero) as the start number + var mdPos = [startIndex + 1, from - startFromOffset + 1]; + var mdNode = toastMark.findNodeAtPosition(mdPos); + var paraNode = findClosestNode(mdNode, function (node) { var _a; return node.type === 'paragraph' && ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === 'item'; }); + if ((_a = paraNode === null || paraNode === void 0 ? void 0 : paraNode.firstChild) === null || _a === void 0 ? void 0 : _a.literal) { + var firstChild = paraNode.firstChild; + var matched = firstChild.literal.match(reTaskMarker); + if (matched) { + var startMdPos = firstChild.sourcepos[0]; + var startSpaces = matched[1], stateChar = matched[2], lastSpaces = matched[3]; + var spaces = startSpaces.length + lastSpaces.length; + var startOffset = getNodeContentOffsetRange(doc, startMdPos[0] - 1).startOffset; + var startPos = startMdPos[1] + startOffset; + if (stateChar) { + var addedPos = spaces ? spaces + 1 : 0; + tr.replaceWith(startPos, addedPos + startPos, schema.text(stateChar)); + view.dispatch(tr); + } + else if (!spaces) { + tr.insertText(' ', startPos); + view.dispatch(tr); + } + } + } + } + return false; + }, + }, + }, + }); +} + +var EVENT_TYPE = 'cut'; +var reLineEnding$2 = /\r\n|\n|\r/; +var MdEditor = /** @class */ (function (_super) { + __extends$1(MdEditor, _super); + function MdEditor(eventEmitter, options) { + var _this = _super.call(this, eventEmitter) || this; + var toastMark = options.toastMark, _a = options.useCommandShortcut, useCommandShortcut = _a === void 0 ? true : _a, _b = options.mdPlugins, mdPlugins = _b === void 0 ? [] : _b; + _this.editorType = 'markdown'; + _this.el.classList.add('md-mode'); + _this.toastMark = toastMark; + _this.extraPlugins = mdPlugins; + _this.specs = _this.createSpecs(); + _this.schema = _this.createSchema(); + _this.context = _this.createContext(); + _this.keymaps = _this.createKeymaps(useCommandShortcut); + _this.view = _this.createView(); + _this.commands = _this.createCommands(); + _this.specs.setContext(__assign$1(__assign$1({}, _this.context), { view: _this.view })); + _this.createClipboard(); + _this.eventEmitter.listen('changePreviewTabWrite', function () { return _this.toggleActive(true); }); + _this.eventEmitter.listen('changePreviewTabPreview', function () { return _this.toggleActive(false); }); + _this.initEvent(); + return _this; + } + MdEditor.prototype.toggleActive = function (active) { + toggleClass(this.el, 'active', active); + if (active) { + this.focus(); + } + else { + this.blur(); + } + }; + MdEditor.prototype.createClipboard = function () { + var _this = this; + this.clipboard = document.createElement('textarea'); + this.clipboard.className = cls('pseudo-clipboard'); + this.clipboard.addEventListener('paste', function (ev) { + var clipboardData = ev.clipboardData || window.clipboardData; + var items = clipboardData && clipboardData.items; + if (items) { + var imageBlob = pasteImageOnly(items); + if (imageBlob) { + ev.preventDefault(); + emitImageBlobHook(_this.eventEmitter, imageBlob, ev.type); + } + } + }); + // process the pasted data in input event for IE11 + this.clipboard.addEventListener('input', function (ev) { + var text = ev.target.value; + _this.replaceSelection(text); + ev.preventDefault(); + ev.target.value = ''; + }); + this.el.insertBefore(this.clipboard, this.view.dom); + }; + MdEditor.prototype.createContext = function () { + return { + toastMark: this.toastMark, + schema: this.schema, + eventEmitter: this.eventEmitter, + }; + }; + MdEditor.prototype.createSpecs = function () { + return new SpecManager([ + new Doc$1(), + new Paragraph$1(), + new Widget(), + new Text$1(), + new Heading$1(), + new BlockQuote$1(), + new CodeBlock$1(), + new CustomBlock$1(), + new Table$1(), + new TableCell(), + new ThematicBreak$1(), + new ListItem$1(), + new Strong$1(), + new Strike$1(), + new Emph$1(), + new Code$1(), + new Link$1(), + new Delimiter(), + new TaskDelimiter(), + new MarkedText(), + new Meta(), + new Html(), + ]); + }; + MdEditor.prototype.createPlugins = function () { + return this.defaultPlugins.concat(__spreadArray$1([ + syntaxHighlight(this.context), + previewHighlight(this.context), + smartTask(this.context) + ], this.createPluginProps())); + }; + MdEditor.prototype.createView = function () { + var _this = this; + return new EditorView(this.el, { + state: this.createState(), + dispatchTransaction: function (tr) { + _this.updateMarkdown(tr); + var state = _this.view.state.applyTransaction(tr).state; + _this.view.updateState(state); + _this.emitChangeEvent(tr); + }, + handleKeyDown: function (_, ev) { + if ((ev.metaKey || ev.ctrlKey) && ev.key.toUpperCase() === 'V') { + _this.clipboard.focus(); + } + _this.eventEmitter.emit('keydown', _this.editorType, ev); + return false; + }, + handleDOMEvents: { + copy: function (_, ev) { return _this.captureCopy(ev); }, + cut: function (_, ev) { return _this.captureCopy(ev, EVENT_TYPE); }, + scroll: function () { + _this.eventEmitter.emit('scroll', 'editor'); + return true; + }, + keyup: function (_, ev) { + _this.eventEmitter.emit('keyup', _this.editorType, ev); + return false; + }, + }, + nodeViews: { + widget: widgetNodeView, + }, + }); + }; + MdEditor.prototype.createCommands = function () { + return this.specs.commands(this.view); + }; + MdEditor.prototype.captureCopy = function (ev, type) { + ev.preventDefault(); + var _a = this.view.state, selection = _a.selection, tr = _a.tr; + if (selection.empty) { + return true; + } + var text = this.getChanged(selection.content()); + if (ev.clipboardData) { + ev.clipboardData.setData('text/plain', text); + } + else { + window.clipboardData.setData('Text', text); + } + if (type === EVENT_TYPE) { + this.view.dispatch(tr.deleteSelection().scrollIntoView().setMeta('uiEvent', EVENT_TYPE)); + } + return true; + }; + MdEditor.prototype.updateMarkdown = function (tr) { + var _this = this; + if (tr.docChanged) { + tr.steps.forEach(function (step, index) { + if (step.slice && !(step instanceof ReplaceAroundStep)) { + var doc = tr.docs[index]; + var _a = [step.from, step.to], from = _a[0], to = _a[1]; + var _b = getEditorToMdPos(doc, from, to), startPos = _b[0], endPos = _b[1]; + var changed = _this.getChanged(step.slice); + if (startPos[0] === endPos[0] && startPos[1] === endPos[1] && changed === '') { + changed = '\n'; + } + var editResult = _this.toastMark.editMarkdown(startPos, endPos, changed); + _this.eventEmitter.emit('updatePreview', editResult); + tr.setMeta('editResult', editResult).scrollIntoView(); + } + }); + } + }; + MdEditor.prototype.getChanged = function (slice) { + var changed = ''; + var from = 0; + var to = slice.content.size; + slice.content.nodesBetween(from, to, function (node, pos) { + if (node.isText) { + changed += node.text.slice(Math.max(from, pos) - pos, to - pos); + } + else if (node.isBlock && pos > 0) { + changed += '\n'; + } + }); + return changed; + }; + MdEditor.prototype.setSelection = function (start, end) { + if (end === void 0) { end = start; } + var tr = this.view.state.tr; + var _a = getMdToEditorPos(tr.doc, start, end), from = _a[0], to = _a[1]; + this.view.dispatch(tr.setSelection(createTextSelection(tr, from, to)).scrollIntoView()); + }; + MdEditor.prototype.replaceSelection = function (text, start, end) { + var newTr; + var _a = this.view.state, tr = _a.tr, schema = _a.schema, doc = _a.doc; + var lineTexts = text.split(reLineEnding$2); + var nodes = lineTexts.map(function (lineText) { + return createParagraph(schema, createNodesWithWidget(lineText, schema)); + }); + var slice = new Slice(Fragment.from(nodes), 1, 1); + this.focus(); + if (start && end) { + var _b = getMdToEditorPos(doc, start, end), from = _b[0], to = _b[1]; + newTr = tr.replaceRange(from, to, slice); + } + else { + newTr = tr.replaceSelection(slice); + } + this.view.dispatch(newTr.scrollIntoView()); + }; + MdEditor.prototype.deleteSelection = function (start, end) { + var newTr; + var _a = this.view.state, tr = _a.tr, doc = _a.doc; + if (start && end) { + var _b = getMdToEditorPos(doc, start, end), from = _b[0], to = _b[1]; + newTr = tr.deleteRange(from, to); + } + else { + newTr = tr.deleteSelection(); + } + this.view.dispatch(newTr.scrollIntoView()); + }; + MdEditor.prototype.getSelectedText = function (start, end) { + var _a = this.view.state, doc = _a.doc, selection = _a.selection; + var from = selection.from, to = selection.to; + if (start && end) { + var pos = getMdToEditorPos(doc, start, end); + from = pos[0]; + to = pos[1]; + } + return doc.textBetween(from, to, '\n'); + }; + MdEditor.prototype.getSelection = function () { + var _a = this.view.state.selection, from = _a.from, to = _a.to; + return getEditorToMdPos(this.view.state.tr.doc, from, to); + }; + MdEditor.prototype.setMarkdown = function (markdown, cursorToEnd) { + if (cursorToEnd === void 0) { cursorToEnd = true; } + var lineTexts = markdown.split(reLineEnding$2); + var _a = this.view.state, tr = _a.tr, doc = _a.doc, schema = _a.schema; + var nodes = lineTexts.map(function (lineText) { + return createParagraph(schema, createNodesWithWidget(lineText, schema)); + }); + this.view.dispatch(tr.replaceWith(0, doc.content.size, nodes)); + if (cursorToEnd) { + this.moveCursorToEnd(true); + } + }; + MdEditor.prototype.addWidget = function (node, style, mdPos) { + var _a = this.view.state, tr = _a.tr, doc = _a.doc, selection = _a.selection; + var pos = mdPos ? getMdToEditorPos(doc, mdPos, mdPos)[0] : selection.to; + this.view.dispatch(tr.setMeta('widget', { pos: pos, node: node, style: style })); + }; + MdEditor.prototype.replaceWithWidget = function (start, end, text) { + var _a = this.view.state, tr = _a.tr, schema = _a.schema, doc = _a.doc; + var pos = getMdToEditorPos(doc, start, end); + var nodes = createNodesWithWidget(text, schema); + this.view.dispatch(tr.replaceWith(pos[0], pos[1], nodes)); + }; + MdEditor.prototype.getRangeInfoOfNode = function (pos) { + var _a = this.view.state, doc = _a.doc, selection = _a.selection; + var mdPos = pos || getEditorToMdPos(doc, selection.from)[0]; + var mdNode = this.toastMark.findNodeAtPosition(mdPos); + if (mdNode.type === 'text' && mdNode.parent.type !== 'paragraph') { + mdNode = mdNode.parent; + } + // add 1 sync for prosemirror position + mdNode.sourcepos[1][1] += 1; + return { range: mdNode.sourcepos, type: mdNode.type }; + }; + MdEditor.prototype.getMarkdown = function () { + return this.toastMark + .getLineTexts() + .map(function (lineText) { return unwrapWidgetSyntax(lineText); }) + .join('\n'); + }; + MdEditor.prototype.getToastMark = function () { + return this.toastMark; + }; + return MdEditor; +}(EditorBase)); + +/** + * @fileoverview Get event collection for specific HTML element + * @author NHN FE Development Lab + */ + +var EVENT_KEY = '_feEventKey'; + +/** + * Get event collection for specific HTML element + * @param {HTMLElement} element - HTML element + * @param {string} type - event type + * @returns {array} + * @private + */ +function safeEvent$2(element, type) { + var events = element[EVENT_KEY]; + var handlers; + + if (!events) { + events = element[EVENT_KEY] = {}; + } + + handlers = events[type]; + if (!handlers) { + handlers = events[type] = []; + } + + return handlers; +} + +var _safeEvent = safeEvent$2; + +/** + * @fileoverview Unbind DOM events + * @author NHN FE Development Lab + */ + +var isString$1 = isString_1; +var forEach$1 = forEach_1; + +var safeEvent$1 = _safeEvent; + +/** + * Unbind DOM events + * If a handler function is not passed, remove all events of that type. + * @param {HTMLElement} element - element to unbind events + * @param {(string|object)} types - Space splitted events names or eventName:handler object + * @param {function} [handler] - handler function + * @memberof module:domEvent + * @example + * // Following the example of domEvent#on + * + * // Unbind one event from an element. + * off(div, 'click', toggle); + * + * // Unbind multiple events with a same handler from multiple elements at once. + * // Use event names splitted by a space. + * off(element, 'mouseenter mouseleave', changeColor); + * + * // Unbind multiple events with different handlers from an element at once. + * // Use an object which of key is an event name and value is a handler function. + * off(div, { + * keydown: highlight, + * keyup: dehighlight + * }); + * + * // Unbind events without handlers. + * off(div, 'drag'); + */ +function off(element, types, handler) { + if (isString$1(types)) { + forEach$1(types.split(/\s+/g), function(type) { + unbindEvent(element, type, handler); + }); + + return; + } + + forEach$1(types, function(func, type) { + unbindEvent(element, type, func); + }); +} + +/** + * Unbind DOM events + * If a handler function is not passed, remove all events of that type. + * @param {HTMLElement} element - element to unbind events + * @param {string} type - events name + * @param {function} [handler] - handler function + * @private + */ +function unbindEvent(element, type, handler) { + var events = safeEvent$1(element, type); + var index; + + if (!handler) { + forEach$1(events, function(item) { + removeHandler(element, type, item.wrappedHandler); + }); + events.splice(0, events.length); + } else { + forEach$1(events, function(item, idx) { + if (handler === item.handler) { + removeHandler(element, type, item.wrappedHandler); + index = idx; + + return false; + } + + return true; + }); + events.splice(index, 1); + } +} + +/** + * Remove an event handler + * @param {HTMLElement} element - An element to remove an event + * @param {string} type - event type + * @param {function} handler - event handler + * @private + */ +function removeHandler(element, type, handler) { + if ('removeEventListener' in element) { + element.removeEventListener(type, handler); + } else if ('detachEvent' in element) { + element.detachEvent('on' + type, handler); + } +} + +var off_1 = off; + +/** + * @fileoverview Bind DOM events + * @author NHN FE Development Lab + */ + +var isString = isString_1; +var forEach = forEach_1; + +var safeEvent = _safeEvent; + +/** + * Bind DOM events. + * @param {HTMLElement} element - element to bind events + * @param {(string|object)} types - Space splitted events names or eventName:handler object + * @param {(function|object)} handler - handler function or context for handler method + * @param {object} [context] context - context for handler method. + * @memberof module:domEvent + * @example + * const div = document.querySelector('div'); + * + * // Bind one event to an element. + * on(div, 'click', toggle); + * + * // Bind multiple events with a same handler to multiple elements at once. + * // Use event names splitted by a space. + * on(div, 'mouseenter mouseleave', changeColor); + * + * // Bind multiple events with different handlers to an element at once. + * // Use an object which of key is an event name and value is a handler function. + * on(div, { + * keydown: highlight, + * keyup: dehighlight + * }); + * + * // Set a context for handler method. + * const name = 'global'; + * const repository = {name: 'CodeSnippet'}; + * on(div, 'drag', function() { + * console.log(this.name); + * }, repository); + * // Result when you drag a div: "CodeSnippet" + */ +function on(element, types, handler, context) { + if (isString(types)) { + forEach(types.split(/\s+/g), function(type) { + bindEvent(element, type, handler, context); + }); + + return; + } + + forEach(types, function(func, type) { + bindEvent(element, type, func, handler); + }); +} + +/** + * Bind DOM events + * @param {HTMLElement} element - element to bind events + * @param {string} type - events name + * @param {function} handler - handler function or context for handler method + * @param {object} [context] context - context for handler method. + * @private + */ +function bindEvent(element, type, handler, context) { + /** + * Event handler + * @param {Event} e - event object + */ + function eventHandler(e) { + handler.call(context || element, e || window.event); + } + + if ('addEventListener' in element) { + element.addEventListener(type, eventHandler); + } else if ('attachEvent' in element) { + element.attachEvent('on' + type, eventHandler); + } + memorizeHandler(element, type, handler, eventHandler); +} + +/** + * Memorize DOM event handler for unbinding. + * @param {HTMLElement} element - element to bind events + * @param {string} type - events name + * @param {function} handler - handler function that user passed at on() use + * @param {function} wrappedHandler - handler function that wrapped by domevent for implementing some features + * @private + */ +function memorizeHandler(element, type, handler, wrappedHandler) { + var events = safeEvent(element, type); + var existInEvents = false; + + forEach(events, function(obj) { + if (obj.handler === handler) { + existInEvents = true; + + return false; + } + + return true; + }); + + if (!existInEvents) { + events.push({ + handler: handler, + wrappedHandler: wrappedHandler + }); + } +} + +var on_1 = on; + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; + +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + +var encodeCache = {}; + + +// Create a lookup array where anything but characters in `chars` string +// and alphanumeric chars is percent-encoded. +// +function getEncodeCache(exclude) { + var i, ch, cache = encodeCache[exclude]; + if (cache) { return cache; } + + cache = encodeCache[exclude] = []; + + for (i = 0; i < 128; i++) { + ch = String.fromCharCode(i); + + if (/^[0-9a-z]$/i.test(ch)) { + // always allow unencoded alphanumeric characters + cache.push(ch); + } else { + cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2)); + } + } + + for (i = 0; i < exclude.length; i++) { + cache[exclude.charCodeAt(i)] = exclude[i]; + } + + return cache; +} + + +// Encode unsafe characters with percent-encoding, skipping already +// encoded sequences. +// +// - string - string to encode +// - exclude - list of characters to ignore (in addition to a-zA-Z0-9) +// - keepEscaped - don't encode '%' in a correct escape sequence (default: true) +// +function encode$1(string, exclude, keepEscaped) { + var i, l, code, nextCode, cache, + result = ''; + + if (typeof exclude !== 'string') { + // encode(string, keepEscaped) + keepEscaped = exclude; + exclude = encode$1.defaultChars; + } + + if (typeof keepEscaped === 'undefined') { + keepEscaped = true; + } + + cache = getEncodeCache(exclude); + + for (i = 0, l = string.length; i < l; i++) { + code = string.charCodeAt(i); + + if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) { + if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) { + result += string.slice(i, i + 3); + i += 2; + continue; + } + } + + if (code < 128) { + result += cache[code]; + continue; + } + + if (code >= 0xD800 && code <= 0xDFFF) { + if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) { + nextCode = string.charCodeAt(i + 1); + if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) { + result += encodeURIComponent(string[i] + string[i + 1]); + i++; + continue; + } + } + result += '%EF%BF%BD'; + continue; + } + + result += encodeURIComponent(string[i]); + } + + return result; +} + +encode$1.defaultChars = ";/?:@&=+$,-_.!~*'()#"; +encode$1.componentChars = "-_.!~*'()"; + + +var encode_1 = encode$1; + +var lib = {}; + +var decode = {}; + +var Aacute$1 = "Á"; +var aacute$1 = "á"; +var Abreve = "Ă"; +var abreve = "ă"; +var ac = "∾"; +var acd = "∿"; +var acE = "∾̳"; +var Acirc$1 = "Â"; +var acirc$1 = "â"; +var acute$1 = "´"; +var Acy = "А"; +var acy = "а"; +var AElig$1 = "Æ"; +var aelig$1 = "æ"; +var af = "⁡"; +var Afr = "𝔄"; +var afr = "𝔞"; +var Agrave$1 = "À"; +var agrave$1 = "à"; +var alefsym = "ℵ"; +var aleph = "ℵ"; +var Alpha = "Α"; +var alpha = "α"; +var Amacr = "Ā"; +var amacr = "ā"; +var amalg = "⨿"; +var amp$2 = "&"; +var AMP$1 = "&"; +var andand = "⩕"; +var And = "⩓"; +var and = "∧"; +var andd = "⩜"; +var andslope = "⩘"; +var andv = "⩚"; +var ang = "∠"; +var ange = "⦤"; +var angle = "∠"; +var angmsdaa = "⦨"; +var angmsdab = "⦩"; +var angmsdac = "⦪"; +var angmsdad = "⦫"; +var angmsdae = "⦬"; +var angmsdaf = "⦭"; +var angmsdag = "⦮"; +var angmsdah = "⦯"; +var angmsd = "∡"; +var angrt = "∟"; +var angrtvb = "⊾"; +var angrtvbd = "⦝"; +var angsph = "∢"; +var angst = "Å"; +var angzarr = "⍼"; +var Aogon = "Ą"; +var aogon = "ą"; +var Aopf = "𝔸"; +var aopf = "𝕒"; +var apacir = "⩯"; +var ap = "≈"; +var apE = "⩰"; +var ape = "≊"; +var apid = "≋"; +var apos$1 = "'"; +var ApplyFunction = "⁡"; +var approx = "≈"; +var approxeq = "≊"; +var Aring$1 = "Å"; +var aring$1 = "å"; +var Ascr = "𝒜"; +var ascr = "𝒶"; +var Assign = "≔"; +var ast = "*"; +var asymp = "≈"; +var asympeq = "≍"; +var Atilde$1 = "Ã"; +var atilde$1 = "ã"; +var Auml$1 = "Ä"; +var auml$1 = "ä"; +var awconint = "∳"; +var awint = "⨑"; +var backcong = "≌"; +var backepsilon = "϶"; +var backprime = "‵"; +var backsim = "∽"; +var backsimeq = "⋍"; +var Backslash = "∖"; +var Barv = "⫧"; +var barvee = "⊽"; +var barwed = "⌅"; +var Barwed = "⌆"; +var barwedge = "⌅"; +var bbrk = "⎵"; +var bbrktbrk = "⎶"; +var bcong = "≌"; +var Bcy = "Б"; +var bcy = "б"; +var bdquo = "„"; +var becaus = "∵"; +var because = "∵"; +var Because = "∵"; +var bemptyv = "⦰"; +var bepsi = "϶"; +var bernou = "ℬ"; +var Bernoullis = "ℬ"; +var Beta = "Β"; +var beta = "β"; +var beth = "ℶ"; +var between = "≬"; +var Bfr = "𝔅"; +var bfr = "𝔟"; +var bigcap = "⋂"; +var bigcirc = "◯"; +var bigcup = "⋃"; +var bigodot = "⨀"; +var bigoplus = "⨁"; +var bigotimes = "⨂"; +var bigsqcup = "⨆"; +var bigstar = "★"; +var bigtriangledown = "▽"; +var bigtriangleup = "△"; +var biguplus = "⨄"; +var bigvee = "⋁"; +var bigwedge = "⋀"; +var bkarow = "⤍"; +var blacklozenge = "⧫"; +var blacksquare = "▪"; +var blacktriangle = "▴"; +var blacktriangledown = "▾"; +var blacktriangleleft = "◂"; +var blacktriangleright = "▸"; +var blank = "␣"; +var blk12 = "▒"; +var blk14 = "░"; +var blk34 = "▓"; +var block = "█"; +var bne = "=⃥"; +var bnequiv = "≡⃥"; +var bNot = "⫭"; +var bnot = "⌐"; +var Bopf = "𝔹"; +var bopf = "𝕓"; +var bot = "⊥"; +var bottom = "⊥"; +var bowtie = "⋈"; +var boxbox = "⧉"; +var boxdl = "┐"; +var boxdL = "╕"; +var boxDl = "╖"; +var boxDL = "╗"; +var boxdr = "┌"; +var boxdR = "╒"; +var boxDr = "╓"; +var boxDR = "╔"; +var boxh = "─"; +var boxH = "═"; +var boxhd = "┬"; +var boxHd = "╤"; +var boxhD = "╥"; +var boxHD = "╦"; +var boxhu = "┴"; +var boxHu = "╧"; +var boxhU = "╨"; +var boxHU = "╩"; +var boxminus = "⊟"; +var boxplus = "⊞"; +var boxtimes = "⊠"; +var boxul = "┘"; +var boxuL = "╛"; +var boxUl = "╜"; +var boxUL = "╝"; +var boxur = "└"; +var boxuR = "╘"; +var boxUr = "╙"; +var boxUR = "╚"; +var boxv = "│"; +var boxV = "║"; +var boxvh = "┼"; +var boxvH = "╪"; +var boxVh = "╫"; +var boxVH = "╬"; +var boxvl = "┤"; +var boxvL = "╡"; +var boxVl = "╢"; +var boxVL = "╣"; +var boxvr = "├"; +var boxvR = "╞"; +var boxVr = "╟"; +var boxVR = "╠"; +var bprime = "‵"; +var breve = "˘"; +var Breve = "˘"; +var brvbar$1 = "¦"; +var bscr = "𝒷"; +var Bscr = "ℬ"; +var bsemi = "⁏"; +var bsim = "∽"; +var bsime = "⋍"; +var bsolb = "⧅"; +var bsol = "\\"; +var bsolhsub = "⟈"; +var bull = "•"; +var bullet = "•"; +var bump = "≎"; +var bumpE = "⪮"; +var bumpe = "≏"; +var Bumpeq = "≎"; +var bumpeq = "≏"; +var Cacute = "Ć"; +var cacute = "ć"; +var capand = "⩄"; +var capbrcup = "⩉"; +var capcap = "⩋"; +var cap = "∩"; +var Cap = "⋒"; +var capcup = "⩇"; +var capdot = "⩀"; +var CapitalDifferentialD = "ⅅ"; +var caps = "∩︀"; +var caret = "⁁"; +var caron = "ˇ"; +var Cayleys = "ℭ"; +var ccaps = "⩍"; +var Ccaron = "Č"; +var ccaron = "č"; +var Ccedil$1 = "Ç"; +var ccedil$1 = "ç"; +var Ccirc = "Ĉ"; +var ccirc = "ĉ"; +var Cconint = "∰"; +var ccups = "⩌"; +var ccupssm = "⩐"; +var Cdot = "Ċ"; +var cdot = "ċ"; +var cedil$1 = "¸"; +var Cedilla = "¸"; +var cemptyv = "⦲"; +var cent$1 = "¢"; +var centerdot = "·"; +var CenterDot = "·"; +var cfr = "𝔠"; +var Cfr = "ℭ"; +var CHcy = "Ч"; +var chcy = "ч"; +var check = "✓"; +var checkmark = "✓"; +var Chi = "Χ"; +var chi = "χ"; +var circ = "ˆ"; +var circeq = "≗"; +var circlearrowleft = "↺"; +var circlearrowright = "↻"; +var circledast = "⊛"; +var circledcirc = "⊚"; +var circleddash = "⊝"; +var CircleDot = "⊙"; +var circledR = "®"; +var circledS = "Ⓢ"; +var CircleMinus = "⊖"; +var CirclePlus = "⊕"; +var CircleTimes = "⊗"; +var cir = "○"; +var cirE = "⧃"; +var cire = "≗"; +var cirfnint = "⨐"; +var cirmid = "⫯"; +var cirscir = "⧂"; +var ClockwiseContourIntegral = "∲"; +var CloseCurlyDoubleQuote = "”"; +var CloseCurlyQuote = "’"; +var clubs = "♣"; +var clubsuit = "♣"; +var colon = ":"; +var Colon = "∷"; +var Colone = "⩴"; +var colone = "≔"; +var coloneq = "≔"; +var comma = ","; +var commat = "@"; +var comp = "∁"; +var compfn = "∘"; +var complement = "∁"; +var complexes = "ℂ"; +var cong = "≅"; +var congdot = "⩭"; +var Congruent = "≡"; +var conint = "∮"; +var Conint = "∯"; +var ContourIntegral = "∮"; +var copf = "𝕔"; +var Copf = "ℂ"; +var coprod = "∐"; +var Coproduct = "∐"; +var copy$1 = "©"; +var COPY$1 = "©"; +var copysr = "℗"; +var CounterClockwiseContourIntegral = "∳"; +var crarr = "↵"; +var cross = "✗"; +var Cross = "⨯"; +var Cscr = "𝒞"; +var cscr = "𝒸"; +var csub = "⫏"; +var csube = "⫑"; +var csup = "⫐"; +var csupe = "⫒"; +var ctdot = "⋯"; +var cudarrl = "⤸"; +var cudarrr = "⤵"; +var cuepr = "⋞"; +var cuesc = "⋟"; +var cularr = "↶"; +var cularrp = "⤽"; +var cupbrcap = "⩈"; +var cupcap = "⩆"; +var CupCap = "≍"; +var cup = "∪"; +var Cup = "⋓"; +var cupcup = "⩊"; +var cupdot = "⊍"; +var cupor = "⩅"; +var cups = "∪︀"; +var curarr = "↷"; +var curarrm = "⤼"; +var curlyeqprec = "⋞"; +var curlyeqsucc = "⋟"; +var curlyvee = "⋎"; +var curlywedge = "⋏"; +var curren$1 = "¤"; +var curvearrowleft = "↶"; +var curvearrowright = "↷"; +var cuvee = "⋎"; +var cuwed = "⋏"; +var cwconint = "∲"; +var cwint = "∱"; +var cylcty = "⌭"; +var dagger = "†"; +var Dagger = "‡"; +var daleth = "ℸ"; +var darr = "↓"; +var Darr = "↡"; +var dArr = "⇓"; +var dash = "‐"; +var Dashv = "⫤"; +var dashv = "⊣"; +var dbkarow = "⤏"; +var dblac = "˝"; +var Dcaron = "Ď"; +var dcaron = "ď"; +var Dcy = "Д"; +var dcy = "д"; +var ddagger = "‡"; +var ddarr = "⇊"; +var DD = "ⅅ"; +var dd = "ⅆ"; +var DDotrahd = "⤑"; +var ddotseq = "⩷"; +var deg$1 = "°"; +var Del = "∇"; +var Delta = "Δ"; +var delta = "δ"; +var demptyv = "⦱"; +var dfisht = "⥿"; +var Dfr = "𝔇"; +var dfr = "𝔡"; +var dHar = "⥥"; +var dharl = "⇃"; +var dharr = "⇂"; +var DiacriticalAcute = "´"; +var DiacriticalDot = "˙"; +var DiacriticalDoubleAcute = "˝"; +var DiacriticalGrave = "`"; +var DiacriticalTilde = "˜"; +var diam = "⋄"; +var diamond = "⋄"; +var Diamond = "⋄"; +var diamondsuit = "♦"; +var diams = "♦"; +var die = "¨"; +var DifferentialD = "ⅆ"; +var digamma = "ϝ"; +var disin = "⋲"; +var div = "÷"; +var divide$1 = "÷"; +var divideontimes = "⋇"; +var divonx = "⋇"; +var DJcy = "Ђ"; +var djcy = "ђ"; +var dlcorn = "⌞"; +var dlcrop = "⌍"; +var dollar = "$"; +var Dopf = "𝔻"; +var dopf = "𝕕"; +var Dot = "¨"; +var dot = "˙"; +var DotDot = "⃜"; +var doteq = "≐"; +var doteqdot = "≑"; +var DotEqual = "≐"; +var dotminus = "∸"; +var dotplus = "∔"; +var dotsquare = "⊡"; +var doublebarwedge = "⌆"; +var DoubleContourIntegral = "∯"; +var DoubleDot = "¨"; +var DoubleDownArrow = "⇓"; +var DoubleLeftArrow = "⇐"; +var DoubleLeftRightArrow = "⇔"; +var DoubleLeftTee = "⫤"; +var DoubleLongLeftArrow = "⟸"; +var DoubleLongLeftRightArrow = "⟺"; +var DoubleLongRightArrow = "⟹"; +var DoubleRightArrow = "⇒"; +var DoubleRightTee = "⊨"; +var DoubleUpArrow = "⇑"; +var DoubleUpDownArrow = "⇕"; +var DoubleVerticalBar = "∥"; +var DownArrowBar = "⤓"; +var downarrow = "↓"; +var DownArrow = "↓"; +var Downarrow = "⇓"; +var DownArrowUpArrow = "⇵"; +var DownBreve = "̑"; +var downdownarrows = "⇊"; +var downharpoonleft = "⇃"; +var downharpoonright = "⇂"; +var DownLeftRightVector = "⥐"; +var DownLeftTeeVector = "⥞"; +var DownLeftVectorBar = "⥖"; +var DownLeftVector = "↽"; +var DownRightTeeVector = "⥟"; +var DownRightVectorBar = "⥗"; +var DownRightVector = "⇁"; +var DownTeeArrow = "↧"; +var DownTee = "⊤"; +var drbkarow = "⤐"; +var drcorn = "⌟"; +var drcrop = "⌌"; +var Dscr = "𝒟"; +var dscr = "𝒹"; +var DScy = "Ѕ"; +var dscy = "ѕ"; +var dsol = "⧶"; +var Dstrok = "Đ"; +var dstrok = "đ"; +var dtdot = "⋱"; +var dtri = "▿"; +var dtrif = "▾"; +var duarr = "⇵"; +var duhar = "⥯"; +var dwangle = "⦦"; +var DZcy = "Џ"; +var dzcy = "џ"; +var dzigrarr = "⟿"; +var Eacute$1 = "É"; +var eacute$1 = "é"; +var easter = "⩮"; +var Ecaron = "Ě"; +var ecaron = "ě"; +var Ecirc$1 = "Ê"; +var ecirc$1 = "ê"; +var ecir = "≖"; +var ecolon = "≕"; +var Ecy = "Э"; +var ecy = "э"; +var eDDot = "⩷"; +var Edot = "Ė"; +var edot = "ė"; +var eDot = "≑"; +var ee = "ⅇ"; +var efDot = "≒"; +var Efr = "𝔈"; +var efr = "𝔢"; +var eg = "⪚"; +var Egrave$1 = "È"; +var egrave$1 = "è"; +var egs = "⪖"; +var egsdot = "⪘"; +var el = "⪙"; +var Element$1 = "∈"; +var elinters = "⏧"; +var ell = "ℓ"; +var els = "⪕"; +var elsdot = "⪗"; +var Emacr = "Ē"; +var emacr = "ē"; +var empty = "∅"; +var emptyset = "∅"; +var EmptySmallSquare = "◻"; +var emptyv = "∅"; +var EmptyVerySmallSquare = "▫"; +var emsp13 = " "; +var emsp14 = " "; +var emsp = " "; +var ENG = "Ŋ"; +var eng = "ŋ"; +var ensp = " "; +var Eogon = "Ę"; +var eogon = "ę"; +var Eopf = "𝔼"; +var eopf = "𝕖"; +var epar = "⋕"; +var eparsl = "⧣"; +var eplus = "⩱"; +var epsi = "ε"; +var Epsilon = "Ε"; +var epsilon = "ε"; +var epsiv = "ϵ"; +var eqcirc = "≖"; +var eqcolon = "≕"; +var eqsim = "≂"; +var eqslantgtr = "⪖"; +var eqslantless = "⪕"; +var Equal = "⩵"; +var equals = "="; +var EqualTilde = "≂"; +var equest = "≟"; +var Equilibrium = "⇌"; +var equiv = "≡"; +var equivDD = "⩸"; +var eqvparsl = "⧥"; +var erarr = "⥱"; +var erDot = "≓"; +var escr = "ℯ"; +var Escr = "ℰ"; +var esdot = "≐"; +var Esim = "⩳"; +var esim = "≂"; +var Eta = "Η"; +var eta = "η"; +var ETH$1 = "Ð"; +var eth$1 = "ð"; +var Euml$1 = "Ë"; +var euml$1 = "ë"; +var euro = "€"; +var excl = "!"; +var exist = "∃"; +var Exists = "∃"; +var expectation = "ℰ"; +var exponentiale = "ⅇ"; +var ExponentialE = "ⅇ"; +var fallingdotseq = "≒"; +var Fcy = "Ф"; +var fcy = "ф"; +var female = "♀"; +var ffilig = "ffi"; +var fflig = "ff"; +var ffllig = "ffl"; +var Ffr = "𝔉"; +var ffr = "𝔣"; +var filig = "fi"; +var FilledSmallSquare = "◼"; +var FilledVerySmallSquare = "▪"; +var fjlig = "fj"; +var flat = "♭"; +var fllig = "fl"; +var fltns = "▱"; +var fnof = "ƒ"; +var Fopf = "𝔽"; +var fopf = "𝕗"; +var forall = "∀"; +var ForAll = "∀"; +var fork = "⋔"; +var forkv = "⫙"; +var Fouriertrf = "ℱ"; +var fpartint = "⨍"; +var frac12$1 = "½"; +var frac13 = "⅓"; +var frac14$1 = "¼"; +var frac15 = "⅕"; +var frac16 = "⅙"; +var frac18 = "⅛"; +var frac23 = "⅔"; +var frac25 = "⅖"; +var frac34$1 = "¾"; +var frac35 = "⅗"; +var frac38 = "⅜"; +var frac45 = "⅘"; +var frac56 = "⅚"; +var frac58 = "⅝"; +var frac78 = "⅞"; +var frasl = "⁄"; +var frown = "⌢"; +var fscr = "𝒻"; +var Fscr = "ℱ"; +var gacute = "ǵ"; +var Gamma = "Γ"; +var gamma = "γ"; +var Gammad = "Ϝ"; +var gammad = "ϝ"; +var gap = "⪆"; +var Gbreve = "Ğ"; +var gbreve = "ğ"; +var Gcedil = "Ģ"; +var Gcirc = "Ĝ"; +var gcirc = "ĝ"; +var Gcy = "Г"; +var gcy = "г"; +var Gdot = "Ġ"; +var gdot = "ġ"; +var ge = "≥"; +var gE = "≧"; +var gEl = "⪌"; +var gel = "⋛"; +var geq = "≥"; +var geqq = "≧"; +var geqslant = "⩾"; +var gescc = "⪩"; +var ges = "⩾"; +var gesdot = "⪀"; +var gesdoto = "⪂"; +var gesdotol = "⪄"; +var gesl = "⋛︀"; +var gesles = "⪔"; +var Gfr = "𝔊"; +var gfr = "𝔤"; +var gg = "≫"; +var Gg = "⋙"; +var ggg = "⋙"; +var gimel = "ℷ"; +var GJcy = "Ѓ"; +var gjcy = "ѓ"; +var gla = "⪥"; +var gl = "≷"; +var glE = "⪒"; +var glj = "⪤"; +var gnap = "⪊"; +var gnapprox = "⪊"; +var gne = "⪈"; +var gnE = "≩"; +var gneq = "⪈"; +var gneqq = "≩"; +var gnsim = "⋧"; +var Gopf = "𝔾"; +var gopf = "𝕘"; +var grave = "`"; +var GreaterEqual = "≥"; +var GreaterEqualLess = "⋛"; +var GreaterFullEqual = "≧"; +var GreaterGreater = "⪢"; +var GreaterLess = "≷"; +var GreaterSlantEqual = "⩾"; +var GreaterTilde = "≳"; +var Gscr = "𝒢"; +var gscr = "ℊ"; +var gsim = "≳"; +var gsime = "⪎"; +var gsiml = "⪐"; +var gtcc = "⪧"; +var gtcir = "⩺"; +var gt$2 = ">"; +var GT$1 = ">"; +var Gt = "≫"; +var gtdot = "⋗"; +var gtlPar = "⦕"; +var gtquest = "⩼"; +var gtrapprox = "⪆"; +var gtrarr = "⥸"; +var gtrdot = "⋗"; +var gtreqless = "⋛"; +var gtreqqless = "⪌"; +var gtrless = "≷"; +var gtrsim = "≳"; +var gvertneqq = "≩︀"; +var gvnE = "≩︀"; +var Hacek = "ˇ"; +var hairsp = " "; +var half = "½"; +var hamilt = "ℋ"; +var HARDcy = "Ъ"; +var hardcy = "ъ"; +var harrcir = "⥈"; +var harr = "↔"; +var hArr = "⇔"; +var harrw = "↭"; +var Hat = "^"; +var hbar = "ℏ"; +var Hcirc = "Ĥ"; +var hcirc = "ĥ"; +var hearts = "♥"; +var heartsuit = "♥"; +var hellip = "…"; +var hercon = "⊹"; +var hfr = "𝔥"; +var Hfr = "ℌ"; +var HilbertSpace = "ℋ"; +var hksearow = "⤥"; +var hkswarow = "⤦"; +var hoarr = "⇿"; +var homtht = "∻"; +var hookleftarrow = "↩"; +var hookrightarrow = "↪"; +var hopf = "𝕙"; +var Hopf = "ℍ"; +var horbar = "―"; +var HorizontalLine = "─"; +var hscr = "𝒽"; +var Hscr = "ℋ"; +var hslash = "ℏ"; +var Hstrok = "Ħ"; +var hstrok = "ħ"; +var HumpDownHump = "≎"; +var HumpEqual = "≏"; +var hybull = "⁃"; +var hyphen = "‐"; +var Iacute$1 = "Í"; +var iacute$1 = "í"; +var ic = "⁣"; +var Icirc$1 = "Î"; +var icirc$1 = "î"; +var Icy = "И"; +var icy = "и"; +var Idot = "İ"; +var IEcy = "Е"; +var iecy = "е"; +var iexcl$1 = "¡"; +var iff = "⇔"; +var ifr = "𝔦"; +var Ifr = "ℑ"; +var Igrave$1 = "Ì"; +var igrave$1 = "ì"; +var ii = "ⅈ"; +var iiiint = "⨌"; +var iiint = "∭"; +var iinfin = "⧜"; +var iiota = "℩"; +var IJlig = "IJ"; +var ijlig = "ij"; +var Imacr = "Ī"; +var imacr = "ī"; +var image = "ℑ"; +var ImaginaryI = "ⅈ"; +var imagline = "ℐ"; +var imagpart = "ℑ"; +var imath = "ı"; +var Im = "ℑ"; +var imof = "⊷"; +var imped = "Ƶ"; +var Implies = "⇒"; +var incare = "℅"; +var infin = "∞"; +var infintie = "⧝"; +var inodot = "ı"; +var intcal = "⊺"; +var int = "∫"; +var Int = "∬"; +var integers = "ℤ"; +var Integral = "∫"; +var intercal = "⊺"; +var Intersection = "⋂"; +var intlarhk = "⨗"; +var intprod = "⨼"; +var InvisibleComma = "⁣"; +var InvisibleTimes = "⁢"; +var IOcy = "Ё"; +var iocy = "ё"; +var Iogon = "Į"; +var iogon = "į"; +var Iopf = "𝕀"; +var iopf = "𝕚"; +var Iota = "Ι"; +var iota = "ι"; +var iprod = "⨼"; +var iquest$1 = "¿"; +var iscr = "𝒾"; +var Iscr = "ℐ"; +var isin = "∈"; +var isindot = "⋵"; +var isinE = "⋹"; +var isins = "⋴"; +var isinsv = "⋳"; +var isinv = "∈"; +var it = "⁢"; +var Itilde = "Ĩ"; +var itilde = "ĩ"; +var Iukcy = "І"; +var iukcy = "і"; +var Iuml$1 = "Ï"; +var iuml$1 = "ï"; +var Jcirc = "Ĵ"; +var jcirc = "ĵ"; +var Jcy = "Й"; +var jcy = "й"; +var Jfr = "𝔍"; +var jfr = "𝔧"; +var jmath = "ȷ"; +var Jopf = "𝕁"; +var jopf = "𝕛"; +var Jscr = "𝒥"; +var jscr = "𝒿"; +var Jsercy = "Ј"; +var jsercy = "ј"; +var Jukcy = "Є"; +var jukcy = "є"; +var Kappa = "Κ"; +var kappa = "κ"; +var kappav = "ϰ"; +var Kcedil = "Ķ"; +var kcedil = "ķ"; +var Kcy = "К"; +var kcy = "к"; +var Kfr = "𝔎"; +var kfr = "𝔨"; +var kgreen = "ĸ"; +var KHcy = "Х"; +var khcy = "х"; +var KJcy = "Ќ"; +var kjcy = "ќ"; +var Kopf = "𝕂"; +var kopf = "𝕜"; +var Kscr = "𝒦"; +var kscr = "𝓀"; +var lAarr = "⇚"; +var Lacute = "Ĺ"; +var lacute = "ĺ"; +var laemptyv = "⦴"; +var lagran = "ℒ"; +var Lambda = "Λ"; +var lambda = "λ"; +var lang = "⟨"; +var Lang = "⟪"; +var langd = "⦑"; +var langle = "⟨"; +var lap = "⪅"; +var Laplacetrf = "ℒ"; +var laquo$1 = "«"; +var larrb = "⇤"; +var larrbfs = "⤟"; +var larr = "←"; +var Larr = "↞"; +var lArr = "⇐"; +var larrfs = "⤝"; +var larrhk = "↩"; +var larrlp = "↫"; +var larrpl = "⤹"; +var larrsim = "⥳"; +var larrtl = "↢"; +var latail = "⤙"; +var lAtail = "⤛"; +var lat = "⪫"; +var late = "⪭"; +var lates = "⪭︀"; +var lbarr = "⤌"; +var lBarr = "⤎"; +var lbbrk = "❲"; +var lbrace = "{"; +var lbrack = "["; +var lbrke = "⦋"; +var lbrksld = "⦏"; +var lbrkslu = "⦍"; +var Lcaron = "Ľ"; +var lcaron = "ľ"; +var Lcedil = "Ļ"; +var lcedil = "ļ"; +var lceil = "⌈"; +var lcub = "{"; +var Lcy = "Л"; +var lcy = "л"; +var ldca = "⤶"; +var ldquo = "“"; +var ldquor = "„"; +var ldrdhar = "⥧"; +var ldrushar = "⥋"; +var ldsh = "↲"; +var le = "≤"; +var lE = "≦"; +var LeftAngleBracket = "⟨"; +var LeftArrowBar = "⇤"; +var leftarrow = "←"; +var LeftArrow = "←"; +var Leftarrow = "⇐"; +var LeftArrowRightArrow = "⇆"; +var leftarrowtail = "↢"; +var LeftCeiling = "⌈"; +var LeftDoubleBracket = "⟦"; +var LeftDownTeeVector = "⥡"; +var LeftDownVectorBar = "⥙"; +var LeftDownVector = "⇃"; +var LeftFloor = "⌊"; +var leftharpoondown = "↽"; +var leftharpoonup = "↼"; +var leftleftarrows = "⇇"; +var leftrightarrow = "↔"; +var LeftRightArrow = "↔"; +var Leftrightarrow = "⇔"; +var leftrightarrows = "⇆"; +var leftrightharpoons = "⇋"; +var leftrightsquigarrow = "↭"; +var LeftRightVector = "⥎"; +var LeftTeeArrow = "↤"; +var LeftTee = "⊣"; +var LeftTeeVector = "⥚"; +var leftthreetimes = "⋋"; +var LeftTriangleBar = "⧏"; +var LeftTriangle = "⊲"; +var LeftTriangleEqual = "⊴"; +var LeftUpDownVector = "⥑"; +var LeftUpTeeVector = "⥠"; +var LeftUpVectorBar = "⥘"; +var LeftUpVector = "↿"; +var LeftVectorBar = "⥒"; +var LeftVector = "↼"; +var lEg = "⪋"; +var leg = "⋚"; +var leq = "≤"; +var leqq = "≦"; +var leqslant = "⩽"; +var lescc = "⪨"; +var les = "⩽"; +var lesdot = "⩿"; +var lesdoto = "⪁"; +var lesdotor = "⪃"; +var lesg = "⋚︀"; +var lesges = "⪓"; +var lessapprox = "⪅"; +var lessdot = "⋖"; +var lesseqgtr = "⋚"; +var lesseqqgtr = "⪋"; +var LessEqualGreater = "⋚"; +var LessFullEqual = "≦"; +var LessGreater = "≶"; +var lessgtr = "≶"; +var LessLess = "⪡"; +var lesssim = "≲"; +var LessSlantEqual = "⩽"; +var LessTilde = "≲"; +var lfisht = "⥼"; +var lfloor = "⌊"; +var Lfr = "𝔏"; +var lfr = "𝔩"; +var lg = "≶"; +var lgE = "⪑"; +var lHar = "⥢"; +var lhard = "↽"; +var lharu = "↼"; +var lharul = "⥪"; +var lhblk = "▄"; +var LJcy = "Љ"; +var ljcy = "љ"; +var llarr = "⇇"; +var ll = "≪"; +var Ll = "⋘"; +var llcorner = "⌞"; +var Lleftarrow = "⇚"; +var llhard = "⥫"; +var lltri = "◺"; +var Lmidot = "Ŀ"; +var lmidot = "ŀ"; +var lmoustache = "⎰"; +var lmoust = "⎰"; +var lnap = "⪉"; +var lnapprox = "⪉"; +var lne = "⪇"; +var lnE = "≨"; +var lneq = "⪇"; +var lneqq = "≨"; +var lnsim = "⋦"; +var loang = "⟬"; +var loarr = "⇽"; +var lobrk = "⟦"; +var longleftarrow = "⟵"; +var LongLeftArrow = "⟵"; +var Longleftarrow = "⟸"; +var longleftrightarrow = "⟷"; +var LongLeftRightArrow = "⟷"; +var Longleftrightarrow = "⟺"; +var longmapsto = "⟼"; +var longrightarrow = "⟶"; +var LongRightArrow = "⟶"; +var Longrightarrow = "⟹"; +var looparrowleft = "↫"; +var looparrowright = "↬"; +var lopar = "⦅"; +var Lopf = "𝕃"; +var lopf = "𝕝"; +var loplus = "⨭"; +var lotimes = "⨴"; +var lowast = "∗"; +var lowbar = "_"; +var LowerLeftArrow = "↙"; +var LowerRightArrow = "↘"; +var loz = "◊"; +var lozenge = "◊"; +var lozf = "⧫"; +var lpar = "("; +var lparlt = "⦓"; +var lrarr = "⇆"; +var lrcorner = "⌟"; +var lrhar = "⇋"; +var lrhard = "⥭"; +var lrm = "‎"; +var lrtri = "⊿"; +var lsaquo = "‹"; +var lscr = "𝓁"; +var Lscr = "ℒ"; +var lsh = "↰"; +var Lsh = "↰"; +var lsim = "≲"; +var lsime = "⪍"; +var lsimg = "⪏"; +var lsqb = "["; +var lsquo = "‘"; +var lsquor = "‚"; +var Lstrok = "Ł"; +var lstrok = "ł"; +var ltcc = "⪦"; +var ltcir = "⩹"; +var lt$2 = "<"; +var LT$1 = "<"; +var Lt = "≪"; +var ltdot = "⋖"; +var lthree = "⋋"; +var ltimes = "⋉"; +var ltlarr = "⥶"; +var ltquest = "⩻"; +var ltri = "◃"; +var ltrie = "⊴"; +var ltrif = "◂"; +var ltrPar = "⦖"; +var lurdshar = "⥊"; +var luruhar = "⥦"; +var lvertneqq = "≨︀"; +var lvnE = "≨︀"; +var macr$1 = "¯"; +var male = "♂"; +var malt = "✠"; +var maltese = "✠"; +var map = "↦"; +var mapsto = "↦"; +var mapstodown = "↧"; +var mapstoleft = "↤"; +var mapstoup = "↥"; +var marker = "▮"; +var mcomma = "⨩"; +var Mcy = "М"; +var mcy = "м"; +var mdash = "—"; +var mDDot = "∺"; +var measuredangle = "∡"; +var MediumSpace = " "; +var Mellintrf = "ℳ"; +var Mfr = "𝔐"; +var mfr = "𝔪"; +var mho = "℧"; +var micro$1 = "µ"; +var midast = "*"; +var midcir = "⫰"; +var mid = "∣"; +var middot$1 = "·"; +var minusb = "⊟"; +var minus = "−"; +var minusd = "∸"; +var minusdu = "⨪"; +var MinusPlus = "∓"; +var mlcp = "⫛"; +var mldr = "…"; +var mnplus = "∓"; +var models = "⊧"; +var Mopf = "𝕄"; +var mopf = "𝕞"; +var mp = "∓"; +var mscr = "𝓂"; +var Mscr = "ℳ"; +var mstpos = "∾"; +var Mu = "Μ"; +var mu = "μ"; +var multimap = "⊸"; +var mumap = "⊸"; +var nabla = "∇"; +var Nacute = "Ń"; +var nacute = "ń"; +var nang = "∠⃒"; +var nap = "≉"; +var napE = "⩰̸"; +var napid = "≋̸"; +var napos = "ʼn"; +var napprox = "≉"; +var natural = "♮"; +var naturals = "ℕ"; +var natur = "♮"; +var nbsp$1 = " "; +var nbump = "≎̸"; +var nbumpe = "≏̸"; +var ncap = "⩃"; +var Ncaron = "Ň"; +var ncaron = "ň"; +var Ncedil = "Ņ"; +var ncedil = "ņ"; +var ncong = "≇"; +var ncongdot = "⩭̸"; +var ncup = "⩂"; +var Ncy = "Н"; +var ncy = "н"; +var ndash = "–"; +var nearhk = "⤤"; +var nearr = "↗"; +var neArr = "⇗"; +var nearrow = "↗"; +var ne = "≠"; +var nedot = "≐̸"; +var NegativeMediumSpace = "​"; +var NegativeThickSpace = "​"; +var NegativeThinSpace = "​"; +var NegativeVeryThinSpace = "​"; +var nequiv = "≢"; +var nesear = "⤨"; +var nesim = "≂̸"; +var NestedGreaterGreater = "≫"; +var NestedLessLess = "≪"; +var NewLine = "\n"; +var nexist = "∄"; +var nexists = "∄"; +var Nfr = "𝔑"; +var nfr = "𝔫"; +var ngE = "≧̸"; +var nge = "≱"; +var ngeq = "≱"; +var ngeqq = "≧̸"; +var ngeqslant = "⩾̸"; +var nges = "⩾̸"; +var nGg = "⋙̸"; +var ngsim = "≵"; +var nGt = "≫⃒"; +var ngt = "≯"; +var ngtr = "≯"; +var nGtv = "≫̸"; +var nharr = "↮"; +var nhArr = "⇎"; +var nhpar = "⫲"; +var ni = "∋"; +var nis = "⋼"; +var nisd = "⋺"; +var niv = "∋"; +var NJcy = "Њ"; +var njcy = "њ"; +var nlarr = "↚"; +var nlArr = "⇍"; +var nldr = "‥"; +var nlE = "≦̸"; +var nle = "≰"; +var nleftarrow = "↚"; +var nLeftarrow = "⇍"; +var nleftrightarrow = "↮"; +var nLeftrightarrow = "⇎"; +var nleq = "≰"; +var nleqq = "≦̸"; +var nleqslant = "⩽̸"; +var nles = "⩽̸"; +var nless = "≮"; +var nLl = "⋘̸"; +var nlsim = "≴"; +var nLt = "≪⃒"; +var nlt = "≮"; +var nltri = "⋪"; +var nltrie = "⋬"; +var nLtv = "≪̸"; +var nmid = "∤"; +var NoBreak = "⁠"; +var NonBreakingSpace = " "; +var nopf = "𝕟"; +var Nopf = "ℕ"; +var Not = "⫬"; +var not$1 = "¬"; +var NotCongruent = "≢"; +var NotCupCap = "≭"; +var NotDoubleVerticalBar = "∦"; +var NotElement = "∉"; +var NotEqual = "≠"; +var NotEqualTilde = "≂̸"; +var NotExists = "∄"; +var NotGreater = "≯"; +var NotGreaterEqual = "≱"; +var NotGreaterFullEqual = "≧̸"; +var NotGreaterGreater = "≫̸"; +var NotGreaterLess = "≹"; +var NotGreaterSlantEqual = "⩾̸"; +var NotGreaterTilde = "≵"; +var NotHumpDownHump = "≎̸"; +var NotHumpEqual = "≏̸"; +var notin = "∉"; +var notindot = "⋵̸"; +var notinE = "⋹̸"; +var notinva = "∉"; +var notinvb = "⋷"; +var notinvc = "⋶"; +var NotLeftTriangleBar = "⧏̸"; +var NotLeftTriangle = "⋪"; +var NotLeftTriangleEqual = "⋬"; +var NotLess = "≮"; +var NotLessEqual = "≰"; +var NotLessGreater = "≸"; +var NotLessLess = "≪̸"; +var NotLessSlantEqual = "⩽̸"; +var NotLessTilde = "≴"; +var NotNestedGreaterGreater = "⪢̸"; +var NotNestedLessLess = "⪡̸"; +var notni = "∌"; +var notniva = "∌"; +var notnivb = "⋾"; +var notnivc = "⋽"; +var NotPrecedes = "⊀"; +var NotPrecedesEqual = "⪯̸"; +var NotPrecedesSlantEqual = "⋠"; +var NotReverseElement = "∌"; +var NotRightTriangleBar = "⧐̸"; +var NotRightTriangle = "⋫"; +var NotRightTriangleEqual = "⋭"; +var NotSquareSubset = "⊏̸"; +var NotSquareSubsetEqual = "⋢"; +var NotSquareSuperset = "⊐̸"; +var NotSquareSupersetEqual = "⋣"; +var NotSubset = "⊂⃒"; +var NotSubsetEqual = "⊈"; +var NotSucceeds = "⊁"; +var NotSucceedsEqual = "⪰̸"; +var NotSucceedsSlantEqual = "⋡"; +var NotSucceedsTilde = "≿̸"; +var NotSuperset = "⊃⃒"; +var NotSupersetEqual = "⊉"; +var NotTilde = "≁"; +var NotTildeEqual = "≄"; +var NotTildeFullEqual = "≇"; +var NotTildeTilde = "≉"; +var NotVerticalBar = "∤"; +var nparallel = "∦"; +var npar = "∦"; +var nparsl = "⫽⃥"; +var npart = "∂̸"; +var npolint = "⨔"; +var npr = "⊀"; +var nprcue = "⋠"; +var nprec = "⊀"; +var npreceq = "⪯̸"; +var npre = "⪯̸"; +var nrarrc = "⤳̸"; +var nrarr = "↛"; +var nrArr = "⇏"; +var nrarrw = "↝̸"; +var nrightarrow = "↛"; +var nRightarrow = "⇏"; +var nrtri = "⋫"; +var nrtrie = "⋭"; +var nsc = "⊁"; +var nsccue = "⋡"; +var nsce = "⪰̸"; +var Nscr = "𝒩"; +var nscr = "𝓃"; +var nshortmid = "∤"; +var nshortparallel = "∦"; +var nsim = "≁"; +var nsime = "≄"; +var nsimeq = "≄"; +var nsmid = "∤"; +var nspar = "∦"; +var nsqsube = "⋢"; +var nsqsupe = "⋣"; +var nsub = "⊄"; +var nsubE = "⫅̸"; +var nsube = "⊈"; +var nsubset = "⊂⃒"; +var nsubseteq = "⊈"; +var nsubseteqq = "⫅̸"; +var nsucc = "⊁"; +var nsucceq = "⪰̸"; +var nsup = "⊅"; +var nsupE = "⫆̸"; +var nsupe = "⊉"; +var nsupset = "⊃⃒"; +var nsupseteq = "⊉"; +var nsupseteqq = "⫆̸"; +var ntgl = "≹"; +var Ntilde$1 = "Ñ"; +var ntilde$1 = "ñ"; +var ntlg = "≸"; +var ntriangleleft = "⋪"; +var ntrianglelefteq = "⋬"; +var ntriangleright = "⋫"; +var ntrianglerighteq = "⋭"; +var Nu = "Ν"; +var nu = "ν"; +var num = "#"; +var numero = "№"; +var numsp = " "; +var nvap = "≍⃒"; +var nvdash = "⊬"; +var nvDash = "⊭"; +var nVdash = "⊮"; +var nVDash = "⊯"; +var nvge = "≥⃒"; +var nvgt = ">⃒"; +var nvHarr = "⤄"; +var nvinfin = "⧞"; +var nvlArr = "⤂"; +var nvle = "≤⃒"; +var nvlt = "<⃒"; +var nvltrie = "⊴⃒"; +var nvrArr = "⤃"; +var nvrtrie = "⊵⃒"; +var nvsim = "∼⃒"; +var nwarhk = "⤣"; +var nwarr = "↖"; +var nwArr = "⇖"; +var nwarrow = "↖"; +var nwnear = "⤧"; +var Oacute$1 = "Ó"; +var oacute$1 = "ó"; +var oast = "⊛"; +var Ocirc$1 = "Ô"; +var ocirc$1 = "ô"; +var ocir = "⊚"; +var Ocy = "О"; +var ocy = "о"; +var odash = "⊝"; +var Odblac = "Ő"; +var odblac = "ő"; +var odiv = "⨸"; +var odot = "⊙"; +var odsold = "⦼"; +var OElig = "Œ"; +var oelig = "œ"; +var ofcir = "⦿"; +var Ofr = "𝔒"; +var ofr = "𝔬"; +var ogon = "˛"; +var Ograve$1 = "Ò"; +var ograve$1 = "ò"; +var ogt = "⧁"; +var ohbar = "⦵"; +var ohm = "Ω"; +var oint = "∮"; +var olarr = "↺"; +var olcir = "⦾"; +var olcross = "⦻"; +var oline = "‾"; +var olt = "⧀"; +var Omacr = "Ō"; +var omacr = "ō"; +var Omega = "Ω"; +var omega = "ω"; +var Omicron = "Ο"; +var omicron = "ο"; +var omid = "⦶"; +var ominus = "⊖"; +var Oopf = "𝕆"; +var oopf = "𝕠"; +var opar = "⦷"; +var OpenCurlyDoubleQuote = "“"; +var OpenCurlyQuote = "‘"; +var operp = "⦹"; +var oplus = "⊕"; +var orarr = "↻"; +var Or = "⩔"; +var or = "∨"; +var ord = "⩝"; +var order = "ℴ"; +var orderof = "ℴ"; +var ordf$1 = "ª"; +var ordm$1 = "º"; +var origof = "⊶"; +var oror = "⩖"; +var orslope = "⩗"; +var orv = "⩛"; +var oS = "Ⓢ"; +var Oscr = "𝒪"; +var oscr = "ℴ"; +var Oslash$1 = "Ø"; +var oslash$1 = "ø"; +var osol = "⊘"; +var Otilde$1 = "Õ"; +var otilde$1 = "õ"; +var otimesas = "⨶"; +var Otimes = "⨷"; +var otimes = "⊗"; +var Ouml$1 = "Ö"; +var ouml$1 = "ö"; +var ovbar = "⌽"; +var OverBar = "‾"; +var OverBrace = "⏞"; +var OverBracket = "⎴"; +var OverParenthesis = "⏜"; +var para$1 = "¶"; +var parallel = "∥"; +var par = "∥"; +var parsim = "⫳"; +var parsl = "⫽"; +var part = "∂"; +var PartialD = "∂"; +var Pcy = "П"; +var pcy = "п"; +var percnt = "%"; +var period = "."; +var permil = "‰"; +var perp = "⊥"; +var pertenk = "‱"; +var Pfr = "𝔓"; +var pfr = "𝔭"; +var Phi = "Φ"; +var phi = "φ"; +var phiv = "ϕ"; +var phmmat = "ℳ"; +var phone = "☎"; +var Pi = "Π"; +var pi = "π"; +var pitchfork = "⋔"; +var piv = "ϖ"; +var planck = "ℏ"; +var planckh = "ℎ"; +var plankv = "ℏ"; +var plusacir = "⨣"; +var plusb = "⊞"; +var pluscir = "⨢"; +var plus = "+"; +var plusdo = "∔"; +var plusdu = "⨥"; +var pluse = "⩲"; +var PlusMinus = "±"; +var plusmn$1 = "±"; +var plussim = "⨦"; +var plustwo = "⨧"; +var pm = "±"; +var Poincareplane = "ℌ"; +var pointint = "⨕"; +var popf = "𝕡"; +var Popf = "ℙ"; +var pound$1 = "£"; +var prap = "⪷"; +var Pr = "⪻"; +var pr = "≺"; +var prcue = "≼"; +var precapprox = "⪷"; +var prec = "≺"; +var preccurlyeq = "≼"; +var Precedes = "≺"; +var PrecedesEqual = "⪯"; +var PrecedesSlantEqual = "≼"; +var PrecedesTilde = "≾"; +var preceq = "⪯"; +var precnapprox = "⪹"; +var precneqq = "⪵"; +var precnsim = "⋨"; +var pre = "⪯"; +var prE = "⪳"; +var precsim = "≾"; +var prime = "′"; +var Prime = "″"; +var primes = "ℙ"; +var prnap = "⪹"; +var prnE = "⪵"; +var prnsim = "⋨"; +var prod = "∏"; +var Product = "∏"; +var profalar = "⌮"; +var profline = "⌒"; +var profsurf = "⌓"; +var prop = "∝"; +var Proportional = "∝"; +var Proportion = "∷"; +var propto = "∝"; +var prsim = "≾"; +var prurel = "⊰"; +var Pscr = "𝒫"; +var pscr = "𝓅"; +var Psi = "Ψ"; +var psi = "ψ"; +var puncsp = " "; +var Qfr = "𝔔"; +var qfr = "𝔮"; +var qint = "⨌"; +var qopf = "𝕢"; +var Qopf = "ℚ"; +var qprime = "⁗"; +var Qscr = "𝒬"; +var qscr = "𝓆"; +var quaternions = "ℍ"; +var quatint = "⨖"; +var quest = "?"; +var questeq = "≟"; +var quot$2 = "\""; +var QUOT$1 = "\""; +var rAarr = "⇛"; +var race = "∽̱"; +var Racute = "Ŕ"; +var racute = "ŕ"; +var radic = "√"; +var raemptyv = "⦳"; +var rang = "⟩"; +var Rang = "⟫"; +var rangd = "⦒"; +var range = "⦥"; +var rangle = "⟩"; +var raquo$1 = "»"; +var rarrap = "⥵"; +var rarrb = "⇥"; +var rarrbfs = "⤠"; +var rarrc = "⤳"; +var rarr = "→"; +var Rarr = "↠"; +var rArr = "⇒"; +var rarrfs = "⤞"; +var rarrhk = "↪"; +var rarrlp = "↬"; +var rarrpl = "⥅"; +var rarrsim = "⥴"; +var Rarrtl = "⤖"; +var rarrtl = "↣"; +var rarrw = "↝"; +var ratail = "⤚"; +var rAtail = "⤜"; +var ratio = "∶"; +var rationals = "ℚ"; +var rbarr = "⤍"; +var rBarr = "⤏"; +var RBarr = "⤐"; +var rbbrk = "❳"; +var rbrace = "}"; +var rbrack = "]"; +var rbrke = "⦌"; +var rbrksld = "⦎"; +var rbrkslu = "⦐"; +var Rcaron = "Ř"; +var rcaron = "ř"; +var Rcedil = "Ŗ"; +var rcedil = "ŗ"; +var rceil = "⌉"; +var rcub = "}"; +var Rcy = "Р"; +var rcy = "р"; +var rdca = "⤷"; +var rdldhar = "⥩"; +var rdquo = "”"; +var rdquor = "”"; +var rdsh = "↳"; +var real = "ℜ"; +var realine = "ℛ"; +var realpart = "ℜ"; +var reals = "ℝ"; +var Re = "ℜ"; +var rect = "▭"; +var reg$1 = "®"; +var REG$1 = "®"; +var ReverseElement = "∋"; +var ReverseEquilibrium = "⇋"; +var ReverseUpEquilibrium = "⥯"; +var rfisht = "⥽"; +var rfloor = "⌋"; +var rfr = "𝔯"; +var Rfr = "ℜ"; +var rHar = "⥤"; +var rhard = "⇁"; +var rharu = "⇀"; +var rharul = "⥬"; +var Rho = "Ρ"; +var rho = "ρ"; +var rhov = "ϱ"; +var RightAngleBracket = "⟩"; +var RightArrowBar = "⇥"; +var rightarrow = "→"; +var RightArrow = "→"; +var Rightarrow = "⇒"; +var RightArrowLeftArrow = "⇄"; +var rightarrowtail = "↣"; +var RightCeiling = "⌉"; +var RightDoubleBracket = "⟧"; +var RightDownTeeVector = "⥝"; +var RightDownVectorBar = "⥕"; +var RightDownVector = "⇂"; +var RightFloor = "⌋"; +var rightharpoondown = "⇁"; +var rightharpoonup = "⇀"; +var rightleftarrows = "⇄"; +var rightleftharpoons = "⇌"; +var rightrightarrows = "⇉"; +var rightsquigarrow = "↝"; +var RightTeeArrow = "↦"; +var RightTee = "⊢"; +var RightTeeVector = "⥛"; +var rightthreetimes = "⋌"; +var RightTriangleBar = "⧐"; +var RightTriangle = "⊳"; +var RightTriangleEqual = "⊵"; +var RightUpDownVector = "⥏"; +var RightUpTeeVector = "⥜"; +var RightUpVectorBar = "⥔"; +var RightUpVector = "↾"; +var RightVectorBar = "⥓"; +var RightVector = "⇀"; +var ring = "˚"; +var risingdotseq = "≓"; +var rlarr = "⇄"; +var rlhar = "⇌"; +var rlm = "‏"; +var rmoustache = "⎱"; +var rmoust = "⎱"; +var rnmid = "⫮"; +var roang = "⟭"; +var roarr = "⇾"; +var robrk = "⟧"; +var ropar = "⦆"; +var ropf = "𝕣"; +var Ropf = "ℝ"; +var roplus = "⨮"; +var rotimes = "⨵"; +var RoundImplies = "⥰"; +var rpar = ")"; +var rpargt = "⦔"; +var rppolint = "⨒"; +var rrarr = "⇉"; +var Rrightarrow = "⇛"; +var rsaquo = "›"; +var rscr = "𝓇"; +var Rscr = "ℛ"; +var rsh = "↱"; +var Rsh = "↱"; +var rsqb = "]"; +var rsquo = "’"; +var rsquor = "’"; +var rthree = "⋌"; +var rtimes = "⋊"; +var rtri = "▹"; +var rtrie = "⊵"; +var rtrif = "▸"; +var rtriltri = "⧎"; +var RuleDelayed = "⧴"; +var ruluhar = "⥨"; +var rx = "℞"; +var Sacute = "Ś"; +var sacute = "ś"; +var sbquo = "‚"; +var scap = "⪸"; +var Scaron = "Š"; +var scaron = "š"; +var Sc = "⪼"; +var sc = "≻"; +var sccue = "≽"; +var sce = "⪰"; +var scE = "⪴"; +var Scedil = "Ş"; +var scedil = "ş"; +var Scirc = "Ŝ"; +var scirc = "ŝ"; +var scnap = "⪺"; +var scnE = "⪶"; +var scnsim = "⋩"; +var scpolint = "⨓"; +var scsim = "≿"; +var Scy = "С"; +var scy = "с"; +var sdotb = "⊡"; +var sdot = "⋅"; +var sdote = "⩦"; +var searhk = "⤥"; +var searr = "↘"; +var seArr = "⇘"; +var searrow = "↘"; +var sect$1 = "§"; +var semi = ";"; +var seswar = "⤩"; +var setminus = "∖"; +var setmn = "∖"; +var sext = "✶"; +var Sfr = "𝔖"; +var sfr = "𝔰"; +var sfrown = "⌢"; +var sharp = "♯"; +var SHCHcy = "Щ"; +var shchcy = "щ"; +var SHcy = "Ш"; +var shcy = "ш"; +var ShortDownArrow = "↓"; +var ShortLeftArrow = "←"; +var shortmid = "∣"; +var shortparallel = "∥"; +var ShortRightArrow = "→"; +var ShortUpArrow = "↑"; +var shy$1 = "­"; +var Sigma = "Σ"; +var sigma = "σ"; +var sigmaf = "ς"; +var sigmav = "ς"; +var sim = "∼"; +var simdot = "⩪"; +var sime = "≃"; +var simeq = "≃"; +var simg = "⪞"; +var simgE = "⪠"; +var siml = "⪝"; +var simlE = "⪟"; +var simne = "≆"; +var simplus = "⨤"; +var simrarr = "⥲"; +var slarr = "←"; +var SmallCircle = "∘"; +var smallsetminus = "∖"; +var smashp = "⨳"; +var smeparsl = "⧤"; +var smid = "∣"; +var smile = "⌣"; +var smt = "⪪"; +var smte = "⪬"; +var smtes = "⪬︀"; +var SOFTcy = "Ь"; +var softcy = "ь"; +var solbar = "⌿"; +var solb = "⧄"; +var sol = "/"; +var Sopf = "𝕊"; +var sopf = "𝕤"; +var spades = "♠"; +var spadesuit = "♠"; +var spar = "∥"; +var sqcap = "⊓"; +var sqcaps = "⊓︀"; +var sqcup = "⊔"; +var sqcups = "⊔︀"; +var Sqrt = "√"; +var sqsub = "⊏"; +var sqsube = "⊑"; +var sqsubset = "⊏"; +var sqsubseteq = "⊑"; +var sqsup = "⊐"; +var sqsupe = "⊒"; +var sqsupset = "⊐"; +var sqsupseteq = "⊒"; +var square = "□"; +var Square = "□"; +var SquareIntersection = "⊓"; +var SquareSubset = "⊏"; +var SquareSubsetEqual = "⊑"; +var SquareSuperset = "⊐"; +var SquareSupersetEqual = "⊒"; +var SquareUnion = "⊔"; +var squarf = "▪"; +var squ = "□"; +var squf = "▪"; +var srarr = "→"; +var Sscr = "𝒮"; +var sscr = "𝓈"; +var ssetmn = "∖"; +var ssmile = "⌣"; +var sstarf = "⋆"; +var Star = "⋆"; +var star = "☆"; +var starf = "★"; +var straightepsilon = "ϵ"; +var straightphi = "ϕ"; +var strns = "¯"; +var sub = "⊂"; +var Sub = "⋐"; +var subdot = "⪽"; +var subE = "⫅"; +var sube = "⊆"; +var subedot = "⫃"; +var submult = "⫁"; +var subnE = "⫋"; +var subne = "⊊"; +var subplus = "⪿"; +var subrarr = "⥹"; +var subset = "⊂"; +var Subset = "⋐"; +var subseteq = "⊆"; +var subseteqq = "⫅"; +var SubsetEqual = "⊆"; +var subsetneq = "⊊"; +var subsetneqq = "⫋"; +var subsim = "⫇"; +var subsub = "⫕"; +var subsup = "⫓"; +var succapprox = "⪸"; +var succ = "≻"; +var succcurlyeq = "≽"; +var Succeeds = "≻"; +var SucceedsEqual = "⪰"; +var SucceedsSlantEqual = "≽"; +var SucceedsTilde = "≿"; +var succeq = "⪰"; +var succnapprox = "⪺"; +var succneqq = "⪶"; +var succnsim = "⋩"; +var succsim = "≿"; +var SuchThat = "∋"; +var sum = "∑"; +var Sum = "∑"; +var sung = "♪"; +var sup1$1 = "¹"; +var sup2$1 = "²"; +var sup3$1 = "³"; +var sup = "⊃"; +var Sup = "⋑"; +var supdot = "⪾"; +var supdsub = "⫘"; +var supE = "⫆"; +var supe = "⊇"; +var supedot = "⫄"; +var Superset = "⊃"; +var SupersetEqual = "⊇"; +var suphsol = "⟉"; +var suphsub = "⫗"; +var suplarr = "⥻"; +var supmult = "⫂"; +var supnE = "⫌"; +var supne = "⊋"; +var supplus = "⫀"; +var supset = "⊃"; +var Supset = "⋑"; +var supseteq = "⊇"; +var supseteqq = "⫆"; +var supsetneq = "⊋"; +var supsetneqq = "⫌"; +var supsim = "⫈"; +var supsub = "⫔"; +var supsup = "⫖"; +var swarhk = "⤦"; +var swarr = "↙"; +var swArr = "⇙"; +var swarrow = "↙"; +var swnwar = "⤪"; +var szlig$1 = "ß"; +var Tab = "\t"; +var target = "⌖"; +var Tau = "Τ"; +var tau = "τ"; +var tbrk = "⎴"; +var Tcaron = "Ť"; +var tcaron = "ť"; +var Tcedil = "Ţ"; +var tcedil = "ţ"; +var Tcy = "Т"; +var tcy = "т"; +var tdot = "⃛"; +var telrec = "⌕"; +var Tfr = "𝔗"; +var tfr = "𝔱"; +var there4 = "∴"; +var therefore = "∴"; +var Therefore = "∴"; +var Theta = "Θ"; +var theta = "θ"; +var thetasym = "ϑ"; +var thetav = "ϑ"; +var thickapprox = "≈"; +var thicksim = "∼"; +var ThickSpace = "  "; +var ThinSpace = " "; +var thinsp = " "; +var thkap = "≈"; +var thksim = "∼"; +var THORN$1 = "Þ"; +var thorn$1 = "þ"; +var tilde = "˜"; +var Tilde = "∼"; +var TildeEqual = "≃"; +var TildeFullEqual = "≅"; +var TildeTilde = "≈"; +var timesbar = "⨱"; +var timesb = "⊠"; +var times$1 = "×"; +var timesd = "⨰"; +var tint = "∭"; +var toea = "⤨"; +var topbot = "⌶"; +var topcir = "⫱"; +var top = "⊤"; +var Topf = "𝕋"; +var topf = "𝕥"; +var topfork = "⫚"; +var tosa = "⤩"; +var tprime = "‴"; +var trade = "™"; +var TRADE = "™"; +var triangle = "▵"; +var triangledown = "▿"; +var triangleleft = "◃"; +var trianglelefteq = "⊴"; +var triangleq = "≜"; +var triangleright = "▹"; +var trianglerighteq = "⊵"; +var tridot = "◬"; +var trie = "≜"; +var triminus = "⨺"; +var TripleDot = "⃛"; +var triplus = "⨹"; +var trisb = "⧍"; +var tritime = "⨻"; +var trpezium = "⏢"; +var Tscr = "𝒯"; +var tscr = "𝓉"; +var TScy = "Ц"; +var tscy = "ц"; +var TSHcy = "Ћ"; +var tshcy = "ћ"; +var Tstrok = "Ŧ"; +var tstrok = "ŧ"; +var twixt = "≬"; +var twoheadleftarrow = "↞"; +var twoheadrightarrow = "↠"; +var Uacute$1 = "Ú"; +var uacute$1 = "ú"; +var uarr = "↑"; +var Uarr = "↟"; +var uArr = "⇑"; +var Uarrocir = "⥉"; +var Ubrcy = "Ў"; +var ubrcy = "ў"; +var Ubreve = "Ŭ"; +var ubreve = "ŭ"; +var Ucirc$1 = "Û"; +var ucirc$1 = "û"; +var Ucy = "У"; +var ucy = "у"; +var udarr = "⇅"; +var Udblac = "Ű"; +var udblac = "ű"; +var udhar = "⥮"; +var ufisht = "⥾"; +var Ufr = "𝔘"; +var ufr = "𝔲"; +var Ugrave$1 = "Ù"; +var ugrave$1 = "ù"; +var uHar = "⥣"; +var uharl = "↿"; +var uharr = "↾"; +var uhblk = "▀"; +var ulcorn = "⌜"; +var ulcorner = "⌜"; +var ulcrop = "⌏"; +var ultri = "◸"; +var Umacr = "Ū"; +var umacr = "ū"; +var uml$1 = "¨"; +var UnderBar = "_"; +var UnderBrace = "⏟"; +var UnderBracket = "⎵"; +var UnderParenthesis = "⏝"; +var Union = "⋃"; +var UnionPlus = "⊎"; +var Uogon = "Ų"; +var uogon = "ų"; +var Uopf = "𝕌"; +var uopf = "𝕦"; +var UpArrowBar = "⤒"; +var uparrow = "↑"; +var UpArrow = "↑"; +var Uparrow = "⇑"; +var UpArrowDownArrow = "⇅"; +var updownarrow = "↕"; +var UpDownArrow = "↕"; +var Updownarrow = "⇕"; +var UpEquilibrium = "⥮"; +var upharpoonleft = "↿"; +var upharpoonright = "↾"; +var uplus = "⊎"; +var UpperLeftArrow = "↖"; +var UpperRightArrow = "↗"; +var upsi = "υ"; +var Upsi = "ϒ"; +var upsih = "ϒ"; +var Upsilon = "Υ"; +var upsilon = "υ"; +var UpTeeArrow = "↥"; +var UpTee = "⊥"; +var upuparrows = "⇈"; +var urcorn = "⌝"; +var urcorner = "⌝"; +var urcrop = "⌎"; +var Uring = "Ů"; +var uring = "ů"; +var urtri = "◹"; +var Uscr = "𝒰"; +var uscr = "𝓊"; +var utdot = "⋰"; +var Utilde = "Ũ"; +var utilde = "ũ"; +var utri = "▵"; +var utrif = "▴"; +var uuarr = "⇈"; +var Uuml$1 = "Ü"; +var uuml$1 = "ü"; +var uwangle = "⦧"; +var vangrt = "⦜"; +var varepsilon = "ϵ"; +var varkappa = "ϰ"; +var varnothing = "∅"; +var varphi = "ϕ"; +var varpi = "ϖ"; +var varpropto = "∝"; +var varr = "↕"; +var vArr = "⇕"; +var varrho = "ϱ"; +var varsigma = "ς"; +var varsubsetneq = "⊊︀"; +var varsubsetneqq = "⫋︀"; +var varsupsetneq = "⊋︀"; +var varsupsetneqq = "⫌︀"; +var vartheta = "ϑ"; +var vartriangleleft = "⊲"; +var vartriangleright = "⊳"; +var vBar = "⫨"; +var Vbar = "⫫"; +var vBarv = "⫩"; +var Vcy = "В"; +var vcy = "в"; +var vdash = "⊢"; +var vDash = "⊨"; +var Vdash = "⊩"; +var VDash = "⊫"; +var Vdashl = "⫦"; +var veebar = "⊻"; +var vee = "∨"; +var Vee = "⋁"; +var veeeq = "≚"; +var vellip = "⋮"; +var verbar = "|"; +var Verbar = "‖"; +var vert = "|"; +var Vert = "‖"; +var VerticalBar = "∣"; +var VerticalLine = "|"; +var VerticalSeparator = "❘"; +var VerticalTilde = "≀"; +var VeryThinSpace = " "; +var Vfr = "𝔙"; +var vfr = "𝔳"; +var vltri = "⊲"; +var vnsub = "⊂⃒"; +var vnsup = "⊃⃒"; +var Vopf = "𝕍"; +var vopf = "𝕧"; +var vprop = "∝"; +var vrtri = "⊳"; +var Vscr = "𝒱"; +var vscr = "𝓋"; +var vsubnE = "⫋︀"; +var vsubne = "⊊︀"; +var vsupnE = "⫌︀"; +var vsupne = "⊋︀"; +var Vvdash = "⊪"; +var vzigzag = "⦚"; +var Wcirc = "Ŵ"; +var wcirc = "ŵ"; +var wedbar = "⩟"; +var wedge = "∧"; +var Wedge = "⋀"; +var wedgeq = "≙"; +var weierp = "℘"; +var Wfr = "𝔚"; +var wfr = "𝔴"; +var Wopf = "𝕎"; +var wopf = "𝕨"; +var wp = "℘"; +var wr = "≀"; +var wreath = "≀"; +var Wscr = "𝒲"; +var wscr = "𝓌"; +var xcap = "⋂"; +var xcirc = "◯"; +var xcup = "⋃"; +var xdtri = "▽"; +var Xfr = "𝔛"; +var xfr = "𝔵"; +var xharr = "⟷"; +var xhArr = "⟺"; +var Xi = "Ξ"; +var xi = "ξ"; +var xlarr = "⟵"; +var xlArr = "⟸"; +var xmap = "⟼"; +var xnis = "⋻"; +var xodot = "⨀"; +var Xopf = "𝕏"; +var xopf = "𝕩"; +var xoplus = "⨁"; +var xotime = "⨂"; +var xrarr = "⟶"; +var xrArr = "⟹"; +var Xscr = "𝒳"; +var xscr = "𝓍"; +var xsqcup = "⨆"; +var xuplus = "⨄"; +var xutri = "△"; +var xvee = "⋁"; +var xwedge = "⋀"; +var Yacute$1 = "Ý"; +var yacute$1 = "ý"; +var YAcy = "Я"; +var yacy = "я"; +var Ycirc = "Ŷ"; +var ycirc = "ŷ"; +var Ycy = "Ы"; +var ycy = "ы"; +var yen$1 = "¥"; +var Yfr = "𝔜"; +var yfr = "𝔶"; +var YIcy = "Ї"; +var yicy = "ї"; +var Yopf = "𝕐"; +var yopf = "𝕪"; +var Yscr = "𝒴"; +var yscr = "𝓎"; +var YUcy = "Ю"; +var yucy = "ю"; +var yuml$1 = "ÿ"; +var Yuml = "Ÿ"; +var Zacute = "Ź"; +var zacute = "ź"; +var Zcaron = "Ž"; +var zcaron = "ž"; +var Zcy = "З"; +var zcy = "з"; +var Zdot = "Ż"; +var zdot = "ż"; +var zeetrf = "ℨ"; +var ZeroWidthSpace = "​"; +var Zeta = "Ζ"; +var zeta = "ζ"; +var zfr = "𝔷"; +var Zfr = "ℨ"; +var ZHcy = "Ж"; +var zhcy = "ж"; +var zigrarr = "⇝"; +var zopf = "𝕫"; +var Zopf = "ℤ"; +var Zscr = "𝒵"; +var zscr = "𝓏"; +var zwj = "‍"; +var zwnj = "‌"; +var require$$1$1 = { + Aacute: Aacute$1, + aacute: aacute$1, + Abreve: Abreve, + abreve: abreve, + ac: ac, + acd: acd, + acE: acE, + Acirc: Acirc$1, + acirc: acirc$1, + acute: acute$1, + Acy: Acy, + acy: acy, + AElig: AElig$1, + aelig: aelig$1, + af: af, + Afr: Afr, + afr: afr, + Agrave: Agrave$1, + agrave: agrave$1, + alefsym: alefsym, + aleph: aleph, + Alpha: Alpha, + alpha: alpha, + Amacr: Amacr, + amacr: amacr, + amalg: amalg, + amp: amp$2, + AMP: AMP$1, + andand: andand, + And: And, + and: and, + andd: andd, + andslope: andslope, + andv: andv, + ang: ang, + ange: ange, + angle: angle, + angmsdaa: angmsdaa, + angmsdab: angmsdab, + angmsdac: angmsdac, + angmsdad: angmsdad, + angmsdae: angmsdae, + angmsdaf: angmsdaf, + angmsdag: angmsdag, + angmsdah: angmsdah, + angmsd: angmsd, + angrt: angrt, + angrtvb: angrtvb, + angrtvbd: angrtvbd, + angsph: angsph, + angst: angst, + angzarr: angzarr, + Aogon: Aogon, + aogon: aogon, + Aopf: Aopf, + aopf: aopf, + apacir: apacir, + ap: ap, + apE: apE, + ape: ape, + apid: apid, + apos: apos$1, + ApplyFunction: ApplyFunction, + approx: approx, + approxeq: approxeq, + Aring: Aring$1, + aring: aring$1, + Ascr: Ascr, + ascr: ascr, + Assign: Assign, + ast: ast, + asymp: asymp, + asympeq: asympeq, + Atilde: Atilde$1, + atilde: atilde$1, + Auml: Auml$1, + auml: auml$1, + awconint: awconint, + awint: awint, + backcong: backcong, + backepsilon: backepsilon, + backprime: backprime, + backsim: backsim, + backsimeq: backsimeq, + Backslash: Backslash, + Barv: Barv, + barvee: barvee, + barwed: barwed, + Barwed: Barwed, + barwedge: barwedge, + bbrk: bbrk, + bbrktbrk: bbrktbrk, + bcong: bcong, + Bcy: Bcy, + bcy: bcy, + bdquo: bdquo, + becaus: becaus, + because: because, + Because: Because, + bemptyv: bemptyv, + bepsi: bepsi, + bernou: bernou, + Bernoullis: Bernoullis, + Beta: Beta, + beta: beta, + beth: beth, + between: between, + Bfr: Bfr, + bfr: bfr, + bigcap: bigcap, + bigcirc: bigcirc, + bigcup: bigcup, + bigodot: bigodot, + bigoplus: bigoplus, + bigotimes: bigotimes, + bigsqcup: bigsqcup, + bigstar: bigstar, + bigtriangledown: bigtriangledown, + bigtriangleup: bigtriangleup, + biguplus: biguplus, + bigvee: bigvee, + bigwedge: bigwedge, + bkarow: bkarow, + blacklozenge: blacklozenge, + blacksquare: blacksquare, + blacktriangle: blacktriangle, + blacktriangledown: blacktriangledown, + blacktriangleleft: blacktriangleleft, + blacktriangleright: blacktriangleright, + blank: blank, + blk12: blk12, + blk14: blk14, + blk34: blk34, + block: block, + bne: bne, + bnequiv: bnequiv, + bNot: bNot, + bnot: bnot, + Bopf: Bopf, + bopf: bopf, + bot: bot, + bottom: bottom, + bowtie: bowtie, + boxbox: boxbox, + boxdl: boxdl, + boxdL: boxdL, + boxDl: boxDl, + boxDL: boxDL, + boxdr: boxdr, + boxdR: boxdR, + boxDr: boxDr, + boxDR: boxDR, + boxh: boxh, + boxH: boxH, + boxhd: boxhd, + boxHd: boxHd, + boxhD: boxhD, + boxHD: boxHD, + boxhu: boxhu, + boxHu: boxHu, + boxhU: boxhU, + boxHU: boxHU, + boxminus: boxminus, + boxplus: boxplus, + boxtimes: boxtimes, + boxul: boxul, + boxuL: boxuL, + boxUl: boxUl, + boxUL: boxUL, + boxur: boxur, + boxuR: boxuR, + boxUr: boxUr, + boxUR: boxUR, + boxv: boxv, + boxV: boxV, + boxvh: boxvh, + boxvH: boxvH, + boxVh: boxVh, + boxVH: boxVH, + boxvl: boxvl, + boxvL: boxvL, + boxVl: boxVl, + boxVL: boxVL, + boxvr: boxvr, + boxvR: boxvR, + boxVr: boxVr, + boxVR: boxVR, + bprime: bprime, + breve: breve, + Breve: Breve, + brvbar: brvbar$1, + bscr: bscr, + Bscr: Bscr, + bsemi: bsemi, + bsim: bsim, + bsime: bsime, + bsolb: bsolb, + bsol: bsol, + bsolhsub: bsolhsub, + bull: bull, + bullet: bullet, + bump: bump, + bumpE: bumpE, + bumpe: bumpe, + Bumpeq: Bumpeq, + bumpeq: bumpeq, + Cacute: Cacute, + cacute: cacute, + capand: capand, + capbrcup: capbrcup, + capcap: capcap, + cap: cap, + Cap: Cap, + capcup: capcup, + capdot: capdot, + CapitalDifferentialD: CapitalDifferentialD, + caps: caps, + caret: caret, + caron: caron, + Cayleys: Cayleys, + ccaps: ccaps, + Ccaron: Ccaron, + ccaron: ccaron, + Ccedil: Ccedil$1, + ccedil: ccedil$1, + Ccirc: Ccirc, + ccirc: ccirc, + Cconint: Cconint, + ccups: ccups, + ccupssm: ccupssm, + Cdot: Cdot, + cdot: cdot, + cedil: cedil$1, + Cedilla: Cedilla, + cemptyv: cemptyv, + cent: cent$1, + centerdot: centerdot, + CenterDot: CenterDot, + cfr: cfr, + Cfr: Cfr, + CHcy: CHcy, + chcy: chcy, + check: check, + checkmark: checkmark, + Chi: Chi, + chi: chi, + circ: circ, + circeq: circeq, + circlearrowleft: circlearrowleft, + circlearrowright: circlearrowright, + circledast: circledast, + circledcirc: circledcirc, + circleddash: circleddash, + CircleDot: CircleDot, + circledR: circledR, + circledS: circledS, + CircleMinus: CircleMinus, + CirclePlus: CirclePlus, + CircleTimes: CircleTimes, + cir: cir, + cirE: cirE, + cire: cire, + cirfnint: cirfnint, + cirmid: cirmid, + cirscir: cirscir, + ClockwiseContourIntegral: ClockwiseContourIntegral, + CloseCurlyDoubleQuote: CloseCurlyDoubleQuote, + CloseCurlyQuote: CloseCurlyQuote, + clubs: clubs, + clubsuit: clubsuit, + colon: colon, + Colon: Colon, + Colone: Colone, + colone: colone, + coloneq: coloneq, + comma: comma, + commat: commat, + comp: comp, + compfn: compfn, + complement: complement, + complexes: complexes, + cong: cong, + congdot: congdot, + Congruent: Congruent, + conint: conint, + Conint: Conint, + ContourIntegral: ContourIntegral, + copf: copf, + Copf: Copf, + coprod: coprod, + Coproduct: Coproduct, + copy: copy$1, + COPY: COPY$1, + copysr: copysr, + CounterClockwiseContourIntegral: CounterClockwiseContourIntegral, + crarr: crarr, + cross: cross, + Cross: Cross, + Cscr: Cscr, + cscr: cscr, + csub: csub, + csube: csube, + csup: csup, + csupe: csupe, + ctdot: ctdot, + cudarrl: cudarrl, + cudarrr: cudarrr, + cuepr: cuepr, + cuesc: cuesc, + cularr: cularr, + cularrp: cularrp, + cupbrcap: cupbrcap, + cupcap: cupcap, + CupCap: CupCap, + cup: cup, + Cup: Cup, + cupcup: cupcup, + cupdot: cupdot, + cupor: cupor, + cups: cups, + curarr: curarr, + curarrm: curarrm, + curlyeqprec: curlyeqprec, + curlyeqsucc: curlyeqsucc, + curlyvee: curlyvee, + curlywedge: curlywedge, + curren: curren$1, + curvearrowleft: curvearrowleft, + curvearrowright: curvearrowright, + cuvee: cuvee, + cuwed: cuwed, + cwconint: cwconint, + cwint: cwint, + cylcty: cylcty, + dagger: dagger, + Dagger: Dagger, + daleth: daleth, + darr: darr, + Darr: Darr, + dArr: dArr, + dash: dash, + Dashv: Dashv, + dashv: dashv, + dbkarow: dbkarow, + dblac: dblac, + Dcaron: Dcaron, + dcaron: dcaron, + Dcy: Dcy, + dcy: dcy, + ddagger: ddagger, + ddarr: ddarr, + DD: DD, + dd: dd, + DDotrahd: DDotrahd, + ddotseq: ddotseq, + deg: deg$1, + Del: Del, + Delta: Delta, + delta: delta, + demptyv: demptyv, + dfisht: dfisht, + Dfr: Dfr, + dfr: dfr, + dHar: dHar, + dharl: dharl, + dharr: dharr, + DiacriticalAcute: DiacriticalAcute, + DiacriticalDot: DiacriticalDot, + DiacriticalDoubleAcute: DiacriticalDoubleAcute, + DiacriticalGrave: DiacriticalGrave, + DiacriticalTilde: DiacriticalTilde, + diam: diam, + diamond: diamond, + Diamond: Diamond, + diamondsuit: diamondsuit, + diams: diams, + die: die, + DifferentialD: DifferentialD, + digamma: digamma, + disin: disin, + div: div, + divide: divide$1, + divideontimes: divideontimes, + divonx: divonx, + DJcy: DJcy, + djcy: djcy, + dlcorn: dlcorn, + dlcrop: dlcrop, + dollar: dollar, + Dopf: Dopf, + dopf: dopf, + Dot: Dot, + dot: dot, + DotDot: DotDot, + doteq: doteq, + doteqdot: doteqdot, + DotEqual: DotEqual, + dotminus: dotminus, + dotplus: dotplus, + dotsquare: dotsquare, + doublebarwedge: doublebarwedge, + DoubleContourIntegral: DoubleContourIntegral, + DoubleDot: DoubleDot, + DoubleDownArrow: DoubleDownArrow, + DoubleLeftArrow: DoubleLeftArrow, + DoubleLeftRightArrow: DoubleLeftRightArrow, + DoubleLeftTee: DoubleLeftTee, + DoubleLongLeftArrow: DoubleLongLeftArrow, + DoubleLongLeftRightArrow: DoubleLongLeftRightArrow, + DoubleLongRightArrow: DoubleLongRightArrow, + DoubleRightArrow: DoubleRightArrow, + DoubleRightTee: DoubleRightTee, + DoubleUpArrow: DoubleUpArrow, + DoubleUpDownArrow: DoubleUpDownArrow, + DoubleVerticalBar: DoubleVerticalBar, + DownArrowBar: DownArrowBar, + downarrow: downarrow, + DownArrow: DownArrow, + Downarrow: Downarrow, + DownArrowUpArrow: DownArrowUpArrow, + DownBreve: DownBreve, + downdownarrows: downdownarrows, + downharpoonleft: downharpoonleft, + downharpoonright: downharpoonright, + DownLeftRightVector: DownLeftRightVector, + DownLeftTeeVector: DownLeftTeeVector, + DownLeftVectorBar: DownLeftVectorBar, + DownLeftVector: DownLeftVector, + DownRightTeeVector: DownRightTeeVector, + DownRightVectorBar: DownRightVectorBar, + DownRightVector: DownRightVector, + DownTeeArrow: DownTeeArrow, + DownTee: DownTee, + drbkarow: drbkarow, + drcorn: drcorn, + drcrop: drcrop, + Dscr: Dscr, + dscr: dscr, + DScy: DScy, + dscy: dscy, + dsol: dsol, + Dstrok: Dstrok, + dstrok: dstrok, + dtdot: dtdot, + dtri: dtri, + dtrif: dtrif, + duarr: duarr, + duhar: duhar, + dwangle: dwangle, + DZcy: DZcy, + dzcy: dzcy, + dzigrarr: dzigrarr, + Eacute: Eacute$1, + eacute: eacute$1, + easter: easter, + Ecaron: Ecaron, + ecaron: ecaron, + Ecirc: Ecirc$1, + ecirc: ecirc$1, + ecir: ecir, + ecolon: ecolon, + Ecy: Ecy, + ecy: ecy, + eDDot: eDDot, + Edot: Edot, + edot: edot, + eDot: eDot, + ee: ee, + efDot: efDot, + Efr: Efr, + efr: efr, + eg: eg, + Egrave: Egrave$1, + egrave: egrave$1, + egs: egs, + egsdot: egsdot, + el: el, + Element: Element$1, + elinters: elinters, + ell: ell, + els: els, + elsdot: elsdot, + Emacr: Emacr, + emacr: emacr, + empty: empty, + emptyset: emptyset, + EmptySmallSquare: EmptySmallSquare, + emptyv: emptyv, + EmptyVerySmallSquare: EmptyVerySmallSquare, + emsp13: emsp13, + emsp14: emsp14, + emsp: emsp, + ENG: ENG, + eng: eng, + ensp: ensp, + Eogon: Eogon, + eogon: eogon, + Eopf: Eopf, + eopf: eopf, + epar: epar, + eparsl: eparsl, + eplus: eplus, + epsi: epsi, + Epsilon: Epsilon, + epsilon: epsilon, + epsiv: epsiv, + eqcirc: eqcirc, + eqcolon: eqcolon, + eqsim: eqsim, + eqslantgtr: eqslantgtr, + eqslantless: eqslantless, + Equal: Equal, + equals: equals, + EqualTilde: EqualTilde, + equest: equest, + Equilibrium: Equilibrium, + equiv: equiv, + equivDD: equivDD, + eqvparsl: eqvparsl, + erarr: erarr, + erDot: erDot, + escr: escr, + Escr: Escr, + esdot: esdot, + Esim: Esim, + esim: esim, + Eta: Eta, + eta: eta, + ETH: ETH$1, + eth: eth$1, + Euml: Euml$1, + euml: euml$1, + euro: euro, + excl: excl, + exist: exist, + Exists: Exists, + expectation: expectation, + exponentiale: exponentiale, + ExponentialE: ExponentialE, + fallingdotseq: fallingdotseq, + Fcy: Fcy, + fcy: fcy, + female: female, + ffilig: ffilig, + fflig: fflig, + ffllig: ffllig, + Ffr: Ffr, + ffr: ffr, + filig: filig, + FilledSmallSquare: FilledSmallSquare, + FilledVerySmallSquare: FilledVerySmallSquare, + fjlig: fjlig, + flat: flat, + fllig: fllig, + fltns: fltns, + fnof: fnof, + Fopf: Fopf, + fopf: fopf, + forall: forall, + ForAll: ForAll, + fork: fork, + forkv: forkv, + Fouriertrf: Fouriertrf, + fpartint: fpartint, + frac12: frac12$1, + frac13: frac13, + frac14: frac14$1, + frac15: frac15, + frac16: frac16, + frac18: frac18, + frac23: frac23, + frac25: frac25, + frac34: frac34$1, + frac35: frac35, + frac38: frac38, + frac45: frac45, + frac56: frac56, + frac58: frac58, + frac78: frac78, + frasl: frasl, + frown: frown, + fscr: fscr, + Fscr: Fscr, + gacute: gacute, + Gamma: Gamma, + gamma: gamma, + Gammad: Gammad, + gammad: gammad, + gap: gap, + Gbreve: Gbreve, + gbreve: gbreve, + Gcedil: Gcedil, + Gcirc: Gcirc, + gcirc: gcirc, + Gcy: Gcy, + gcy: gcy, + Gdot: Gdot, + gdot: gdot, + ge: ge, + gE: gE, + gEl: gEl, + gel: gel, + geq: geq, + geqq: geqq, + geqslant: geqslant, + gescc: gescc, + ges: ges, + gesdot: gesdot, + gesdoto: gesdoto, + gesdotol: gesdotol, + gesl: gesl, + gesles: gesles, + Gfr: Gfr, + gfr: gfr, + gg: gg, + Gg: Gg, + ggg: ggg, + gimel: gimel, + GJcy: GJcy, + gjcy: gjcy, + gla: gla, + gl: gl, + glE: glE, + glj: glj, + gnap: gnap, + gnapprox: gnapprox, + gne: gne, + gnE: gnE, + gneq: gneq, + gneqq: gneqq, + gnsim: gnsim, + Gopf: Gopf, + gopf: gopf, + grave: grave, + GreaterEqual: GreaterEqual, + GreaterEqualLess: GreaterEqualLess, + GreaterFullEqual: GreaterFullEqual, + GreaterGreater: GreaterGreater, + GreaterLess: GreaterLess, + GreaterSlantEqual: GreaterSlantEqual, + GreaterTilde: GreaterTilde, + Gscr: Gscr, + gscr: gscr, + gsim: gsim, + gsime: gsime, + gsiml: gsiml, + gtcc: gtcc, + gtcir: gtcir, + gt: gt$2, + GT: GT$1, + Gt: Gt, + gtdot: gtdot, + gtlPar: gtlPar, + gtquest: gtquest, + gtrapprox: gtrapprox, + gtrarr: gtrarr, + gtrdot: gtrdot, + gtreqless: gtreqless, + gtreqqless: gtreqqless, + gtrless: gtrless, + gtrsim: gtrsim, + gvertneqq: gvertneqq, + gvnE: gvnE, + Hacek: Hacek, + hairsp: hairsp, + half: half, + hamilt: hamilt, + HARDcy: HARDcy, + hardcy: hardcy, + harrcir: harrcir, + harr: harr, + hArr: hArr, + harrw: harrw, + Hat: Hat, + hbar: hbar, + Hcirc: Hcirc, + hcirc: hcirc, + hearts: hearts, + heartsuit: heartsuit, + hellip: hellip, + hercon: hercon, + hfr: hfr, + Hfr: Hfr, + HilbertSpace: HilbertSpace, + hksearow: hksearow, + hkswarow: hkswarow, + hoarr: hoarr, + homtht: homtht, + hookleftarrow: hookleftarrow, + hookrightarrow: hookrightarrow, + hopf: hopf, + Hopf: Hopf, + horbar: horbar, + HorizontalLine: HorizontalLine, + hscr: hscr, + Hscr: Hscr, + hslash: hslash, + Hstrok: Hstrok, + hstrok: hstrok, + HumpDownHump: HumpDownHump, + HumpEqual: HumpEqual, + hybull: hybull, + hyphen: hyphen, + Iacute: Iacute$1, + iacute: iacute$1, + ic: ic, + Icirc: Icirc$1, + icirc: icirc$1, + Icy: Icy, + icy: icy, + Idot: Idot, + IEcy: IEcy, + iecy: iecy, + iexcl: iexcl$1, + iff: iff, + ifr: ifr, + Ifr: Ifr, + Igrave: Igrave$1, + igrave: igrave$1, + ii: ii, + iiiint: iiiint, + iiint: iiint, + iinfin: iinfin, + iiota: iiota, + IJlig: IJlig, + ijlig: ijlig, + Imacr: Imacr, + imacr: imacr, + image: image, + ImaginaryI: ImaginaryI, + imagline: imagline, + imagpart: imagpart, + imath: imath, + Im: Im, + imof: imof, + imped: imped, + Implies: Implies, + incare: incare, + "in": "∈", + infin: infin, + infintie: infintie, + inodot: inodot, + intcal: intcal, + int: int, + Int: Int, + integers: integers, + Integral: Integral, + intercal: intercal, + Intersection: Intersection, + intlarhk: intlarhk, + intprod: intprod, + InvisibleComma: InvisibleComma, + InvisibleTimes: InvisibleTimes, + IOcy: IOcy, + iocy: iocy, + Iogon: Iogon, + iogon: iogon, + Iopf: Iopf, + iopf: iopf, + Iota: Iota, + iota: iota, + iprod: iprod, + iquest: iquest$1, + iscr: iscr, + Iscr: Iscr, + isin: isin, + isindot: isindot, + isinE: isinE, + isins: isins, + isinsv: isinsv, + isinv: isinv, + it: it, + Itilde: Itilde, + itilde: itilde, + Iukcy: Iukcy, + iukcy: iukcy, + Iuml: Iuml$1, + iuml: iuml$1, + Jcirc: Jcirc, + jcirc: jcirc, + Jcy: Jcy, + jcy: jcy, + Jfr: Jfr, + jfr: jfr, + jmath: jmath, + Jopf: Jopf, + jopf: jopf, + Jscr: Jscr, + jscr: jscr, + Jsercy: Jsercy, + jsercy: jsercy, + Jukcy: Jukcy, + jukcy: jukcy, + Kappa: Kappa, + kappa: kappa, + kappav: kappav, + Kcedil: Kcedil, + kcedil: kcedil, + Kcy: Kcy, + kcy: kcy, + Kfr: Kfr, + kfr: kfr, + kgreen: kgreen, + KHcy: KHcy, + khcy: khcy, + KJcy: KJcy, + kjcy: kjcy, + Kopf: Kopf, + kopf: kopf, + Kscr: Kscr, + kscr: kscr, + lAarr: lAarr, + Lacute: Lacute, + lacute: lacute, + laemptyv: laemptyv, + lagran: lagran, + Lambda: Lambda, + lambda: lambda, + lang: lang, + Lang: Lang, + langd: langd, + langle: langle, + lap: lap, + Laplacetrf: Laplacetrf, + laquo: laquo$1, + larrb: larrb, + larrbfs: larrbfs, + larr: larr, + Larr: Larr, + lArr: lArr, + larrfs: larrfs, + larrhk: larrhk, + larrlp: larrlp, + larrpl: larrpl, + larrsim: larrsim, + larrtl: larrtl, + latail: latail, + lAtail: lAtail, + lat: lat, + late: late, + lates: lates, + lbarr: lbarr, + lBarr: lBarr, + lbbrk: lbbrk, + lbrace: lbrace, + lbrack: lbrack, + lbrke: lbrke, + lbrksld: lbrksld, + lbrkslu: lbrkslu, + Lcaron: Lcaron, + lcaron: lcaron, + Lcedil: Lcedil, + lcedil: lcedil, + lceil: lceil, + lcub: lcub, + Lcy: Lcy, + lcy: lcy, + ldca: ldca, + ldquo: ldquo, + ldquor: ldquor, + ldrdhar: ldrdhar, + ldrushar: ldrushar, + ldsh: ldsh, + le: le, + lE: lE, + LeftAngleBracket: LeftAngleBracket, + LeftArrowBar: LeftArrowBar, + leftarrow: leftarrow, + LeftArrow: LeftArrow, + Leftarrow: Leftarrow, + LeftArrowRightArrow: LeftArrowRightArrow, + leftarrowtail: leftarrowtail, + LeftCeiling: LeftCeiling, + LeftDoubleBracket: LeftDoubleBracket, + LeftDownTeeVector: LeftDownTeeVector, + LeftDownVectorBar: LeftDownVectorBar, + LeftDownVector: LeftDownVector, + LeftFloor: LeftFloor, + leftharpoondown: leftharpoondown, + leftharpoonup: leftharpoonup, + leftleftarrows: leftleftarrows, + leftrightarrow: leftrightarrow, + LeftRightArrow: LeftRightArrow, + Leftrightarrow: Leftrightarrow, + leftrightarrows: leftrightarrows, + leftrightharpoons: leftrightharpoons, + leftrightsquigarrow: leftrightsquigarrow, + LeftRightVector: LeftRightVector, + LeftTeeArrow: LeftTeeArrow, + LeftTee: LeftTee, + LeftTeeVector: LeftTeeVector, + leftthreetimes: leftthreetimes, + LeftTriangleBar: LeftTriangleBar, + LeftTriangle: LeftTriangle, + LeftTriangleEqual: LeftTriangleEqual, + LeftUpDownVector: LeftUpDownVector, + LeftUpTeeVector: LeftUpTeeVector, + LeftUpVectorBar: LeftUpVectorBar, + LeftUpVector: LeftUpVector, + LeftVectorBar: LeftVectorBar, + LeftVector: LeftVector, + lEg: lEg, + leg: leg, + leq: leq, + leqq: leqq, + leqslant: leqslant, + lescc: lescc, + les: les, + lesdot: lesdot, + lesdoto: lesdoto, + lesdotor: lesdotor, + lesg: lesg, + lesges: lesges, + lessapprox: lessapprox, + lessdot: lessdot, + lesseqgtr: lesseqgtr, + lesseqqgtr: lesseqqgtr, + LessEqualGreater: LessEqualGreater, + LessFullEqual: LessFullEqual, + LessGreater: LessGreater, + lessgtr: lessgtr, + LessLess: LessLess, + lesssim: lesssim, + LessSlantEqual: LessSlantEqual, + LessTilde: LessTilde, + lfisht: lfisht, + lfloor: lfloor, + Lfr: Lfr, + lfr: lfr, + lg: lg, + lgE: lgE, + lHar: lHar, + lhard: lhard, + lharu: lharu, + lharul: lharul, + lhblk: lhblk, + LJcy: LJcy, + ljcy: ljcy, + llarr: llarr, + ll: ll, + Ll: Ll, + llcorner: llcorner, + Lleftarrow: Lleftarrow, + llhard: llhard, + lltri: lltri, + Lmidot: Lmidot, + lmidot: lmidot, + lmoustache: lmoustache, + lmoust: lmoust, + lnap: lnap, + lnapprox: lnapprox, + lne: lne, + lnE: lnE, + lneq: lneq, + lneqq: lneqq, + lnsim: lnsim, + loang: loang, + loarr: loarr, + lobrk: lobrk, + longleftarrow: longleftarrow, + LongLeftArrow: LongLeftArrow, + Longleftarrow: Longleftarrow, + longleftrightarrow: longleftrightarrow, + LongLeftRightArrow: LongLeftRightArrow, + Longleftrightarrow: Longleftrightarrow, + longmapsto: longmapsto, + longrightarrow: longrightarrow, + LongRightArrow: LongRightArrow, + Longrightarrow: Longrightarrow, + looparrowleft: looparrowleft, + looparrowright: looparrowright, + lopar: lopar, + Lopf: Lopf, + lopf: lopf, + loplus: loplus, + lotimes: lotimes, + lowast: lowast, + lowbar: lowbar, + LowerLeftArrow: LowerLeftArrow, + LowerRightArrow: LowerRightArrow, + loz: loz, + lozenge: lozenge, + lozf: lozf, + lpar: lpar, + lparlt: lparlt, + lrarr: lrarr, + lrcorner: lrcorner, + lrhar: lrhar, + lrhard: lrhard, + lrm: lrm, + lrtri: lrtri, + lsaquo: lsaquo, + lscr: lscr, + Lscr: Lscr, + lsh: lsh, + Lsh: Lsh, + lsim: lsim, + lsime: lsime, + lsimg: lsimg, + lsqb: lsqb, + lsquo: lsquo, + lsquor: lsquor, + Lstrok: Lstrok, + lstrok: lstrok, + ltcc: ltcc, + ltcir: ltcir, + lt: lt$2, + LT: LT$1, + Lt: Lt, + ltdot: ltdot, + lthree: lthree, + ltimes: ltimes, + ltlarr: ltlarr, + ltquest: ltquest, + ltri: ltri, + ltrie: ltrie, + ltrif: ltrif, + ltrPar: ltrPar, + lurdshar: lurdshar, + luruhar: luruhar, + lvertneqq: lvertneqq, + lvnE: lvnE, + macr: macr$1, + male: male, + malt: malt, + maltese: maltese, + "Map": "⤅", + map: map, + mapsto: mapsto, + mapstodown: mapstodown, + mapstoleft: mapstoleft, + mapstoup: mapstoup, + marker: marker, + mcomma: mcomma, + Mcy: Mcy, + mcy: mcy, + mdash: mdash, + mDDot: mDDot, + measuredangle: measuredangle, + MediumSpace: MediumSpace, + Mellintrf: Mellintrf, + Mfr: Mfr, + mfr: mfr, + mho: mho, + micro: micro$1, + midast: midast, + midcir: midcir, + mid: mid, + middot: middot$1, + minusb: minusb, + minus: minus, + minusd: minusd, + minusdu: minusdu, + MinusPlus: MinusPlus, + mlcp: mlcp, + mldr: mldr, + mnplus: mnplus, + models: models, + Mopf: Mopf, + mopf: mopf, + mp: mp, + mscr: mscr, + Mscr: Mscr, + mstpos: mstpos, + Mu: Mu, + mu: mu, + multimap: multimap, + mumap: mumap, + nabla: nabla, + Nacute: Nacute, + nacute: nacute, + nang: nang, + nap: nap, + napE: napE, + napid: napid, + napos: napos, + napprox: napprox, + natural: natural, + naturals: naturals, + natur: natur, + nbsp: nbsp$1, + nbump: nbump, + nbumpe: nbumpe, + ncap: ncap, + Ncaron: Ncaron, + ncaron: ncaron, + Ncedil: Ncedil, + ncedil: ncedil, + ncong: ncong, + ncongdot: ncongdot, + ncup: ncup, + Ncy: Ncy, + ncy: ncy, + ndash: ndash, + nearhk: nearhk, + nearr: nearr, + neArr: neArr, + nearrow: nearrow, + ne: ne, + nedot: nedot, + NegativeMediumSpace: NegativeMediumSpace, + NegativeThickSpace: NegativeThickSpace, + NegativeThinSpace: NegativeThinSpace, + NegativeVeryThinSpace: NegativeVeryThinSpace, + nequiv: nequiv, + nesear: nesear, + nesim: nesim, + NestedGreaterGreater: NestedGreaterGreater, + NestedLessLess: NestedLessLess, + NewLine: NewLine, + nexist: nexist, + nexists: nexists, + Nfr: Nfr, + nfr: nfr, + ngE: ngE, + nge: nge, + ngeq: ngeq, + ngeqq: ngeqq, + ngeqslant: ngeqslant, + nges: nges, + nGg: nGg, + ngsim: ngsim, + nGt: nGt, + ngt: ngt, + ngtr: ngtr, + nGtv: nGtv, + nharr: nharr, + nhArr: nhArr, + nhpar: nhpar, + ni: ni, + nis: nis, + nisd: nisd, + niv: niv, + NJcy: NJcy, + njcy: njcy, + nlarr: nlarr, + nlArr: nlArr, + nldr: nldr, + nlE: nlE, + nle: nle, + nleftarrow: nleftarrow, + nLeftarrow: nLeftarrow, + nleftrightarrow: nleftrightarrow, + nLeftrightarrow: nLeftrightarrow, + nleq: nleq, + nleqq: nleqq, + nleqslant: nleqslant, + nles: nles, + nless: nless, + nLl: nLl, + nlsim: nlsim, + nLt: nLt, + nlt: nlt, + nltri: nltri, + nltrie: nltrie, + nLtv: nLtv, + nmid: nmid, + NoBreak: NoBreak, + NonBreakingSpace: NonBreakingSpace, + nopf: nopf, + Nopf: Nopf, + Not: Not, + not: not$1, + NotCongruent: NotCongruent, + NotCupCap: NotCupCap, + NotDoubleVerticalBar: NotDoubleVerticalBar, + NotElement: NotElement, + NotEqual: NotEqual, + NotEqualTilde: NotEqualTilde, + NotExists: NotExists, + NotGreater: NotGreater, + NotGreaterEqual: NotGreaterEqual, + NotGreaterFullEqual: NotGreaterFullEqual, + NotGreaterGreater: NotGreaterGreater, + NotGreaterLess: NotGreaterLess, + NotGreaterSlantEqual: NotGreaterSlantEqual, + NotGreaterTilde: NotGreaterTilde, + NotHumpDownHump: NotHumpDownHump, + NotHumpEqual: NotHumpEqual, + notin: notin, + notindot: notindot, + notinE: notinE, + notinva: notinva, + notinvb: notinvb, + notinvc: notinvc, + NotLeftTriangleBar: NotLeftTriangleBar, + NotLeftTriangle: NotLeftTriangle, + NotLeftTriangleEqual: NotLeftTriangleEqual, + NotLess: NotLess, + NotLessEqual: NotLessEqual, + NotLessGreater: NotLessGreater, + NotLessLess: NotLessLess, + NotLessSlantEqual: NotLessSlantEqual, + NotLessTilde: NotLessTilde, + NotNestedGreaterGreater: NotNestedGreaterGreater, + NotNestedLessLess: NotNestedLessLess, + notni: notni, + notniva: notniva, + notnivb: notnivb, + notnivc: notnivc, + NotPrecedes: NotPrecedes, + NotPrecedesEqual: NotPrecedesEqual, + NotPrecedesSlantEqual: NotPrecedesSlantEqual, + NotReverseElement: NotReverseElement, + NotRightTriangleBar: NotRightTriangleBar, + NotRightTriangle: NotRightTriangle, + NotRightTriangleEqual: NotRightTriangleEqual, + NotSquareSubset: NotSquareSubset, + NotSquareSubsetEqual: NotSquareSubsetEqual, + NotSquareSuperset: NotSquareSuperset, + NotSquareSupersetEqual: NotSquareSupersetEqual, + NotSubset: NotSubset, + NotSubsetEqual: NotSubsetEqual, + NotSucceeds: NotSucceeds, + NotSucceedsEqual: NotSucceedsEqual, + NotSucceedsSlantEqual: NotSucceedsSlantEqual, + NotSucceedsTilde: NotSucceedsTilde, + NotSuperset: NotSuperset, + NotSupersetEqual: NotSupersetEqual, + NotTilde: NotTilde, + NotTildeEqual: NotTildeEqual, + NotTildeFullEqual: NotTildeFullEqual, + NotTildeTilde: NotTildeTilde, + NotVerticalBar: NotVerticalBar, + nparallel: nparallel, + npar: npar, + nparsl: nparsl, + npart: npart, + npolint: npolint, + npr: npr, + nprcue: nprcue, + nprec: nprec, + npreceq: npreceq, + npre: npre, + nrarrc: nrarrc, + nrarr: nrarr, + nrArr: nrArr, + nrarrw: nrarrw, + nrightarrow: nrightarrow, + nRightarrow: nRightarrow, + nrtri: nrtri, + nrtrie: nrtrie, + nsc: nsc, + nsccue: nsccue, + nsce: nsce, + Nscr: Nscr, + nscr: nscr, + nshortmid: nshortmid, + nshortparallel: nshortparallel, + nsim: nsim, + nsime: nsime, + nsimeq: nsimeq, + nsmid: nsmid, + nspar: nspar, + nsqsube: nsqsube, + nsqsupe: nsqsupe, + nsub: nsub, + nsubE: nsubE, + nsube: nsube, + nsubset: nsubset, + nsubseteq: nsubseteq, + nsubseteqq: nsubseteqq, + nsucc: nsucc, + nsucceq: nsucceq, + nsup: nsup, + nsupE: nsupE, + nsupe: nsupe, + nsupset: nsupset, + nsupseteq: nsupseteq, + nsupseteqq: nsupseteqq, + ntgl: ntgl, + Ntilde: Ntilde$1, + ntilde: ntilde$1, + ntlg: ntlg, + ntriangleleft: ntriangleleft, + ntrianglelefteq: ntrianglelefteq, + ntriangleright: ntriangleright, + ntrianglerighteq: ntrianglerighteq, + Nu: Nu, + nu: nu, + num: num, + numero: numero, + numsp: numsp, + nvap: nvap, + nvdash: nvdash, + nvDash: nvDash, + nVdash: nVdash, + nVDash: nVDash, + nvge: nvge, + nvgt: nvgt, + nvHarr: nvHarr, + nvinfin: nvinfin, + nvlArr: nvlArr, + nvle: nvle, + nvlt: nvlt, + nvltrie: nvltrie, + nvrArr: nvrArr, + nvrtrie: nvrtrie, + nvsim: nvsim, + nwarhk: nwarhk, + nwarr: nwarr, + nwArr: nwArr, + nwarrow: nwarrow, + nwnear: nwnear, + Oacute: Oacute$1, + oacute: oacute$1, + oast: oast, + Ocirc: Ocirc$1, + ocirc: ocirc$1, + ocir: ocir, + Ocy: Ocy, + ocy: ocy, + odash: odash, + Odblac: Odblac, + odblac: odblac, + odiv: odiv, + odot: odot, + odsold: odsold, + OElig: OElig, + oelig: oelig, + ofcir: ofcir, + Ofr: Ofr, + ofr: ofr, + ogon: ogon, + Ograve: Ograve$1, + ograve: ograve$1, + ogt: ogt, + ohbar: ohbar, + ohm: ohm, + oint: oint, + olarr: olarr, + olcir: olcir, + olcross: olcross, + oline: oline, + olt: olt, + Omacr: Omacr, + omacr: omacr, + Omega: Omega, + omega: omega, + Omicron: Omicron, + omicron: omicron, + omid: omid, + ominus: ominus, + Oopf: Oopf, + oopf: oopf, + opar: opar, + OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, + OpenCurlyQuote: OpenCurlyQuote, + operp: operp, + oplus: oplus, + orarr: orarr, + Or: Or, + or: or, + ord: ord, + order: order, + orderof: orderof, + ordf: ordf$1, + ordm: ordm$1, + origof: origof, + oror: oror, + orslope: orslope, + orv: orv, + oS: oS, + Oscr: Oscr, + oscr: oscr, + Oslash: Oslash$1, + oslash: oslash$1, + osol: osol, + Otilde: Otilde$1, + otilde: otilde$1, + otimesas: otimesas, + Otimes: Otimes, + otimes: otimes, + Ouml: Ouml$1, + ouml: ouml$1, + ovbar: ovbar, + OverBar: OverBar, + OverBrace: OverBrace, + OverBracket: OverBracket, + OverParenthesis: OverParenthesis, + para: para$1, + parallel: parallel, + par: par, + parsim: parsim, + parsl: parsl, + part: part, + PartialD: PartialD, + Pcy: Pcy, + pcy: pcy, + percnt: percnt, + period: period, + permil: permil, + perp: perp, + pertenk: pertenk, + Pfr: Pfr, + pfr: pfr, + Phi: Phi, + phi: phi, + phiv: phiv, + phmmat: phmmat, + phone: phone, + Pi: Pi, + pi: pi, + pitchfork: pitchfork, + piv: piv, + planck: planck, + planckh: planckh, + plankv: plankv, + plusacir: plusacir, + plusb: plusb, + pluscir: pluscir, + plus: plus, + plusdo: plusdo, + plusdu: plusdu, + pluse: pluse, + PlusMinus: PlusMinus, + plusmn: plusmn$1, + plussim: plussim, + plustwo: plustwo, + pm: pm, + Poincareplane: Poincareplane, + pointint: pointint, + popf: popf, + Popf: Popf, + pound: pound$1, + prap: prap, + Pr: Pr, + pr: pr, + prcue: prcue, + precapprox: precapprox, + prec: prec, + preccurlyeq: preccurlyeq, + Precedes: Precedes, + PrecedesEqual: PrecedesEqual, + PrecedesSlantEqual: PrecedesSlantEqual, + PrecedesTilde: PrecedesTilde, + preceq: preceq, + precnapprox: precnapprox, + precneqq: precneqq, + precnsim: precnsim, + pre: pre, + prE: prE, + precsim: precsim, + prime: prime, + Prime: Prime, + primes: primes, + prnap: prnap, + prnE: prnE, + prnsim: prnsim, + prod: prod, + Product: Product, + profalar: profalar, + profline: profline, + profsurf: profsurf, + prop: prop, + Proportional: Proportional, + Proportion: Proportion, + propto: propto, + prsim: prsim, + prurel: prurel, + Pscr: Pscr, + pscr: pscr, + Psi: Psi, + psi: psi, + puncsp: puncsp, + Qfr: Qfr, + qfr: qfr, + qint: qint, + qopf: qopf, + Qopf: Qopf, + qprime: qprime, + Qscr: Qscr, + qscr: qscr, + quaternions: quaternions, + quatint: quatint, + quest: quest, + questeq: questeq, + quot: quot$2, + QUOT: QUOT$1, + rAarr: rAarr, + race: race, + Racute: Racute, + racute: racute, + radic: radic, + raemptyv: raemptyv, + rang: rang, + Rang: Rang, + rangd: rangd, + range: range, + rangle: rangle, + raquo: raquo$1, + rarrap: rarrap, + rarrb: rarrb, + rarrbfs: rarrbfs, + rarrc: rarrc, + rarr: rarr, + Rarr: Rarr, + rArr: rArr, + rarrfs: rarrfs, + rarrhk: rarrhk, + rarrlp: rarrlp, + rarrpl: rarrpl, + rarrsim: rarrsim, + Rarrtl: Rarrtl, + rarrtl: rarrtl, + rarrw: rarrw, + ratail: ratail, + rAtail: rAtail, + ratio: ratio, + rationals: rationals, + rbarr: rbarr, + rBarr: rBarr, + RBarr: RBarr, + rbbrk: rbbrk, + rbrace: rbrace, + rbrack: rbrack, + rbrke: rbrke, + rbrksld: rbrksld, + rbrkslu: rbrkslu, + Rcaron: Rcaron, + rcaron: rcaron, + Rcedil: Rcedil, + rcedil: rcedil, + rceil: rceil, + rcub: rcub, + Rcy: Rcy, + rcy: rcy, + rdca: rdca, + rdldhar: rdldhar, + rdquo: rdquo, + rdquor: rdquor, + rdsh: rdsh, + real: real, + realine: realine, + realpart: realpart, + reals: reals, + Re: Re, + rect: rect, + reg: reg$1, + REG: REG$1, + ReverseElement: ReverseElement, + ReverseEquilibrium: ReverseEquilibrium, + ReverseUpEquilibrium: ReverseUpEquilibrium, + rfisht: rfisht, + rfloor: rfloor, + rfr: rfr, + Rfr: Rfr, + rHar: rHar, + rhard: rhard, + rharu: rharu, + rharul: rharul, + Rho: Rho, + rho: rho, + rhov: rhov, + RightAngleBracket: RightAngleBracket, + RightArrowBar: RightArrowBar, + rightarrow: rightarrow, + RightArrow: RightArrow, + Rightarrow: Rightarrow, + RightArrowLeftArrow: RightArrowLeftArrow, + rightarrowtail: rightarrowtail, + RightCeiling: RightCeiling, + RightDoubleBracket: RightDoubleBracket, + RightDownTeeVector: RightDownTeeVector, + RightDownVectorBar: RightDownVectorBar, + RightDownVector: RightDownVector, + RightFloor: RightFloor, + rightharpoondown: rightharpoondown, + rightharpoonup: rightharpoonup, + rightleftarrows: rightleftarrows, + rightleftharpoons: rightleftharpoons, + rightrightarrows: rightrightarrows, + rightsquigarrow: rightsquigarrow, + RightTeeArrow: RightTeeArrow, + RightTee: RightTee, + RightTeeVector: RightTeeVector, + rightthreetimes: rightthreetimes, + RightTriangleBar: RightTriangleBar, + RightTriangle: RightTriangle, + RightTriangleEqual: RightTriangleEqual, + RightUpDownVector: RightUpDownVector, + RightUpTeeVector: RightUpTeeVector, + RightUpVectorBar: RightUpVectorBar, + RightUpVector: RightUpVector, + RightVectorBar: RightVectorBar, + RightVector: RightVector, + ring: ring, + risingdotseq: risingdotseq, + rlarr: rlarr, + rlhar: rlhar, + rlm: rlm, + rmoustache: rmoustache, + rmoust: rmoust, + rnmid: rnmid, + roang: roang, + roarr: roarr, + robrk: robrk, + ropar: ropar, + ropf: ropf, + Ropf: Ropf, + roplus: roplus, + rotimes: rotimes, + RoundImplies: RoundImplies, + rpar: rpar, + rpargt: rpargt, + rppolint: rppolint, + rrarr: rrarr, + Rrightarrow: Rrightarrow, + rsaquo: rsaquo, + rscr: rscr, + Rscr: Rscr, + rsh: rsh, + Rsh: Rsh, + rsqb: rsqb, + rsquo: rsquo, + rsquor: rsquor, + rthree: rthree, + rtimes: rtimes, + rtri: rtri, + rtrie: rtrie, + rtrif: rtrif, + rtriltri: rtriltri, + RuleDelayed: RuleDelayed, + ruluhar: ruluhar, + rx: rx, + Sacute: Sacute, + sacute: sacute, + sbquo: sbquo, + scap: scap, + Scaron: Scaron, + scaron: scaron, + Sc: Sc, + sc: sc, + sccue: sccue, + sce: sce, + scE: scE, + Scedil: Scedil, + scedil: scedil, + Scirc: Scirc, + scirc: scirc, + scnap: scnap, + scnE: scnE, + scnsim: scnsim, + scpolint: scpolint, + scsim: scsim, + Scy: Scy, + scy: scy, + sdotb: sdotb, + sdot: sdot, + sdote: sdote, + searhk: searhk, + searr: searr, + seArr: seArr, + searrow: searrow, + sect: sect$1, + semi: semi, + seswar: seswar, + setminus: setminus, + setmn: setmn, + sext: sext, + Sfr: Sfr, + sfr: sfr, + sfrown: sfrown, + sharp: sharp, + SHCHcy: SHCHcy, + shchcy: shchcy, + SHcy: SHcy, + shcy: shcy, + ShortDownArrow: ShortDownArrow, + ShortLeftArrow: ShortLeftArrow, + shortmid: shortmid, + shortparallel: shortparallel, + ShortRightArrow: ShortRightArrow, + ShortUpArrow: ShortUpArrow, + shy: shy$1, + Sigma: Sigma, + sigma: sigma, + sigmaf: sigmaf, + sigmav: sigmav, + sim: sim, + simdot: simdot, + sime: sime, + simeq: simeq, + simg: simg, + simgE: simgE, + siml: siml, + simlE: simlE, + simne: simne, + simplus: simplus, + simrarr: simrarr, + slarr: slarr, + SmallCircle: SmallCircle, + smallsetminus: smallsetminus, + smashp: smashp, + smeparsl: smeparsl, + smid: smid, + smile: smile, + smt: smt, + smte: smte, + smtes: smtes, + SOFTcy: SOFTcy, + softcy: softcy, + solbar: solbar, + solb: solb, + sol: sol, + Sopf: Sopf, + sopf: sopf, + spades: spades, + spadesuit: spadesuit, + spar: spar, + sqcap: sqcap, + sqcaps: sqcaps, + sqcup: sqcup, + sqcups: sqcups, + Sqrt: Sqrt, + sqsub: sqsub, + sqsube: sqsube, + sqsubset: sqsubset, + sqsubseteq: sqsubseteq, + sqsup: sqsup, + sqsupe: sqsupe, + sqsupset: sqsupset, + sqsupseteq: sqsupseteq, + square: square, + Square: Square, + SquareIntersection: SquareIntersection, + SquareSubset: SquareSubset, + SquareSubsetEqual: SquareSubsetEqual, + SquareSuperset: SquareSuperset, + SquareSupersetEqual: SquareSupersetEqual, + SquareUnion: SquareUnion, + squarf: squarf, + squ: squ, + squf: squf, + srarr: srarr, + Sscr: Sscr, + sscr: sscr, + ssetmn: ssetmn, + ssmile: ssmile, + sstarf: sstarf, + Star: Star, + star: star, + starf: starf, + straightepsilon: straightepsilon, + straightphi: straightphi, + strns: strns, + sub: sub, + Sub: Sub, + subdot: subdot, + subE: subE, + sube: sube, + subedot: subedot, + submult: submult, + subnE: subnE, + subne: subne, + subplus: subplus, + subrarr: subrarr, + subset: subset, + Subset: Subset, + subseteq: subseteq, + subseteqq: subseteqq, + SubsetEqual: SubsetEqual, + subsetneq: subsetneq, + subsetneqq: subsetneqq, + subsim: subsim, + subsub: subsub, + subsup: subsup, + succapprox: succapprox, + succ: succ, + succcurlyeq: succcurlyeq, + Succeeds: Succeeds, + SucceedsEqual: SucceedsEqual, + SucceedsSlantEqual: SucceedsSlantEqual, + SucceedsTilde: SucceedsTilde, + succeq: succeq, + succnapprox: succnapprox, + succneqq: succneqq, + succnsim: succnsim, + succsim: succsim, + SuchThat: SuchThat, + sum: sum, + Sum: Sum, + sung: sung, + sup1: sup1$1, + sup2: sup2$1, + sup3: sup3$1, + sup: sup, + Sup: Sup, + supdot: supdot, + supdsub: supdsub, + supE: supE, + supe: supe, + supedot: supedot, + Superset: Superset, + SupersetEqual: SupersetEqual, + suphsol: suphsol, + suphsub: suphsub, + suplarr: suplarr, + supmult: supmult, + supnE: supnE, + supne: supne, + supplus: supplus, + supset: supset, + Supset: Supset, + supseteq: supseteq, + supseteqq: supseteqq, + supsetneq: supsetneq, + supsetneqq: supsetneqq, + supsim: supsim, + supsub: supsub, + supsup: supsup, + swarhk: swarhk, + swarr: swarr, + swArr: swArr, + swarrow: swarrow, + swnwar: swnwar, + szlig: szlig$1, + Tab: Tab, + target: target, + Tau: Tau, + tau: tau, + tbrk: tbrk, + Tcaron: Tcaron, + tcaron: tcaron, + Tcedil: Tcedil, + tcedil: tcedil, + Tcy: Tcy, + tcy: tcy, + tdot: tdot, + telrec: telrec, + Tfr: Tfr, + tfr: tfr, + there4: there4, + therefore: therefore, + Therefore: Therefore, + Theta: Theta, + theta: theta, + thetasym: thetasym, + thetav: thetav, + thickapprox: thickapprox, + thicksim: thicksim, + ThickSpace: ThickSpace, + ThinSpace: ThinSpace, + thinsp: thinsp, + thkap: thkap, + thksim: thksim, + THORN: THORN$1, + thorn: thorn$1, + tilde: tilde, + Tilde: Tilde, + TildeEqual: TildeEqual, + TildeFullEqual: TildeFullEqual, + TildeTilde: TildeTilde, + timesbar: timesbar, + timesb: timesb, + times: times$1, + timesd: timesd, + tint: tint, + toea: toea, + topbot: topbot, + topcir: topcir, + top: top, + Topf: Topf, + topf: topf, + topfork: topfork, + tosa: tosa, + tprime: tprime, + trade: trade, + TRADE: TRADE, + triangle: triangle, + triangledown: triangledown, + triangleleft: triangleleft, + trianglelefteq: trianglelefteq, + triangleq: triangleq, + triangleright: triangleright, + trianglerighteq: trianglerighteq, + tridot: tridot, + trie: trie, + triminus: triminus, + TripleDot: TripleDot, + triplus: triplus, + trisb: trisb, + tritime: tritime, + trpezium: trpezium, + Tscr: Tscr, + tscr: tscr, + TScy: TScy, + tscy: tscy, + TSHcy: TSHcy, + tshcy: tshcy, + Tstrok: Tstrok, + tstrok: tstrok, + twixt: twixt, + twoheadleftarrow: twoheadleftarrow, + twoheadrightarrow: twoheadrightarrow, + Uacute: Uacute$1, + uacute: uacute$1, + uarr: uarr, + Uarr: Uarr, + uArr: uArr, + Uarrocir: Uarrocir, + Ubrcy: Ubrcy, + ubrcy: ubrcy, + Ubreve: Ubreve, + ubreve: ubreve, + Ucirc: Ucirc$1, + ucirc: ucirc$1, + Ucy: Ucy, + ucy: ucy, + udarr: udarr, + Udblac: Udblac, + udblac: udblac, + udhar: udhar, + ufisht: ufisht, + Ufr: Ufr, + ufr: ufr, + Ugrave: Ugrave$1, + ugrave: ugrave$1, + uHar: uHar, + uharl: uharl, + uharr: uharr, + uhblk: uhblk, + ulcorn: ulcorn, + ulcorner: ulcorner, + ulcrop: ulcrop, + ultri: ultri, + Umacr: Umacr, + umacr: umacr, + uml: uml$1, + UnderBar: UnderBar, + UnderBrace: UnderBrace, + UnderBracket: UnderBracket, + UnderParenthesis: UnderParenthesis, + Union: Union, + UnionPlus: UnionPlus, + Uogon: Uogon, + uogon: uogon, + Uopf: Uopf, + uopf: uopf, + UpArrowBar: UpArrowBar, + uparrow: uparrow, + UpArrow: UpArrow, + Uparrow: Uparrow, + UpArrowDownArrow: UpArrowDownArrow, + updownarrow: updownarrow, + UpDownArrow: UpDownArrow, + Updownarrow: Updownarrow, + UpEquilibrium: UpEquilibrium, + upharpoonleft: upharpoonleft, + upharpoonright: upharpoonright, + uplus: uplus, + UpperLeftArrow: UpperLeftArrow, + UpperRightArrow: UpperRightArrow, + upsi: upsi, + Upsi: Upsi, + upsih: upsih, + Upsilon: Upsilon, + upsilon: upsilon, + UpTeeArrow: UpTeeArrow, + UpTee: UpTee, + upuparrows: upuparrows, + urcorn: urcorn, + urcorner: urcorner, + urcrop: urcrop, + Uring: Uring, + uring: uring, + urtri: urtri, + Uscr: Uscr, + uscr: uscr, + utdot: utdot, + Utilde: Utilde, + utilde: utilde, + utri: utri, + utrif: utrif, + uuarr: uuarr, + Uuml: Uuml$1, + uuml: uuml$1, + uwangle: uwangle, + vangrt: vangrt, + varepsilon: varepsilon, + varkappa: varkappa, + varnothing: varnothing, + varphi: varphi, + varpi: varpi, + varpropto: varpropto, + varr: varr, + vArr: vArr, + varrho: varrho, + varsigma: varsigma, + varsubsetneq: varsubsetneq, + varsubsetneqq: varsubsetneqq, + varsupsetneq: varsupsetneq, + varsupsetneqq: varsupsetneqq, + vartheta: vartheta, + vartriangleleft: vartriangleleft, + vartriangleright: vartriangleright, + vBar: vBar, + Vbar: Vbar, + vBarv: vBarv, + Vcy: Vcy, + vcy: vcy, + vdash: vdash, + vDash: vDash, + Vdash: Vdash, + VDash: VDash, + Vdashl: Vdashl, + veebar: veebar, + vee: vee, + Vee: Vee, + veeeq: veeeq, + vellip: vellip, + verbar: verbar, + Verbar: Verbar, + vert: vert, + Vert: Vert, + VerticalBar: VerticalBar, + VerticalLine: VerticalLine, + VerticalSeparator: VerticalSeparator, + VerticalTilde: VerticalTilde, + VeryThinSpace: VeryThinSpace, + Vfr: Vfr, + vfr: vfr, + vltri: vltri, + vnsub: vnsub, + vnsup: vnsup, + Vopf: Vopf, + vopf: vopf, + vprop: vprop, + vrtri: vrtri, + Vscr: Vscr, + vscr: vscr, + vsubnE: vsubnE, + vsubne: vsubne, + vsupnE: vsupnE, + vsupne: vsupne, + Vvdash: Vvdash, + vzigzag: vzigzag, + Wcirc: Wcirc, + wcirc: wcirc, + wedbar: wedbar, + wedge: wedge, + Wedge: Wedge, + wedgeq: wedgeq, + weierp: weierp, + Wfr: Wfr, + wfr: wfr, + Wopf: Wopf, + wopf: wopf, + wp: wp, + wr: wr, + wreath: wreath, + Wscr: Wscr, + wscr: wscr, + xcap: xcap, + xcirc: xcirc, + xcup: xcup, + xdtri: xdtri, + Xfr: Xfr, + xfr: xfr, + xharr: xharr, + xhArr: xhArr, + Xi: Xi, + xi: xi, + xlarr: xlarr, + xlArr: xlArr, + xmap: xmap, + xnis: xnis, + xodot: xodot, + Xopf: Xopf, + xopf: xopf, + xoplus: xoplus, + xotime: xotime, + xrarr: xrarr, + xrArr: xrArr, + Xscr: Xscr, + xscr: xscr, + xsqcup: xsqcup, + xuplus: xuplus, + xutri: xutri, + xvee: xvee, + xwedge: xwedge, + Yacute: Yacute$1, + yacute: yacute$1, + YAcy: YAcy, + yacy: yacy, + Ycirc: Ycirc, + ycirc: ycirc, + Ycy: Ycy, + ycy: ycy, + yen: yen$1, + Yfr: Yfr, + yfr: yfr, + YIcy: YIcy, + yicy: yicy, + Yopf: Yopf, + yopf: yopf, + Yscr: Yscr, + yscr: yscr, + YUcy: YUcy, + yucy: yucy, + yuml: yuml$1, + Yuml: Yuml, + Zacute: Zacute, + zacute: zacute, + Zcaron: Zcaron, + zcaron: zcaron, + Zcy: Zcy, + zcy: zcy, + Zdot: Zdot, + zdot: zdot, + zeetrf: zeetrf, + ZeroWidthSpace: ZeroWidthSpace, + Zeta: Zeta, + zeta: zeta, + zfr: zfr, + Zfr: Zfr, + ZHcy: ZHcy, + zhcy: zhcy, + zigrarr: zigrarr, + zopf: zopf, + Zopf: Zopf, + Zscr: Zscr, + zscr: zscr, + zwj: zwj, + zwnj: zwnj +}; + +var Aacute = "Á"; +var aacute = "á"; +var Acirc = "Â"; +var acirc = "â"; +var acute = "´"; +var AElig = "Æ"; +var aelig = "æ"; +var Agrave = "À"; +var agrave = "à"; +var amp$1 = "&"; +var AMP = "&"; +var Aring = "Å"; +var aring = "å"; +var Atilde = "Ã"; +var atilde = "ã"; +var Auml = "Ä"; +var auml = "ä"; +var brvbar = "¦"; +var Ccedil = "Ç"; +var ccedil = "ç"; +var cedil = "¸"; +var cent = "¢"; +var copy = "©"; +var COPY = "©"; +var curren = "¤"; +var deg = "°"; +var divide = "÷"; +var Eacute = "É"; +var eacute = "é"; +var Ecirc = "Ê"; +var ecirc = "ê"; +var Egrave = "È"; +var egrave = "è"; +var ETH = "Ð"; +var eth = "ð"; +var Euml = "Ë"; +var euml = "ë"; +var frac12 = "½"; +var frac14 = "¼"; +var frac34 = "¾"; +var gt$1 = ">"; +var GT = ">"; +var Iacute = "Í"; +var iacute = "í"; +var Icirc = "Î"; +var icirc = "î"; +var iexcl = "¡"; +var Igrave = "Ì"; +var igrave = "ì"; +var iquest = "¿"; +var Iuml = "Ï"; +var iuml = "ï"; +var laquo = "«"; +var lt$1 = "<"; +var LT = "<"; +var macr = "¯"; +var micro = "µ"; +var middot = "·"; +var nbsp = " "; +var not = "¬"; +var Ntilde = "Ñ"; +var ntilde = "ñ"; +var Oacute = "Ó"; +var oacute = "ó"; +var Ocirc = "Ô"; +var ocirc = "ô"; +var Ograve = "Ò"; +var ograve = "ò"; +var ordf = "ª"; +var ordm = "º"; +var Oslash = "Ø"; +var oslash = "ø"; +var Otilde = "Õ"; +var otilde = "õ"; +var Ouml = "Ö"; +var ouml = "ö"; +var para = "¶"; +var plusmn = "±"; +var pound = "£"; +var quot$1 = "\""; +var QUOT = "\""; +var raquo = "»"; +var reg = "®"; +var REG = "®"; +var sect = "§"; +var shy = "­"; +var sup1 = "¹"; +var sup2 = "²"; +var sup3 = "³"; +var szlig = "ß"; +var THORN = "Þ"; +var thorn = "þ"; +var times = "×"; +var Uacute = "Ú"; +var uacute = "ú"; +var Ucirc = "Û"; +var ucirc = "û"; +var Ugrave = "Ù"; +var ugrave = "ù"; +var uml = "¨"; +var Uuml = "Ü"; +var uuml = "ü"; +var Yacute = "Ý"; +var yacute = "ý"; +var yen = "¥"; +var yuml = "ÿ"; +var require$$1 = { + Aacute: Aacute, + aacute: aacute, + Acirc: Acirc, + acirc: acirc, + acute: acute, + AElig: AElig, + aelig: aelig, + Agrave: Agrave, + agrave: agrave, + amp: amp$1, + AMP: AMP, + Aring: Aring, + aring: aring, + Atilde: Atilde, + atilde: atilde, + Auml: Auml, + auml: auml, + brvbar: brvbar, + Ccedil: Ccedil, + ccedil: ccedil, + cedil: cedil, + cent: cent, + copy: copy, + COPY: COPY, + curren: curren, + deg: deg, + divide: divide, + Eacute: Eacute, + eacute: eacute, + Ecirc: Ecirc, + ecirc: ecirc, + Egrave: Egrave, + egrave: egrave, + ETH: ETH, + eth: eth, + Euml: Euml, + euml: euml, + frac12: frac12, + frac14: frac14, + frac34: frac34, + gt: gt$1, + GT: GT, + Iacute: Iacute, + iacute: iacute, + Icirc: Icirc, + icirc: icirc, + iexcl: iexcl, + Igrave: Igrave, + igrave: igrave, + iquest: iquest, + Iuml: Iuml, + iuml: iuml, + laquo: laquo, + lt: lt$1, + LT: LT, + macr: macr, + micro: micro, + middot: middot, + nbsp: nbsp, + not: not, + Ntilde: Ntilde, + ntilde: ntilde, + Oacute: Oacute, + oacute: oacute, + Ocirc: Ocirc, + ocirc: ocirc, + Ograve: Ograve, + ograve: ograve, + ordf: ordf, + ordm: ordm, + Oslash: Oslash, + oslash: oslash, + Otilde: Otilde, + otilde: otilde, + Ouml: Ouml, + ouml: ouml, + para: para, + plusmn: plusmn, + pound: pound, + quot: quot$1, + QUOT: QUOT, + raquo: raquo, + reg: reg, + REG: REG, + sect: sect, + shy: shy, + sup1: sup1, + sup2: sup2, + sup3: sup3, + szlig: szlig, + THORN: THORN, + thorn: thorn, + times: times, + Uacute: Uacute, + uacute: uacute, + Ucirc: Ucirc, + ucirc: ucirc, + Ugrave: Ugrave, + ugrave: ugrave, + uml: uml, + Uuml: Uuml, + uuml: uuml, + Yacute: Yacute, + yacute: yacute, + yen: yen, + yuml: yuml +}; + +var amp = "&"; +var apos = "'"; +var gt = ">"; +var lt = "<"; +var quot = "\""; +var require$$0$1 = { + amp: amp, + apos: apos, + gt: gt, + lt: lt, + quot: quot +}; + +var decode_codepoint = {}; + +var require$$0 = { + "0": 65533, + "128": 8364, + "130": 8218, + "131": 402, + "132": 8222, + "133": 8230, + "134": 8224, + "135": 8225, + "136": 710, + "137": 8240, + "138": 352, + "139": 8249, + "140": 338, + "142": 381, + "145": 8216, + "146": 8217, + "147": 8220, + "148": 8221, + "149": 8226, + "150": 8211, + "151": 8212, + "152": 732, + "153": 8482, + "154": 353, + "155": 8250, + "156": 339, + "158": 382, + "159": 376 +}; + +var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(decode_codepoint, "__esModule", { value: true }); +var decode_json_1 = __importDefault$2(require$$0); +// Adapted from https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119 +var fromCodePoint$2 = +// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition +String.fromCodePoint || + function (codePoint) { + var output = ""; + if (codePoint > 0xffff) { + codePoint -= 0x10000; + output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800); + codePoint = 0xdc00 | (codePoint & 0x3ff); + } + output += String.fromCharCode(codePoint); + return output; + }; +function decodeCodePoint(codePoint) { + if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) { + return "\uFFFD"; + } + if (codePoint in decode_json_1.default) { + codePoint = decode_json_1.default[codePoint]; + } + return fromCodePoint$2(codePoint); +} +decode_codepoint.default = decodeCodePoint; + +var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(decode, "__esModule", { value: true }); +decode.decodeHTML = decode.decodeHTMLStrict = decode.decodeXML = void 0; +var entities_json_1$1 = __importDefault$1(require$$1$1); +var legacy_json_1 = __importDefault$1(require$$1); +var xml_json_1$1 = __importDefault$1(require$$0$1); +var decode_codepoint_1 = __importDefault$1(decode_codepoint); +var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g; +decode.decodeXML = getStrictDecoder(xml_json_1$1.default); +decode.decodeHTMLStrict = getStrictDecoder(entities_json_1$1.default); +function getStrictDecoder(map) { + var replace = getReplacer(map); + return function (str) { return String(str).replace(strictEntityRe, replace); }; +} +var sorter = function (a, b) { return (a < b ? 1 : -1); }; +decode.decodeHTML = (function () { + var legacy = Object.keys(legacy_json_1.default).sort(sorter); + var keys = Object.keys(entities_json_1$1.default).sort(sorter); + for (var i = 0, j = 0; i < keys.length; i++) { + if (legacy[j] === keys[i]) { + keys[i] += ";?"; + j++; + } + else { + keys[i] += ";"; + } + } + var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"); + var replace = getReplacer(entities_json_1$1.default); + function replacer(str) { + if (str.substr(-1) !== ";") + str += ";"; + return replace(str); + } + // TODO consider creating a merged map + return function (str) { return String(str).replace(re, replacer); }; +})(); +function getReplacer(map) { + return function replace(str) { + if (str.charAt(1) === "#") { + var secondChar = str.charAt(2); + if (secondChar === "X" || secondChar === "x") { + return decode_codepoint_1.default(parseInt(str.substr(3), 16)); + } + return decode_codepoint_1.default(parseInt(str.substr(2), 10)); + } + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + return map[str.slice(1, -1)] || str; + }; +} + +var encode = {}; + +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(encode, "__esModule", { value: true }); +encode.escapeUTF8 = encode.escape = encode.encodeNonAsciiHTML = encode.encodeHTML = encode.encodeXML = void 0; +var xml_json_1 = __importDefault(require$$0$1); +var inverseXML = getInverseObj(xml_json_1.default); +var xmlReplacer = getInverseReplacer(inverseXML); +/** + * Encodes all non-ASCII characters, as well as characters not valid in XML + * documents using XML entities. + * + * If a character has no equivalent entity, a + * numeric hexadecimal reference (eg. `ü`) will be used. + */ +encode.encodeXML = getASCIIEncoder(inverseXML); +var entities_json_1 = __importDefault(require$$1$1); +var inverseHTML = getInverseObj(entities_json_1.default); +var htmlReplacer = getInverseReplacer(inverseHTML); +/** + * Encodes all entities and non-ASCII characters in the input. + * + * This includes characters that are valid ASCII characters in HTML documents. + * For example `#` will be encoded as `#`. To get a more compact output, + * consider using the `encodeNonAsciiHTML` function. + * + * If a character has no equivalent entity, a + * numeric hexadecimal reference (eg. `ü`) will be used. + */ +encode.encodeHTML = getInverse(inverseHTML, htmlReplacer); +/** + * Encodes all non-ASCII characters, as well as characters not valid in HTML + * documents using HTML entities. + * + * If a character has no equivalent entity, a + * numeric hexadecimal reference (eg. `ü`) will be used. + */ +encode.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML); +function getInverseObj(obj) { + return Object.keys(obj) + .sort() + .reduce(function (inverse, name) { + inverse[obj[name]] = "&" + name + ";"; + return inverse; + }, {}); +} +function getInverseReplacer(inverse) { + var single = []; + var multiple = []; + for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) { + var k = _a[_i]; + if (k.length === 1) { + // Add value to single array + single.push("\\" + k); + } + else { + // Add value to multiple array + multiple.push(k); + } + } + // Add ranges to single characters. + single.sort(); + for (var start = 0; start < single.length - 1; start++) { + // Find the end of a run of characters + var end = start; + while (end < single.length - 1 && + single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) { + end += 1; + } + var count = 1 + end - start; + // We want to replace at least three characters + if (count < 3) + continue; + single.splice(start, count, single[start] + "-" + single[end]); + } + multiple.unshift("[" + single.join("") + "]"); + return new RegExp(multiple.join("|"), "g"); +} +// /[^\0-\x7F]/gu +var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g; +var getCodePoint = +// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition +String.prototype.codePointAt != null + ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + function (str) { return str.codePointAt(0); } + : // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + function (c) { + return (c.charCodeAt(0) - 0xd800) * 0x400 + + c.charCodeAt(1) - + 0xdc00 + + 0x10000; + }; +function singleCharReplacer(c) { + return "&#x" + (c.length > 1 ? getCodePoint(c) : c.charCodeAt(0)) + .toString(16) + .toUpperCase() + ";"; +} +function getInverse(inverse, re) { + return function (data) { + return data + .replace(re, function (name) { return inverse[name]; }) + .replace(reNonASCII, singleCharReplacer); + }; +} +var reEscapeChars = new RegExp(xmlReplacer.source + "|" + reNonASCII.source, "g"); +/** + * Encodes all non-ASCII characters, as well as characters not valid in XML + * documents using numeric hexadecimal reference (eg. `ü`). + * + * Have a look at `escapeUTF8` if you want a more concise output at the expense + * of reduced transportability. + * + * @param data String to escape. + */ +function escape(data) { + return data.replace(reEscapeChars, singleCharReplacer); +} +encode.escape = escape; +/** + * Encodes all characters not valid in XML documents using numeric hexadecimal + * reference (eg. `ü`). + * + * Note that the output will be character-set dependent. + * + * @param data String to escape. + */ +function escapeUTF8(data) { + return data.replace(xmlReplacer, singleCharReplacer); +} +encode.escapeUTF8 = escapeUTF8; +function getASCIIEncoder(obj) { + return function (data) { + return data.replace(reEscapeChars, function (c) { return obj[c] || singleCharReplacer(c); }); + }; +} + +(function (exports) { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = void 0; +var decode_1 = decode; +var encode_1 = encode; +/** + * Decodes a string with entities. + * + * @param data String to decode. + * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. + * @deprecated Use `decodeXML` or `decodeHTML` directly. + */ +function decode$1(data, level) { + return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data); +} +exports.decode = decode$1; +/** + * Decodes a string with entities. Does not allow missing trailing semicolons for entities. + * + * @param data String to decode. + * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. + * @deprecated Use `decodeHTMLStrict` or `decodeXML` directly. + */ +function decodeStrict(data, level) { + return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data); +} +exports.decodeStrict = decodeStrict; +/** + * Encodes a string with entities. + * + * @param data String to encode. + * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0. + * @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly. + */ +function encode$1(data, level) { + return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data); +} +exports.encode = encode$1; +var encode_2 = encode; +Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function () { return encode_2.encodeXML; } }); +Object.defineProperty(exports, "encodeHTML", { enumerable: true, get: function () { return encode_2.encodeHTML; } }); +Object.defineProperty(exports, "encodeNonAsciiHTML", { enumerable: true, get: function () { return encode_2.encodeNonAsciiHTML; } }); +Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return encode_2.escape; } }); +Object.defineProperty(exports, "escapeUTF8", { enumerable: true, get: function () { return encode_2.escapeUTF8; } }); +// Legacy aliases (deprecated) +Object.defineProperty(exports, "encodeHTML4", { enumerable: true, get: function () { return encode_2.encodeHTML; } }); +Object.defineProperty(exports, "encodeHTML5", { enumerable: true, get: function () { return encode_2.encodeHTML; } }); +var decode_2 = decode; +Object.defineProperty(exports, "decodeXML", { enumerable: true, get: function () { return decode_2.decodeXML; } }); +Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return decode_2.decodeHTML; } }); +Object.defineProperty(exports, "decodeHTMLStrict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } }); +// Legacy aliases (deprecated) +Object.defineProperty(exports, "decodeHTML4", { enumerable: true, get: function () { return decode_2.decodeHTML; } }); +Object.defineProperty(exports, "decodeHTML5", { enumerable: true, get: function () { return decode_2.decodeHTML; } }); +Object.defineProperty(exports, "decodeHTML4Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } }); +Object.defineProperty(exports, "decodeHTML5Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } }); +Object.defineProperty(exports, "decodeXMLStrict", { enumerable: true, get: function () { return decode_2.decodeXML; } }); +}(lib)); + +var ENTITY = '&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});'; +var C_BACKSLASH$1 = 92; +var reBackslashOrAmp = /[\\&]/; +var ESCAPABLE = '[!"#$%&\'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]'; +var reEntityOrEscapedChar = new RegExp("\\\\" + ESCAPABLE + "|" + ENTITY, 'gi'); +var XMLSPECIAL = '[&<>"]'; +var reXmlSpecial = new RegExp(XMLSPECIAL, 'g'); +var unescapeChar = function (s) { + if (s.charCodeAt(0) === C_BACKSLASH$1) { + return s.charAt(1); + } + return lib.decodeHTML(s); +}; +// Replace entities and backslash escapes with literal characters. +function unescapeString(s) { + if (reBackslashOrAmp.test(s)) { + return s.replace(reEntityOrEscapedChar, unescapeChar); + } + return s; +} +function normalizeURI(uri) { + try { + return encode_1(uri); + } + catch (err) { + return uri; + } +} +function replaceUnsafeChar(s) { + switch (s) { + case '&': + return '&'; + case '<': + return '<'; + case '>': + return '>'; + case '"': + return '"'; + default: + return s; + } +} +function escapeXml(s) { + if (reXmlSpecial.test(s)) { + return s.replace(reXmlSpecial, replaceUnsafeChar); + } + return s; +} +function repeat(str, count) { + var arr = []; + for (var i = 0; i < count; i++) { + arr.push(str); + } + return arr.join(''); +} +function isEmpty(str) { + if (!str) { + return true; + } + return !/[^ \t]+/.test(str); +} + +var NodeWalker = /** @class */ (function () { + function NodeWalker(root) { + this.current = root; + this.root = root; + this.entering = true; + } + NodeWalker.prototype.next = function () { + var cur = this.current; + var entering = this.entering; + if (cur === null) { + return null; + } + var container = isContainer$1(cur); + if (entering && container) { + if (cur.firstChild) { + this.current = cur.firstChild; + this.entering = true; + } + else { + // stay on node but exit + this.entering = false; + } + } + else if (cur === this.root) { + this.current = null; + } + else if (cur.next === null) { + this.current = cur.parent; + this.entering = false; + } + else { + this.current = cur.next; + this.entering = true; + } + return { entering: entering, node: cur }; + }; + NodeWalker.prototype.resumeAt = function (node, entering) { + this.current = node; + this.entering = entering === true; + }; + return NodeWalker; +}()); + +function isContainer$1(node) { + switch (node.type) { + case 'document': + case 'blockQuote': + case 'list': + case 'item': + case 'paragraph': + case 'heading': + case 'emph': + case 'strong': + case 'strike': + case 'link': + case 'image': + case 'table': + case 'tableHead': + case 'tableBody': + case 'tableRow': + case 'tableCell': + case 'tableDelimRow': + case 'customInline': + return true; + default: + return false; + } +} +var lastNodeId = 1; +var nodeMap = {}; +function getNodeById(id) { + return nodeMap[id]; +} +function removeNodeById(id) { + delete nodeMap[id]; +} +function removeAllNode() { + nodeMap = {}; +} +var Node$1 = /** @class */ (function () { + function Node(nodeType, sourcepos) { + this.parent = null; + this.prev = null; + this.next = null; + // only for container node + this.firstChild = null; + this.lastChild = null; + // only for leaf node + this.literal = null; + if (nodeType === 'document') { + this.id = -1; + } + else { + this.id = lastNodeId++; + } + this.type = nodeType; + this.sourcepos = sourcepos; + nodeMap[this.id] = this; + } + Node.prototype.isContainer = function () { + return isContainer$1(this); + }; + Node.prototype.unlink = function () { + if (this.prev) { + this.prev.next = this.next; + } + else if (this.parent) { + this.parent.firstChild = this.next; + } + if (this.next) { + this.next.prev = this.prev; + } + else if (this.parent) { + this.parent.lastChild = this.prev; + } + this.parent = null; + this.next = null; + this.prev = null; + }; + Node.prototype.replaceWith = function (node) { + this.insertBefore(node); + this.unlink(); + }; + Node.prototype.insertAfter = function (sibling) { + sibling.unlink(); + sibling.next = this.next; + if (sibling.next) { + sibling.next.prev = sibling; + } + sibling.prev = this; + this.next = sibling; + if (this.parent) { + sibling.parent = this.parent; + if (!sibling.next) { + sibling.parent.lastChild = sibling; + } + } + }; + Node.prototype.insertBefore = function (sibling) { + sibling.unlink(); + sibling.prev = this.prev; + if (sibling.prev) { + sibling.prev.next = sibling; + } + sibling.next = this; + this.prev = sibling; + sibling.parent = this.parent; + if (!sibling.prev) { + sibling.parent.firstChild = sibling; + } + }; + Node.prototype.appendChild = function (child) { + child.unlink(); + child.parent = this; + if (this.lastChild) { + this.lastChild.next = child; + child.prev = this.lastChild; + this.lastChild = child; + } + else { + this.firstChild = child; + this.lastChild = child; + } + }; + Node.prototype.prependChild = function (child) { + child.unlink(); + child.parent = this; + if (this.firstChild) { + this.firstChild.prev = child; + child.next = this.firstChild; + this.firstChild = child; + } + else { + this.firstChild = child; + this.lastChild = child; + } + }; + Node.prototype.walker = function () { + return new NodeWalker(this); + }; + return Node; +}()); +var BlockNode = /** @class */ (function (_super) { + __extends(BlockNode, _super); + function BlockNode(nodeType, sourcepos) { + var _this = _super.call(this, nodeType, sourcepos) || this; + // temporal data (for parsing) + _this.open = true; + _this.lineOffsets = null; + _this.stringContent = null; + _this.lastLineBlank = false; + _this.lastLineChecked = false; + _this.type = nodeType; + return _this; + } + return BlockNode; +}(Node$1)); +var ListNode = /** @class */ (function (_super) { + __extends(ListNode, _super); + function ListNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.listData = null; + return _this; + } + return ListNode; +}(BlockNode)); +var HeadingNode = /** @class */ (function (_super) { + __extends(HeadingNode, _super); + function HeadingNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.level = 0; + _this.headingType = 'atx'; + return _this; + } + return HeadingNode; +}(BlockNode)); +var CodeBlockNode = /** @class */ (function (_super) { + __extends(CodeBlockNode, _super); + function CodeBlockNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.isFenced = false; + _this.fenceChar = null; + _this.fenceLength = 0; + _this.fenceOffset = -1; + _this.info = null; + _this.infoPadding = 0; + return _this; + } + return CodeBlockNode; +}(BlockNode)); +var TableNode = /** @class */ (function (_super) { + __extends(TableNode, _super); + function TableNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.columns = []; + return _this; + } + return TableNode; +}(BlockNode)); +var TableCellNode = /** @class */ (function (_super) { + __extends(TableCellNode, _super); + function TableCellNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.startIdx = 0; + _this.endIdx = 0; + _this.paddingLeft = 0; + _this.paddingRight = 0; + _this.ignored = false; + return _this; + } + return TableCellNode; +}(BlockNode)); +var RefDefNode = /** @class */ (function (_super) { + __extends(RefDefNode, _super); + function RefDefNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.title = ''; + _this.dest = ''; + _this.label = ''; + return _this; + } + return RefDefNode; +}(BlockNode)); +var CustomBlockNode = /** @class */ (function (_super) { + __extends(CustomBlockNode, _super); + function CustomBlockNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.syntaxLength = 0; + _this.offset = -1; + _this.info = ''; + return _this; + } + return CustomBlockNode; +}(BlockNode)); +var HtmlBlockNode = /** @class */ (function (_super) { + __extends(HtmlBlockNode, _super); + function HtmlBlockNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.htmlBlockType = -1; + return _this; + } + return HtmlBlockNode; +}(BlockNode)); +var LinkNode = /** @class */ (function (_super) { + __extends(LinkNode, _super); + function LinkNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.destination = null; + _this.title = null; + _this.extendedAutolink = false; + return _this; + } + return LinkNode; +}(Node$1)); +var CodeNode = /** @class */ (function (_super) { + __extends(CodeNode, _super); + function CodeNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.tickCount = 0; + return _this; + } + return CodeNode; +}(Node$1)); +var CustomInlineNode = /** @class */ (function (_super) { + __extends(CustomInlineNode, _super); + function CustomInlineNode() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.info = ''; + return _this; + } + return CustomInlineNode; +}(Node$1)); +function createNode$1(type, sourcepos) { + switch (type) { + case 'heading': + return new HeadingNode(type, sourcepos); + case 'list': + case 'item': + return new ListNode(type, sourcepos); + case 'link': + case 'image': + return new LinkNode(type, sourcepos); + case 'codeBlock': + return new CodeBlockNode(type, sourcepos); + case 'htmlBlock': + return new HtmlBlockNode(type, sourcepos); + case 'table': + return new TableNode(type, sourcepos); + case 'tableCell': + return new TableCellNode(type, sourcepos); + case 'document': + case 'paragraph': + case 'blockQuote': + case 'thematicBreak': + case 'tableRow': + case 'tableBody': + case 'tableHead': + case 'frontMatter': + return new BlockNode(type, sourcepos); + case 'code': + return new CodeNode(type, sourcepos); + case 'refDef': + return new RefDefNode(type, sourcepos); + case 'customBlock': + return new CustomBlockNode(type, sourcepos); + case 'customInline': + return new CustomInlineNode(type, sourcepos); + default: + return new Node$1(type, sourcepos); + } +} +function isCodeBlock(node) { + return node.type === 'codeBlock'; +} +function isHtmlBlock(node) { + return node.type === 'htmlBlock'; +} +function isHeading(node) { + return node.type === 'heading'; +} +function isList(node) { + return node.type === 'list'; +} +function isTable(node) { + return node.type === 'table'; +} +function isRefDef(node) { + return node.type === 'refDef'; +} +function isCustomBlock(node) { + return node.type === 'customBlock'; +} +function isCustomInline(node) { + return node.type === 'customInline'; +} +function text$1(s, sourcepos) { + var node = createNode$1('text', sourcepos); + node.literal = s; + return node; +} + +var TAGNAME = '[A-Za-z][A-Za-z0-9-]*'; +var ATTRIBUTENAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; +var UNQUOTEDVALUE = '[^"\'=<>`\\x00-\\x20]+'; +var SINGLEQUOTEDVALUE = "'[^']*'"; +var DOUBLEQUOTEDVALUE = '"[^"]*"'; +var ATTRIBUTEVALUE = "(?:" + UNQUOTEDVALUE + "|" + SINGLEQUOTEDVALUE + "|" + DOUBLEQUOTEDVALUE + ")"; +var ATTRIBUTEVALUESPEC = "" + '(?:\\s*=\\s*' + ATTRIBUTEVALUE + ")"; +var ATTRIBUTE = "" + '(?:\\s+' + ATTRIBUTENAME + ATTRIBUTEVALUESPEC + "?)"; +var OPENTAG = "<" + TAGNAME + ATTRIBUTE + "*\\s*/?>"; +var CLOSETAG = "]"; +var HTMLCOMMENT = '|'; +var PROCESSINGINSTRUCTION = '[<][?].*?[?][>]'; +var DECLARATION = ']*>'; +var CDATA = ''; +var HTMLTAG = "(?:" + OPENTAG + "|" + CLOSETAG + "|" + HTMLCOMMENT + "|" + PROCESSINGINSTRUCTION + "|" + DECLARATION + "|" + CDATA + ")"; +var reHtmlTag = new RegExp("^" + HTMLTAG, 'i'); + +// derived from https://github.com/mathiasbynens/String.fromCodePoint +/*! http://mths.be/fromcodepoint v0.2.1 by @mathias */ +var fromCodePoint; +if (String.fromCodePoint) { + fromCodePoint = function (_) { + try { + return String.fromCodePoint(_); + } + catch (e) { + if (e instanceof RangeError) { + return String.fromCharCode(0xfffd); + } + throw e; + } + }; +} +else { + var stringFromCharCode_1 = String.fromCharCode; + var floor_1 = Math.floor; + fromCodePoint = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var MAX_SIZE = 0x4000; + var codeUnits = []; + var highSurrogate; + var lowSurrogate; + var index = -1; + var length = args.length; + if (!length) { + return ''; + } + var result = ''; + while (++index < length) { + var codePoint = Number(args[index]); + if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` + codePoint < 0 || // not a valid Unicode code point + codePoint > 0x10ffff || // not a valid Unicode code point + floor_1(codePoint) !== codePoint // not an integer + ) { + return String.fromCharCode(0xfffd); + } + if (codePoint <= 0xffff) { + // BMP code point + codeUnits.push(codePoint); + } + else { + // Astral code point; split in surrogate halves + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + codePoint -= 0x10000; + highSurrogate = (codePoint >> 10) + 0xd800; + lowSurrogate = (codePoint % 0x400) + 0xdc00; + codeUnits.push(highSurrogate, lowSurrogate); + } + if (index + 1 === length || codeUnits.length > MAX_SIZE) { + result += stringFromCharCode_1.apply(void 0, codeUnits); + codeUnits.length = 0; + } + } + return result; + }; +} +var fromCodePoint$1 = fromCodePoint; + +var DOMAIN = '(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+'; +var PATH = '[^<\\s]*[^ lastIdx) { + newNodes.push(text$1(literal.substring(lastIdx, range[0]), sourcepos(lastIdx, range[0] - 1))); + } + var linkNode = createNode$1('link', sourcepos.apply(void 0, range)); + linkNode.appendChild(text$1(linkText, sourcepos.apply(void 0, range))); + linkNode.destination = url; + linkNode.extendedAutolink = true; + newNodes.push(linkNode); + lastIdx = range[1] + 1; + } + if (lastIdx < literal.length) { + newNodes.push(text$1(literal.substring(lastIdx), sourcepos(lastIdx, literal.length - 1))); + } + for (var _c = 0, newNodes_1 = newNodes; _c < newNodes_1.length; _c++) { + var newNode = newNodes_1[_c]; + node.insertBefore(newNode); + } + node.unlink(); + } + }; + while ((event = walker.next())) { + _loop_1(); + } +} + +function last(arr) { + return arr[arr.length - 1]; +} +// normalize a reference in reference link (remove []s, trim, +// collapse internal space, unicode case fold. +// See commonmark/commonmark.js#168. +function normalizeReference(str) { + return str + .slice(1, str.length - 1) + .trim() + .replace(/[ \t\r\n]+/, ' ') + .toLowerCase() + .toUpperCase(); +} +function iterateObject(obj, iteratee) { + Object.keys(obj).forEach(function (key) { + iteratee(key, obj[key]); + }); +} +function omit(obj) { + var propNames = []; + for (var _i = 1; _i < arguments.length; _i++) { + propNames[_i - 1] = arguments[_i]; + } + var resultMap = __assign({}, obj); + propNames.forEach(function (key) { + delete resultMap[key]; + }); + return resultMap; +} +function isEmptyObj(obj) { + return !Object.keys(obj).length; +} +function clearObj(obj) { + Object.keys(obj).forEach(function (key) { + delete obj[key]; + }); +} + +var C_NEWLINE = 10; +var C_ASTERISK = 42; +var C_UNDERSCORE = 95; +var C_BACKTICK = 96; +var C_OPEN_BRACKET$1 = 91; +var C_CLOSE_BRACKET = 93; +var C_TILDE = 126; +var C_LESSTHAN$1 = 60; +var C_BANG = 33; +var C_BACKSLASH = 92; +var C_AMPERSAND = 38; +var C_OPEN_PAREN = 40; +var C_CLOSE_PAREN = 41; +var C_COLON = 58; +var C_SINGLEQUOTE = 39; +var C_DOUBLEQUOTE = 34; +var C_DOLLAR = 36; +// Some regexps used in inline parser: +var ESCAPED_CHAR = "\\\\" + ESCAPABLE; +var rePunctuation = new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/); +var reLinkTitle = new RegExp("^(?:\"(" + ESCAPED_CHAR + "|[^\"\\x00])*\"" + + "|" + + ("'(" + ESCAPED_CHAR + "|[^'\\x00])*'") + + "|" + + ("\\((" + ESCAPED_CHAR + "|[^()\\x00])*\\))")); +var reLinkDestinationBraces = /^(?:<(?:[^<>\n\\\x00]|\\.)*>)/; +var reEscapable = new RegExp("^" + ESCAPABLE); +var reEntityHere = new RegExp("^" + ENTITY, 'i'); +var reTicks = /`+/; +var reTicksHere = /^`+/; +var reEllipses = /\.\.\./g; +var reDash = /--+/g; +var reEmailAutolink = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/; +var reAutolink = /^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i; +var reSpnl = /^ *(?:\n *)?/; +var reWhitespaceChar = /^[ \t\n\x0b\x0c\x0d]/; +var reUnicodeWhitespaceChar = /^\s/; +var reFinalSpace = / *$/; +var reInitialSpace = /^ */; +var reSpaceAtEndOfLine = /^ *(?:\n|$)/; +var reLinkLabel = /^\[(?:[^\\\[\]]|\\.){0,1000}\]/; +// Matches a string of non-special characters. +var reMain = /^[^\n`\[\]\\!<&*_'"~$]+/m; +var InlineParser = /** @class */ (function () { + function InlineParser(options) { + // An InlineParser keeps track of a subject (a string to be parsed) + // and a position in that subject. + this.subject = ''; + this.delimiters = null; // used by handleDelim method + this.brackets = null; + this.pos = 0; + this.lineStartNum = 0; + this.lineIdx = 0; + this.lineOffsets = [0]; + this.linePosOffset = 0; + this.refMap = {}; + this.refLinkCandidateMap = {}; + this.refDefCandidateMap = {}; + this.options = options; + } + InlineParser.prototype.sourcepos = function (start, end) { + var linePosOffset = this.linePosOffset + this.lineOffsets[this.lineIdx]; + var lineNum = this.lineStartNum + this.lineIdx; + var startpos = [lineNum, start + linePosOffset]; + if (typeof end === 'number') { + return [startpos, [lineNum, end + linePosOffset]]; + } + return startpos; + }; + InlineParser.prototype.nextLine = function () { + this.lineIdx += 1; + this.linePosOffset = -this.pos; + }; + // If re matches at current position in the subject, advance + // position in subject and return the match; otherwise return null. + InlineParser.prototype.match = function (re) { + var m = re.exec(this.subject.slice(this.pos)); + if (m === null) { + return null; + } + this.pos += m.index + m[0].length; + return m[0]; + }; + // Returns the code for the character at the current subject position, or -1 + // there are no more characters. + InlineParser.prototype.peek = function () { + if (this.pos < this.subject.length) { + return this.subject.charCodeAt(this.pos); + } + return -1; + }; + // Parse zero or more space characters, including at most one newline + InlineParser.prototype.spnl = function () { + this.match(reSpnl); + return true; + }; + // All of the parsers below try to match something at the current position + // in the subject. If they succeed in matching anything, they + // return the inline matched, advancing the subject. + // Attempt to parse backticks, adding either a backtick code span or a + // literal sequence of backticks. + InlineParser.prototype.parseBackticks = function (block) { + var startpos = this.pos + 1; + var ticks = this.match(reTicksHere); + if (ticks === null) { + return false; + } + var afterOpenTicks = this.pos; + var matched; + while ((matched = this.match(reTicks)) !== null) { + if (matched === ticks) { + var contents = this.subject.slice(afterOpenTicks, this.pos - ticks.length); + var sourcepos = this.sourcepos(startpos, this.pos); + var lines = contents.split('\n'); + if (lines.length > 1) { + var lastLine = last(lines); + this.lineIdx += lines.length - 1; + this.linePosOffset = -(this.pos - lastLine.length - ticks.length); + sourcepos[1] = this.sourcepos(this.pos); + contents = lines.join(' '); + } + var node = createNode$1('code', sourcepos); + if (contents.length > 0 && + contents.match(/[^ ]/) !== null && + contents[0] == ' ' && + contents[contents.length - 1] == ' ') { + node.literal = contents.slice(1, contents.length - 1); + } + else { + node.literal = contents; + } + node.tickCount = ticks.length; + block.appendChild(node); + return true; + } + } + // If we got here, we didn't match a closing backtick sequence. + this.pos = afterOpenTicks; + block.appendChild(text$1(ticks, this.sourcepos(startpos, this.pos - 1))); + return true; + }; + // Parse a backslash-escaped special character, adding either the escaped + // character, a hard line break (if the backslash is followed by a newline), + // or a literal backslash to the block's children. Assumes current character + // is a backslash. + InlineParser.prototype.parseBackslash = function (block) { + var subj = this.subject; + var node; + this.pos += 1; + var startpos = this.pos; + if (this.peek() === C_NEWLINE) { + this.pos += 1; + node = createNode$1('linebreak', this.sourcepos(this.pos - 1, this.pos)); + block.appendChild(node); + this.nextLine(); + } + else if (reEscapable.test(subj.charAt(this.pos))) { + block.appendChild(text$1(subj.charAt(this.pos), this.sourcepos(startpos, this.pos))); + this.pos += 1; + } + else { + block.appendChild(text$1('\\', this.sourcepos(startpos, startpos))); + } + return true; + }; + // Attempt to parse an autolink (URL or email in pointy brackets). + InlineParser.prototype.parseAutolink = function (block) { + var m; + var dest; + var node; + var startpos = this.pos + 1; + if ((m = this.match(reEmailAutolink))) { + dest = m.slice(1, m.length - 1); + node = createNode$1('link', this.sourcepos(startpos, this.pos)); + node.destination = normalizeURI("mailto:" + dest); + node.title = ''; + node.appendChild(text$1(dest, this.sourcepos(startpos + 1, this.pos - 1))); + block.appendChild(node); + return true; + } + if ((m = this.match(reAutolink))) { + dest = m.slice(1, m.length - 1); + node = createNode$1('link', this.sourcepos(startpos, this.pos)); + node.destination = normalizeURI(dest); + node.title = ''; + node.appendChild(text$1(dest, this.sourcepos(startpos + 1, this.pos - 1))); + block.appendChild(node); + return true; + } + return false; + }; + // Attempt to parse a raw HTML tag. + InlineParser.prototype.parseHtmlTag = function (block) { + var startpos = this.pos + 1; + var m = this.match(reHtmlTag); + if (m === null) { + return false; + } + var node = createNode$1('htmlInline', this.sourcepos(startpos, this.pos)); + node.literal = m; + block.appendChild(node); + return true; + }; + // Scan a sequence of characters with code cc, and return information about + // the number of delimiters and whether they are positioned such that + // they can open and/or close emphasis or strong emphasis. A utility + // function for strong/emph parsing. + InlineParser.prototype.scanDelims = function (cc) { + var numdelims = 0; + var startpos = this.pos; + if (cc === C_SINGLEQUOTE || cc === C_DOUBLEQUOTE) { + numdelims++; + this.pos++; + } + else { + while (this.peek() === cc) { + numdelims++; + this.pos++; + } + } + if (numdelims === 0 || (numdelims < 2 && (cc === C_TILDE || cc === C_DOLLAR))) { + this.pos = startpos; + return null; + } + var charBefore = startpos === 0 ? '\n' : this.subject.charAt(startpos - 1); + var ccAfter = this.peek(); + var charAfter; + if (ccAfter === -1) { + charAfter = '\n'; + } + else { + charAfter = fromCodePoint$1(ccAfter); + } + var afterIsWhitespace = reUnicodeWhitespaceChar.test(charAfter); + var afterIsPunctuation = rePunctuation.test(charAfter); + var beforeIsWhitespace = reUnicodeWhitespaceChar.test(charBefore); + var beforeIsPunctuation = rePunctuation.test(charBefore); + var leftFlanking = !afterIsWhitespace && (!afterIsPunctuation || beforeIsWhitespace || beforeIsPunctuation); + var rightFlanking = !beforeIsWhitespace && (!beforeIsPunctuation || afterIsWhitespace || afterIsPunctuation); + var canOpen; + var canClose; + if (cc === C_UNDERSCORE) { + canOpen = leftFlanking && (!rightFlanking || beforeIsPunctuation); + canClose = rightFlanking && (!leftFlanking || afterIsPunctuation); + } + else if (cc === C_SINGLEQUOTE || cc === C_DOUBLEQUOTE) { + canOpen = leftFlanking && !rightFlanking; + canClose = rightFlanking; + } + else if (cc === C_DOLLAR) { + canOpen = !afterIsWhitespace; + canClose = !beforeIsWhitespace; + } + else { + canOpen = leftFlanking; + canClose = rightFlanking; + } + this.pos = startpos; + return { numdelims: numdelims, canOpen: canOpen, canClose: canClose }; + }; + // Handle a delimiter marker for emphasis or a quote. + InlineParser.prototype.handleDelim = function (cc, block) { + var res = this.scanDelims(cc); + if (!res) { + return false; + } + var numdelims = res.numdelims; + var startpos = this.pos + 1; + var contents; + this.pos += numdelims; + if (cc === C_SINGLEQUOTE) { + contents = '\u2019'; + } + else if (cc === C_DOUBLEQUOTE) { + contents = '\u201C'; + } + else { + contents = this.subject.slice(startpos - 1, this.pos); + } + var node = text$1(contents, this.sourcepos(startpos, this.pos)); + block.appendChild(node); + // Add entry to stack for this opener + if ((res.canOpen || res.canClose) && + (this.options.smart || (cc !== C_SINGLEQUOTE && cc !== C_DOUBLEQUOTE))) { + this.delimiters = { + cc: cc, + numdelims: numdelims, + origdelims: numdelims, + node: node, + previous: this.delimiters, + next: null, + canOpen: res.canOpen, + canClose: res.canClose, + }; + if (this.delimiters.previous) { + this.delimiters.previous.next = this.delimiters; + } + } + return true; + }; + InlineParser.prototype.removeDelimiter = function (delim) { + if (delim.previous !== null) { + delim.previous.next = delim.next; + } + if (delim.next === null) { + // top of stack + this.delimiters = delim.previous; + } + else { + delim.next.previous = delim.previous; + } + }; + InlineParser.prototype.removeDelimitersBetween = function (bottom, top) { + if (bottom.next !== top) { + bottom.next = top; + top.previous = bottom; + } + }; + /** + * Process all delimiters - emphasis, strong emphasis, strikethrough(gfm) + * If the smart punctuation options is true, + * convert single/double quotes to corresponding unicode characters. + **/ + InlineParser.prototype.processEmphasis = function (stackBottom) { + var _a; + var opener; + var closer; + var oldCloser; + var openerInl, closerInl; + var openerFound; + var oddMatch = false; + var openersBottom = (_a = {}, + _a[C_UNDERSCORE] = [stackBottom, stackBottom, stackBottom], + _a[C_ASTERISK] = [stackBottom, stackBottom, stackBottom], + _a[C_SINGLEQUOTE] = [stackBottom], + _a[C_DOUBLEQUOTE] = [stackBottom], + _a[C_TILDE] = [stackBottom], + _a[C_DOLLAR] = [stackBottom], + _a); + // find first closer above stackBottom: + closer = this.delimiters; + while (closer !== null && closer.previous !== stackBottom) { + closer = closer.previous; + } + // move forward, looking for closers, and handling each + while (closer !== null) { + var closercc = closer.cc; + var closerEmph = closercc === C_UNDERSCORE || closercc === C_ASTERISK; + if (!closer.canClose) { + closer = closer.next; + } + else { + // found emphasis closer. now look back for first matching opener: + opener = closer.previous; + openerFound = false; + while (opener !== null && + opener !== stackBottom && + opener !== openersBottom[closercc][closerEmph ? closer.origdelims % 3 : 0]) { + oddMatch = + closerEmph && + (closer.canOpen || opener.canClose) && + closer.origdelims % 3 !== 0 && + (opener.origdelims + closer.origdelims) % 3 === 0; + if (opener.cc === closer.cc && opener.canOpen && !oddMatch) { + openerFound = true; + break; + } + opener = opener.previous; + } + oldCloser = closer; + if (closerEmph || closercc === C_TILDE || closercc === C_DOLLAR) { + if (!openerFound) { + closer = closer.next; + } + else if (opener) { + // (null opener check for type narrowing) + // calculate actual number of delimiters used from closer + var useDelims = closer.numdelims >= 2 && opener.numdelims >= 2 ? 2 : 1; + var emptyDelims = closerEmph ? 0 : 1; + openerInl = opener.node; + closerInl = closer.node; + // build contents for new emph element + var nodeType = closerEmph + ? useDelims === 1 + ? 'emph' + : 'strong' + : 'strike'; + if (closercc === C_DOLLAR) { + nodeType = 'customInline'; + } + var newNode = createNode$1(nodeType); + var openerEndPos = openerInl.sourcepos[1]; + var closerStartPos = closerInl.sourcepos[0]; + newNode.sourcepos = [ + [openerEndPos[0], openerEndPos[1] - useDelims + 1], + [closerStartPos[0], closerStartPos[1] + useDelims - 1], + ]; + openerInl.sourcepos[1][1] -= useDelims; + closerInl.sourcepos[0][1] += useDelims; + openerInl.literal = openerInl.literal.slice(useDelims); + closerInl.literal = closerInl.literal.slice(useDelims); + opener.numdelims -= useDelims; + closer.numdelims -= useDelims; + // remove used delimiters from stack elts and inlines + var tmp = openerInl.next; + var next = void 0; + while (tmp && tmp !== closerInl) { + next = tmp.next; + tmp.unlink(); + newNode.appendChild(tmp); + tmp = next; + } + // build custom inline node + if (closercc === C_DOLLAR) { + var textNode = newNode.firstChild; + var literal = textNode.literal || ''; + var info = literal.split(/\s/)[0]; + newNode.info = info; + if (literal.length === info.length + 1) { + textNode.unlink(); + } + else { + textNode.sourcepos[0][1] += info.length; + textNode.literal = literal.replace(info + " ", ''); + } + } + openerInl.insertAfter(newNode); + // remove elts between opener and closer in delimiters stack + this.removeDelimitersBetween(opener, closer); + // if opener has 0 delims, remove it and the inline + // if opener has 1 delims and character is tilde, remove delimiter only + if (opener.numdelims <= emptyDelims) { + if (opener.numdelims === 0) { + openerInl.unlink(); + } + this.removeDelimiter(opener); + } + // if closer has 0 delims, remove it and the inline + // if closer has 1 delims and character is tilde, remove delimiter only + if (closer.numdelims <= emptyDelims) { + if (closer.numdelims === 0) { + closerInl.unlink(); + } + var tempstack = closer.next; + this.removeDelimiter(closer); + closer = tempstack; + } + } + } + else if (closercc === C_SINGLEQUOTE) { + closer.node.literal = '\u2019'; + if (openerFound) { + opener.node.literal = '\u2018'; + } + closer = closer.next; + } + else if (closercc === C_DOUBLEQUOTE) { + closer.node.literal = '\u201D'; + if (openerFound) { + opener.node.literal = '\u201C'; + } + closer = closer.next; + } + if (!openerFound) { + // Set lower bound for future searches for openers: + openersBottom[closercc][closerEmph ? oldCloser.origdelims % 3 : 0] = oldCloser.previous; + if (!oldCloser.canOpen) { + // We can remove a closer that can't be an opener, + // once we've seen there's no matching opener: + this.removeDelimiter(oldCloser); + } + } + } + } + // remove all delimiters + while (this.delimiters !== null && this.delimiters !== stackBottom) { + this.removeDelimiter(this.delimiters); + } + }; + // Attempt to parse link title (sans quotes), returning the string + // or null if no match. + InlineParser.prototype.parseLinkTitle = function () { + var title = this.match(reLinkTitle); + if (title === null) { + return null; + } + // chop off quotes from title and unescape: + return unescapeString(title.substr(1, title.length - 2)); + }; + // Attempt to parse link destination, returning the string or null if no match. + InlineParser.prototype.parseLinkDestination = function () { + var res = this.match(reLinkDestinationBraces); + if (res === null) { + if (this.peek() === C_LESSTHAN$1) { + return null; + } + // @TODO handrolled parser; res should be null or the string + var savepos = this.pos; + var openparens = 0; + var c = void 0; + while ((c = this.peek()) !== -1) { + if (c === C_BACKSLASH && reEscapable.test(this.subject.charAt(this.pos + 1))) { + this.pos += 1; + if (this.peek() !== -1) { + this.pos += 1; + } + } + else if (c === C_OPEN_PAREN) { + this.pos += 1; + openparens += 1; + } + else if (c === C_CLOSE_PAREN) { + if (openparens < 1) { + break; + } + else { + this.pos += 1; + openparens -= 1; + } + } + else if (reWhitespaceChar.exec(fromCodePoint$1(c)) !== null) { + break; + } + else { + this.pos += 1; + } + } + if (this.pos === savepos && c !== C_CLOSE_PAREN) { + return null; + } + if (openparens !== 0) { + return null; + } + res = this.subject.substr(savepos, this.pos - savepos); + return normalizeURI(unescapeString(res)); + } // chop off surrounding <..>: + return normalizeURI(unescapeString(res.substr(1, res.length - 2))); + }; + // Attempt to parse a link label, returning number of characters parsed. + InlineParser.prototype.parseLinkLabel = function () { + var m = this.match(reLinkLabel); + if (m === null || m.length > 1001) { + return 0; + } + return m.length; + }; + // Add open bracket to delimiter stack and add a text node to block's children. + InlineParser.prototype.parseOpenBracket = function (block) { + var startpos = this.pos; + this.pos += 1; + var node = text$1('[', this.sourcepos(this.pos, this.pos)); + block.appendChild(node); + // Add entry to stack for this opener + this.addBracket(node, startpos, false); + return true; + }; + // IF next character is [, and ! delimiter to delimiter stack and + // add a text node to block's children. Otherwise just add a text node. + InlineParser.prototype.parseBang = function (block) { + var startpos = this.pos; + this.pos += 1; + if (this.peek() === C_OPEN_BRACKET$1) { + this.pos += 1; + var node = text$1('![', this.sourcepos(this.pos - 1, this.pos)); + block.appendChild(node); + // Add entry to stack for this opener + this.addBracket(node, startpos + 1, true); + } + else { + var node = text$1('!', this.sourcepos(this.pos, this.pos)); + block.appendChild(node); + } + return true; + }; + // Try to match close bracket against an opening in the delimiter + // stack. Add either a link or image, or a plain [ character, + // to block's children. If there is a matching delimiter, + // remove it from the delimiter stack. + InlineParser.prototype.parseCloseBracket = function (block) { + var dest = null; + var title = null; + var matched = false; + this.pos += 1; + var startpos = this.pos; + // get last [ or ![ + var opener = this.brackets; + if (opener === null) { + // no matched opener, just return a literal + block.appendChild(text$1(']', this.sourcepos(startpos, startpos))); + return true; + } + if (!opener.active) { + // no matched opener, just return a literal + block.appendChild(text$1(']', this.sourcepos(startpos, startpos))); + // take opener off brackets stack + this.removeBracket(); + return true; + } + // If we got here, open is a potential opener + var isImage = opener.image; + // Check to see if we have a link/image + var savepos = this.pos; + // Inline link? + if (this.peek() === C_OPEN_PAREN) { + this.pos++; + if (this.spnl() && + (dest = this.parseLinkDestination()) !== null && + this.spnl() && + // make sure there's a space before the title: + ((reWhitespaceChar.test(this.subject.charAt(this.pos - 1)) && + (title = this.parseLinkTitle())) || + true) && + this.spnl() && + this.peek() === C_CLOSE_PAREN) { + this.pos += 1; + matched = true; + } + else { + this.pos = savepos; + } + } + var refLabel = ''; + if (!matched) { + // Next, see if there's a link label + var beforelabel = this.pos; + var n = this.parseLinkLabel(); + if (n > 2) { + refLabel = this.subject.slice(beforelabel, beforelabel + n); + } + else if (!opener.bracketAfter) { + // Empty or missing second label means to use the first label as the reference. + // The reference must not contain a bracket. If we know there's a bracket, we don't even bother checking it. + refLabel = this.subject.slice(opener.index, startpos); + } + if (n === 0) { + // If shortcut reference link, rewind before spaces we skipped. + this.pos = savepos; + } + if (refLabel) { + refLabel = normalizeReference(refLabel); + // lookup rawlabel in refMap + var link = this.refMap[refLabel]; + if (link) { + dest = link.destination; + title = link.title; + matched = true; + } + } + } + if (matched) { + var node = createNode$1(isImage ? 'image' : 'link'); + node.destination = dest; + node.title = title || ''; + node.sourcepos = [opener.startpos, this.sourcepos(this.pos)]; + var tmp = opener.node.next; + var next = void 0; + while (tmp) { + next = tmp.next; + tmp.unlink(); + node.appendChild(tmp); + tmp = next; + } + block.appendChild(node); + this.processEmphasis(opener.previousDelimiter); + this.removeBracket(); + opener.node.unlink(); + // We remove this bracket and processEmphasis will remove later delimiters. + // Now, for a link, we also deactivate earlier link openers. + // (no links in links) + if (!isImage) { + opener = this.brackets; + while (opener !== null) { + if (!opener.image) { + opener.active = false; // deactivate this opener + } + opener = opener.previous; + } + } + if (this.options.referenceDefinition) { + this.refLinkCandidateMap[block.id] = { node: block, refLabel: refLabel }; + } + return true; + } // no match + this.removeBracket(); // remove this opener from stack + this.pos = startpos; + block.appendChild(text$1(']', this.sourcepos(startpos, startpos))); + if (this.options.referenceDefinition) { + this.refLinkCandidateMap[block.id] = { node: block, refLabel: refLabel }; + } + return true; + }; + InlineParser.prototype.addBracket = function (node, index, image) { + if (this.brackets !== null) { + this.brackets.bracketAfter = true; + } + this.brackets = { + node: node, + startpos: this.sourcepos(index + (image ? 0 : 1)), + previous: this.brackets, + previousDelimiter: this.delimiters, + index: index, + image: image, + active: true, + }; + }; + InlineParser.prototype.removeBracket = function () { + if (this.brackets) { + this.brackets = this.brackets.previous; + } + }; + // Attempt to parse an entity. + InlineParser.prototype.parseEntity = function (block) { + var m; + var startpos = this.pos + 1; + if ((m = this.match(reEntityHere))) { + block.appendChild(text$1(lib.decodeHTML(m), this.sourcepos(startpos, this.pos))); + return true; + } + return false; + }; + // Parse a run of ordinary characters, or a single character with + // a special meaning in markdown, as a plain string. + InlineParser.prototype.parseString = function (block) { + var m; + var startpos = this.pos + 1; + if ((m = this.match(reMain))) { + if (this.options.smart) { + var lit = m.replace(reEllipses, '\u2026').replace(reDash, function (chars) { + var enCount = 0; + var emCount = 0; + if (chars.length % 3 === 0) { + // If divisible by 3, use all em dashes + emCount = chars.length / 3; + } + else if (chars.length % 2 === 0) { + // If divisible by 2, use all en dashes + enCount = chars.length / 2; + } + else if (chars.length % 3 === 2) { + // If 2 extra dashes, use en dash for last 2; em dashes for rest + enCount = 1; + emCount = (chars.length - 2) / 3; + } + else { + // Use en dashes for last 4 hyphens; em dashes for rest + enCount = 2; + emCount = (chars.length - 4) / 3; + } + return repeat('\u2014', emCount) + repeat('\u2013', enCount); + }); + block.appendChild(text$1(lit, this.sourcepos(startpos, this.pos))); + } + else { + var node = text$1(m, this.sourcepos(startpos, this.pos)); + block.appendChild(node); + } + return true; + } + return false; + }; + // Parse a newline. If it was preceded by two spaces, return a hard + // line break; otherwise a soft line break. + InlineParser.prototype.parseNewline = function (block) { + this.pos += 1; // assume we're at a \n + // check previous node for trailing spaces + var lastc = block.lastChild; + if (lastc && lastc.type === 'text' && lastc.literal[lastc.literal.length - 1] === ' ') { + var hardbreak = lastc.literal[lastc.literal.length - 2] === ' '; + var litLen = lastc.literal.length; + lastc.literal = lastc.literal.replace(reFinalSpace, ''); + var finalSpaceLen = litLen - lastc.literal.length; + lastc.sourcepos[1][1] -= finalSpaceLen; + block.appendChild(createNode$1(hardbreak ? 'linebreak' : 'softbreak', this.sourcepos(this.pos - finalSpaceLen, this.pos))); + } + else { + block.appendChild(createNode$1('softbreak', this.sourcepos(this.pos, this.pos))); + } + this.nextLine(); + this.match(reInitialSpace); // gobble leading spaces in next line + return true; + }; + // Attempt to parse a link reference, modifying refmap. + InlineParser.prototype.parseReference = function (block, refMap) { + if (!this.options.referenceDefinition) { + return 0; + } + this.subject = block.stringContent; + this.pos = 0; + var title = null; + var startpos = this.pos; + // label: + var matchChars = this.parseLinkLabel(); + if (matchChars === 0) { + return 0; + } + var rawlabel = this.subject.substr(0, matchChars); + // colon: + if (this.peek() === C_COLON) { + this.pos++; + } + else { + this.pos = startpos; + return 0; + } + // link url + this.spnl(); + var dest = this.parseLinkDestination(); + if (dest === null) { + this.pos = startpos; + return 0; + } + var beforetitle = this.pos; + this.spnl(); + if (this.pos !== beforetitle) { + title = this.parseLinkTitle(); + } + if (title === null) { + title = ''; + // rewind before spaces + this.pos = beforetitle; + } + // make sure we're at line end: + var atLineEnd = true; + if (this.match(reSpaceAtEndOfLine) === null) { + if (title === '') { + atLineEnd = false; + } + else { + // the potential title we found is not at the line end, + // but it could still be a legal link reference if we + // discard the title + title = ''; + // rewind before spaces + this.pos = beforetitle; + // and instead check if the link URL is at the line end + atLineEnd = this.match(reSpaceAtEndOfLine) !== null; + } + } + if (!atLineEnd) { + this.pos = startpos; + return 0; + } + var normalLabel = normalizeReference(rawlabel); + if (normalLabel === '') { + // label must contain non-whitespace characters + this.pos = startpos; + return 0; + } + var sourcepos = this.getReferenceDefSourcepos(block); + block.sourcepos[0][0] = sourcepos[1][0] + 1; + var node = createNode$1('refDef', sourcepos); + node.title = title; + node.dest = dest; + node.label = normalLabel; + block.insertBefore(node); + if (!refMap[normalLabel]) { + refMap[normalLabel] = createRefDefState(node); + } + else { + this.refDefCandidateMap[node.id] = node; + } + return this.pos - startpos; + }; + InlineParser.prototype.mergeTextNodes = function (walker) { + var event; + var textNodes = []; + while ((event = walker.next())) { + var entering = event.entering, node = event.node; + if (entering && node.type === 'text') { + textNodes.push(node); + } + else if (textNodes.length === 1) { + textNodes = []; + } + else if (textNodes.length > 1) { + var firstNode = textNodes[0]; + var lastNode = textNodes[textNodes.length - 1]; + if (firstNode.sourcepos && lastNode.sourcepos) { + firstNode.sourcepos[1] = lastNode.sourcepos[1]; + } + firstNode.next = lastNode.next; + if (firstNode.next) { + firstNode.next.prev = firstNode; + } + for (var i = 1; i < textNodes.length; i += 1) { + firstNode.literal += textNodes[i].literal; + textNodes[i].unlink(); + } + textNodes = []; + } + } + }; + InlineParser.prototype.getReferenceDefSourcepos = function (block) { + var lines = block.stringContent.split(/\n|\r\n/); + var passedUrlLine = false; + var quotationCount = 0; + var lastLineOffset = { line: 0, ch: 0 }; + for (var i = 0; i < lines.length; i += 1) { + var line = lines[i]; + if (reWhitespaceChar.test(line)) { + break; + } + if (/\:/.test(line) && quotationCount === 0) { + if (passedUrlLine) { + break; + } + var lineOffset = line.indexOf(':') === line.length - 1 ? i + 1 : i; + lastLineOffset = { line: lineOffset, ch: lines[lineOffset].length }; + passedUrlLine = true; + } + // should consider extendable title + var matched = line.match(/'|"/g); + if (matched) { + quotationCount += matched.length; + } + if (quotationCount === 2) { + lastLineOffset = { line: i, ch: line.length }; + break; + } + } + return [ + [block.sourcepos[0][0], block.sourcepos[0][1]], + [block.sourcepos[0][0] + lastLineOffset.line, lastLineOffset.ch], + ]; + }; + // Parse the next inline element in subject, advancing subject position. + // On success, add the result to block's children and return true. + // On failure, return false. + InlineParser.prototype.parseInline = function (block) { + var _a; + var res = false; + var c = this.peek(); + if (c === -1) { + return false; + } + switch (c) { + case C_NEWLINE: + res = this.parseNewline(block); + break; + case C_BACKSLASH: + res = this.parseBackslash(block); + break; + case C_BACKTICK: + res = this.parseBackticks(block); + break; + case C_ASTERISK: + case C_UNDERSCORE: + case C_TILDE: + case C_DOLLAR: + res = this.handleDelim(c, block); + break; + case C_SINGLEQUOTE: + case C_DOUBLEQUOTE: + res = !!((_a = this.options) === null || _a === void 0 ? void 0 : _a.smart) && this.handleDelim(c, block); + break; + case C_OPEN_BRACKET$1: + res = this.parseOpenBracket(block); + break; + case C_BANG: + res = this.parseBang(block); + break; + case C_CLOSE_BRACKET: + res = this.parseCloseBracket(block); + break; + case C_LESSTHAN$1: + res = this.parseAutolink(block) || this.parseHtmlTag(block); + break; + case C_AMPERSAND: + res = this.parseEntity(block); + break; + default: + res = this.parseString(block); + break; + } + if (!res) { + this.pos += 1; + block.appendChild(text$1(fromCodePoint$1(c), this.sourcepos(this.pos, this.pos + 1))); + } + return true; + }; + // Parse string content in block into inline children, + // using refmap to resolve references. + InlineParser.prototype.parse = function (block) { + this.subject = block.stringContent.trim(); + this.pos = 0; + this.delimiters = null; + this.brackets = null; + this.lineOffsets = block.lineOffsets || [0]; + this.lineIdx = 0; + this.linePosOffset = 0; + this.lineStartNum = block.sourcepos[0][0]; + if (isHeading(block)) { + this.lineOffsets[0] += block.level + 1; + } + while (this.parseInline(block)) { } + block.stringContent = null; // allow raw string to be garbage collected + this.processEmphasis(null); + this.mergeTextNodes(block.walker()); + var _a = this.options, extendedAutolinks = _a.extendedAutolinks, customParser = _a.customParser; + if (extendedAutolinks) { + convertExtAutoLinks(block.walker(), extendedAutolinks); + } + if (customParser && block.firstChild) { + var event_1; + var walker = block.firstChild.walker(); + while ((event_1 = walker.next())) { + var node = event_1.node, entering = event_1.entering; + if (customParser[node.type]) { + customParser[node.type](node, { entering: entering, options: this.options }); + } + } + } + }; + return InlineParser; +}()); + +var reTaskListItemMarker = /^\[([ \txX])\][ \t]+/; +// finalize for block handler +function taskListItemFinalize(_, block) { + if (block.firstChild && block.firstChild.type === 'paragraph') { + var p = block.firstChild; + var m = p.stringContent.match(reTaskListItemMarker); + if (m) { + var mLen = m[0].length; + p.stringContent = p.stringContent.substring(mLen - 1); + p.sourcepos[0][1] += mLen; + p.lineOffsets[0] += mLen; + block.listData.task = true; + block.listData.checked = /[xX]/.test(m[1]); + } + } +} + +var table = { + continue: function () { + return 0 /* Go */; + }, + finalize: function () { }, + canContain: function (t) { + return t === 'tableHead' || t === 'tableBody'; + }, + acceptsLines: false, +}; +var tableBody$1 = { + continue: function () { + return 0 /* Go */; + }, + finalize: function () { }, + canContain: function (t) { + return t === 'tableRow'; + }, + acceptsLines: false, +}; +var tableHead$1 = { + continue: function () { + return 1 /* Stop */; + }, + finalize: function () { }, + canContain: function (t) { + return t === 'tableRow' || t === 'tableDelimRow'; + }, + acceptsLines: false, +}; +var tableDelimRow = { + continue: function () { + return 1 /* Stop */; + }, + finalize: function () { }, + canContain: function (t) { + return t === 'tableDelimCell'; + }, + acceptsLines: false, +}; +var tableDelimCell = { + continue: function () { + return 1 /* Stop */; + }, + finalize: function () { }, + canContain: function () { + return false; + }, + acceptsLines: false, +}; +var tableRow = { + continue: function () { + return 1 /* Stop */; + }, + finalize: function () { }, + canContain: function (t) { + return t === 'tableCell'; + }, + acceptsLines: false, +}; +var tableCell = { + continue: function () { + return 1 /* Stop */; + }, + finalize: function () { }, + canContain: function () { + return false; + }, + acceptsLines: false, +}; + +var CODE_INDENT = 4; +var C_TAB = 9; +var C_GREATERTHAN = 62; +var C_LESSTHAN = 60; +var C_SPACE = 32; +var C_OPEN_BRACKET = 91; +var reNonSpace = /[^ \t\f\v\r\n]/; +var reClosingCodeFence = /^(?:`{3,}|~{3,})(?= *$)/; +// Returns true if block ends with a blank line, descending if needed +// into lists and sublists. +function endsWithBlankLine(block) { + var curBlock = block; + while (curBlock) { + if (curBlock.lastLineBlank) { + return true; + } + var t = curBlock.type; + if (!curBlock.lastLineChecked && (t === 'list' || t === 'item')) { + curBlock.lastLineChecked = true; + curBlock = curBlock.lastChild; + } + else { + curBlock.lastLineChecked = true; + break; + } + } + return false; +} +function peek(ln, pos) { + if (pos < ln.length) { + return ln.charCodeAt(pos); + } + return -1; +} +// Returns true if string contains only space characters. +function isBlank(s) { + return !reNonSpace.test(s); +} +function isSpaceOrTab(c) { + return c === C_SPACE || c === C_TAB; +} + +var reClosingCustomBlock = /^\$\$$/; +var customBlock$1 = { + continue: function (parser, container) { + var line = parser.currentLine; + var match = line.match(reClosingCustomBlock); + if (match) { + // closing custom block + parser.lastLineLength = match[0].length; + parser.finalize(container, parser.lineNumber); + return 2 /* Finished */; + } + // skip optional spaces of custom block offset + var i = container.offset; + while (i > 0 && isSpaceOrTab(peek(line, parser.offset))) { + parser.advanceOffset(1, true); + i--; + } + return 0 /* Go */; + }, + finalize: function (_, block) { + if (block.stringContent === null) { + return; + } + // first line becomes info string + var content = block.stringContent; + var newlinePos = content.indexOf('\n'); + var firstLine = content.slice(0, newlinePos); + var rest = content.slice(newlinePos + 1); + var infoString = firstLine.match(/^(\s*)(.*)/); + block.info = unescapeString(infoString[2].trim()); + block.literal = rest; + block.stringContent = null; + }, + canContain: function () { + return false; + }, + acceptsLines: true, +}; + +var noop = { + continue: function () { + return 1 /* Stop */; + }, + finalize: function () { }, + canContain: function () { + return false; + }, + acceptsLines: true, +}; +var document$1 = { + continue: function () { + return 0 /* Go */; + }, + finalize: function () { }, + canContain: function (t) { + return t !== 'item'; + }, + acceptsLines: false, +}; +var list = { + continue: function () { + return 0 /* Go */; + }, + finalize: function (_, block) { + var item = block.firstChild; + while (item) { + // check for non-final list item ending with blank line: + if (endsWithBlankLine(item) && item.next) { + block.listData.tight = false; + break; + } + // recurse into children of list item, to see if there are + // spaces between any of them: + var subitem = item.firstChild; + while (subitem) { + if (endsWithBlankLine(subitem) && (item.next || subitem.next)) { + block.listData.tight = false; + break; + } + subitem = subitem.next; + } + item = item.next; + } + }, + canContain: function (t) { + return t === 'item'; + }, + acceptsLines: false, +}; +var blockQuote$1 = { + continue: function (parser) { + var ln = parser.currentLine; + if (!parser.indented && peek(ln, parser.nextNonspace) === C_GREATERTHAN) { + parser.advanceNextNonspace(); + parser.advanceOffset(1, false); + if (isSpaceOrTab(peek(ln, parser.offset))) { + parser.advanceOffset(1, true); + } + } + else { + return 1 /* Stop */; + } + return 0 /* Go */; + }, + finalize: function () { }, + canContain: function (t) { + return t !== 'item'; + }, + acceptsLines: false, +}; +var item = { + continue: function (parser, container) { + if (parser.blank) { + if (container.firstChild === null) { + // Blank line after empty list item + return 1 /* Stop */; + } + parser.advanceNextNonspace(); + } + else if (parser.indent >= container.listData.markerOffset + container.listData.padding) { + parser.advanceOffset(container.listData.markerOffset + container.listData.padding, true); + } + else { + return 1 /* Stop */; + } + return 0 /* Go */; + }, + finalize: taskListItemFinalize, + canContain: function (t) { + return t !== 'item'; + }, + acceptsLines: false, +}; +var heading = { + continue: function () { + // a heading can never container > 1 line, so fail to match: + return 1 /* Stop */; + }, + finalize: function () { }, + canContain: function () { + return false; + }, + acceptsLines: false, +}; +var thematicBreak$1 = { + continue: function () { + // a thematic break can never container > 1 line, so fail to match: + return 1 /* Stop */; + }, + finalize: function () { }, + canContain: function () { + return false; + }, + acceptsLines: false, +}; +var codeBlock = { + continue: function (parser, container) { + var ln = parser.currentLine; + var indent = parser.indent; + if (container.isFenced) { + // fenced + var match = indent <= 3 && + ln.charAt(parser.nextNonspace) === container.fenceChar && + ln.slice(parser.nextNonspace).match(reClosingCodeFence); + if (match && match[0].length >= container.fenceLength) { + // closing fence - we're at end of line, so we can return + parser.lastLineLength = parser.offset + indent + match[0].length; + parser.finalize(container, parser.lineNumber); + return 2 /* Finished */; + } + // skip optional spaces of fence offset + var i = container.fenceOffset; + while (i > 0 && isSpaceOrTab(peek(ln, parser.offset))) { + parser.advanceOffset(1, true); + i--; + } + } + else { + // indented + if (indent >= CODE_INDENT) { + parser.advanceOffset(CODE_INDENT, true); + } + else if (parser.blank) { + parser.advanceNextNonspace(); + } + else { + return 1 /* Stop */; + } + } + return 0 /* Go */; + }, + finalize: function (_, block) { + var _a; + if (block.stringContent === null) { + return; + } + if (block.isFenced) { + // fenced + // first line becomes info string + var content = block.stringContent; + var newlinePos = content.indexOf('\n'); + var firstLine = content.slice(0, newlinePos); + var rest = content.slice(newlinePos + 1); + var infoString = firstLine.match(/^(\s*)(.*)/); + block.infoPadding = infoString[1].length; + block.info = unescapeString(infoString[2].trim()); + block.literal = rest; + } + else { + // indented + block.literal = (_a = block.stringContent) === null || _a === void 0 ? void 0 : _a.replace(/(\n *)+$/, '\n'); + } + block.stringContent = null; // allow GC + }, + canContain: function () { + return false; + }, + acceptsLines: true, +}; +var htmlBlock$1 = { + continue: function (parser, container) { + return parser.blank && (container.htmlBlockType === 6 || container.htmlBlockType === 7) + ? 1 /* Stop */ + : 0 /* Go */; + }, + finalize: function (_, block) { + var _a; + block.literal = ((_a = block.stringContent) === null || _a === void 0 ? void 0 : _a.replace(/(\n *)+$/, '')) || null; + block.stringContent = null; // allow GC + }, + canContain: function () { + return false; + }, + acceptsLines: true, +}; +var paragraph = { + continue: function (parser) { + return parser.blank ? 1 /* Stop */ : 0 /* Go */; + }, + finalize: function (parser, block) { + if (block.stringContent === null) { + return; + } + var pos; + var hasReferenceDefs = false; + // try parsing the beginning as link reference definitions: + while (peek(block.stringContent, 0) === C_OPEN_BRACKET && + (pos = parser.inlineParser.parseReference(block, parser.refMap))) { + block.stringContent = block.stringContent.slice(pos); + hasReferenceDefs = true; + } + if (hasReferenceDefs && isBlank(block.stringContent)) { + block.unlink(); + } + }, + canContain: function () { + return false; + }, + acceptsLines: true, +}; +var refDef = noop; +var frontMatter$2 = noop; +var blockHandlers = { + document: document$1, + list: list, + blockQuote: blockQuote$1, + item: item, + heading: heading, + thematicBreak: thematicBreak$1, + codeBlock: codeBlock, + htmlBlock: htmlBlock$1, + paragraph: paragraph, + table: table, + tableBody: tableBody$1, + tableHead: tableHead$1, + tableRow: tableRow, + tableCell: tableCell, + tableDelimRow: tableDelimRow, + tableDelimCell: tableDelimCell, + refDef: refDef, + customBlock: customBlock$1, + frontMatter: frontMatter$2, +}; + +function parseRowContent(content) { + var startIdx = 0; + var offset = 0; + var cells = []; + for (var i = 0; i < content.length; i += 1) { + if (content[i] === '|' && content[i - 1] !== '\\') { + var cell = content.substring(startIdx, i); + if (startIdx === 0 && isEmpty(cell)) { + offset = i + 1; + } + else { + cells.push(cell); + } + startIdx = i + 1; + } + } + if (startIdx < content.length) { + var cell = content.substring(startIdx, content.length); + if (!isEmpty(cell)) { + cells.push(cell); + } + } + return [offset, cells]; +} +function generateTableCells(cellType, contents, lineNum, chPos) { + var cells = []; + for (var _i = 0, contents_1 = contents; _i < contents_1.length; _i++) { + var content = contents_1[_i]; + var preSpaces = content.match(/^[ \t]+/); + var paddingLeft = preSpaces ? preSpaces[0].length : 0; + var paddingRight = void 0, trimmed = void 0; + if (paddingLeft === content.length) { + paddingLeft = 0; + paddingRight = 0; + trimmed = ''; + } + else { + var postSpaces = content.match(/[ \t]+$/); + paddingRight = postSpaces ? postSpaces[0].length : 0; + trimmed = content.slice(paddingLeft, content.length - paddingRight); + } + var chPosStart = chPos + paddingLeft; + var tableCell = createNode$1(cellType, [ + [lineNum, chPos], + [lineNum, chPos + content.length - 1], + ]); + tableCell.stringContent = trimmed.replace(/\\\|/g, '|'); // replace esacped pipe(\|) + tableCell.startIdx = cells.length; + tableCell.endIdx = cells.length; + tableCell.lineOffsets = [chPosStart - 1]; + tableCell.paddingLeft = paddingLeft; + tableCell.paddingRight = paddingRight; + cells.push(tableCell); + chPos += content.length + 1; + } + return cells; +} +function getColumnFromDelimCell(cellNode) { + var align = null; + var content = cellNode.stringContent; + var firstCh = content[0]; + var lastCh = content[content.length - 1]; + if (lastCh === ':') { + align = firstCh === ':' ? 'center' : 'right'; + } + else if (firstCh === ':') { + align = 'left'; + } + return { align: align }; +} +var tableHead = function (parser, container) { + var stringContent = container.stringContent; + if (container.type === 'paragraph' && !parser.indented && !parser.blank) { + var lastNewLineIdx = stringContent.length - 1; + var lastLineStartIdx = stringContent.lastIndexOf('\n', lastNewLineIdx - 1) + 1; + var headerContent = stringContent.slice(lastLineStartIdx, lastNewLineIdx); + var delimContent = parser.currentLine.slice(parser.nextNonspace); + var _a = parseRowContent(headerContent), headerOffset = _a[0], headerCells = _a[1]; + var _b = parseRowContent(delimContent), delimOffset = _b[0], delimCells = _b[1]; + var reValidDelimCell_1 = /^[ \t]*:?-+:?[ \t]*$/; + if ( + // not checking if the number of header cells and delimiter cells are the same + // to consider the case of merged-column (via plugin) + !headerCells.length || + !delimCells.length || + delimCells.some(function (cell) { return !reValidDelimCell_1.test(cell); }) || + // to prevent to regard setTextHeading as tabel delim cell with 'disallowDeepHeading' option + (delimCells.length === 1 && delimContent.indexOf('|') !== 0)) { + return 0 /* None */; + } + var lineOffsets = container.lineOffsets; + var firstLineNum = parser.lineNumber - 1; + var firstLineStart = last(lineOffsets) + 1; + var table = createNode$1('table', [ + [firstLineNum, firstLineStart], + [parser.lineNumber, parser.offset], + ]); + // eslint-disable-next-line arrow-body-style + table.columns = delimCells.map(function () { return ({ align: null }); }); + container.insertAfter(table); + if (lineOffsets.length === 1) { + container.unlink(); + } + else { + container.stringContent = stringContent.slice(0, lastLineStartIdx); + var paraLastLineStartIdx = stringContent.lastIndexOf('\n', lastLineStartIdx - 2) + 1; + var paraLastLineLen = lastLineStartIdx - paraLastLineStartIdx - 1; + parser.lastLineLength = lineOffsets[lineOffsets.length - 2] + paraLastLineLen; + parser.finalize(container, firstLineNum - 1); + } + parser.advanceOffset(parser.currentLine.length - parser.offset, false); + var tableHead_1 = createNode$1('tableHead', [ + [firstLineNum, firstLineStart], + [parser.lineNumber, parser.offset], + ]); + table.appendChild(tableHead_1); + var tableHeadRow_1 = createNode$1('tableRow', [ + [firstLineNum, firstLineStart], + [firstLineNum, firstLineStart + headerContent.length - 1], + ]); + var tableDelimRow_1 = createNode$1('tableDelimRow', [ + [parser.lineNumber, parser.nextNonspace + 1], + [parser.lineNumber, parser.offset], + ]); + tableHead_1.appendChild(tableHeadRow_1); + tableHead_1.appendChild(tableDelimRow_1); + generateTableCells('tableCell', headerCells, firstLineNum, firstLineStart + headerOffset).forEach(function (cellNode) { + tableHeadRow_1.appendChild(cellNode); + }); + var delimCellNodes = generateTableCells('tableDelimCell', delimCells, parser.lineNumber, parser.nextNonspace + 1 + delimOffset); + delimCellNodes.forEach(function (cellNode) { + tableDelimRow_1.appendChild(cellNode); + }); + table.columns = delimCellNodes.map(getColumnFromDelimCell); + parser.tip = table; + return 2 /* Leaf */; + } + return 0 /* None */; +}; +var tableBody = function (parser, container) { + if ((container.type !== 'table' && container.type !== 'tableBody') || + (!parser.blank && parser.currentLine.indexOf('|') === -1)) { + return 0 /* None */; + } + parser.advanceOffset(parser.currentLine.length - parser.offset, false); + if (parser.blank) { + var table_1 = container; + if (container.type === 'tableBody') { + table_1 = container.parent; + parser.finalize(container, parser.lineNumber - 1); + } + parser.finalize(table_1, parser.lineNumber - 1); + return 0 /* None */; + } + var tableBody = container; + if (container.type === 'table') { + tableBody = parser.addChild('tableBody', parser.nextNonspace); + tableBody.stringContent = null; + } + var tableRow = createNode$1('tableRow', [ + [parser.lineNumber, parser.nextNonspace + 1], + [parser.lineNumber, parser.currentLine.length], + ]); + tableBody.appendChild(tableRow); + var table = tableBody.parent; + var content = parser.currentLine.slice(parser.nextNonspace); + var _a = parseRowContent(content), offset = _a[0], cellContents = _a[1]; + generateTableCells('tableCell', cellContents, parser.lineNumber, parser.nextNonspace + 1 + offset).forEach(function (cellNode, idx) { + if (idx >= table.columns.length) { + cellNode.ignored = true; + } + tableRow.appendChild(cellNode); + }); + return 2 /* Leaf */; +}; + +var reCustomBlock = /^(\$\$)(\s*[a-zA-Z])+/; +var reCanBeCustomInline = /^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/; +var customBlock = function (parser) { + var match; + if (!parser.indented && + !reCanBeCustomInline.test(parser.currentLine) && + (match = parser.currentLine.match(reCustomBlock))) { + var syntaxLength = match[1].length; + parser.closeUnmatchedBlocks(); + var container = parser.addChild('customBlock', parser.nextNonspace); + container.syntaxLength = syntaxLength; + container.offset = parser.indent; + parser.advanceNextNonspace(); + parser.advanceOffset(syntaxLength, false); + return 2 /* Leaf */; + } + return 0 /* None */; +}; + +var reCodeFence = /^`{3,}(?!.*`)|^~{3,}/; +var reHtmlBlockOpen = [ + /./, + /^<(?:script|pre|style)(?:\s|>|$)/i, + /^/, + /\?>/, + />/, + /\]\]>/, +]; +var reMaybeSpecial = /^[#`~*+_=<>0-9-;$]/; +var reLineEnding$1 = /\r\n|\n|\r/; +function document$2() { + return createNode$1('document', [ + [1, 1], + [0, 0], + ]); +} +var defaultOptions$1 = { + smart: false, + tagFilter: false, + extendedAutolinks: false, + disallowedHtmlBlockTags: [], + referenceDefinition: false, + disallowDeepHeading: false, + customParser: null, + frontMatter: false, +}; +var Parser = /** @class */ (function () { + function Parser(options) { + this.options = __assign(__assign({}, defaultOptions$1), options); + this.doc = document$2(); + this.tip = this.doc; + this.oldtip = this.doc; + this.lineNumber = 0; + this.offset = 0; + this.column = 0; + this.nextNonspace = 0; + this.nextNonspaceColumn = 0; + this.indent = 0; + this.currentLine = ''; + this.indented = false; + this.blank = false; + this.partiallyConsumedTab = false; + this.allClosed = true; + this.lastMatchedContainer = this.doc; + this.refMap = {}; + this.refLinkCandidateMap = {}; + this.refDefCandidateMap = {}; + this.lastLineLength = 0; + this.lines = []; + if (this.options.frontMatter) { + blockHandlers.frontMatter = frontMatter; + blockStarts.unshift(frontMatter$1); + } + this.inlineParser = new InlineParser(this.options); + } + Parser.prototype.advanceOffset = function (count, columns) { + if (columns === void 0) { columns = false; } + var currentLine = this.currentLine; + var charsToTab, charsToAdvance; + var c; + while (count > 0 && (c = currentLine[this.offset])) { + if (c === '\t') { + charsToTab = 4 - (this.column % 4); + if (columns) { + this.partiallyConsumedTab = charsToTab > count; + charsToAdvance = charsToTab > count ? count : charsToTab; + this.column += charsToAdvance; + this.offset += this.partiallyConsumedTab ? 0 : 1; + count -= charsToAdvance; + } + else { + this.partiallyConsumedTab = false; + this.column += charsToTab; + this.offset += 1; + count -= 1; + } + } + else { + this.partiallyConsumedTab = false; + this.offset += 1; + this.column += 1; // assume ascii; block starts are ascii + count -= 1; + } + } + }; + Parser.prototype.advanceNextNonspace = function () { + this.offset = this.nextNonspace; + this.column = this.nextNonspaceColumn; + this.partiallyConsumedTab = false; + }; + Parser.prototype.findNextNonspace = function () { + var currentLine = this.currentLine; + var i = this.offset; + var cols = this.column; + var c; + while ((c = currentLine.charAt(i)) !== '') { + if (c === ' ') { + i++; + cols++; + } + else if (c === '\t') { + i++; + cols += 4 - (cols % 4); + } + else { + break; + } + } + this.blank = c === '\n' || c === '\r' || c === ''; + this.nextNonspace = i; + this.nextNonspaceColumn = cols; + this.indent = this.nextNonspaceColumn - this.column; + this.indented = this.indent >= CODE_INDENT; + }; + // Add a line to the block at the tip. We assume the tip + // can accept lines -- that check should be done before calling this. + Parser.prototype.addLine = function () { + if (this.partiallyConsumedTab) { + this.offset += 1; // skip over tab + // add space characters: + var charsToTab = 4 - (this.column % 4); + this.tip.stringContent += repeat(' ', charsToTab); + } + if (this.tip.lineOffsets) { + this.tip.lineOffsets.push(this.offset); + } + else { + this.tip.lineOffsets = [this.offset]; + } + this.tip.stringContent += this.currentLine.slice(this.offset) + "\n"; + }; + // Add block of type tag as a child of the tip. If the tip can't + // accept children, close and finalize it and try its parent, + // and so on til we find a block that can accept children. + Parser.prototype.addChild = function (tag, offset) { + while (!blockHandlers[this.tip.type].canContain(tag)) { + this.finalize(this.tip, this.lineNumber - 1); + } + var columnNumber = offset + 1; // offset 0 = column 1 + var newBlock = createNode$1(tag, [ + [this.lineNumber, columnNumber], + [0, 0], + ]); + newBlock.stringContent = ''; + this.tip.appendChild(newBlock); + this.tip = newBlock; + return newBlock; + }; + // Finalize and close any unmatched blocks. + Parser.prototype.closeUnmatchedBlocks = function () { + if (!this.allClosed) { + // finalize any blocks not matched + while (this.oldtip !== this.lastMatchedContainer) { + var parent_1 = this.oldtip.parent; + this.finalize(this.oldtip, this.lineNumber - 1); + this.oldtip = parent_1; + } + this.allClosed = true; + } + }; + // Finalize a block. Close it and do any necessary postprocessing, + // e.g. creating stringContent from strings, setting the 'tight' + // or 'loose' status of a list, and parsing the beginnings + // of paragraphs for reference definitions. Reset the tip to the + // parent of the closed block. + Parser.prototype.finalize = function (block, lineNumber) { + var above = block.parent; + block.open = false; + block.sourcepos[1] = [lineNumber, this.lastLineLength]; + blockHandlers[block.type].finalize(this, block); + this.tip = above; + }; + // Walk through a block & children recursively, parsing string content + // into inline content where appropriate. + Parser.prototype.processInlines = function (block) { + var event; + var customParser = this.options.customParser; + var walker = block.walker(); + this.inlineParser.refMap = this.refMap; + this.inlineParser.refLinkCandidateMap = this.refLinkCandidateMap; + this.inlineParser.refDefCandidateMap = this.refDefCandidateMap; + this.inlineParser.options = this.options; + while ((event = walker.next())) { + var node = event.node, entering = event.entering; + var t = node.type; + if (customParser && customParser[t]) { + customParser[t](node, { entering: entering, options: this.options }); + } + if (!entering && + (t === 'paragraph' || + t === 'heading' || + (t === 'tableCell' && !node.ignored))) { + this.inlineParser.parse(node); + } + } + }; + // Analyze a line of text and update the document appropriately. + // We parse markdown text by calling this on each line of input, + // then finalizing the document. + Parser.prototype.incorporateLine = function (ln) { + var container = this.doc; + this.oldtip = this.tip; + this.offset = 0; + this.column = 0; + this.blank = false; + this.partiallyConsumedTab = false; + this.lineNumber += 1; + // replace NUL characters for security + if (ln.indexOf('\u0000') !== -1) { + ln = ln.replace(/\0/g, '\uFFFD'); + } + this.currentLine = ln; + // For each containing block, try to parse the associated line start. + // Bail out on failure: container will point to the last matching block. + // Set allMatched to false if not all containers match. + var allMatched = true; + var lastChild; + while ((lastChild = container.lastChild) && lastChild.open) { + container = lastChild; + this.findNextNonspace(); + switch (blockHandlers[container.type]['continue'](this, container)) { + case 0 /* Go */: // we've matched, keep going + break; + case 1 /* Stop */: // we've failed to match a block + allMatched = false; + break; + case 2 /* Finished */: // we've hit end of line for fenced code close and can return + this.lastLineLength = ln.length; + return; + default: + throw new Error('continue returned illegal value, must be 0, 1, or 2'); + } + if (!allMatched) { + container = container.parent; // back up to last matching block + break; + } + } + this.allClosed = container === this.oldtip; + this.lastMatchedContainer = container; + var matchedLeaf = container.type !== 'paragraph' && blockHandlers[container.type].acceptsLines; + var blockStartsLen = blockStarts.length; + // Unless last matched container is a code block, try new container starts, + // adding children to the last matched container: + while (!matchedLeaf) { + this.findNextNonspace(); + // this is a little performance optimization: + if (container.type !== 'table' && + container.type !== 'tableBody' && + container.type !== 'paragraph' && + !this.indented && + !reMaybeSpecial.test(ln.slice(this.nextNonspace))) { + this.advanceNextNonspace(); + break; + } + var i = 0; + while (i < blockStartsLen) { + var res = blockStarts[i](this, container); + if (res === 1 /* Container */) { + container = this.tip; + break; + } + else if (res === 2 /* Leaf */) { + container = this.tip; + matchedLeaf = true; + break; + } + else { + i++; + } + } + if (i === blockStartsLen) { + // nothing matched + this.advanceNextNonspace(); + break; + } + } + // What remains at the offset is a text line. Add the text to the + // appropriate container. + // First check for a lazy paragraph continuation: + if (!this.allClosed && !this.blank && this.tip.type === 'paragraph') { + // lazy paragraph continuation + this.addLine(); + } + else { + // not a lazy continuation + // finalize any blocks not matched + this.closeUnmatchedBlocks(); + if (this.blank && container.lastChild) { + container.lastChild.lastLineBlank = true; + } + var t = container.type; + // Block quote lines are never blank as they start with > + // and we don't count blanks in fenced code for purposes of tight/loose + // lists or breaking out of lists. We also don't set _lastLineBlank + // on an empty list item, or if we just closed a fenced block. + var lastLineBlank = this.blank && + !(t === 'blockQuote' || + (isCodeBlock(container) && container.isFenced) || + (t === 'item' && !container.firstChild && container.sourcepos[0][0] === this.lineNumber)); + // propagate lastLineBlank up through parents: + var cont = container; + while (cont) { + cont.lastLineBlank = lastLineBlank; + cont = cont.parent; + } + if (blockHandlers[t].acceptsLines) { + this.addLine(); + // if HtmlBlock, check for end condition + if (isHtmlBlock(container) && + container.htmlBlockType >= 1 && + container.htmlBlockType <= 5 && + reHtmlBlockClose[container.htmlBlockType].test(this.currentLine.slice(this.offset))) { + this.lastLineLength = ln.length; + this.finalize(container, this.lineNumber); + } + } + else if (this.offset < ln.length && !this.blank) { + // create paragraph container for line + container = this.addChild('paragraph', this.offset); + this.advanceNextNonspace(); + this.addLine(); + } + } + this.lastLineLength = ln.length; + }; + // The main parsing function. Returns a parsed document AST. + Parser.prototype.parse = function (input, lineTexts) { + this.doc = document$2(); + this.tip = this.doc; + this.lineNumber = 0; + this.lastLineLength = 0; + this.offset = 0; + this.column = 0; + this.lastMatchedContainer = this.doc; + this.currentLine = ''; + var lines = input.split(reLineEnding$1); + var len = lines.length; + this.lines = lineTexts ? lineTexts : lines; + if (this.options.referenceDefinition) { + this.clearRefMaps(); + } + if (input.charCodeAt(input.length - 1) === C_NEWLINE) { + // ignore last blank line created by final newline + len -= 1; + } + for (var i = 0; i < len; i++) { + this.incorporateLine(lines[i]); + } + while (this.tip) { + this.finalize(this.tip, len); + } + this.processInlines(this.doc); + return this.doc; + }; + Parser.prototype.partialParseStart = function (lineNumber, lines) { + this.doc = document$2(); + this.tip = this.doc; + this.lineNumber = lineNumber - 1; + this.lastLineLength = 0; + this.offset = 0; + this.column = 0; + this.lastMatchedContainer = this.doc; + this.currentLine = ''; + var len = lines.length; + for (var i = 0; i < len; i++) { + this.incorporateLine(lines[i]); + } + return this.doc; + }; + Parser.prototype.partialParseExtends = function (lines) { + for (var i = 0; i < lines.length; i++) { + this.incorporateLine(lines[i]); + } + }; + Parser.prototype.partialParseFinish = function () { + while (this.tip) { + this.finalize(this.tip, this.lineNumber); + } + this.processInlines(this.doc); + }; + Parser.prototype.setRefMaps = function (refMap, refLinkCandidateMap, refDefCandidateMap) { + this.refMap = refMap; + this.refLinkCandidateMap = refLinkCandidateMap; + this.refDefCandidateMap = refDefCandidateMap; + }; + Parser.prototype.clearRefMaps = function () { + [this.refMap, this.refLinkCandidateMap, this.refDefCandidateMap].forEach(function (map) { + clearObj(map); + }); + }; + return Parser; +}()); + +function comparePos(p1, p2) { + if (p1[0] < p2[0]) { + return 1 /* LT */; + } + if (p1[0] > p2[0]) { + return -1 /* GT */; + } + if (p1[1] < p2[1]) { + return 1 /* LT */; + } + if (p1[1] > p2[1]) { + return -1 /* GT */; + } + return 0 /* EQ */; +} +function compareRangeAndPos(_a, pos) { + var startPos = _a[0], endPos = _a[1]; + if (comparePos(endPos, pos) === 1 /* LT */) { + return 1 /* LT */; + } + if (comparePos(startPos, pos) === -1 /* GT */) { + return -1 /* GT */; + } + return 0 /* EQ */; +} +function removeNextUntil(node, last) { + if (node.parent !== last.parent || node === last) { + return; + } + var next = node.next; + while (next && next !== last) { + var temp = next.next; + for (var _i = 0, _a = ['parent', 'prev', 'next']; _i < _a.length; _i++) { + var type = _a[_i]; + if (next[type]) { + removeNodeById(next[type].id); + next[type] = null; + } + } + next = temp; + } + node.next = last.next; + if (last.next) { + last.next.prev = node; + } + else { + node.parent.lastChild = node; + } +} +function getChildNodes(parent) { + var nodes = []; + var curr = parent.firstChild; + while (curr) { + nodes.push(curr); + curr = curr.next; + } + return nodes; +} +function insertNodesBefore(target, nodes) { + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var node = nodes_1[_i]; + target.insertBefore(node); + } +} +function prependChildNodes(parent, nodes) { + for (var i = nodes.length - 1; i >= 0; i -= 1) { + parent.prependChild(nodes[i]); + } +} +function updateNextLineNumbers(base, diff) { + if (!base || !base.parent || diff === 0) { + return; + } + var walker = base.parent.walker(); + walker.resumeAt(base, true); + var event; + while ((event = walker.next())) { + var node = event.node, entering = event.entering; + if (entering) { + node.sourcepos[0][0] += diff; + node.sourcepos[1][0] += diff; + } + } +} +function compareRangeAndLine(_a, line) { + var startPos = _a[0], endPos = _a[1]; + if (endPos[0] < line) { + return 1 /* LT */; + } + if (startPos[0] > line) { + return -1 /* GT */; + } + return 0 /* EQ */; +} +function findChildNodeAtLine(parent, line) { + var node = parent.firstChild; + while (node) { + var comp = compareRangeAndLine(node.sourcepos, line); + if (comp === 0 /* EQ */) { + return node; + } + if (comp === -1 /* GT */) { + // To consider that top line is blank line + return node.prev || node; + } + node = node.next; + } + return parent.lastChild; +} +function lastLeafNode(node) { + while (node.lastChild) { + node = node.lastChild; + } + return node; +} +function sameLineTopAncestor(node) { + while (node.parent && + node.parent.type !== 'document' && + node.parent.sourcepos[0][0] === node.sourcepos[0][0]) { + node = node.parent; + } + return node; +} +function findFirstNodeAtLine(parent, line) { + var node = parent.firstChild; + var prev = null; + while (node) { + var comp = compareRangeAndLine(node.sourcepos, line); + if (comp === 0 /* EQ */) { + if (node.sourcepos[0][0] === line || !node.firstChild) { + return node; + } + prev = node; + node = node.firstChild; + } + else if (comp === -1 /* GT */) { + break; + } + else { + prev = node; + node = node.next; + } + } + if (prev) { + return sameLineTopAncestor(lastLeafNode(prev)); + } + return null; +} +function findNodeAtPosition(parent, pos) { + var node = parent; + var prev = null; + while (node) { + var comp = compareRangeAndPos(node.sourcepos, pos); + if (comp === 0 /* EQ */) { + if (node.firstChild) { + prev = node; + node = node.firstChild; + } + else { + return node; + } + } + else if (comp === -1 /* GT */) { + return prev; + } + else if (node.next) { + node = node.next; + } + else { + return prev; + } + } + return node; +} +function findNodeById(id) { + return getNodeById(id) || null; +} +function invokeNextUntil(callback, start, end) { + if (end === void 0) { end = null; } + if (start) { + var walker = start.walker(); + while (start && start !== end) { + callback(start); + var next = walker.next(); + if (next) { + start = next.node; + } + else { + break; + } + } + } +} +function isUnlinked(id) { + var node = findNodeById(id); + if (!node) { + return true; + } + while (node && node.type !== 'document') { + // eslint-disable-next-line no-loop-func + if (!node.parent && !node.prev && !node.next) { + return true; + } + node = node.parent; + } + return false; +} + +var reLineEnding = /\r\n|\n|\r/; +function canBeContinuedListItem(lineText) { + var spaceMatch = lineText.match(/^[ \t]+/); + if (spaceMatch && (spaceMatch[0].length >= 2 || /\t/.test(spaceMatch[0]))) { + return true; + } + var leftTrimmed = spaceMatch ? lineText.slice(spaceMatch.length) : lineText; + return reBulletListMarker.test(leftTrimmed) || reOrderedListMarker.test(leftTrimmed); +} +function canBeContinuedTableBody(lineText) { + return !isBlank(lineText) && lineText.indexOf('|') !== -1; +} +function createRefDefState(node) { + var id = node.id, title = node.title, sourcepos = node.sourcepos, dest = node.dest; + return { + id: id, + title: title, + sourcepos: sourcepos, + unlinked: false, + destination: dest, + }; +} +var ToastMark = /** @class */ (function () { + function ToastMark(contents, options) { + this.refMap = {}; + this.refLinkCandidateMap = {}; + this.refDefCandidateMap = {}; + this.referenceDefinition = !!(options === null || options === void 0 ? void 0 : options.referenceDefinition); + this.parser = new Parser(options); + this.parser.setRefMaps(this.refMap, this.refLinkCandidateMap, this.refDefCandidateMap); + this.eventHandlerMap = { change: [] }; + contents = contents || ''; + this.lineTexts = contents.split(reLineEnding); + this.root = this.parser.parse(contents, this.lineTexts); + } + ToastMark.prototype.updateLineTexts = function (startPos, endPos, newText) { + var _a; + var startLine = startPos[0], startCol = startPos[1]; + var endLine = endPos[0], endCol = endPos[1]; + var newLines = newText.split(reLineEnding); + var newLineLen = newLines.length; + var startLineText = this.lineTexts[startLine - 1]; + var endLineText = this.lineTexts[endLine - 1]; + newLines[0] = startLineText.slice(0, startCol - 1) + newLines[0]; + newLines[newLineLen - 1] = newLines[newLineLen - 1] + endLineText.slice(endCol - 1); + var removedLineLen = endLine - startLine + 1; + (_a = this.lineTexts).splice.apply(_a, __spreadArray([startLine - 1, removedLineLen], newLines)); + return newLineLen - removedLineLen; + }; + ToastMark.prototype.updateRootNodeState = function () { + if (this.lineTexts.length === 1 && this.lineTexts[0] === '') { + this.root.lastLineBlank = true; + this.root.sourcepos = [ + [1, 1], + [1, 0], + ]; + return; + } + if (this.root.lastChild) { + this.root.lastLineBlank = this.root.lastChild.lastLineBlank; + } + var lineTexts = this.lineTexts; + var idx = lineTexts.length - 1; + while (lineTexts[idx] === '') { + idx -= 1; + } + if (lineTexts.length - 2 > idx) { + idx += 1; + } + this.root.sourcepos[1] = [idx + 1, lineTexts[idx].length]; + }; + ToastMark.prototype.replaceRangeNodes = function (startNode, endNode, newNodes) { + if (!startNode) { + if (endNode) { + insertNodesBefore(endNode, newNodes); + removeNodeById(endNode.id); + endNode.unlink(); + } + else { + prependChildNodes(this.root, newNodes); + } + } + else { + insertNodesBefore(startNode, newNodes); + removeNextUntil(startNode, endNode); + [startNode.id, endNode.id].forEach(function (id) { return removeNodeById(id); }); + startNode.unlink(); + } + }; + ToastMark.prototype.getNodeRange = function (startPos, endPos) { + var startNode = findChildNodeAtLine(this.root, startPos[0]); + var endNode = findChildNodeAtLine(this.root, endPos[0]); + // extend node range to include a following block which doesn't have preceding blank line + if (endNode && endNode.next && endPos[0] + 1 === endNode.next.sourcepos[0][0]) { + endNode = endNode.next; + } + return [startNode, endNode]; + }; + ToastMark.prototype.trigger = function (eventName, param) { + this.eventHandlerMap[eventName].forEach(function (handler) { + handler(param); + }); + }; + ToastMark.prototype.extendEndLine = function (line) { + while (this.lineTexts[line] === '') { + line += 1; + } + return line; + }; + ToastMark.prototype.parseRange = function (startNode, endNode, startLine, endLine) { + // extends starting range if the first node can be a continued list item + if (startNode && + startNode.prev && + ((isList(startNode.prev) && canBeContinuedListItem(this.lineTexts[startLine - 1])) || + (isTable(startNode.prev) && canBeContinuedTableBody(this.lineTexts[startLine - 1])))) { + startNode = startNode.prev; + startLine = startNode.sourcepos[0][0]; + } + var editedLines = this.lineTexts.slice(startLine - 1, endLine); + var root = this.parser.partialParseStart(startLine, editedLines); + // extends ending range if the following node can be a fenced code block or a continued list item + var nextNode = endNode ? endNode.next : this.root.firstChild; + var lastChild = root.lastChild; + var isOpenedLastChildCodeBlock = lastChild && isCodeBlock(lastChild) && lastChild.open; + var isOpenedLastChildCustomBlock = lastChild && isCustomBlock(lastChild) && lastChild.open; + var isLastChildList = lastChild && isList(lastChild); + while (((isOpenedLastChildCodeBlock || isOpenedLastChildCustomBlock) && nextNode) || + (isLastChildList && nextNode && (nextNode.type === 'list' || nextNode.sourcepos[0][1] >= 2))) { + var newEndLine = this.extendEndLine(nextNode.sourcepos[1][0]); + this.parser.partialParseExtends(this.lineTexts.slice(endLine, newEndLine)); + if (!startNode) { + startNode = endNode; + } + endNode = nextNode; + endLine = newEndLine; + nextNode = nextNode.next; + } + this.parser.partialParseFinish(); + var newNodes = getChildNodes(root); + return { newNodes: newNodes, extStartNode: startNode, extEndNode: endNode }; + }; + ToastMark.prototype.getRemovedNodeRange = function (extStartNode, extEndNode) { + if (!extStartNode || + (extStartNode && isRefDef(extStartNode)) || + (extEndNode && isRefDef(extEndNode))) { + return null; + } + return { + id: [extStartNode.id, extEndNode.id], + line: [extStartNode.sourcepos[0][0] - 1, extEndNode.sourcepos[1][0] - 1], + }; + }; + ToastMark.prototype.markDeletedRefMap = function (extStartNode, extEndNode) { + var _this = this; + if (!isEmptyObj(this.refMap)) { + var markDeleted = function (node) { + if (isRefDef(node)) { + var refDefState = _this.refMap[node.label]; + if (refDefState && node.id === refDefState.id) { + refDefState.unlinked = true; + } + } + }; + if (extStartNode) { + invokeNextUntil(markDeleted, extStartNode.parent, extEndNode); + } + if (extEndNode) { + invokeNextUntil(markDeleted, extEndNode); + } + } + }; + ToastMark.prototype.replaceWithNewRefDefState = function (nodes) { + var _this = this; + if (!isEmptyObj(this.refMap)) { + var replaceWith_1 = function (node) { + if (isRefDef(node)) { + var label = node.label; + var refDefState = _this.refMap[label]; + if (!refDefState || refDefState.unlinked) { + _this.refMap[label] = createRefDefState(node); + } + } + }; + nodes.forEach(function (node) { + invokeNextUntil(replaceWith_1, node); + }); + } + }; + ToastMark.prototype.replaceWithRefDefCandidate = function () { + var _this = this; + if (!isEmptyObj(this.refDefCandidateMap)) { + iterateObject(this.refDefCandidateMap, function (_, candidate) { + var label = candidate.label, sourcepos = candidate.sourcepos; + var refDefState = _this.refMap[label]; + if (!refDefState || + refDefState.unlinked || + refDefState.sourcepos[0][0] > sourcepos[0][0]) { + _this.refMap[label] = createRefDefState(candidate); + } + }); + } + }; + ToastMark.prototype.getRangeWithRefDef = function (startLine, endLine, startNode, endNode, lineDiff) { + if (this.referenceDefinition && !isEmptyObj(this.refMap)) { + var prevNode = findChildNodeAtLine(this.root, startLine - 1); + var nextNode = findChildNodeAtLine(this.root, endLine + 1); + if (prevNode && isRefDef(prevNode) && prevNode !== startNode && prevNode !== endNode) { + startNode = prevNode; + startLine = startNode.sourcepos[0][0]; + } + if (nextNode && isRefDef(nextNode) && nextNode !== startNode && nextNode !== endNode) { + endNode = nextNode; + endLine = this.extendEndLine(endNode.sourcepos[1][0] + lineDiff); + } + } + return [startNode, endNode, startLine, endLine]; + }; + ToastMark.prototype.parse = function (startPos, endPos, lineDiff) { + if (lineDiff === void 0) { lineDiff = 0; } + var range = this.getNodeRange(startPos, endPos); + var startNode = range[0], endNode = range[1]; + var startLine = startNode ? Math.min(startNode.sourcepos[0][0], startPos[0]) : startPos[0]; + var endLine = this.extendEndLine((endNode ? Math.max(endNode.sourcepos[1][0], endPos[0]) : endPos[0]) + lineDiff); + var parseResult = this.parseRange.apply(this, this.getRangeWithRefDef(startLine, endLine, startNode, endNode, lineDiff)); + var newNodes = parseResult.newNodes, extStartNode = parseResult.extStartNode, extEndNode = parseResult.extEndNode; + var removedNodeRange = this.getRemovedNodeRange(extStartNode, extEndNode); + var nextNode = extEndNode ? extEndNode.next : this.root.firstChild; + if (this.referenceDefinition) { + this.markDeletedRefMap(extStartNode, extEndNode); + this.replaceRangeNodes(extStartNode, extEndNode, newNodes); + this.replaceWithNewRefDefState(newNodes); + } + else { + this.replaceRangeNodes(extStartNode, extEndNode, newNodes); + } + return { nodes: newNodes, removedNodeRange: removedNodeRange, nextNode: nextNode }; + }; + ToastMark.prototype.parseRefLink = function () { + var _this = this; + var result = []; + if (!isEmptyObj(this.refMap)) { + iterateObject(this.refMap, function (label, value) { + if (value.unlinked) { + delete _this.refMap[label]; + } + iterateObject(_this.refLinkCandidateMap, function (_, candidate) { + var node = candidate.node, refLabel = candidate.refLabel; + if (refLabel === label) { + result.push(_this.parse(node.sourcepos[0], node.sourcepos[1])); + } + }); + }); + } + return result; + }; + ToastMark.prototype.removeUnlinkedCandidate = function () { + if (!isEmptyObj(this.refDefCandidateMap)) { + [this.refLinkCandidateMap, this.refDefCandidateMap].forEach(function (candidateMap) { + iterateObject(candidateMap, function (id) { + if (isUnlinked(id)) { + delete candidateMap[id]; + } + }); + }); + } + }; + ToastMark.prototype.editMarkdown = function (startPos, endPos, newText) { + var lineDiff = this.updateLineTexts(startPos, endPos, newText); + var parseResult = this.parse(startPos, endPos, lineDiff); + var editResult = omit(parseResult, 'nextNode'); + updateNextLineNumbers(parseResult.nextNode, lineDiff); + this.updateRootNodeState(); + var result = [editResult]; + if (this.referenceDefinition) { + this.removeUnlinkedCandidate(); + this.replaceWithRefDefCandidate(); + result = result.concat(this.parseRefLink()); + } + this.trigger('change', result); + return result; + }; + ToastMark.prototype.getLineTexts = function () { + return this.lineTexts; + }; + ToastMark.prototype.getRootNode = function () { + return this.root; + }; + ToastMark.prototype.findNodeAtPosition = function (pos) { + var node = findNodeAtPosition(this.root, pos); + if (!node || node === this.root) { + return null; + } + return node; + }; + ToastMark.prototype.findFirstNodeAtLine = function (line) { + return findFirstNodeAtLine(this.root, line); + }; + ToastMark.prototype.on = function (eventName, callback) { + this.eventHandlerMap[eventName].push(callback); + }; + ToastMark.prototype.off = function (eventName, callback) { + var handlers = this.eventHandlerMap[eventName]; + var idx = handlers.indexOf(callback); + handlers.splice(idx, 1); + }; + ToastMark.prototype.findNodeById = function (id) { + return findNodeById(id); + }; + ToastMark.prototype.removeAllNode = function () { + removeAllNode(); + }; + return ToastMark; +}()); + +var disallowedTags = [ + 'title', + 'textarea', + 'style', + 'xmp', + 'iframe', + 'noembed', + 'noframes', + 'script', + 'plaintext', +]; +var reDisallowedTag = new RegExp("<(/?(?:" + disallowedTags.join('|') + ")[^>]*>)", 'ig'); +function filterDisallowedTags(str) { + if (reDisallowedTag.test(str)) { + return str.replace(reDisallowedTag, function (_, group) { return "<" + group; }); + } + return str; +} + +var CUSTOM_SYNTAX_LENGTH = 4; +var baseConvertors$1 = { + heading: function (node, _a) { + var entering = _a.entering; + return { + type: entering ? 'openTag' : 'closeTag', + tagName: "h" + node.level, + outerNewLine: true, + }; + }, + text: function (node) { + return { + type: 'text', + content: node.literal, + }; + }, + softbreak: function (_, _a) { + var options = _a.options; + return { + type: 'html', + content: options.softbreak, + }; + }, + linebreak: function () { + return { + type: 'html', + content: '
\n', + }; + }, + emph: function (_, _a) { + var entering = _a.entering; + return { + type: entering ? 'openTag' : 'closeTag', + tagName: 'em', + }; + }, + strong: function (_, _a) { + var entering = _a.entering; + return { + type: entering ? 'openTag' : 'closeTag', + tagName: 'strong', + }; + }, + paragraph: function (node, _a) { + var _b; + var entering = _a.entering; + var grandparent = (_b = node.parent) === null || _b === void 0 ? void 0 : _b.parent; + if (grandparent && grandparent.type === 'list') { + if (grandparent.listData.tight) { + return null; + } + } + return { + type: entering ? 'openTag' : 'closeTag', + tagName: 'p', + outerNewLine: true, + }; + }, + thematicBreak: function () { + return { + type: 'openTag', + tagName: 'hr', + outerNewLine: true, + selfClose: true, + }; + }, + blockQuote: function (_, _a) { + var entering = _a.entering; + return { + type: entering ? 'openTag' : 'closeTag', + tagName: 'blockquote', + outerNewLine: true, + innerNewLine: true, + }; + }, + list: function (node, _a) { + var entering = _a.entering; + var _b = node.listData, type = _b.type, start = _b.start; + var tagName = type === 'bullet' ? 'ul' : 'ol'; + var attributes = {}; + if (tagName === 'ol' && start !== null && start !== 1) { + attributes.start = start.toString(); + } + return { + type: entering ? 'openTag' : 'closeTag', + tagName: tagName, + attributes: attributes, + outerNewLine: true, + }; + }, + item: function (_, _a) { + var entering = _a.entering; + return { + type: entering ? 'openTag' : 'closeTag', + tagName: 'li', + outerNewLine: true, + }; + }, + htmlInline: function (node, _a) { + var options = _a.options; + var content = options.tagFilter ? filterDisallowedTags(node.literal) : node.literal; + return { type: 'html', content: content }; + }, + htmlBlock: function (node, _a) { + var options = _a.options; + var content = options.tagFilter ? filterDisallowedTags(node.literal) : node.literal; + if (options.nodeId) { + return [ + { type: 'openTag', tagName: 'div', outerNewLine: true }, + { type: 'html', content: content }, + { type: 'closeTag', tagName: 'div', outerNewLine: true }, + ]; + } + return { type: 'html', content: content, outerNewLine: true }; + }, + code: function (node) { + return [ + { type: 'openTag', tagName: 'code' }, + { type: 'text', content: node.literal }, + { type: 'closeTag', tagName: 'code' }, + ]; + }, + codeBlock: function (node) { + var infoStr = node.info; + var infoWords = infoStr ? infoStr.split(/\s+/) : []; + var codeClassNames = []; + if (infoWords.length > 0 && infoWords[0].length > 0) { + codeClassNames.push("language-" + escapeXml(infoWords[0])); + } + return [ + { type: 'openTag', tagName: 'pre', outerNewLine: true }, + { type: 'openTag', tagName: 'code', classNames: codeClassNames }, + { type: 'text', content: node.literal }, + { type: 'closeTag', tagName: 'code' }, + { type: 'closeTag', tagName: 'pre', outerNewLine: true }, + ]; + }, + link: function (node, _a) { + var entering = _a.entering; + if (entering) { + var _b = node, title = _b.title, destination = _b.destination; + return { + type: 'openTag', + tagName: 'a', + attributes: __assign({ href: escapeXml(destination) }, (title && { title: escapeXml(title) })), + }; + } + return { type: 'closeTag', tagName: 'a' }; + }, + image: function (node, _a) { + var getChildrenText = _a.getChildrenText, skipChildren = _a.skipChildren; + var _b = node, title = _b.title, destination = _b.destination; + skipChildren(); + return { + type: 'openTag', + tagName: 'img', + selfClose: true, + attributes: __assign({ src: escapeXml(destination), alt: getChildrenText(node) }, (title && { title: escapeXml(title) })), + }; + }, + customBlock: function (node, context, convertors) { + var info = node.info.trim().toLowerCase(); + var customConvertor = convertors[info]; + if (customConvertor) { + try { + return customConvertor(node, context); + } + catch (e) { + console.warn("[@toast-ui/editor] - The error occurred when " + info + " block node was parsed in markdown renderer: " + e); + } + } + return [ + { type: 'openTag', tagName: 'div', outerNewLine: true }, + { type: 'text', content: node.literal }, + { type: 'closeTag', tagName: 'div', outerNewLine: true }, + ]; + }, + frontMatter: function (node) { + return [ + { + type: 'openTag', + tagName: 'div', + outerNewLine: true, + // Because front matter is metadata, it should not be render. + attributes: { style: 'white-space: pre; display: none;' }, + }, + { type: 'text', content: node.literal }, + { type: 'closeTag', tagName: 'div', outerNewLine: true }, + ]; + }, + customInline: function (node, context, convertors) { + var _a = node, sourcepos = _a.sourcepos, info = _a.info; + var nomalizedInfo = info.trim().toLowerCase(); + var customConvertor = convertors[nomalizedInfo]; + var entering = context.entering; + if (customConvertor) { + try { + return customConvertor(node, context); + } + catch (e) { + console.warn("[@toast-ui/editor] - The error occurred when " + nomalizedInfo + " inline node was parsed in markdown renderer: " + e); + } + } + var text = sourcepos[1][1] - sourcepos[0][1] + 1 === info.length + CUSTOM_SYNTAX_LENGTH + ? '' + : info + " "; + return entering + ? [ + { type: 'openTag', tagName: 'span' }, + { type: 'text', content: "$$" + text }, + ] + : [ + { type: 'text', content: '$$' }, + { type: 'closeTag', tagName: 'span' }, + ]; + }, +}; + +var gfmConvertors = { + strike: function (_, _a) { + var entering = _a.entering; + return { + type: entering ? 'openTag' : 'closeTag', + tagName: 'del', + }; + }, + item: function (node, _a) { + var entering = _a.entering; + var _b = node.listData, checked = _b.checked, task = _b.task; + if (entering) { + var itemTag = { + type: 'openTag', + tagName: 'li', + outerNewLine: true, + }; + if (task) { + return [ + itemTag, + { + type: 'openTag', + tagName: 'input', + selfClose: true, + attributes: __assign(__assign({}, (checked && { checked: '' })), { disabled: '', type: 'checkbox' }), + }, + { + type: 'text', + content: ' ', + }, + ]; + } + return itemTag; + } + return { + type: 'closeTag', + tagName: 'li', + outerNewLine: true, + }; + }, + table: function (_, _a) { + var entering = _a.entering; + return { + type: entering ? 'openTag' : 'closeTag', + tagName: 'table', + outerNewLine: true, + }; + }, + tableHead: function (_, _a) { + var entering = _a.entering; + return { + type: entering ? 'openTag' : 'closeTag', + tagName: 'thead', + outerNewLine: true, + }; + }, + tableBody: function (_, _a) { + var entering = _a.entering; + return { + type: entering ? 'openTag' : 'closeTag', + tagName: 'tbody', + outerNewLine: true, + }; + }, + tableRow: function (node, _a) { + var entering = _a.entering; + if (entering) { + return { + type: 'openTag', + tagName: 'tr', + outerNewLine: true, + }; + } + var result = []; + if (node.lastChild) { + var columnLen = node.parent.parent.columns.length; + var lastColIdx = node.lastChild.endIdx; + for (var i = lastColIdx + 1; i < columnLen; i += 1) { + result.push({ + type: 'openTag', + tagName: 'td', + outerNewLine: true, + }, { + type: 'closeTag', + tagName: 'td', + outerNewLine: true, + }); + } + } + result.push({ + type: 'closeTag', + tagName: 'tr', + outerNewLine: true, + }); + return result; + }, + tableCell: function (node, _a) { + var entering = _a.entering; + if (node.ignored) { + return { + type: 'text', + content: '', + }; + } + var tablePart = node.parent.parent; + var tagName = tablePart.type === 'tableHead' ? 'th' : 'td'; + var table = tablePart.parent; + var columnInfo = table.columns[node.startIdx]; + var attributes = (columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.align) ? { align: columnInfo.align } : null; + if (entering) { + return __assign({ type: 'openTag', tagName: tagName, outerNewLine: true }, (attributes && { attributes: attributes })); + } + return { + type: 'closeTag', + tagName: tagName, + outerNewLine: true, + }; + }, +}; + +var defaultOptions = { + softbreak: '\n', + gfm: false, + tagFilter: false, + nodeId: false, +}; +function getChildrenText(node) { + var buffer = []; + var walker = node.walker(); + var event = null; + while ((event = walker.next())) { + var node_1 = event.node; + if (node_1.type === 'text') { + buffer.push(node_1.literal); + } + } + return buffer.join(''); +} +var Renderer = /** @class */ (function () { + function Renderer(customOptions) { + this.buffer = []; + this.options = __assign(__assign({}, defaultOptions), customOptions); + this.convertors = this.createConvertors(); + delete this.options.convertors; + } + Renderer.prototype.createConvertors = function () { + var convertors = __assign({}, baseConvertors$1); + if (this.options.gfm) { + convertors = __assign(__assign({}, convertors), gfmConvertors); + } + if (this.options.convertors) { + var customConvertors_1 = this.options.convertors; + var nodeTypes = Object.keys(customConvertors_1); + var defaultConvertors_1 = __assign(__assign({}, baseConvertors$1), gfmConvertors); + nodeTypes.forEach(function (nodeType) { + var orgConvertor = convertors[nodeType]; + var convertor = customConvertors_1[nodeType]; + var convertorType = Object.keys(defaultConvertors_1).indexOf(nodeType) === -1 + ? nodeType.toLowerCase() + : nodeType; + if (orgConvertor) { + convertors[convertorType] = function (node, context, convertors) { + context.origin = function () { return orgConvertor(node, context, convertors); }; + return convertor(node, context); + }; + } + else { + convertors[convertorType] = convertor; + } + }); + } + return convertors; + }; + Renderer.prototype.getConvertors = function () { + return this.convertors; + }; + Renderer.prototype.getOptions = function () { + return this.options; + }; + Renderer.prototype.render = function (rootNode) { + var _this = this; + this.buffer = []; + var walker = rootNode.walker(); + var event = null; + var _loop_1 = function () { + var node = event.node, entering = event.entering; + var convertor = this_1.convertors[node.type]; + if (!convertor) { + return "continue"; + } + var skipped = false; + var context = { + entering: entering, + leaf: !isContainer$1(node), + options: this_1.options, + getChildrenText: getChildrenText, + skipChildren: function () { + skipped = true; + }, + }; + var converted = isCustomBlock(node) || isCustomInline(node) + ? convertor(node, context, this_1.convertors) + : convertor(node, context); + if (converted) { + var htmlNodes = Array.isArray(converted) ? converted : [converted]; + htmlNodes.forEach(function (htmlNode, index) { + if (htmlNode.type === 'openTag' && _this.options.nodeId && index === 0) { + if (!htmlNode.attributes) { + htmlNode.attributes = {}; + } + htmlNode.attributes['data-nodeid'] = String(node.id); + } + _this.renderHTMLNode(htmlNode); + }); + if (skipped) { + walker.resumeAt(node, false); + walker.next(); + } + } + }; + var this_1 = this; + while ((event = walker.next())) { + _loop_1(); + } + this.addNewLine(); + return this.buffer.join(''); + }; + Renderer.prototype.renderHTMLNode = function (node) { + switch (node.type) { + case 'openTag': + case 'closeTag': + this.renderElementNode(node); + break; + case 'text': + this.renderTextNode(node); + break; + case 'html': + this.renderRawHtmlNode(node); + break; + // no-default-case + } + }; + Renderer.prototype.generateOpenTagString = function (node) { + var _this = this; + var tagName = node.tagName, classNames = node.classNames, attributes = node.attributes; + this.buffer.push("<" + tagName); + if (classNames && classNames.length > 0) { + this.buffer.push(" class=\"" + classNames.join(' ') + "\""); + } + if (attributes) { + Object.keys(attributes).forEach(function (attrName) { + var attrValue = attributes[attrName]; + _this.buffer.push(" " + attrName + "=\"" + attrValue + "\""); + }); + } + if (node.selfClose) { + this.buffer.push(' /'); + } + this.buffer.push('>'); + }; + Renderer.prototype.generateCloseTagString = function (_a) { + var tagName = _a.tagName; + this.buffer.push(""); + }; + Renderer.prototype.addNewLine = function () { + if (this.buffer.length && last(last(this.buffer)) !== '\n') { + this.buffer.push('\n'); + } + }; + Renderer.prototype.addOuterNewLine = function (node) { + if (node.outerNewLine) { + this.addNewLine(); + } + }; + Renderer.prototype.addInnerNewLine = function (node) { + if (node.innerNewLine) { + this.addNewLine(); + } + }; + Renderer.prototype.renderTextNode = function (node) { + this.buffer.push(escapeXml(node.content)); + }; + Renderer.prototype.renderRawHtmlNode = function (node) { + this.addOuterNewLine(node); + this.buffer.push(node.content); + this.addOuterNewLine(node); + }; + Renderer.prototype.renderElementNode = function (node) { + if (node.type === 'openTag') { + this.addOuterNewLine(node); + this.generateOpenTagString(node); + if (node.selfClose) { + this.addOuterNewLine(node); + } + else { + this.addInnerNewLine(node); + } + } + else { + this.addInnerNewLine(node); + this.generateCloseTagString(node); + this.addOuterNewLine(node); + } + }; + return Renderer; +}()); + +/*! @license DOMPurify 2.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.3/LICENSE */ + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var hasOwnProperty = Object.hasOwnProperty, + setPrototypeOf = Object.setPrototypeOf, + isFrozen = Object.isFrozen, + getPrototypeOf = Object.getPrototypeOf, + getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var freeze = Object.freeze, + seal = Object.seal, + create = Object.create; // eslint-disable-line import/no-mutable-exports + +var _ref = typeof Reflect !== 'undefined' && Reflect, + apply = _ref.apply, + construct = _ref.construct; + +if (!apply) { + apply = function apply(fun, thisValue, args) { + return fun.apply(thisValue, args); + }; +} + +if (!freeze) { + freeze = function freeze(x) { + return x; + }; +} + +if (!seal) { + seal = function seal(x) { + return x; + }; +} + +if (!construct) { + construct = function construct(Func, args) { + return new (Function.prototype.bind.apply(Func, [null].concat(_toConsumableArray(args))))(); + }; +} + +var arrayForEach = unapply(Array.prototype.forEach); +var arrayPop = unapply(Array.prototype.pop); +var arrayPush = unapply(Array.prototype.push); + +var stringToLowerCase = unapply(String.prototype.toLowerCase); +var stringMatch = unapply(String.prototype.match); +var stringReplace = unapply(String.prototype.replace); +var stringIndexOf = unapply(String.prototype.indexOf); +var stringTrim = unapply(String.prototype.trim); + +var regExpTest = unapply(RegExp.prototype.test); + +var typeErrorCreate = unconstruct(TypeError); + +function unapply(func) { + return function (thisArg) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + return apply(func, thisArg, args); + }; +} + +function unconstruct(func) { + return function () { + for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + return construct(func, args); + }; +} + +/* Add properties to a lookup table */ +function addToSet(set, array) { + if (setPrototypeOf) { + // Make 'in' and truthy checks like Boolean(set.constructor) + // independent of any properties defined on Object.prototype. + // Prevent prototype setters from intercepting set as a this value. + setPrototypeOf(set, null); + } + + var l = array.length; + while (l--) { + var element = array[l]; + if (typeof element === 'string') { + var lcElement = stringToLowerCase(element); + if (lcElement !== element) { + // Config presets (e.g. tags.js, attrs.js) are immutable. + if (!isFrozen(array)) { + array[l] = lcElement; + } + + element = lcElement; + } + } + + set[element] = true; + } + + return set; +} + +/* Shallow clone an object */ +function clone(object) { + var newObject = create(null); + + var property = void 0; + for (property in object) { + if (apply(hasOwnProperty, object, [property])) { + newObject[property] = object[property]; + } + } + + return newObject; +} + +/* IE10 doesn't support __lookupGetter__ so lets' + * simulate it. It also automatically checks + * if the prop is function or getter and behaves + * accordingly. */ +function lookupGetter(object, prop) { + while (object !== null) { + var desc = getOwnPropertyDescriptor(object, prop); + if (desc) { + if (desc.get) { + return unapply(desc.get); + } + + if (typeof desc.value === 'function') { + return unapply(desc.value); + } + } + + object = getPrototypeOf(object); + } + + function fallbackValue(element) { + console.warn('fallback value for', element); + return null; + } + + return fallbackValue; +} + +var html$2 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); + +// SVG +var svg = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); + +var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); + +// List of SVG elements that are disallowed by default. +// We still need to know them so that we can do namespace +// checks properly in case one wants to add them to +// allow-list. +var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'feimage', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']); + +var mathMl = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); + +// Similarly to SVG, we want to know all MathML elements, +// even those that we disallow by default. +var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); + +var text = freeze(['#text']); + +var html$1$1 = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']); + +var svg$1 = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); + +var mathMl$1 = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); + +var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); + +// eslint-disable-next-line unicorn/better-regex +var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode +var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm); +var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape +var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape +var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape +); +var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); +var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex +); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +function _toConsumableArray$1(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var getGlobal = function getGlobal() { + return typeof window === 'undefined' ? null : window; +}; + +/** + * Creates a no-op policy for internal use only. + * Don't export this function outside this module! + * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. + * @param {Document} document The document object (to determine policy name suffix) + * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types + * are not supported). + */ +var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) { + if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') { + return null; + } + + // Allow the callers to control the unique policy name + // by adding a data-tt-policy-suffix to the script element with the DOMPurify. + // Policy creation with duplicate names throws in Trusted Types. + var suffix = null; + var ATTR_NAME = 'data-tt-policy-suffix'; + if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) { + suffix = document.currentScript.getAttribute(ATTR_NAME); + } + + var policyName = 'dompurify' + (suffix ? '#' + suffix : ''); + + try { + return trustedTypes.createPolicy(policyName, { + createHTML: function createHTML(html$$1) { + return html$$1; + } + }); + } catch (_) { + // Policy creation failed (most likely another DOMPurify script has + // already run). Skip creating the policy, as this will only cause errors + // if TT are enforced. + console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); + return null; + } +}; + +function createDOMPurify() { + var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); + + var DOMPurify = function DOMPurify(root) { + return createDOMPurify(root); + }; + + /** + * Version label, exposed for easier checks + * if DOMPurify is up to date or not + */ + DOMPurify.version = '2.3.3'; + + /** + * Array of elements that DOMPurify removed during sanitation. + * Empty if nothing was removed. + */ + DOMPurify.removed = []; + + if (!window || !window.document || window.document.nodeType !== 9) { + // Not running in a browser, provide a factory function + // so that you can pass your own Window + DOMPurify.isSupported = false; + + return DOMPurify; + } + + var originalDocument = window.document; + + var document = window.document; + var DocumentFragment = window.DocumentFragment, + HTMLTemplateElement = window.HTMLTemplateElement, + Node = window.Node, + Element = window.Element, + NodeFilter = window.NodeFilter, + _window$NamedNodeMap = window.NamedNodeMap, + NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, + Text = window.Text, + Comment = window.Comment, + DOMParser = window.DOMParser, + trustedTypes = window.trustedTypes; + + + var ElementPrototype = Element.prototype; + + var cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); + var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); + var getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); + var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); + + // As per issue #47, the web-components registry is inherited by a + // new document created via createHTMLDocument. As per the spec + // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) + // a new empty registry is used when creating a template contents owner + // document, so we use that as our parent document to ensure nothing + // is inherited. + if (typeof HTMLTemplateElement === 'function') { + var template = document.createElement('template'); + if (template.content && template.content.ownerDocument) { + document = template.content.ownerDocument; + } + } + + var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); + var emptyHTML = trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML('') : ''; + + var _document = document, + implementation = _document.implementation, + createNodeIterator = _document.createNodeIterator, + createDocumentFragment = _document.createDocumentFragment, + getElementsByTagName = _document.getElementsByTagName; + var importNode = originalDocument.importNode; + + + var documentMode = {}; + try { + documentMode = clone(document).documentMode ? document.documentMode : {}; + } catch (_) {} + + var hooks = {}; + + /** + * Expose whether this browser supports running the full DOMPurify. + */ + DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9; + + var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR, + ERB_EXPR$$1 = ERB_EXPR, + DATA_ATTR$$1 = DATA_ATTR, + ARIA_ATTR$$1 = ARIA_ATTR, + IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA, + ATTR_WHITESPACE$$1 = ATTR_WHITESPACE; + var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI; + + /** + * We consider the elements and attributes below to be safe. Ideally + * don't add any new ones but feel free to remove unwanted ones. + */ + + /* allowed element names */ + + var ALLOWED_TAGS = null; + var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(html$2), _toConsumableArray$1(svg), _toConsumableArray$1(svgFilters), _toConsumableArray$1(mathMl), _toConsumableArray$1(text))); + + /* Allowed attribute names */ + var ALLOWED_ATTR = null; + var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray$1(html$1$1), _toConsumableArray$1(svg$1), _toConsumableArray$1(mathMl$1), _toConsumableArray$1(xml))); + + /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ + var FORBID_TAGS = null; + + /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ + var FORBID_ATTR = null; + + /* Decide if ARIA attributes are okay */ + var ALLOW_ARIA_ATTR = true; + + /* Decide if custom data attributes are okay */ + var ALLOW_DATA_ATTR = true; + + /* Decide if unknown protocols are okay */ + var ALLOW_UNKNOWN_PROTOCOLS = false; + + /* Output should be safe for common template engines. + * This means, DOMPurify removes data attributes, mustaches and ERB + */ + var SAFE_FOR_TEMPLATES = false; + + /* Decide if document with ... should be returned */ + var WHOLE_DOCUMENT = false; + + /* Track whether config is already set on this instance of DOMPurify. */ + var SET_CONFIG = false; + + /* Decide if all elements (e.g. style, script) must be children of + * document.body. By default, browsers might move them to document.head */ + var FORCE_BODY = false; + + /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html + * string (or a TrustedHTML object if Trusted Types are supported). + * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead + */ + var RETURN_DOM = false; + + /* Decide if a DOM `DocumentFragment` should be returned, instead of a html + * string (or a TrustedHTML object if Trusted Types are supported) */ + var RETURN_DOM_FRAGMENT = false; + + /* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM + * `Node` is imported into the current `Document`. If this flag is not enabled the + * `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by + * DOMPurify. + * + * This defaults to `true` starting DOMPurify 2.2.0. Note that setting it to `false` + * might cause XSS from attacks hidden in closed shadowroots in case the browser + * supports Declarative Shadow: DOM https://web.dev/declarative-shadow-dom/ + */ + var RETURN_DOM_IMPORT = true; + + /* Try to return a Trusted Type object instead of a string, return a string in + * case Trusted Types are not supported */ + var RETURN_TRUSTED_TYPE = false; + + /* Output should be free from DOM clobbering attacks? */ + var SANITIZE_DOM = true; + + /* Keep element content when removing element? */ + var KEEP_CONTENT = true; + + /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead + * of importing it into a new Document and returning a sanitized copy */ + var IN_PLACE = false; + + /* Allow usage of profiles like html, svg and mathMl */ + var USE_PROFILES = {}; + + /* Tags to ignore content of when KEEP_CONTENT is true */ + var FORBID_CONTENTS = null; + var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); + + /* Tags that are safe for data: URIs */ + var DATA_URI_TAGS = null; + var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); + + /* Attributes safe for values like "javascript:" */ + var URI_SAFE_ATTRIBUTES = null; + var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); + + var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; + var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; + var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; + /* Document namespace */ + var NAMESPACE = HTML_NAMESPACE; + var IS_EMPTY_INPUT = false; + + /* Parsing of strict XHTML documents */ + var PARSER_MEDIA_TYPE = void 0; + var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html']; + var DEFAULT_PARSER_MEDIA_TYPE = 'text/html'; + var transformCaseFunc = void 0; + + /* Keep a reference to config to pass to hooks */ + var CONFIG = null; + + /* Ideally, do not touch anything below this line */ + /* ______________________________________________ */ + + var formElement = document.createElement('form'); + + /** + * _parseConfig + * + * @param {Object} cfg optional config literal + */ + // eslint-disable-next-line complexity + var _parseConfig = function _parseConfig(cfg) { + if (CONFIG && CONFIG === cfg) { + return; + } + + /* Shield configuration object from tampering */ + if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') { + cfg = {}; + } + + /* Shield configuration object from prototype pollution */ + cfg = clone(cfg); + + /* Set configuration parameters */ + ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS; + ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR; + URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES; + DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS; + FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS; + FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {}; + FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {}; + USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; + ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true + ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true + ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false + SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false + WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false + RETURN_DOM = cfg.RETURN_DOM || false; // Default false + RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false + RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT !== false; // Default true + RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false + FORCE_BODY = cfg.FORCE_BODY || false; // Default false + SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true + KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true + IN_PLACE = cfg.IN_PLACE || false; // Default false + IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1; + NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; + + PARSER_MEDIA_TYPE = + // eslint-disable-next-line unicorn/prefer-includes + SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; + + // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is. + transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) { + return x; + } : stringToLowerCase; + + if (SAFE_FOR_TEMPLATES) { + ALLOW_DATA_ATTR = false; + } + + if (RETURN_DOM_FRAGMENT) { + RETURN_DOM = true; + } + + /* Parse profile info */ + if (USE_PROFILES) { + ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(text))); + ALLOWED_ATTR = []; + if (USE_PROFILES.html === true) { + addToSet(ALLOWED_TAGS, html$2); + addToSet(ALLOWED_ATTR, html$1$1); + } + + if (USE_PROFILES.svg === true) { + addToSet(ALLOWED_TAGS, svg); + addToSet(ALLOWED_ATTR, svg$1); + addToSet(ALLOWED_ATTR, xml); + } + + if (USE_PROFILES.svgFilters === true) { + addToSet(ALLOWED_TAGS, svgFilters); + addToSet(ALLOWED_ATTR, svg$1); + addToSet(ALLOWED_ATTR, xml); + } + + if (USE_PROFILES.mathMl === true) { + addToSet(ALLOWED_TAGS, mathMl); + addToSet(ALLOWED_ATTR, mathMl$1); + addToSet(ALLOWED_ATTR, xml); + } + } + + /* Merge configuration parameters */ + if (cfg.ADD_TAGS) { + if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { + ALLOWED_TAGS = clone(ALLOWED_TAGS); + } + + addToSet(ALLOWED_TAGS, cfg.ADD_TAGS); + } + + if (cfg.ADD_ATTR) { + if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { + ALLOWED_ATTR = clone(ALLOWED_ATTR); + } + + addToSet(ALLOWED_ATTR, cfg.ADD_ATTR); + } + + if (cfg.ADD_URI_SAFE_ATTR) { + addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR); + } + + if (cfg.FORBID_CONTENTS) { + if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { + FORBID_CONTENTS = clone(FORBID_CONTENTS); + } + + addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS); + } + + /* Add #text in case KEEP_CONTENT is set to true */ + if (KEEP_CONTENT) { + ALLOWED_TAGS['#text'] = true; + } + + /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ + if (WHOLE_DOCUMENT) { + addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); + } + + /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ + if (ALLOWED_TAGS.table) { + addToSet(ALLOWED_TAGS, ['tbody']); + delete FORBID_TAGS.tbody; + } + + // Prevent further manipulation of configuration. + // Not available in IE8, Safari 5, etc. + if (freeze) { + freeze(cfg); + } + + CONFIG = cfg; + }; + + var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); + + var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); + + /* Keep track of all possible SVG and MathML tags + * so that we can perform the namespace checks + * correctly. */ + var ALL_SVG_TAGS = addToSet({}, svg); + addToSet(ALL_SVG_TAGS, svgFilters); + addToSet(ALL_SVG_TAGS, svgDisallowed); + + var ALL_MATHML_TAGS = addToSet({}, mathMl); + addToSet(ALL_MATHML_TAGS, mathMlDisallowed); + + /** + * + * + * @param {Element} element a DOM element whose namespace is being checked + * @returns {boolean} Return false if the element has a + * namespace that a spec-compliant parser would never + * return. Return true otherwise. + */ + var _checkValidNamespace = function _checkValidNamespace(element) { + var parent = getParentNode(element); + + // In JSDOM, if we're inside shadow DOM, then parentNode + // can be null. We just simulate parent in this case. + if (!parent || !parent.tagName) { + parent = { + namespaceURI: HTML_NAMESPACE, + tagName: 'template' + }; + } + + var tagName = stringToLowerCase(element.tagName); + var parentTagName = stringToLowerCase(parent.tagName); + + if (element.namespaceURI === SVG_NAMESPACE) { + // The only way to switch from HTML namespace to SVG + // is via . If it happens via any other tag, then + // it should be killed. + if (parent.namespaceURI === HTML_NAMESPACE) { + return tagName === 'svg'; + } + + // The only way to switch from MathML to SVG is via + // svg if parent is either or MathML + // text integration points. + if (parent.namespaceURI === MATHML_NAMESPACE) { + return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); + } + + // We only allow elements that are defined in SVG + // spec. All others are disallowed in SVG namespace. + return Boolean(ALL_SVG_TAGS[tagName]); + } + + if (element.namespaceURI === MATHML_NAMESPACE) { + // The only way to switch from HTML namespace to MathML + // is via . If it happens via any other tag, then + // it should be killed. + if (parent.namespaceURI === HTML_NAMESPACE) { + return tagName === 'math'; + } + + // The only way to switch from SVG to MathML is via + // and HTML integration points + if (parent.namespaceURI === SVG_NAMESPACE) { + return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; + } + + // We only allow elements that are defined in MathML + // spec. All others are disallowed in MathML namespace. + return Boolean(ALL_MATHML_TAGS[tagName]); + } + + if (element.namespaceURI === HTML_NAMESPACE) { + // The only way to switch from SVG to HTML is via + // HTML integration points, and from MathML to HTML + // is via MathML text integration points + if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { + return false; + } + + if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { + return false; + } + + // Certain elements are allowed in both SVG and HTML + // namespace. We need to specify them explicitly + // so that they don't get erronously deleted from + // HTML namespace. + var commonSvgAndHTMLElements = addToSet({}, ['title', 'style', 'font', 'a', 'script']); + + // We disallow tags that are specific for MathML + // or SVG and should never appear in HTML namespace + return !ALL_MATHML_TAGS[tagName] && (commonSvgAndHTMLElements[tagName] || !ALL_SVG_TAGS[tagName]); + } + + // The code should never reach this place (this means + // that the element somehow got namespace that is not + // HTML, SVG or MathML). Return false just in case. + return false; + }; + + /** + * _forceRemove + * + * @param {Node} node a DOM node + */ + var _forceRemove = function _forceRemove(node) { + arrayPush(DOMPurify.removed, { element: node }); + try { + // eslint-disable-next-line unicorn/prefer-dom-node-remove + node.parentNode.removeChild(node); + } catch (_) { + try { + node.outerHTML = emptyHTML; + } catch (_) { + node.remove(); + } + } + }; + + /** + * _removeAttribute + * + * @param {String} name an Attribute name + * @param {Node} node a DOM node + */ + var _removeAttribute = function _removeAttribute(name, node) { + try { + arrayPush(DOMPurify.removed, { + attribute: node.getAttributeNode(name), + from: node + }); + } catch (_) { + arrayPush(DOMPurify.removed, { + attribute: null, + from: node + }); + } + + node.removeAttribute(name); + + // We void attribute values for unremovable "is"" attributes + if (name === 'is' && !ALLOWED_ATTR[name]) { + if (RETURN_DOM || RETURN_DOM_FRAGMENT) { + try { + _forceRemove(node); + } catch (_) {} + } else { + try { + node.setAttribute(name, ''); + } catch (_) {} + } + } + }; + + /** + * _initDocument + * + * @param {String} dirty a string of dirty markup + * @return {Document} a DOM, filled with the dirty markup + */ + var _initDocument = function _initDocument(dirty) { + /* Create a HTML document */ + var doc = void 0; + var leadingWhitespace = void 0; + + if (FORCE_BODY) { + dirty = '' + dirty; + } else { + /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ + var matches = stringMatch(dirty, /^[\r\n\t ]+/); + leadingWhitespace = matches && matches[0]; + } + + if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') { + // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict) + dirty = '' + dirty + ''; + } + + var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; + /* + * Use the DOMParser API by default, fallback later if needs be + * DOMParser not work for svg when has multiple root element. + */ + if (NAMESPACE === HTML_NAMESPACE) { + try { + doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); + } catch (_) {} + } + + /* Use createHTMLDocument in case DOMParser is not available */ + if (!doc || !doc.documentElement) { + doc = implementation.createDocument(NAMESPACE, 'template', null); + try { + doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload; + } catch (_) { + // Syntax error if dirtyPayload is invalid xml + } + } + + var body = doc.body || doc.documentElement; + + if (dirty && leadingWhitespace) { + body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); + } + + /* Work on whole document or just its body */ + if (NAMESPACE === HTML_NAMESPACE) { + return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; + } + + return WHOLE_DOCUMENT ? doc.documentElement : body; + }; + + /** + * _createIterator + * + * @param {Document} root document/fragment to create iterator for + * @return {Iterator} iterator instance + */ + var _createIterator = function _createIterator(root) { + return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false); + }; + + /** + * _isClobbered + * + * @param {Node} elm element to check for clobbering attacks + * @return {Boolean} true if clobbered, false if safe + */ + var _isClobbered = function _isClobbered(elm) { + if (elm instanceof Text || elm instanceof Comment) { + return false; + } + + if (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function') { + return true; + } + + return false; + }; + + /** + * _isNode + * + * @param {Node} obj object to check whether it's a DOM node + * @return {Boolean} true is object is a DOM node + */ + var _isNode = function _isNode(object) { + return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? object instanceof Node : object && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'; + }; + + /** + * _executeHook + * Execute user configurable hooks + * + * @param {String} entryPoint Name of the hook's entry point + * @param {Node} currentNode node to work on with the hook + * @param {Object} data additional hook parameters + */ + var _executeHook = function _executeHook(entryPoint, currentNode, data) { + if (!hooks[entryPoint]) { + return; + } + + arrayForEach(hooks[entryPoint], function (hook) { + hook.call(DOMPurify, currentNode, data, CONFIG); + }); + }; + + /** + * _sanitizeElements + * + * @protect nodeName + * @protect textContent + * @protect removeChild + * + * @param {Node} currentNode to check for permission to exist + * @return {Boolean} true if node was killed, false if left alive + */ + var _sanitizeElements = function _sanitizeElements(currentNode) { + var content = void 0; + + /* Execute a hook if present */ + _executeHook('beforeSanitizeElements', currentNode, null); + + /* Check if element is clobbered or can clobber */ + if (_isClobbered(currentNode)) { + _forceRemove(currentNode); + return true; + } + + /* Check if tagname contains Unicode */ + if (stringMatch(currentNode.nodeName, /[\u0080-\uFFFF]/)) { + _forceRemove(currentNode); + return true; + } + + /* Now let's check the element's type and name */ + var tagName = transformCaseFunc(currentNode.nodeName); + + /* Execute a hook if present */ + _executeHook('uponSanitizeElement', currentNode, { + tagName: tagName, + allowedTags: ALLOWED_TAGS + }); + + /* Detect mXSS attempts abusing namespace confusion */ + if (!_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { + _forceRemove(currentNode); + return true; + } + + /* Mitigate a problem with templates inside select */ + if (tagName === 'select' && regExpTest(/