diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 2a990b8c..00000000 --- a/.babelrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "presets": ["@babel/preset-env"], - "plugins": ["@babel/plugin-transform-private-methods"] -} diff --git a/README.md b/README.md index bfa2674f..be9e5895 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,30 @@ +The CodeMirror extension provides syntax highlighting in MediaWiki wikitext editors using +the [CodeMirror library](https://codemirror.net/). + CodeMirror 6 homepage: [https://www.mediawiki.org/wiki/Extension:CodeMirror/6](https://www.mediawiki.org/wiki/Extension:CodeMirror/6) +JS documentation: [https://doc.wikimedia.org/CodeMirror](https://doc.wikimedia.org/CodeMirror) + ## Development -As part of the [upgrade to CodeMirror 6](https://phabricator.wikimedia.org/T259059), -CodeMirror now uses an asset bundler, so during development you'll need to run a script -to assemble the frontend assets. +### Preface + +Extension:CodeMirror is currently in the process of being upgraded to the new major version, CodeMirror 6. +See the [change log](https://www.mediawiki.org/wiki/Extension:CodeMirror/6#Change_log) for details. Use of CodeMirror 6 is controlled by the `wgCodeMirrorV6` configuration setting, or by passing in `cm6enable=1` in the URL query string. -You can find the v6 frontend source files in `src/`, the compiled sources in -`resources/dist/`, and other frontend assets managed by ResourceLoader in -`resources/*`. +CodeMirror 6 requires the use of NPM to bundle the dependencies. These are bundled in +[resources/codemirror.bundle.js](resources/codemirror.bundle.js), built using [Rollup](https://rollupjs.org/), +and packaged as the `ext.CodeMirror.v6.lib` ResourceLoader module. If you make changes to the +versions of the dependencies, you will need to run `npm run build` to update the ResourceLoader module. -### Commands +### NPM commands _NOTE: Consider using [Fresh](https://gerrit.wikimedia.org/g/fresh/) to run these tasks._ * `npm install` to install dependencies. -* `npm start` to run the bundler in watch mode, reassembling the files on file change. - You'll want to keep this running in a separate terminal during development. -* `npm run build` to compile the production assets. You *must* run this step before - sending the patch or CI will fail (so that sources and built assets are in sync). * `npm run doc` to generate the API documentation. * `npm test` to run the linting tools, JavaScript unit tests, and build checks. * `npm run test:lint` for linting of JS/LESS/CSS. @@ -30,9 +33,8 @@ _NOTE: Consider using [Fresh](https://gerrit.wikimedia.org/g/fresh/) to run thes * `npm run test:i18n` for linting of i18n messages with banana-checker. * `npm run test:unit` for the new Jest unit tests. * `npm run selenium-test` for the Selenium tests. +* `npm run build` to rebundle the CodeMirror library. If changes are made to the `@codemirror` + or `@lezer` dependencies in [package.json](package.json), this command *must* be run before + sending the patch or CI will fail. * Older QUnit tests are in `resources/mode/mediawiki/tests/qunit/`. These have been - replaced and will be removed after the CodeMirror 6 upgrade. - -## CodeMirror 6 change log - -* See [Extension:CodeMirror/6](https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:CodeMirror/6#Differences_from_CodeMirror_5) + replaced and will be removed after the CodeMirror 6 upgrade is complete. diff --git a/extension.json b/extension.json index f969e2c3..adb55a9d 100644 --- a/extension.json +++ b/extension.json @@ -1,11 +1,12 @@ { "name": "CodeMirror", - "version": "5.0.0", + "version": "6.0.0", "author": [ "[https://www.mediawiki.org/wiki/User:Pastakhov Pavel Astakhov]", "[https://www.mediawiki.org/wiki/User:Florianschmidtwelzow Florian Schmidt]", "Marijn Haverbeke", "MusikAnimal", + "Bhsd", "[https://raw.githubusercontent.com/codemirror/CodeMirror/master/AUTHORS CodeMirror contributors]" ], "url": "https://www.mediawiki.org/wiki/Extension:CodeMirror", @@ -58,9 +59,9 @@ "user.options" ], "packageFiles": [ - "ext.CodeMirror.js", + "legacy/ext.CodeMirror.js", { - "name": "ext.CodeMirror.data.js", + "name": "legacy/ext.CodeMirror.data.js", "callback": "MediaWiki\\Extension\\CodeMirror\\DataScript::makeScript" } ] @@ -74,10 +75,10 @@ "oojs-ui.styles.icons-editing-styling" ], "packageFiles": [ - "ext.CodeMirror.WikiEditor.js" + "legacy/ext.CodeMirror.WikiEditor.js" ], "styles": [ - "ext.CodeMirror.less" + "legacy/ext.CodeMirror.less" ], "messages": [ "codemirror-toggle-label" @@ -89,22 +90,22 @@ ], "styles": [ "lib/codemirror/lib/codemirror.css", - "lib/codemirror-fixes.less" + "legacy/codemirror-fixes.less" ] }, "ext.CodeMirror.addons": { "scripts": [ - "addon/edit/matchbrackets-wmde.js" + "legacy/addon/matchbrackets-wmde.js" ], "dependencies": [ "ext.CodeMirror.lib" ] }, "ext.CodeMirror.mode.mediawiki": { - "packageFiles": "mode/mediawiki/mediawiki.js", + "packageFiles": "legacy/mode/mediawiki/mediawiki.js", "styles": [ - "mode/mediawiki/mediawiki.less", - "mode/mediawiki/colorblind-colors.less" + "codemirror.mediawiki.less", + "codemirror.mediawiki.colorblind.less" ], "dependencies": [ "ext.CodeMirror.lib" @@ -160,11 +161,11 @@ "ext.CodeMirror" ], "scripts": [ - "modules/ve-cm/ve.ui.CodeMirrorAction.js", - "modules/ve-cm/ve.ui.CodeMirrorTool.js" + "legacy/modules/ve-cm/ve.ui.CodeMirrorAction.js", + "legacy/modules/ve-cm/ve.ui.CodeMirrorTool.js" ], "styles": [ - "modules/ve-cm/ve.ui.CodeMirror.less" + "legacy/modules/ve-cm/ve.ui.CodeMirror.less" ], "messages": [ "codemirror-toggle-label" @@ -172,21 +173,21 @@ }, "ext.CodeMirror.v6": { "dependencies": [ - "web2017-polyfills", "mediawiki.api", "mediawiki.user", "user.options", "ext.CodeMirror.v6.lib" ], "packageFiles": [ - "dist/codemirror.js", + "codemirror.js", + "codemirror.textSelection.js", { "name": "ext.CodeMirror.data.js", "callback": "MediaWiki\\Extension\\CodeMirror\\DataScript::makeScript" } ], "styles": [ - "ext.CodeMirror.v6.less" + "codemirror.less" ], "messages": [ "codemirror-find", @@ -234,22 +235,24 @@ "ext.CodeMirror.v6.mode.mediawiki" ], "packageFiles": [ - "dist/codemirror.mediawiki.js" + "codemirror.mediawiki.init.js" ] }, "ext.CodeMirror.v6.lib": { "packageFiles": [ - "dist/vendor.js" - ], - "dependencies": [ - "web2017-polyfills" + "lib/codemirror6.bundle.dist.js" ] }, "ext.CodeMirror.v6.mode.mediawiki": { - "packageFiles": "dist/codemirror.mode.mediawiki.js", + "packageFiles": [ + "codemirror.mediawiki.js", + "codemirror.mediawiki.config.js", + "codemirror.mediawiki.bidiIsolation.js", + "codemirror.mediawiki.templateFolding.js" + ], "styles": [ - "mode/mediawiki/mediawiki.less", - "mode/mediawiki/colorblind-colors.less" + "codemirror.mediawiki.less", + "codemirror.mediawiki.colorblind.less" ], "dependencies": [ "ext.CodeMirror.v6", @@ -258,11 +261,10 @@ }, "ext.CodeMirror.v6.WikiEditor": { "dependencies": [ - "ext.wikiEditor", - "ext.CodeMirror.v6" + "ext.wikiEditor" ], "packageFiles": [ - "dist/codemirror.wikieditor.js" + "codemirror.wikieditor.js" ], "messages": [ "codemirror-toggle-label" @@ -274,7 +276,7 @@ "ext.CodeMirror.v6.mode.mediawiki" ], "packageFiles": [ - "dist/codemirror.wikieditor.mediawiki.js" + "codemirror.wikieditor.mediawiki.init.js" ] } }, @@ -287,8 +289,8 @@ "usecodemirror": 0 }, "QUnitTestModule": { - "localBasePath": "resources/mode/mediawiki/tests", - "remoteExtPath": "CodeMirror/resources/mode/mediawiki/tests", + "localBasePath": "resources/legacy/mode/mediawiki/tests", + "remoteExtPath": "CodeMirror/resources/legacy/mode/mediawiki/tests", "packageFiles": [ "qunit/CodeMirror.mediawiki.test.js" ], diff --git a/jsdoc.json b/jsdoc.json index cbcc5d96..b680b653 100644 --- a/jsdoc.json +++ b/jsdoc.json @@ -11,7 +11,8 @@ "node_modules/jsdoc-wmf-theme/plugins/default" ], "source": { - "include": [ "src" ], + "include": [ "resources" ], + "exclude": [ "resources/legacy", "resources/lib" ], "includePattern": ".+\\.js$" }, "tags": {}, @@ -25,9 +26,10 @@ "repository": "https://gerrit.wikimedia.org/g/mediawiki/extensions/CodeMirror", "linkMap": { "jQuery.fn.textSelection": "https://doc.wikimedia.org/mediawiki-core/master/js/jQueryPlugins.html#.textSelection", - + "Compartment": "https://codemirror.net/docs/ref/#state.Compartment", "Decoration": "https://codemirror.net/docs/ref/#view.Decoration", "DecorationSet": "https://codemirror.net/docs/ref/#view.DecorationSet", + "Direction": "https://codemirror.net/docs/ref/#view.Direction", "EditorState": "https://codemirror.net/docs/ref/#state.EditorState", "EditorView": "https://codemirror.net/docs/ref/#view.EditorView", "Extension": "https://codemirror.net/docs/ref/#state.Extension", diff --git a/package-lock.json b/package-lock.json index 4b4e6bdd..caa75bfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,27 +1,23 @@ { - "name": "CodeMirror", + "name": "codemirror", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "CodeMirror", + "name": "codemirror", "devDependencies": { - "@babel/plugin-transform-private-methods": "7.23.3", - "@babel/preset-env": "7.24.0", "@codemirror/commands": "6.2.5", "@codemirror/language": "6.9.3", "@codemirror/search": "6.5.4", "@codemirror/state": "6.2.1", "@codemirror/view": "6.22.2", "@lezer/highlight": "1.2.0", - "@rollup/plugin-babel": "6.0.4", "@rollup/plugin-node-resolve": "15.2.3", - "@rollup/plugin-terser": "0.4.4", - "@wdio/cli": "7.30.1", - "@wdio/junit-reporter": "7.29.1", - "@wdio/local-runner": "7.30.1", - "@wdio/mocha-framework": "7.26.0", - "@wdio/spec-reporter": "7.29.1", + "@wdio/cli": "7.36.0", + "@wdio/junit-reporter": "7.35.0", + "@wdio/local-runner": "7.36.0", + "@wdio/mocha-framework": "7.33.0", + "@wdio/spec-reporter": "7.33.0", "@wikimedia/mw-node-qunit": "7.2.0", "dotenv": "8.2.0", "eslint-config-wikimedia": "0.28.2", @@ -32,9 +28,8 @@ "jsdoc": "4.0.3", "jsdoc-wmf-theme": "1.1.0", "rollup": "4.13.0", - "rollup-plugin-copy": "3.5.0", "stylelint-config-wikimedia": "0.16.1", - "wdio-mediawiki": "2.3.0" + "wdio-mediawiki": "2.5.0" }, "engines": { "node": "18.20.2" @@ -123,28 +118,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.22.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.22.15", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-compilation-targets": { "version": "7.23.6", "dev": true, @@ -160,59 +133,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.24.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.23.0", - "@babel/helper-member-expression-to-functions": "^7.23.0", - "@babel/helper-optimise-call-expression": "^7.22.5", - "@babel/helper-replace-supers": "^7.22.20", - "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.22.15", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "regexpu-core": "^5.3.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.6.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-compilation-targets": "^7.22.6", - "@babel/helper-plugin-utils": "^7.22.5", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, "node_modules/@babel/helper-environment-visitor": { "version": "7.22.20", "dev": true, @@ -244,17 +164,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.23.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.23.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-module-imports": { "version": "7.22.15", "dev": true, @@ -284,17 +193,6 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.22.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-plugin-utils": { "version": "7.24.0", "dev": true, @@ -303,38 +201,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-remap-async-to-generator": { - "version": "7.22.20", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-wrap-function": "^7.22.20" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.22.20", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-member-expression-to-functions": "^7.22.15", - "@babel/helper-optimise-call-expression": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, "node_modules/@babel/helper-simple-access": { "version": "7.22.5", "dev": true, @@ -346,17 +212,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.22.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-split-export-declaration": { "version": "7.22.6", "dev": true, @@ -393,19 +248,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-wrap-function": { - "version": "7.22.20", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-function-name": "^7.22.5", - "@babel/template": "^7.22.15", - "@babel/types": "^7.22.19" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helpers": { "version": "7.23.8", "dev": true, @@ -443,62 +285,6 @@ "node": ">=6.0.0" } }, - "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", - "@babel/plugin-transform-optional-chaining": "^7.23.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.13.0" - } - }, - "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { - "version": "7.23.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.21.0-placeholder-for-preset-env.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-syntax-async-generators": { "version": "7.8.4", "dev": true, @@ -532,70 +318,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-assertions": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-attributes": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-syntax-import-meta": { "version": "7.10.4", "dev": true, @@ -698,20 +420,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-syntax-top-level-await": { "version": "7.14.5", "dev": true, @@ -740,867 +448,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-unicode-sets-regex": { - "version": "7.18.6", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-async-generator-functions": { - "version": "7.23.9", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-remap-async-to-generator": "^7.22.20", - "@babel/plugin-syntax-async-generators": "^7.8.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-async-to-generator": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-remap-async-to-generator": "^7.22.20" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoped-functions": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-class-properties": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-class-static-block": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0" - } - }, - "node_modules/@babel/plugin-transform-classes": { - "version": "7.23.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.23.0", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-replace-supers": "^7.22.20", - "@babel/helper-split-export-declaration": "^7.22.6", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-computed-properties": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/template": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-dotall-regex": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-duplicate-keys": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-dynamic-import": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-exponentiation-operator": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-export-namespace-from": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-for-of": { - "version": "7.23.6", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-function-name": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-function-name": "^7.23.0", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-json-strings": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-json-strings": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-literals": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-logical-assignment-operators": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-member-expression-literals": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.23.3", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.23.3", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-simple-access": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.23.9", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-hoist-variables": "^7.22.5", - "@babel/helper-module-transforms": "^7.23.3", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-umd": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.23.3", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.22.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-transform-new-target": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-numeric-separator": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-object-rest-spread": { - "version": "7.24.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.23.5", - "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-plugin-utils": "^7.24.0", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.23.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-object-super": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-replace-supers": "^7.22.20" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-optional-catch-binding": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-optional-chaining": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-parameters": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-private-methods": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-private-property-in-object": { - "version": "7.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-create-class-features-plugin": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-property-literals": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-regenerator": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "regenerator-transform": "^0.15.2" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-reserved-words": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-shorthand-properties": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-spread": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-sticky-regex": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-template-literals": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-typeof-symbol": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-escapes": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-property-regex": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-regex": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-sets-regex": { - "version": "7.23.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/preset-env": { - "version": "7.24.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.23.5", - "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-plugin-utils": "^7.24.0", - "@babel/helper-validator-option": "^7.23.5", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.23.3", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.23.3", - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.23.7", - "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.23.3", - "@babel/plugin-syntax-import-attributes": "^7.23.3", - "@babel/plugin-syntax-import-meta": "^7.10.4", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", - "@babel/plugin-transform-arrow-functions": "^7.23.3", - "@babel/plugin-transform-async-generator-functions": "^7.23.9", - "@babel/plugin-transform-async-to-generator": "^7.23.3", - "@babel/plugin-transform-block-scoped-functions": "^7.23.3", - "@babel/plugin-transform-block-scoping": "^7.23.4", - "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-class-static-block": "^7.23.4", - "@babel/plugin-transform-classes": "^7.23.8", - "@babel/plugin-transform-computed-properties": "^7.23.3", - "@babel/plugin-transform-destructuring": "^7.23.3", - "@babel/plugin-transform-dotall-regex": "^7.23.3", - "@babel/plugin-transform-duplicate-keys": "^7.23.3", - "@babel/plugin-transform-dynamic-import": "^7.23.4", - "@babel/plugin-transform-exponentiation-operator": "^7.23.3", - "@babel/plugin-transform-export-namespace-from": "^7.23.4", - "@babel/plugin-transform-for-of": "^7.23.6", - "@babel/plugin-transform-function-name": "^7.23.3", - "@babel/plugin-transform-json-strings": "^7.23.4", - "@babel/plugin-transform-literals": "^7.23.3", - "@babel/plugin-transform-logical-assignment-operators": "^7.23.4", - "@babel/plugin-transform-member-expression-literals": "^7.23.3", - "@babel/plugin-transform-modules-amd": "^7.23.3", - "@babel/plugin-transform-modules-commonjs": "^7.23.3", - "@babel/plugin-transform-modules-systemjs": "^7.23.9", - "@babel/plugin-transform-modules-umd": "^7.23.3", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.22.5", - "@babel/plugin-transform-new-target": "^7.23.3", - "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", - "@babel/plugin-transform-numeric-separator": "^7.23.4", - "@babel/plugin-transform-object-rest-spread": "^7.24.0", - "@babel/plugin-transform-object-super": "^7.23.3", - "@babel/plugin-transform-optional-catch-binding": "^7.23.4", - "@babel/plugin-transform-optional-chaining": "^7.23.4", - "@babel/plugin-transform-parameters": "^7.23.3", - "@babel/plugin-transform-private-methods": "^7.23.3", - "@babel/plugin-transform-private-property-in-object": "^7.23.4", - "@babel/plugin-transform-property-literals": "^7.23.3", - "@babel/plugin-transform-regenerator": "^7.23.3", - "@babel/plugin-transform-reserved-words": "^7.23.3", - "@babel/plugin-transform-shorthand-properties": "^7.23.3", - "@babel/plugin-transform-spread": "^7.23.3", - "@babel/plugin-transform-sticky-regex": "^7.23.3", - "@babel/plugin-transform-template-literals": "^7.23.3", - "@babel/plugin-transform-typeof-symbol": "^7.23.3", - "@babel/plugin-transform-unicode-escapes": "^7.23.3", - "@babel/plugin-transform-unicode-property-regex": "^7.23.3", - "@babel/plugin-transform-unicode-regex": "^7.23.3", - "@babel/plugin-transform-unicode-sets-regex": "^7.23.3", - "@babel/preset-modules": "0.1.6-no-external-plugins", - "babel-plugin-polyfill-corejs2": "^0.4.8", - "babel-plugin-polyfill-corejs3": "^0.9.0", - "babel-plugin-polyfill-regenerator": "^0.5.5", - "core-js-compat": "^3.31.0", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-modules": { - "version": "0.1.6-no-external-plugins", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/@babel/regjsgen": { - "version": "0.8.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/runtime": { - "version": "7.24.0", - "dev": true, - "license": "MIT", - "dependencies": { - "regenerator-runtime": "^0.14.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/template": { "version": "7.22.15", "dev": true, @@ -2980,15 +1827,6 @@ "node": ">=6.0.0" } }, - "node_modules/@jridgewell/source-map": { - "version": "0.3.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.15", "dev": true, @@ -3073,31 +1911,6 @@ "node": ">= 8" } }, - "node_modules/@rollup/plugin-babel": { - "version": "6.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.18.6", - "@rollup/pluginutils": "^5.0.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0", - "@types/babel__core": "^7.1.9", - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "@types/babel__core": { - "optional": true - }, - "rollup": { - "optional": true - } - } - }, "node_modules/@rollup/plugin-node-resolve": { "version": "15.2.3", "dev": true, @@ -3122,35 +1935,6 @@ } } }, - "node_modules/@rollup/plugin-terser": { - "version": "0.4.4", - "dev": true, - "license": "MIT", - "dependencies": { - "serialize-javascript": "^6.0.1", - "smob": "^1.0.0", - "terser": "^5.17.4" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-terser/node_modules/serialize-javascript": { - "version": "6.0.2", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" - } - }, "node_modules/@rollup/pluginutils": { "version": "5.1.0", "dev": true, @@ -3322,8 +2106,9 @@ }, "node_modules/@sindresorhus/is": { "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -3372,8 +2157,9 @@ }, "node_modules/@szmarczak/http-timer": { "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", "dev": true, - "license": "MIT", "dependencies": { "defer-to-connect": "^2.0.0" }, @@ -3391,8 +2177,9 @@ }, "node_modules/@types/aria-query": { "version": "5.0.4", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true }, "node_modules/@types/babel__core": { "version": "7.20.5", @@ -3433,8 +2220,9 @@ }, "node_modules/@types/cacheable-request": { "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", "dev": true, - "license": "MIT", "dependencies": { "@types/http-cache-semantics": "*", "@types/keyv": "^3.1.4", @@ -3443,9 +2231,10 @@ } }, "node_modules/@types/diff": { - "version": "5.0.9", - "dev": true, - "license": "MIT" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@types/diff/-/diff-5.2.1.tgz", + "integrity": "sha512-uxpcuwWJGhe2AR1g8hD9F5OYGCqjqWnBUQFD8gMZsDbv8oPHzxJF6iMO6n8Tk0AdzlxoaaoQhOYlIg/PukVU8g==", + "dev": true }, "node_modules/@types/easy-table": { "version": "1.2.0", @@ -3476,19 +2265,22 @@ "license": "MIT" }, "node_modules/@types/fs-extra": { - "version": "9.0.13", + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz", + "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==", "dev": true, - "license": "MIT", "dependencies": { + "@types/jsonfile": "*", "@types/node": "*" } }, "node_modules/@types/glob": { - "version": "7.2.0", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==", "dev": true, - "license": "MIT", "dependencies": { - "@types/minimatch": "*", + "@types/minimatch": "^5.1.2", "@types/node": "*" } }, @@ -3502,8 +2294,9 @@ }, "node_modules/@types/http-cache-semantics": { "version": "4.0.4", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", + "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", + "dev": true }, "node_modules/@types/inquirer": { "version": "8.2.10", @@ -3556,10 +2349,20 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/jsonfile": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz", + "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/keyv": { "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*" } @@ -3617,8 +2420,9 @@ }, "node_modules/@types/minimatch": { "version": "5.1.2", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true }, "node_modules/@types/minimist": { "version": "1.2.5", @@ -3644,9 +2448,10 @@ "license": "MIT" }, "node_modules/@types/object-inspect": { - "version": "1.8.4", - "dev": true, - "license": "MIT" + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/@types/object-inspect/-/object-inspect-1.13.0.tgz", + "integrity": "sha512-lwGTVESDDV+XsQ1pH4UifpJ1f7OtXzQ6QBOX2Afq2bM/T3oOt8hF6exJMjjIjtEWeAN2YAo25J7HxWh97CCz9w==", + "dev": true }, "node_modules/@types/recursive-readdir": { "version": "2.2.4", @@ -3663,8 +2468,9 @@ }, "node_modules/@types/responselike": { "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz", + "integrity": "sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "*" } @@ -3684,8 +2490,9 @@ }, "node_modules/@types/supports-color": { "version": "8.1.3", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/@types/supports-color/-/supports-color-8.1.3.tgz", + "integrity": "sha512-Hy6UMpxhE3j1tLpl27exp1XqHD7n8chAiNPzWfz16LPZoMMoSc4dzLl6w9qijkEb/r5O1ozdu1CWGA2L83ZeZg==", + "dev": true }, "node_modules/@types/through": { "version": "0.0.33", @@ -3697,8 +2504,9 @@ }, "node_modules/@types/tmp": { "version": "0.2.6", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.6.tgz", + "integrity": "sha512-chhaNf2oKHlRkDGt+tiKE2Z5aJ6qalm7Z9rlLdBwmOiAAf09YQvvoLXjWK4HWPF1xU/fqvMgfNfpVoBscA/tKA==", + "dev": true }, "node_modules/@types/tough-cookie": { "version": "4.0.5", @@ -3707,8 +2515,9 @@ }, "node_modules/@types/ua-parser-js": { "version": "0.7.39", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/@types/ua-parser-js/-/ua-parser-js-0.7.39.tgz", + "integrity": "sha512-P/oDfpofrdtF5xw433SPALpdSchtJmY7nsJItf8h3KXqOslkbySh8zq4dSWXH2oTjRvJ5PczVEoCZPow6GicLg==", + "dev": true }, "node_modules/@types/validator": { "version": "13.11.8", @@ -3717,8 +2526,9 @@ }, "node_modules/@types/which": { "version": "1.3.2", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/@types/which/-/which-1.3.2.tgz", + "integrity": "sha512-8oDqyLC7eD4HM307boe2QWKyuzdzWBj56xI/imSl2cpL+U3tCMaTAkMJ4ee5JBZ/FsOJlvRGeIShiZDAl1qERA==", + "dev": true }, "node_modules/@types/yargs": { "version": "17.0.32", @@ -3735,8 +2545,9 @@ }, "node_modules/@types/yauzl": { "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", "dev": true, - "license": "MIT", "optional": true, "dependencies": { "@types/node": "*" @@ -3901,36 +2712,37 @@ "license": "ISC" }, "node_modules/@wdio/cli": { - "version": "7.30.1", + "version": "7.36.0", + "resolved": "https://registry.npmjs.org/@wdio/cli/-/cli-7.36.0.tgz", + "integrity": "sha512-vYL2tB9x7vjK3N7oRFJbUKsU4y04wqk7DQXdbmgBzC9Em4u9yvFxvtiDMCSC8kvFowiIhMtEFk8SQacL8pNszA==", "dev": true, - "license": "MIT", "dependencies": { "@types/ejs": "^3.0.5", - "@types/fs-extra": "^9.0.4", + "@types/fs-extra": "^11.0.1", "@types/inquirer": "^8.1.2", "@types/lodash.flattendeep": "^4.4.6", "@types/lodash.pickby": "^4.6.6", "@types/lodash.union": "^4.6.6", "@types/node": "^18.0.0", "@types/recursive-readdir": "^2.2.0", - "@wdio/config": "7.30.0", + "@wdio/config": "7.33.0", "@wdio/logger": "7.26.0", "@wdio/protocols": "7.27.0", - "@wdio/types": "7.26.0", - "@wdio/utils": "7.26.0", + "@wdio/types": "7.33.0", + "@wdio/utils": "7.33.0", "async-exit-hook": "^2.0.1", "chalk": "^4.0.0", "chokidar": "^3.0.0", "cli-spinners": "^2.1.0", "ejs": "^3.0.1", - "fs-extra": "^10.0.0", + "fs-extra": "^11.1.1", "inquirer": "8.2.4", "lodash.flattendeep": "^4.4.0", "lodash.pickby": "^4.6.0", "lodash.union": "^4.6.0", - "mkdirp": "^1.0.4", + "mkdirp": "^3.0.0", "recursive-readdir": "^2.2.2", - "webdriverio": "7.30.1", + "webdriverio": "7.36.0", "yargs": "^17.0.0", "yarn-install": "^1.0.0" }, @@ -3986,6 +2798,21 @@ "dev": true, "license": "MIT" }, + "node_modules/@wdio/cli/node_modules/mkdirp": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", + "dev": true, + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@wdio/cli/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -3998,13 +2825,15 @@ } }, "node_modules/@wdio/config": { - "version": "7.30.0", + "version": "7.33.0", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-7.33.0.tgz", + "integrity": "sha512-SaCZNKrDtBghf7ujyaxTiU4pBW+1Kms32shSoXpJ/wFop6/MiA7nb19qpUPoJtEDw5/NOKevUKz8nBMBXphiew==", "dev": true, - "license": "MIT", "dependencies": { + "@types/glob": "^8.1.0", "@wdio/logger": "7.26.0", - "@wdio/types": "7.26.0", - "@wdio/utils": "7.26.0", + "@wdio/types": "7.33.0", + "@wdio/utils": "7.33.0", "deepmerge": "^4.0.0", "glob": "^8.0.3" }, @@ -4013,14 +2842,15 @@ } }, "node_modules/@wdio/junit-reporter": { - "version": "7.29.1", + "version": "7.35.0", + "resolved": "https://registry.npmjs.org/@wdio/junit-reporter/-/junit-reporter-7.35.0.tgz", + "integrity": "sha512-pRLmk7o95+WM90KqHHGI87rEJpFRZZOpRKccFDp7fB/B+h5X1kSOexZhX81oeEbMin87w6NbJexlJtzF/wP+2g==", "dev": true, - "license": "MIT", "dependencies": { "@types/json-stringify-safe": "^5.0.0", "@types/validator": "^13.1.3", - "@wdio/reporter": "7.29.1", - "@wdio/types": "7.26.0", + "@wdio/reporter": "7.33.0", + "@wdio/types": "7.33.0", "json-stringify-safe": "^5.0.1", "junit-report-builder": "^3.0.0", "validator": "^13.0.0" @@ -4033,15 +2863,16 @@ } }, "node_modules/@wdio/local-runner": { - "version": "7.30.1", + "version": "7.36.0", + "resolved": "https://registry.npmjs.org/@wdio/local-runner/-/local-runner-7.36.0.tgz", + "integrity": "sha512-01uDD4O5RbtuFE0F7PmtZjYuqCfJ2HvP1b+q8OUm5oINoaQ7djSkHCM01UKu5Rn5I1cQa0vSr5r12puD5Gp+Yw==", "dev": true, - "license": "MIT", "dependencies": { "@types/stream-buffers": "^3.0.3", "@wdio/logger": "7.26.0", - "@wdio/repl": "7.26.0", - "@wdio/runner": "7.30.1", - "@wdio/types": "7.26.0", + "@wdio/repl": "7.33.0", + "@wdio/runner": "7.36.0", + "@wdio/types": "7.33.0", "async-exit-hook": "^2.0.1", "split2": "^4.0.0", "stream-buffers": "^3.0.2" @@ -4124,14 +2955,15 @@ } }, "node_modules/@wdio/mocha-framework": { - "version": "7.26.0", + "version": "7.33.0", + "resolved": "https://registry.npmjs.org/@wdio/mocha-framework/-/mocha-framework-7.33.0.tgz", + "integrity": "sha512-y6+iBF+QrqeiXC+mNwW/o0vRsB+qaRznxoh+ds6Xz9V0tui55cn4kl2gYkBu3oHX8h+9R52ykLyaY9wv+r2aeg==", "dev": true, - "license": "MIT", "dependencies": { "@types/mocha": "^10.0.0", "@wdio/logger": "7.26.0", - "@wdio/types": "7.26.0", - "@wdio/utils": "7.26.0", + "@wdio/types": "7.33.0", + "@wdio/utils": "7.33.0", "expect-webdriverio": "^3.0.0", "mocha": "^10.0.0" }, @@ -4148,29 +2980,31 @@ } }, "node_modules/@wdio/repl": { - "version": "7.26.0", + "version": "7.33.0", + "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-7.33.0.tgz", + "integrity": "sha512-17KM9NCg+UVpZNbS8koT/917vklF5M8IQnw0kGwmJEo444ifTMxmLwQymbS2ovQKAKAQxlfdM7bpqMeI15kzsQ==", "dev": true, - "license": "MIT", "dependencies": { - "@wdio/utils": "7.26.0" + "@wdio/utils": "7.33.0" }, "engines": { "node": ">=12.0.0" } }, "node_modules/@wdio/reporter": { - "version": "7.29.1", + "version": "7.33.0", + "resolved": "https://registry.npmjs.org/@wdio/reporter/-/reporter-7.33.0.tgz", + "integrity": "sha512-iL3SwP+hVmu1qj54YPwRCK+ZpVN75xpltYihjpuZCWZKJ0qpQuE2oBlNauFQWgrrd74ta20EDV4mSIhXm9lX6g==", "dev": true, - "license": "MIT", "dependencies": { "@types/diff": "^5.0.0", "@types/node": "^18.0.0", "@types/object-inspect": "^1.8.0", "@types/supports-color": "^8.1.0", "@types/tmp": "^0.2.0", - "@wdio/types": "7.26.0", + "@wdio/types": "7.33.0", "diff": "^5.0.0", - "fs-extra": "^10.0.0", + "fs-extra": "^11.1.1", "object-inspect": "^1.10.3", "supports-color": "8.1.1" }, @@ -4179,31 +3013,33 @@ } }, "node_modules/@wdio/runner": { - "version": "7.30.1", + "version": "7.36.0", + "resolved": "https://registry.npmjs.org/@wdio/runner/-/runner-7.36.0.tgz", + "integrity": "sha512-EU/0XprH6UEqaYarxuSSLYgsxC6/jLHE7Wj/5FIJyFwdx//Ip8DnTXzbJylskeWX2NkCfJH2VerGSo423c98+Q==", "dev": true, - "license": "MIT", "dependencies": { - "@wdio/config": "7.30.0", + "@wdio/config": "7.33.0", "@wdio/logger": "7.26.0", - "@wdio/types": "7.26.0", - "@wdio/utils": "7.26.0", + "@wdio/types": "7.33.0", + "@wdio/utils": "7.33.0", "deepmerge": "^4.0.0", "gaze": "^1.1.2", - "webdriver": "7.30.0", - "webdriverio": "7.30.1" + "webdriver": "7.33.0", + "webdriverio": "7.36.0" }, "engines": { "node": ">=12.0.0" } }, "node_modules/@wdio/spec-reporter": { - "version": "7.29.1", + "version": "7.33.0", + "resolved": "https://registry.npmjs.org/@wdio/spec-reporter/-/spec-reporter-7.33.0.tgz", + "integrity": "sha512-+BTJE6p82EaQMK+2t3lmXlpxF0Q72EJwUSEqY6RPyPUZL7fB+AZdHKQcxcmCR8bYyOUp68H45Yj4PuCKRS6hAg==", "dev": true, - "license": "MIT", "dependencies": { "@types/easy-table": "^1.2.0", - "@wdio/reporter": "7.29.1", - "@wdio/types": "7.26.0", + "@wdio/reporter": "7.33.0", + "@wdio/types": "7.33.0", "chalk": "^4.0.0", "easy-table": "^1.1.1", "pretty-ms": "^7.0.0" @@ -4272,9 +3108,10 @@ } }, "node_modules/@wdio/types": { - "version": "7.26.0", + "version": "7.33.0", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.33.0.tgz", + "integrity": "sha512-tNcuN5Kl+i5CffaeTYV1omzAo4rVjiI1m9raIA8ph6iVteWdCzYv2/ImpGgFiBPb7Mf6VokU3+q9Slh5Jitaww==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "^18.0.0", "got": "^11.8.1" @@ -4292,12 +3129,13 @@ } }, "node_modules/@wdio/utils": { - "version": "7.26.0", + "version": "7.33.0", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-7.33.0.tgz", + "integrity": "sha512-4kQQ86EvEN6fBY5+u7M08cT6LfJtpk1rHd203xyxmbmV9lpNv/OCl4CsC+SD0jGT0aZZqYSIJ/Pil07pAh5K0g==", "dev": true, - "license": "MIT", "dependencies": { "@wdio/logger": "7.26.0", - "@wdio/types": "7.26.0", + "@wdio/types": "7.33.0", "p-iteration": "^1.1.8" }, "engines": { @@ -4508,8 +3346,9 @@ }, "node_modules/archiver": { "version": "5.3.2", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.3.2.tgz", + "integrity": "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==", "dev": true, - "license": "MIT", "dependencies": { "archiver-utils": "^2.1.0", "async": "^3.2.4", @@ -4525,8 +3364,9 @@ }, "node_modules/archiver-utils": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-2.1.0.tgz", + "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", "dev": true, - "license": "MIT", "dependencies": { "glob": "^7.1.4", "graceful-fs": "^4.2.0", @@ -4545,8 +3385,10 @@ }, "node_modules/archiver-utils/node_modules/glob": { "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -4562,17 +3404,19 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/archiver/node_modules/readable-stream": { - "version": "3.6.2", + "node_modules/archiver-utils/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, - "license": "MIT", "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "node_modules/are-docs-informative": { @@ -4594,8 +3438,9 @@ }, "node_modules/aria-query": { "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", "dev": true, - "license": "Apache-2.0", "dependencies": { "dequal": "^2.0.3" } @@ -4807,72 +3652,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.4.10", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.22.6", - "@babel/helper-define-polyfill-provider": "^0.6.1", - "semver": "^6.3.1" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.5.0", - "core-js-compat": "^3.34.0" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/babel-plugin-polyfill-corejs3/node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-compilation-targets": "^7.22.6", - "@babel/helper-plugin-utils": "^7.22.5", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.5.0" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/babel-plugin-polyfill-regenerator/node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-compilation-targets": "^7.22.6", - "@babel/helper-plugin-utils": "^7.22.5", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, "node_modules/babel-preset-current-node-syntax": { "version": "1.0.1", "dev": true, @@ -4960,19 +3739,6 @@ "readable-stream": "^3.4.0" } }, - "node_modules/bl/node_modules/readable-stream": { - "version": "3.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/bluebird": { "version": "3.7.2", "dev": true, @@ -5080,8 +3846,9 @@ }, "node_modules/buffer-crc32": { "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "dev": true, - "license": "MIT", "engines": { "node": "*" } @@ -5276,16 +4043,18 @@ }, "node_modules/cacheable-lookup": { "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", "dev": true, - "license": "MIT", "engines": { "node": ">=10.6.0" } }, "node_modules/cacheable-request": { "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", + "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", "dev": true, - "license": "MIT", "dependencies": { "clone-response": "^1.0.2", "get-stream": "^5.1.0", @@ -5454,13 +4223,15 @@ }, "node_modules/chownr": { "version": "1.1.4", - "dev": true, - "license": "ISC" + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true }, "node_modules/chrome-launcher": { "version": "0.15.2", + "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.15.2.tgz", + "integrity": "sha512-zdLEwNo3aUVzIhKhTtXfxhdvZhUghrnmkvcAq2NoDd+LeOHKf03H5jwZ8T/STsAlzyALkBVK552iaG1fGf1xVQ==", "dev": true, - "license": "Apache-2.0", "dependencies": { "@types/node": "*", "escape-string-regexp": "^4.0.0", @@ -5476,8 +4247,9 @@ }, "node_modules/chrome-launcher/node_modules/escape-string-regexp": { "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -5569,8 +4341,9 @@ }, "node_modules/clone-response": { "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", "dev": true, - "license": "MIT", "dependencies": { "mimic-response": "^1.0.0" }, @@ -5610,11 +4383,6 @@ "dev": true, "license": "MIT" }, - "node_modules/colorette": { - "version": "1.4.0", - "dev": true, - "license": "MIT" - }, "node_modules/colors": { "version": "1.4.0", "dev": true, @@ -5634,11 +4402,6 @@ "node": ">= 0.8" } }, - "node_modules/commander": { - "version": "2.20.3", - "dev": true, - "license": "MIT" - }, "node_modules/comment-parser": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", @@ -5650,8 +4413,9 @@ }, "node_modules/compress-commons": { "version": "4.1.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.2.tgz", + "integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==", "dev": true, - "license": "MIT", "dependencies": { "buffer-crc32": "^0.2.13", "crc32-stream": "^4.0.2", @@ -5662,19 +4426,6 @@ "node": ">= 10" } }, - "node_modules/compress-commons/node_modules/readable-stream": { - "version": "3.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/concat-map": { "version": "0.0.1", "dev": true, @@ -5705,8 +4456,9 @@ }, "node_modules/crc-32": { "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", "dev": true, - "license": "Apache-2.0", "bin": { "crc32": "bin/crc32.njs" }, @@ -5716,8 +4468,9 @@ }, "node_modules/crc32-stream": { "version": "4.0.3", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.3.tgz", + "integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==", "dev": true, - "license": "MIT", "dependencies": { "crc-32": "^1.2.0", "readable-stream": "^3.4.0" @@ -5726,19 +4479,6 @@ "node": ">= 10" } }, - "node_modules/crc32-stream/node_modules/readable-stream": { - "version": "3.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/create-jest": { "version": "29.7.0", "dev": true, @@ -5838,8 +4578,9 @@ }, "node_modules/cross-fetch": { "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", "dev": true, - "license": "MIT", "dependencies": { "node-fetch": "2.6.7" } @@ -5911,6 +4652,8 @@ }, "node_modules/css-shorthand-properties": { "version": "1.1.1", + "resolved": "https://registry.npmjs.org/css-shorthand-properties/-/css-shorthand-properties-1.1.1.tgz", + "integrity": "sha512-Md+Juc7M3uOdbAFwOYlTrccIZ7oCFuzrhKYQjdeUEW/sE1hv17Jp/Bws+ReOPpGVBTYCBoYo+G17V5Qo8QQ75A==", "dev": true }, "node_modules/css-tokenize": { @@ -5957,6 +4700,8 @@ }, "node_modules/css-value": { "version": "0.0.1", + "resolved": "https://registry.npmjs.org/css-value/-/css-value-0.0.1.tgz", + "integrity": "sha512-FUV3xaJ63buRLgHrLQVlVgQnQdR4yqdLGaDu7g8CQcWjInDfM9plBTPI9FRfpahju1UBSaMckeb2/46ApS/V1Q==", "dev": true }, "node_modules/cssesc": { @@ -6083,8 +4828,9 @@ }, "node_modules/decompress-response": { "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", "dev": true, - "license": "MIT", "dependencies": { "mimic-response": "^3.1.0" }, @@ -6097,8 +4843,9 @@ }, "node_modules/decompress-response/node_modules/mimic-response": { "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -6145,8 +4892,9 @@ }, "node_modules/defer-to-connect": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" } @@ -6161,8 +4909,9 @@ }, "node_modules/dequal": { "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } @@ -6176,20 +4925,21 @@ } }, "node_modules/devtools": { - "version": "7.30.0", + "version": "7.35.0", + "resolved": "https://registry.npmjs.org/devtools/-/devtools-7.35.0.tgz", + "integrity": "sha512-7HMZMcJSCK/PaBCWVs4n4ZhtBNdUQj10iPwXvj/JDkqPreEXN/XW9GJAoMuLPFmCEKfxe+LrIbgs8ocGJ6rp/A==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "^18.0.0", "@types/ua-parser-js": "^0.7.33", - "@wdio/config": "7.30.0", + "@wdio/config": "7.33.0", "@wdio/logger": "7.26.0", "@wdio/protocols": "7.27.0", - "@wdio/types": "7.26.0", - "@wdio/utils": "7.26.0", + "@wdio/types": "7.33.0", + "@wdio/utils": "7.33.0", "chrome-launcher": "^0.15.0", "edge-paths": "^2.1.0", - "puppeteer-core": "^13.1.3", + "puppeteer-core": "13.1.3", "query-selector-shadow-dom": "^1.0.0", "ua-parser-js": "^1.0.1", "uuid": "^9.0.0" @@ -6199,22 +4949,104 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1102555", + "version": "0.0.1260888", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1260888.tgz", + "integrity": "sha512-9rTIZ4ZjWwalCPiaY+kPiALLfOKgAz5CTi/Zb1L+qSZ8PH3zVo1T8JcgXIIqg1iM3pZ6hF+n9xO5r2jZ/SF+jg==", + "dev": true + }, + "node_modules/devtools/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, - "license": "BSD-3-Clause" + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/devtools/node_modules/devtools-protocol": { + "version": "0.0.948846", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.948846.tgz", + "integrity": "sha512-5fGyt9xmMqUl2VI7+rnUkKCiAQIpLns8sfQtTENy5L70ktbNw0Z3TFJ1JoFNYdx/jffz4YXU45VF75wKZD7sZQ==", + "dev": true + }, + "node_modules/devtools/node_modules/https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dev": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/devtools/node_modules/puppeteer-core": { + "version": "13.1.3", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-13.1.3.tgz", + "integrity": "sha512-96pzvVBzq5lUGt3L/QrIH3mxn3NfZylHeusNhq06xBAHPI0Upc0SC/9u7tXjL0oRnmcExeVRJivr1lj7Ah/yDQ==", + "dev": true, + "dependencies": { + "debug": "4.3.2", + "devtools-protocol": "0.0.948846", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.0", + "node-fetch": "2.6.7", + "pkg-dir": "4.2.0", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.2.3" + }, + "engines": { + "node": ">=10.18.1" + } }, "node_modules/devtools/node_modules/uuid": { "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", "dev": true, "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], - "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } }, + "node_modules/devtools/node_modules/ws": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/diff": { "version": "5.1.0", "dev": true, @@ -6437,8 +5269,9 @@ }, "node_modules/edge-paths": { "version": "2.2.1", + "resolved": "https://registry.npmjs.org/edge-paths/-/edge-paths-2.2.1.tgz", + "integrity": "sha512-AI5fC7dfDmCdKo3m5y7PkYE8m6bMqR6pvVpgtrZkkhcJXFLelUgkjrhk3kXXx8Kbw2cRaTT4LkOR7hqf39KJdw==", "dev": true, - "license": "MIT", "dependencies": { "@types/which": "^1.3.2", "which": "^2.0.2" @@ -6481,8 +5314,9 @@ }, "node_modules/end-of-stream": { "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "dev": true, - "license": "MIT", "dependencies": { "once": "^1.4.0" } @@ -7570,8 +6404,9 @@ }, "node_modules/extract-zip": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "debug": "^4.1.1", "get-stream": "^5.1.0", @@ -7651,8 +6486,9 @@ }, "node_modules/fd-slicer": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "dev": true, - "license": "MIT", "dependencies": { "pend": "~1.2.0" } @@ -7757,39 +6593,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/flat-cache/node_modules/glob": { - "version": "7.2.3", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/flat-cache/node_modules/rimraf": { - "version": "3.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/flatted": { "version": "3.2.9", "dev": true, @@ -7818,20 +6621,22 @@ }, "node_modules/fs-constants": { "version": "1.0.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true }, "node_modules/fs-extra": { - "version": "10.1.0", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", "dev": true, - "license": "MIT", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=12" + "node": ">=14.14" } }, "node_modules/fs.realpath": { @@ -7863,8 +6668,9 @@ }, "node_modules/gaze": { "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", "dev": true, - "license": "MIT", "dependencies": { "globule": "^1.0.0" }, @@ -7898,8 +6704,9 @@ }, "node_modules/get-stream": { "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dev": true, - "license": "MIT", "dependencies": { "pump": "^3.0.0" }, @@ -7932,8 +6739,10 @@ }, "node_modules/glob": { "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -7961,16 +6770,18 @@ }, "node_modules/glob/node_modules/brace-expansion": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, - "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/glob/node_modules/minimatch": { "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, - "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -8026,43 +6837,6 @@ "dev": true, "license": "MIT" }, - "node_modules/globby": { - "version": "10.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/glob": "^7.1.1", - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.0.3", - "glob": "^7.1.3", - "ignore": "^5.1.1", - "merge2": "^1.2.3", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/globby/node_modules/glob": { - "version": "7.2.3", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/globjoin": { "version": "0.1.4", "dev": true, @@ -8075,8 +6849,9 @@ }, "node_modules/globule": { "version": "1.3.4", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.4.tgz", + "integrity": "sha512-OPTIfhMBh7JbBYDpa5b+Q5ptmMWKwcNcFSR/0c6t8V4f3ZAVBEsKNY37QdVqmLRYSMhOUGYrY0QhSoEpzGr/Eg==", "dev": true, - "license": "MIT", "dependencies": { "glob": "~7.1.1", "lodash": "^4.17.21", @@ -8088,8 +6863,10 @@ }, "node_modules/globule/node_modules/glob": { "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -8107,8 +6884,9 @@ }, "node_modules/globule/node_modules/minimatch": { "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", "dev": true, - "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -8118,8 +6896,9 @@ }, "node_modules/got": { "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", "dev": true, - "license": "MIT", "dependencies": { "@sindresorhus/is": "^4.0.0", "@szmarczak/http-timer": "^4.0.5", @@ -8147,8 +6926,9 @@ }, "node_modules/grapheme-splitter": { "version": "1.0.4", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true }, "node_modules/graphemer": { "version": "1.4.0", @@ -8357,8 +7137,9 @@ }, "node_modules/http-cache-semantics": { "version": "4.1.1", - "dev": true, - "license": "BSD-2-Clause" + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", + "dev": true }, "node_modules/http-proxy-agent": { "version": "5.0.0", @@ -8389,8 +7170,9 @@ }, "node_modules/http2-wrapper": { "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", "dev": true, - "license": "MIT", "dependencies": { "quick-lru": "^5.1.1", "resolve-alpn": "^1.0.0" @@ -8499,65 +7281,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/import-local/node_modules/find-up": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/locate-path": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/p-limit": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-local/node_modules/p-locate": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/pkg-dir": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/imurmurhash": { "version": "0.1.4", "dev": true, @@ -8718,8 +7441,9 @@ }, "node_modules/is-docker": { "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", "dev": true, - "license": "MIT", "bin": { "is-docker": "cli.js" }, @@ -8850,8 +7574,9 @@ }, "node_modules/is-wsl": { "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", "dev": true, - "license": "MIT", "dependencies": { "is-docker": "^2.0.0" }, @@ -8861,8 +7586,9 @@ }, "node_modules/isarray": { "version": "1.0.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true }, "node_modules/isexe": { "version": "2.0.0", @@ -11757,8 +10483,9 @@ }, "node_modules/jsonfile": { "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, - "license": "MIT", "dependencies": { "universalify": "^2.0.0" }, @@ -11852,8 +10579,9 @@ }, "node_modules/ky": { "version": "0.30.0", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.30.0.tgz", + "integrity": "sha512-X/u76z4JtDVq10u1JA5UQfatPxgPaVDMYTrgHyiTpGN2z4TMEJkIHsoSBBSg9SWZEIXTKsi9kHgiQ9o3Y/4yog==", "dev": true, - "license": "MIT", "engines": { "node": ">=12" }, @@ -11863,8 +10591,9 @@ }, "node_modules/lazystream": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", "dev": true, - "license": "MIT", "dependencies": { "readable-stream": "^2.0.5" }, @@ -11872,6 +10601,21 @@ "node": ">= 0.6.3" } }, + "node_modules/lazystream/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, "node_modules/ldjson-stream": { "version": "1.2.1", "dev": true, @@ -11941,8 +10685,9 @@ }, "node_modules/lighthouse-logger": { "version": "1.4.2", + "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.4.2.tgz", + "integrity": "sha512-gPWxznF6TKmUHrOQjlVo2UbaL2EJ71mb2CCeRs/2qBpi4L/g4LUVc9+3lKQ6DTUZwJswfM7ainGrLO1+fOqa2g==", "dev": true, - "license": "Apache-2.0", "dependencies": { "debug": "^2.6.9", "marky": "^1.2.2" @@ -11950,16 +10695,18 @@ }, "node_modules/lighthouse-logger/node_modules/debug": { "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, - "license": "MIT", "dependencies": { "ms": "2.0.0" } }, "node_modules/lighthouse-logger/node_modules/ms": { "version": "2.0.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true }, "node_modules/lines-and-columns": { "version": "1.2.4", @@ -12041,28 +10788,27 @@ }, "node_modules/lodash.clonedeep": { "version": "4.5.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.debounce": { - "version": "4.0.8", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", + "dev": true }, "node_modules/lodash.defaults": { "version": "4.2.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", + "dev": true }, "node_modules/lodash.difference": { "version": "4.5.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==", + "dev": true }, "node_modules/lodash.flatten": { "version": "4.4.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "dev": true }, "node_modules/lodash.flattendeep": { "version": "4.4.0", @@ -12076,13 +10822,15 @@ }, "node_modules/lodash.isobject": { "version": "3.0.2", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", + "integrity": "sha512-3/Qptq2vr7WeJbB4KHUSKlq8Pl7ASXi3UG6CMbBm8WRtXi8+GHm7mKaU3urfpSEzWe2wCIChs6/sdocUsTKJiA==", + "dev": true }, "node_modules/lodash.isplainobject": { "version": "4.0.6", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true }, "node_modules/lodash.memoize": { "version": "4.1.2", @@ -12111,8 +10859,9 @@ }, "node_modules/lodash.zip": { "version": "4.2.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz", + "integrity": "sha512-C7IOaBBK/0gMORRBd8OETNx3kmOkgIWIPvyDpZSCTwUrpYmgZwJkjZeOD8ww4xbOUOs4/attY+pciKvadNfFbg==", + "dev": true }, "node_modules/log-symbols": { "version": "4.1.0", @@ -12204,8 +10953,9 @@ }, "node_modules/lowercase-keys": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -12286,8 +11036,9 @@ }, "node_modules/marky": { "version": "1.2.5", - "dev": true, - "license": "Apache-2.0" + "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.5.tgz", + "integrity": "sha512-q9JtQJKjpsVxCRVgQ+WapguSbKC3SQ5HEzFGPAJMStgh3QjCawp00UKv3MTTAArTmGmmPUvllHZoNbZ3gs0I+Q==", + "dev": true }, "node_modules/mathml-tag-names": { "version": "2.1.3", @@ -12495,8 +11246,9 @@ }, "node_modules/mimic-response": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -12554,8 +11306,9 @@ }, "node_modules/mkdirp-classic": { "version": "0.5.3", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true }, "node_modules/mocha": { "version": "10.2.0", @@ -12843,8 +11596,9 @@ }, "node_modules/node-fetch": { "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "dev": true, - "license": "MIT", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -12862,18 +11616,21 @@ }, "node_modules/node-fetch/node_modules/tr46": { "version": "0.0.3", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true }, "node_modules/node-fetch/node_modules/webidl-conversions": { "version": "3.0.1", - "dev": true, - "license": "BSD-2-Clause" + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true }, "node_modules/node-fetch/node_modules/whatwg-url": { "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, - "license": "MIT", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -12926,8 +11683,9 @@ }, "node_modules/normalize-url": { "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -12977,9 +11735,13 @@ } }, "node_modules/object-inspect": { - "version": "1.13.1", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", "dev": true, - "license": "MIT", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -13115,16 +11877,18 @@ }, "node_modules/p-cancelable": { "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/p-iteration": { "version": "1.1.8", + "resolved": "https://registry.npmjs.org/p-iteration/-/p-iteration-1.1.8.tgz", + "integrity": "sha512-IMFBSDIYcPNnW7uWYGrBqmvTiq7W0uB0fJn6shQZs7dlF3OvrHOre+JT9ikSZ7gZS3vWqclVgoQSvToJrns7uQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=8.0.0" } @@ -13264,8 +12028,9 @@ }, "node_modules/pend": { "version": "1.2.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true }, "node_modules/performance-now": { "version": "2.1.0", @@ -13315,6 +12080,70 @@ "node": ">= 6" } }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/pluralize": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", @@ -13511,13 +12340,15 @@ }, "node_modules/process-nextick-args": { "version": "2.0.1", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true }, "node_modules/progress": { "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.4.0" } @@ -13536,8 +12367,9 @@ }, "node_modules/proxy-from-env": { "version": "1.1.0", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true }, "node_modules/pseudomap": { "version": "1.0.2", @@ -13551,8 +12383,9 @@ }, "node_modules/pump": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, - "license": "MIT", "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -13577,8 +12410,9 @@ }, "node_modules/puppeteer-core": { "version": "13.7.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-13.7.0.tgz", + "integrity": "sha512-rXja4vcnAzFAP1OVLq/5dWNfwBGuzcOARJ6qGV7oAZhnLmVRU8G5MsdeQEAOy332ZhkIOnn9jp15R89LKHyp2Q==", "dev": true, - "license": "Apache-2.0", "dependencies": { "cross-fetch": "3.1.5", "debug": "4.3.4", @@ -13599,105 +12433,15 @@ }, "node_modules/puppeteer-core/node_modules/devtools-protocol": { "version": "0.0.981744", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/puppeteer-core/node_modules/find-up": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer-core/node_modules/glob": { - "version": "7.2.3", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/puppeteer-core/node_modules/locate-path": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer-core/node_modules/p-limit": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/puppeteer-core/node_modules/p-locate": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer-core/node_modules/pkg-dir": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer-core/node_modules/rimraf": { - "version": "3.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.981744.tgz", + "integrity": "sha512-0cuGS8+jhR67Fy7qG3i3Pc7Aw494sb9yG9QgpG97SFVWwolgYjlhJg7n+UaHxOQT30d1TYu/EYe9k01ivLErIg==", + "dev": true }, "node_modules/puppeteer-core/node_modules/ws": { "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", "dev": true, - "license": "MIT", "engines": { "node": ">=10.0.0" }, @@ -13739,8 +12483,9 @@ }, "node_modules/query-selector-shadow-dom": { "version": "1.0.1", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/query-selector-shadow-dom/-/query-selector-shadow-dom-1.0.1.tgz", + "integrity": "sha512-lT5yCqEBgfoMYpf3F2xQRK7zEr1rhIIZuceDK6+xRkJQ4NMbHTwXqk4NkwDwQMNqXgG9r9fyHnzwNVs6zV5KRw==", + "dev": true }, "node_modules/querystringify": { "version": "2.2.0", @@ -13922,39 +12667,42 @@ } }, "node_modules/readable-stream": { - "version": "2.3.8", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, - "license": "MIT", "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" } }, "node_modules/readdir-glob": { "version": "1.1.3", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", + "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", "dev": true, - "license": "Apache-2.0", "dependencies": { "minimatch": "^5.1.0" } }, "node_modules/readdir-glob/node_modules/brace-expansion": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, - "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/readdir-glob/node_modules/minimatch": { "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, - "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -14024,35 +12772,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/regenerate": { - "version": "1.4.2", - "dev": true, - "license": "MIT" - }, - "node_modules/regenerate-unicode-properties": { - "version": "10.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "regenerate": "^1.4.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.14.1", - "dev": true, - "license": "MIT" - }, - "node_modules/regenerator-transform": { - "version": "0.15.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.8.4" - } - }, "node_modules/regexp-tree": { "version": "0.1.27", "dev": true, @@ -14061,40 +12780,6 @@ "regexp-tree": "bin/regexp-tree" } }, - "node_modules/regexpu-core": { - "version": "5.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/regjsgen": "^0.8.0", - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.1.0", - "regjsparser": "^0.9.1", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regexpu-core/node_modules/jsesc": { - "version": "0.5.0", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - } - }, - "node_modules/regexpu-core/node_modules/regjsparser": { - "version": "0.9.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "jsesc": "~0.5.0" - }, - "bin": { - "regjsparser": "bin/parser" - } - }, "node_modules/regjsparser": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.10.0.tgz", @@ -14226,8 +12911,9 @@ }, "node_modules/resolve-alpn": { "version": "1.2.1", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true }, "node_modules/resolve-cwd": { "version": "3.0.0", @@ -14276,8 +12962,9 @@ }, "node_modules/responselike": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", "dev": true, - "license": "MIT", "dependencies": { "lowercase-keys": "^2.0.0" }, @@ -14287,16 +12974,18 @@ }, "node_modules/resq": { "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resq/-/resq-1.11.0.tgz", + "integrity": "sha512-G10EBz+zAAy3zUd/CDoBbXRL6ia9kOo3xRHrMDsHljI0GDkhYlyjwoCx5+3eCC4swi1uCoZQhskuJkj7Gp57Bw==", "dev": true, - "license": "MIT", "dependencies": { "fast-deep-equal": "^2.0.1" } }, "node_modules/resq/node_modules/fast-deep-equal": { "version": "2.0.1", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==", + "dev": true }, "node_modules/restore-cursor": { "version": "3.1.0", @@ -14321,8 +13010,46 @@ }, "node_modules/rgb2hex": { "version": "0.2.5", + "resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.2.5.tgz", + "integrity": "sha512-22MOP1Rh7sAo1BZpDG6R5RFYzR2lYEgwq7HEmyW2qcsOqR2lQKmn+O//xV3YG/0rrhMC6KVX2hU+ZXuaw9a5bw==", + "dev": true + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, - "license": "MIT" + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } }, "node_modules/rollup": { "version": "4.13.0", @@ -14355,66 +13082,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/rollup-plugin-copy": { - "version": "3.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/fs-extra": "^8.0.1", - "colorette": "^1.1.0", - "fs-extra": "^8.1.0", - "globby": "10.0.1", - "is-plain-object": "^3.0.0" - }, - "engines": { - "node": ">=8.3" - } - }, - "node_modules/rollup-plugin-copy/node_modules/@types/fs-extra": { - "version": "8.1.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/rollup-plugin-copy/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/is-plain-object": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-plugin-copy/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/rollup-plugin-copy/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/rollup/node_modules/@rollup/rollup-linux-x64-gnu": { "version": "4.13.0", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.13.0.tgz", @@ -14582,8 +13249,9 @@ }, "node_modules/serialize-error": { "version": "8.1.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-8.1.0.tgz", + "integrity": "sha512-3NnuWfM6vBYoy5gZFvHiYsVbafvI9vZv/+jlIigFn4oP4zjNPK3LhcY0xSCgeb1a5L8jO71Mit9LlNoi2UfDDQ==", "dev": true, - "license": "MIT", "dependencies": { "type-fest": "^0.20.2" }, @@ -14596,8 +13264,9 @@ }, "node_modules/serialize-error/node_modules/type-fest": { "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, - "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -14740,11 +13409,6 @@ "dev": true, "license": "MIT" }, - "node_modules/smob": { - "version": "1.4.1", - "dev": true, - "license": "MIT" - }, "node_modules/source-map": { "version": "0.6.1", "dev": true, @@ -15283,8 +13947,9 @@ }, "node_modules/tar-fs": { "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", "dev": true, - "license": "MIT", "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", @@ -15294,8 +13959,9 @@ }, "node_modules/tar-stream": { "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", "dev": true, - "license": "MIT", "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", @@ -15307,45 +13973,6 @@ "node": ">=6" } }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "3.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/terser": { - "version": "5.26.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.8.2", - "commander": "^2.20.0", - "source-map-support": "~0.5.20" - }, - "bin": { - "terser": "bin/terser" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/terser/node_modules/source-map-support": { - "version": "0.5.21", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, "node_modules/test-exclude": { "version": "6.0.0", "dev": true, @@ -15396,19 +14023,6 @@ "readable-stream": "3" } }, - "node_modules/through2/node_modules/readable-stream": { - "version": "3.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/tiny-glob": { "version": "0.2.9", "dev": true, @@ -15575,7 +14189,9 @@ } }, "node_modules/ua-parser-js": { - "version": "1.0.37", + "version": "1.0.38", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.38.tgz", + "integrity": "sha512-Aq5ppTOfvrCMgAPneW1HfWj66Xi7XL+/mIy996R1/CLS/rcyJQm6QZdsKrUeivDFQ+Oc9Wyuwor8Ze8peEoUoQ==", "dev": true, "funding": [ { @@ -15591,7 +14207,6 @@ "url": "https://github.com/sponsors/faisalman" } ], - "license": "MIT", "engines": { "node": "*" } @@ -15604,8 +14219,9 @@ }, "node_modules/unbzip2-stream": { "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", "dev": true, - "license": "MIT", "dependencies": { "buffer": "^5.2.1", "through": "^2.3.8" @@ -15621,46 +14237,11 @@ "dev": true, "license": "MIT" }, - "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-ecmascript": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/universalify": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, - "license": "MIT", "engines": { "node": ">= 10.0.0" } @@ -15856,27 +14437,30 @@ } }, "node_modules/wdio-mediawiki": { - "version": "2.3.0", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/wdio-mediawiki/-/wdio-mediawiki-2.5.0.tgz", + "integrity": "sha512-cuBotMJyga/49r5rQzO4Op1brj0yj7Kw/FTe3k6TrNJeK5iwIDsbmruEoYwr5Z2cl3TKPuK6Y4YbV/gdSFfqtg==", "dev": true, - "license": "MIT", "dependencies": { "mwbot": "2.1.3" }, "engines": { - "node": ">=10.0" + "node": ">=18.17.0", + "npm": ">=9.6.7" } }, "node_modules/webdriver": { - "version": "7.30.0", + "version": "7.33.0", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-7.33.0.tgz", + "integrity": "sha512-cyMRAVUHgQhEBHojOeNet2e8GkfyvvjpioNCPcF6qUtT+URdagr8Mh0t4Fs+Jr0tpuMqFnw70xZexAcV/6I/jg==", "dev": true, - "license": "MIT", "dependencies": { "@types/node": "^18.0.0", - "@wdio/config": "7.30.0", + "@wdio/config": "7.33.0", "@wdio/logger": "7.26.0", "@wdio/protocols": "7.27.0", - "@wdio/types": "7.26.0", - "@wdio/utils": "7.26.0", + "@wdio/types": "7.33.0", + "@wdio/utils": "7.33.0", "got": "^11.0.2", "ky": "0.30.0", "lodash.merge": "^4.6.1" @@ -15886,25 +14470,26 @@ } }, "node_modules/webdriverio": { - "version": "7.30.1", + "version": "7.36.0", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-7.36.0.tgz", + "integrity": "sha512-OTYmKBF7eFKBX39ojUIEzw7AlE1ZRJiFoMTtEQaPMuPzZCP2jUBq6Ey38nuZrYXLkXn3/le9a14pNnKSM0n56w==", "dev": true, - "license": "MIT", "dependencies": { "@types/aria-query": "^5.0.0", "@types/node": "^18.0.0", - "@wdio/config": "7.30.0", + "@wdio/config": "7.33.0", "@wdio/logger": "7.26.0", "@wdio/protocols": "7.27.0", - "@wdio/repl": "7.26.0", - "@wdio/types": "7.26.0", - "@wdio/utils": "7.26.0", + "@wdio/repl": "7.33.0", + "@wdio/types": "7.33.0", + "@wdio/utils": "7.33.0", "archiver": "^5.0.0", - "aria-query": "^5.0.0", + "aria-query": "^5.2.1", "css-shorthand-properties": "^1.1.1", "css-value": "^0.0.1", - "devtools": "7.30.0", - "devtools-protocol": "^0.0.1102555", - "fs-extra": "^10.0.0", + "devtools": "7.35.0", + "devtools-protocol": "^0.0.1260888", + "fs-extra": "^11.1.1", "grapheme-splitter": "^1.0.2", "lodash.clonedeep": "^4.5.0", "lodash.isobject": "^3.0.2", @@ -15916,7 +14501,7 @@ "resq": "^1.9.1", "rgb2hex": "0.2.5", "serialize-error": "^8.0.0", - "webdriver": "7.30.0" + "webdriver": "7.33.0" }, "engines": { "node": ">=12.0.0" @@ -15924,16 +14509,18 @@ }, "node_modules/webdriverio/node_modules/brace-expansion": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, - "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/webdriverio/node_modules/minimatch": { "version": "6.2.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-6.2.0.tgz", + "integrity": "sha512-sauLxniAmvnhhRjFwPNnJKaPFYyddAgbYdeUpHULtCT/GhzdCx/MDNy+Y40lBxTQUrMzDE8e0S43Z5uqfO0REg==", "dev": true, - "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -16350,8 +14937,9 @@ }, "node_modules/yauzl": { "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "dev": true, - "license": "MIT", "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" @@ -16370,8 +14958,9 @@ }, "node_modules/zip-stream": { "version": "4.1.1", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz", + "integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==", "dev": true, - "license": "MIT", "dependencies": { "archiver-utils": "^3.0.4", "compress-commons": "^4.1.2", @@ -16383,8 +14972,9 @@ }, "node_modules/zip-stream/node_modules/archiver-utils": { "version": "3.0.4", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-3.0.4.tgz", + "integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==", "dev": true, - "license": "MIT", "dependencies": { "glob": "^7.2.3", "graceful-fs": "^4.2.0", @@ -16403,8 +14993,10 @@ }, "node_modules/zip-stream/node_modules/glob": { "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -16419,19 +15011,6 @@ "funding": { "url": "https://github.com/sponsors/isaacs" } - }, - "node_modules/zip-stream/node_modules/readable-stream": { - "version": "3.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } } } } diff --git a/package.json b/package.json index 9e0f6fe5..c0a9d467 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,15 @@ { - "name": "CodeMirror", + "name": "codemirror", "private": true, "scripts": { - "start": "rollup -c --watch", - "build": "rollup -c --environment BUILD:production", + "build": "rollup -c", "test": "npm run test:lint && npm run test:unit && npm run check-built-assets", "test:lint": "npm run test:lint:styles && npm run test:lint:js && npm run test:lint:i18n", "test:lint:js": "eslint --cache .", "test:lint:styles": "stylelint \"resources/**/*.less\"", "test:lint:i18n": "banana-checker i18n/", "test:unit": "jest", - "check-built-assets": "{ git status src/ | grep \"nothing to commit, working tree clean\"; } && { echo 'CHECKING BUILD SOURCES ARE COMMITTED' && npm run build && git status resources/dist/ | grep \"nothing to commit, working tree clean\" || { npm run node-debug; false; }; }", + "check-built-assets": "{ git status src/ | grep \"nothing to commit, working tree clean\"; } && { echo 'CHECKING BUILD SOURCES ARE COMMITTED' && npm run build && git status resources/lib/ | grep \"nothing to commit, working tree clean\" || { npm run node-debug; false; }; }", "node-debug": "node -v && npm -v && echo 'ERROR: Please ensure that production assets have been built with `npm run build` and commited, and that you are using the correct version of Node/NPM.'", "selenium-test": "wdio tests/selenium/wdio.conf.js", "doc": "jsdoc -c jsdoc.json" @@ -19,22 +18,18 @@ "node": "18.20.2" }, "devDependencies": { - "@babel/plugin-transform-private-methods": "7.23.3", - "@babel/preset-env": "7.24.0", "@codemirror/commands": "6.2.5", "@codemirror/language": "6.9.3", "@codemirror/search": "6.5.4", "@codemirror/state": "6.2.1", "@codemirror/view": "6.22.2", "@lezer/highlight": "1.2.0", - "@rollup/plugin-babel": "6.0.4", "@rollup/plugin-node-resolve": "15.2.3", - "@rollup/plugin-terser": "0.4.4", - "@wdio/cli": "7.30.1", - "@wdio/junit-reporter": "7.29.1", - "@wdio/local-runner": "7.30.1", - "@wdio/mocha-framework": "7.26.0", - "@wdio/spec-reporter": "7.29.1", + "@wdio/cli": "7.36.0", + "@wdio/junit-reporter": "7.35.0", + "@wdio/local-runner": "7.36.0", + "@wdio/mocha-framework": "7.33.0", + "@wdio/spec-reporter": "7.33.0", "@wikimedia/mw-node-qunit": "7.2.0", "dotenv": "8.2.0", "eslint-config-wikimedia": "0.28.2", @@ -45,8 +40,7 @@ "jsdoc": "4.0.3", "jsdoc-wmf-theme": "1.1.0", "rollup": "4.13.0", - "rollup-plugin-copy": "3.5.0", "stylelint-config-wikimedia": "0.16.1", - "wdio-mediawiki": "2.3.0" + "wdio-mediawiki": "2.5.0" } } diff --git a/resources/.eslintrc.json b/resources/.eslintrc.json index 983a9234..8e065e0b 100644 --- a/resources/.eslintrc.json +++ b/resources/.eslintrc.json @@ -6,13 +6,18 @@ "wikimedia/mediawiki" ], "parserOptions": { - "sourceType": "commonjs" + "sourceType": "module" + }, + "env": { + "browser": true, + "commonjs": true }, "globals": { - "CodeMirror": "readonly" + "Tree": "readonly" }, "rules": { - "max-len": "off" + "max-len": "off", + "es-x/no-array-prototype-includes": "off" }, "overrides": [ { diff --git a/resources/codemirror.bundle.js b/resources/codemirror.bundle.js new file mode 100644 index 00000000..09342f74 --- /dev/null +++ b/resources/codemirror.bundle.js @@ -0,0 +1,18 @@ +/** + * This file is managed by Rollup and bundles all the CodeMirror dependencies + * into the single file resources/lib/codemirror6.bundle.dist.js. + */ +import '@codemirror/commands'; +import '@codemirror/language'; +import '@codemirror/search'; +import '@codemirror/state'; +import '@codemirror/view'; +import '@lezer/highlight'; + +/* eslint-disable es-x/no-export-ns-from */ +export * from '@codemirror/commands'; +export * from '@codemirror/language'; +export * from '@codemirror/search'; +export * from '@codemirror/state'; +export * from '@codemirror/view'; +export * from '@lezer/highlight'; diff --git a/src/codemirror.js b/resources/codemirror.js similarity index 97% rename from src/codemirror.js rename to resources/codemirror.js index 1fcf5e6a..04f6336a 100644 --- a/src/codemirror.js +++ b/resources/codemirror.js @@ -1,20 +1,23 @@ -import { EditorState, Extension, Compartment } from '@codemirror/state'; -import { +const { + EditorState, EditorView, - drawSelection, - lineNumbers, - highlightSpecialChars, - keymap, - rectangularSelection, + Extension, + Compartment, + ViewUpdate, + bracketMatching, crosshairCursor, - ViewUpdate -} from '@codemirror/view'; -import { defaultKeymap, history, historyKeymap } from '@codemirror/commands'; -import { searchKeymap } from '@codemirror/search'; -import { bracketMatching } from '@codemirror/language'; -import CodeMirrorTextSelection from './codemirror.textSelection'; - -require( '../ext.CodeMirror.data.js' ); + defaultKeymap, + drawSelection, + highlightSpecialChars, + history, + historyKeymap, + keymap, + lineNumbers, + rectangularSelection, + searchKeymap +} = require( 'ext.CodeMirror.v6.lib' ); +const CodeMirrorTextSelection = require( './codemirror.textSelection.js' ); +require( './ext.CodeMirror.data.js' ); /** * Interface for the CodeMirror editor. @@ -381,7 +384,7 @@ class CodeMirror { } ); // Add CodeMirror view to the DOM. - this.#addCodeMirrorToDom(); + this.addCodeMirrorToDom(); // Hide native textarea and sync CodeMirror contents upon submission. this.$textarea.hide(); @@ -418,7 +421,7 @@ class CodeMirror { * * @private */ - #addCodeMirrorToDom() { + addCodeMirrorToDom() { this.$textarea.wrap( '
' ); this.view = new EditorView( { @@ -521,4 +524,4 @@ class CodeMirror { } } -export default CodeMirror; +module.exports = CodeMirror; diff --git a/resources/ext.CodeMirror.v6.less b/resources/codemirror.less similarity index 100% rename from resources/ext.CodeMirror.v6.less rename to resources/codemirror.less diff --git a/src/codemirror.bidiIsolation.js b/resources/codemirror.mediawiki.bidiIsolation.js similarity index 89% rename from src/codemirror.bidiIsolation.js rename to resources/codemirror.mediawiki.bidiIsolation.js index dc9e20ba..00267a7f 100644 --- a/src/codemirror.bidiIsolation.js +++ b/resources/codemirror.mediawiki.bidiIsolation.js @@ -1,15 +1,17 @@ -import { +const { Decoration, DecorationSet, Direction, EditorView, PluginSpec, + Prec, + RangeSet, + RangeSetBuilder, ViewPlugin, - ViewUpdate -} from '@codemirror/view'; -import { Prec, RangeSet, RangeSetBuilder } from '@codemirror/state'; -import { syntaxTree } from '@codemirror/language'; -import { mwModeConfig } from './codemirror.mode.mediawiki.config'; + ViewUpdate, + syntaxTree +} = require( 'ext.CodeMirror.v6.lib' ); +const mwModeConfig = require( './codemirror.mediawiki.config.js' ); /** * @type {Decoration} @@ -122,4 +124,4 @@ const bidiIsolationSpec = { * @module CodeMirrorBidiIsolation * @see https://codemirror.net/examples/bidi/ */ -export default ViewPlugin.fromClass( CodeMirrorBidiIsolation, bidiIsolationSpec ); +module.exports = ViewPlugin.fromClass( CodeMirrorBidiIsolation, bidiIsolationSpec ); diff --git a/resources/mode/mediawiki/colorblind-colors.less b/resources/codemirror.mediawiki.colorblind.less similarity index 100% rename from resources/mode/mediawiki/colorblind-colors.less rename to resources/codemirror.mediawiki.colorblind.less diff --git a/src/codemirror.mode.mediawiki.config.js b/resources/codemirror.mediawiki.config.js similarity index 97% rename from src/codemirror.mode.mediawiki.config.js rename to resources/codemirror.mediawiki.config.js index c10b36ff..87a83b1b 100644 --- a/src/codemirror.mode.mediawiki.config.js +++ b/resources/codemirror.mediawiki.config.js @@ -1,5 +1,9 @@ -import { Tag, tags } from '@lezer/highlight'; -import { TagStyle, StreamParser } from '@codemirror/language'; +const { + StreamParser, + Tag, + TagStyle, + tags +} = require( 'ext.CodeMirror.v6.lib' ); /** * Configuration for the MediaWiki highlighting mode for CodeMirror. @@ -10,7 +14,7 @@ import { TagStyle, StreamParser } from '@codemirror/language'; * * @example * // within MediaWiki: - * import { mwModeConfig } from 'ext.CodeMirror.v6.mode.mediawiki'; + * const { mwModeConfig } = require( 'ext.CodeMirror.v6.mode.mediawiki' ); * // Reference tags by their constants in the tags property. * if ( tag === mwModeConfig.tags.htmlTagBracket ) { * // … @@ -118,7 +122,7 @@ class CodeMirrorModeMediaWikiConfig { * @return {Object} */ get tags() { - return { + return Object.assign( { apostrophes: 'character', apostrophesBold: 'strong', apostrophesItalic: 'emphasis', @@ -160,9 +164,8 @@ class CodeMirrorModeMediaWikiConfig { templateName: 'moduleKeyword', templateVariable: 'atom', templateVariableBracket: 'brace', - templateVariableName: 'variableName', - ...this.#customTags - }; + templateVariableName: 'variableName' + }, this.customTags ); } /** @@ -175,7 +178,7 @@ class CodeMirrorModeMediaWikiConfig { * @return {Object} * @private */ - get #customTags() { + get customTags() { return { em: 'mw-em', error: 'mw-error', @@ -203,7 +206,7 @@ class CodeMirrorModeMediaWikiConfig { /** * These are custom tokens (a.k.a. tags) that aren't mapped to any of the standardized tags. - * Make sure these are also defined in #customTags() above. + * Make sure these are also defined in customTags() above. * * TODO: pass parent Tags in Tag.define() where appropriate for better theming. * @@ -516,4 +519,6 @@ class CodeMirrorModeMediaWikiConfig { * @member CodeMirrorModeMediaWikiConfig * @type {CodeMirrorModeMediaWikiConfig} */ -export const mwModeConfig = new CodeMirrorModeMediaWikiConfig(); +const mwModeConfig = new CodeMirrorModeMediaWikiConfig(); + +module.exports = mwModeConfig; diff --git a/src/codemirror.mediawiki.js b/resources/codemirror.mediawiki.init.js similarity index 74% rename from src/codemirror.mediawiki.js rename to resources/codemirror.mediawiki.init.js index 57b985e4..b2bd620f 100644 --- a/src/codemirror.mediawiki.js +++ b/resources/codemirror.mediawiki.init.js @@ -1,5 +1,5 @@ -import CodeMirror from './codemirror'; -import mediaWikiLang from './codemirror.mode.mediawiki'; +const CodeMirror = require( 'ext.CodeMirror.v6' ); +const mediaWikiLang = require( 'ext.CodeMirror.v6.mode.mediawiki' ); const textarea = document.getElementById( 'wpTextbox1' ); const cm = new CodeMirror( textarea ); diff --git a/src/codemirror.mode.mediawiki.js b/resources/codemirror.mediawiki.js similarity index 77% rename from src/codemirror.mode.mediawiki.js rename to resources/codemirror.mediawiki.js index 56524734..d757139b 100644 --- a/src/codemirror.mode.mediawiki.js +++ b/resources/codemirror.mediawiki.js @@ -1,15 +1,15 @@ -import { +const { HighlightStyle, LanguageSupport, StreamLanguage, StreamParser, StringStream, + Tag, syntaxHighlighting -} from '@codemirror/language'; -import { mwModeConfig as modeConfig } from './codemirror.mode.mediawiki.config'; -import { Tag } from '@lezer/highlight'; -import templateFoldingExtension from './codemirror.templateFolding'; -import bidiIsolationExtension from './codemirror.bidiIsolation'; +} = require( 'ext.CodeMirror.v6.lib' ); +const mwModeConfig = require( './codemirror.mediawiki.config.js' ); +const bidiIsolationExtension = require( './codemirror.mediawiki.bidiIsolation.js' ); +const templateFoldingExtension = require( './codemirror.mediawiki.templateFolding.js' ); /** * MediaWiki language support for CodeMirror 6. @@ -47,11 +47,11 @@ class CodeMirrorModeMediaWiki { this.oldStyle = null; this.tokens = []; this.oldTokens = []; - this.tokenTable = modeConfig.tokenTable; + this.tokenTable = mwModeConfig.tokenTable; this.registerGroundTokens(); // Dynamically register any tags that aren't already in CodeMirrorModeMediaWikiConfig - Object.keys( this.config.tags ).forEach( ( tag ) => modeConfig.addTag( tag ) ); + Object.keys( this.config.tags ).forEach( ( tag ) => mwModeConfig.addTag( tag ) ); } /** @@ -94,7 +94,7 @@ class CodeMirrorModeMediaWiki { 'mw-template3-ext3-link-ground', 'mw-template3-ground', 'mw-template3-link-ground' - ].forEach( ( ground ) => modeConfig.addToken( ground ) ); + ].forEach( ( ground ) => mwModeConfig.addToken( ground ) ); } eatHtmlEntity( stream, style ) { @@ -109,7 +109,7 @@ class CodeMirrorModeMediaWiki { ok = stream.eatWhile( /[\w.\-:]/ ) && stream.eat( ';' ); } if ( ok ) { - return modeConfig.tags.htmlEntity; + return mwModeConfig.tags.htmlEntity; } return style; } @@ -120,10 +120,10 @@ class CodeMirrorModeMediaWiki { makeStyle( style, state, endGround ) { if ( this.isBold || state.nDt > 0 ) { - style += ' ' + modeConfig.tags.strong; + style += ' ' + mwModeConfig.tags.strong; } if ( this.isItalic ) { - style += ' ' + modeConfig.tags.em; + style += ' ' + mwModeConfig.tags.em; } return this.makeLocalStyle( style, state, endGround ); } @@ -196,7 +196,7 @@ class CodeMirrorModeMediaWiki { if ( stream.eat( char ) ) { return this.makeLocalStyle( style, state ); } - return this.makeLocalStyle( modeConfig.tags.error, state ); + return this.makeLocalStyle( mwModeConfig.tags.error, state ); }; } @@ -205,89 +205,89 @@ class CodeMirrorModeMediaWiki { if ( stream.match( /^[^&<[{~]+/ ) ) { if ( stream.eol() ) { stream.backUp( count ); - state.tokenize = this.eatEnd( modeConfig.tags.sectionHeader ); + state.tokenize = this.eatEnd( mwModeConfig.tags.sectionHeader ); } else if ( stream.match( /^.*?=)/, false ) ) { // T171074: handle trailing comments stream.backUp( count ); - state.tokenize = this.eatBlock( modeConfig.tags.sectionHeader, '/ ) ) { - return this.makeLocalStyle( modeConfig.tags.comment, state ); + return this.makeLocalStyle( mwModeConfig.tags.comment, state ); } if ( haveAte && stream.sol() ) { // @todo error message @@ -297,14 +297,14 @@ class CodeMirrorModeMediaWiki { } if ( stream.match( /^[\s\u00a0]*[^\s\u00a0|}<{&~]+/ ) ) { state.tokenize = this.eatTemplatePageName( true ); - return this.makeLocalStyle( modeConfig.tags.templateName, state ); + return this.makeLocalStyle( mwModeConfig.tags.templateName, state ); } else if ( stream.eatSpace() ) { if ( stream.eol() === true ) { - return this.makeLocalStyle( modeConfig.tags.templateName, state ); + return this.makeLocalStyle( mwModeConfig.tags.templateName, state ); } - return this.makeLocalStyle( modeConfig.tags.templateName, state ); + return this.makeLocalStyle( mwModeConfig.tags.templateName, state ); } - return this.eatWikiText( modeConfig.tags.templateName )( stream, state ); + return this.eatWikiText( mwModeConfig.tags.templateName )( stream, state ); }; } @@ -313,19 +313,19 @@ class CodeMirrorModeMediaWiki { if ( expectArgName && stream.eatWhile( /[^=|}{[<&~]/ ) ) { if ( stream.eat( '=' ) ) { state.tokenize = this.eatTemplateArgument( false ); - return this.makeLocalStyle( modeConfig.tags.templateArgumentName, state ); + return this.makeLocalStyle( mwModeConfig.tags.templateArgumentName, state ); } - return this.makeLocalStyle( modeConfig.tags.template, state ); + return this.makeLocalStyle( mwModeConfig.tags.template, state ); } else if ( stream.eatWhile( /[^|}{[<&~]/ ) ) { - return this.makeLocalStyle( modeConfig.tags.template, state ); + return this.makeLocalStyle( mwModeConfig.tags.template, state ); } else if ( stream.eat( '|' ) ) { state.tokenize = this.eatTemplateArgument( true ); - return this.makeLocalStyle( modeConfig.tags.templateDelimiter, state ); + return this.makeLocalStyle( mwModeConfig.tags.templateDelimiter, state ); } else if ( stream.match( '}}' ) ) { state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.templateBracket, state, 'nTemplate' ); + return this.makeLocalStyle( mwModeConfig.tags.templateBracket, state, 'nTemplate' ); } - return this.eatWikiText( modeConfig.tags.template )( stream, state ); + return this.eatWikiText( mwModeConfig.tags.template )( stream, state ); }; } @@ -342,7 +342,7 @@ class CodeMirrorModeMediaWiki { } else { state.tokenize = this.inExternalLink.bind( this ); } - return this.makeLocalStyle( modeConfig.tags.extLinkProtocol, state ); + return this.makeLocalStyle( mwModeConfig.tags.extLinkProtocol, state ); }; } @@ -355,7 +355,7 @@ class CodeMirrorModeMediaWiki { } if ( stream.match( /^[\s\u00a0]*\]/ ) ) { state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.extLinkBracket, state, 'nLink' ); + return this.makeLocalStyle( mwModeConfig.tags.extLinkBracket, state, 'nLink' ); } if ( stream.eatSpace() ) { state.tokenize = this.inExternalLinkText.bind( this ); @@ -369,9 +369,9 @@ class CodeMirrorModeMediaWiki { stream.next(); } } - return this.makeStyle( modeConfig.tags.extLink, state ); + return this.makeStyle( mwModeConfig.tags.extLink, state ); } - return this.eatWikiText( modeConfig.tags.extLink )( stream, state ); + return this.eatWikiText( mwModeConfig.tags.extLink )( stream, state ); } inExternalLinkText( stream, state ) { @@ -383,12 +383,12 @@ class CodeMirrorModeMediaWiki { } if ( stream.eat( ']' ) ) { state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.extLinkBracket, state, 'nLink' ); + return this.makeLocalStyle( mwModeConfig.tags.extLinkBracket, state, 'nLink' ); } if ( stream.match( /^[^'\]{&~<]+/ ) ) { - return this.makeStyle( modeConfig.tags.extLinkText, state ); + return this.makeStyle( mwModeConfig.tags.extLinkText, state ); } - return this.eatWikiText( modeConfig.tags.extLinkText )( stream, state ); + return this.eatWikiText( mwModeConfig.tags.extLinkText )( stream, state ); } inLink( stream, state ) { @@ -400,24 +400,24 @@ class CodeMirrorModeMediaWiki { } if ( stream.match( /^[\s\u00a0]*#[\s\u00a0]*/ ) ) { state.tokenize = this.inLinkToSection.bind( this ); - return this.makeLocalStyle( modeConfig.tags.link, state ); + return this.makeLocalStyle( mwModeConfig.tags.link, state ); } if ( stream.match( /^[\s\u00a0]*\|[\s\u00a0]*/ ) ) { state.tokenize = this.eatLinkText(); - return this.makeLocalStyle( modeConfig.tags.linkDelimiter, state ); + return this.makeLocalStyle( mwModeConfig.tags.linkDelimiter, state ); } if ( stream.match( /^[\s\u00a0]*\]\]/ ) ) { state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.linkBracket, state, 'nLink' ); + return this.makeLocalStyle( mwModeConfig.tags.linkBracket, state, 'nLink' ); } if ( stream.match( /^[\s\u00a0]*[^\s\u00a0#|\]&~{]+/ ) || stream.eatSpace() ) { return this.makeStyle( - `${ modeConfig.tags.linkPageName } ${ modeConfig.tags.pageName }`, + `${ mwModeConfig.tags.linkPageName } ${ mwModeConfig.tags.pageName }`, state ); } return this.eatWikiText( - `${ modeConfig.tags.linkPageName } ${ modeConfig.tags.pageName }` + `${ mwModeConfig.tags.linkPageName } ${ mwModeConfig.tags.pageName }` )( stream, state ); } @@ -430,17 +430,17 @@ class CodeMirrorModeMediaWiki { } // FIXME '{{' breaks links, example: [[z{{page]] if ( stream.match( /^[^|\]&~{}]+/ ) ) { - return this.makeLocalStyle( modeConfig.tags.linkToSection, state ); + return this.makeLocalStyle( mwModeConfig.tags.linkToSection, state ); } if ( stream.eat( '|' ) ) { state.tokenize = this.eatLinkText(); - return this.makeLocalStyle( modeConfig.tags.linkDelimiter, state ); + return this.makeLocalStyle( mwModeConfig.tags.linkDelimiter, state ); } if ( stream.match( ']]' ) ) { state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.linkBracket, state, 'nLink' ); + return this.makeLocalStyle( mwModeConfig.tags.linkBracket, state, 'nLink' ); } - return this.eatWikiText( modeConfig.tags.linkToSection )( stream, state ); + return this.eatWikiText( mwModeConfig.tags.linkToSection )( stream, state ); } eatLinkText() { @@ -449,28 +449,28 @@ class CodeMirrorModeMediaWiki { let tmpstyle; if ( stream.match( ']]' ) ) { state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.linkBracket, state, 'nLink' ); + return this.makeLocalStyle( mwModeConfig.tags.linkBracket, state, 'nLink' ); } if ( stream.match( '\'\'\'' ) ) { linkIsBold = !linkIsBold; return this.makeLocalStyle( - `${ modeConfig.tags.linkText } ${ modeConfig.tags.apostrophes }`, + `${ mwModeConfig.tags.linkText } ${ mwModeConfig.tags.apostrophes }`, state ); } if ( stream.match( '\'\'' ) ) { linkIsItalic = !linkIsItalic; return this.makeLocalStyle( - `${ modeConfig.tags.linkText } ${ modeConfig.tags.apostrophes }`, + `${ mwModeConfig.tags.linkText } ${ mwModeConfig.tags.apostrophes }`, state ); } - tmpstyle = modeConfig.tags.linkText; + tmpstyle = mwModeConfig.tags.linkText; if ( linkIsBold ) { - tmpstyle += ' ' + modeConfig.tags.strong; + tmpstyle += ' ' + mwModeConfig.tags.strong; } if ( linkIsItalic ) { - tmpstyle += ' ' + modeConfig.tags.em; + tmpstyle += ' ' + mwModeConfig.tags.em; } if ( stream.match( /^[^'\]{&~<]+/ ) ) { return this.makeStyle( tmpstyle, state ); @@ -490,23 +490,23 @@ class CodeMirrorModeMediaWiki { name = name.toLowerCase(); if ( isHtmlTag ) { - if ( isCloseTag && !modeConfig.implicitlyClosedHtmlTags[ name ] ) { - state.tokenize = this.eatChar( '>', modeConfig.tags.htmlTagBracket ); + if ( isCloseTag && !mwModeConfig.implicitlyClosedHtmlTags[ name ] ) { + state.tokenize = this.eatChar( '>', mwModeConfig.tags.htmlTagBracket ); } else { state.tokenize = this.eatHtmlTagAttribute( name ); } - return this.makeLocalStyle( modeConfig.tags.htmlTagName, state ); + return this.makeLocalStyle( mwModeConfig.tags.htmlTagName, state ); } // it is the extension tag if ( isCloseTag ) { state.tokenize = this.eatChar( '>', - `${ modeConfig.tags.extTagBracket } mw-ext-${ name }` + `${ mwModeConfig.tags.extTagBracket } mw-ext-${ name }` ); } else { state.tokenize = this.eatExtTagAttribute( name ); } - return this.makeLocalStyle( `${ modeConfig.tags.extTagName } mw-ext-${ name }`, state ); + return this.makeLocalStyle( `${ mwModeConfig.tags.extTagName } mw-ext-${ name }`, state ); }; } @@ -514,20 +514,20 @@ class CodeMirrorModeMediaWiki { return ( stream, state ) => { if ( stream.match( /^(?:"[^<">]*"|'[^<'>]*'|[^>/<{&~])+/ ) ) { - return this.makeLocalStyle( modeConfig.tags.htmlTagAttribute, state ); + return this.makeLocalStyle( mwModeConfig.tags.htmlTagAttribute, state ); } if ( stream.eat( '>' ) ) { - if ( !( name in modeConfig.implicitlyClosedHtmlTags ) ) { + if ( !( name in mwModeConfig.implicitlyClosedHtmlTags ) ) { state.inHtmlTag.push( name ); } state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.htmlTagBracket, state ); + return this.makeLocalStyle( mwModeConfig.tags.htmlTagBracket, state ); } if ( stream.match( '/>' ) ) { state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.htmlTagBracket, state ); + return this.makeLocalStyle( mwModeConfig.tags.htmlTagBracket, state ); } - return this.eatWikiText( modeConfig.tags.htmlTagAttribute )( stream, state ); + return this.eatWikiText( mwModeConfig.tags.htmlTagAttribute )( stream, state ); }; } @@ -546,7 +546,7 @@ class CodeMirrorModeMediaWiki { return ( stream, state ) => { if ( stream.match( /^(?:"[^">]*"|'[^'>]*'|[^>/<{&~])+/ ) ) { - return this.makeLocalStyle( `${ modeConfig.tags.extTagAttribute } mw-ext-${ name }`, state ); + return this.makeLocalStyle( `${ mwModeConfig.tags.extTagAttribute } mw-ext-${ name }`, state ); } if ( stream.eat( '>' ) ) { state.extName = name; @@ -570,13 +570,13 @@ class CodeMirrorModeMediaWiki { } state.tokenize = this.eatExtTagArea( name ); - return this.makeLocalStyle( `${ modeConfig.tags.extTagBracket } mw-ext-${ name }`, state ); + return this.makeLocalStyle( `${ mwModeConfig.tags.extTagBracket } mw-ext-${ name }`, state ); } if ( stream.match( '/>' ) ) { state.tokenize = state.stack.pop(); - return this.makeLocalStyle( `${ modeConfig.tags.extTagBracket } mw-ext-${ name }`, state ); + return this.makeLocalStyle( `${ mwModeConfig.tags.extTagBracket } mw-ext-${ name }`, state ); } - return this.eatWikiText( `${ modeConfig.tags.extTagAttribute } mw-ext-${ name }` )( stream, state ); + return this.eatWikiText( `${ mwModeConfig.tags.extTagAttribute } mw-ext-${ name }` )( stream, state ); }; } @@ -615,7 +615,7 @@ class CodeMirrorModeMediaWiki { stream.next(); // eat < stream.next(); // eat / state.tokenize = this.eatTagName( name.length, true, false ); - return this.makeLocalStyle( `${ modeConfig.tags.extTagBracket } mw-ext-${ name }`, state ); + return this.makeLocalStyle( `${ mwModeConfig.tags.extTagBracket } mw-ext-${ name }`, state ); }; } @@ -623,7 +623,7 @@ class CodeMirrorModeMediaWiki { return ( stream, state ) => { let ret; if ( state.extMode === false ) { - ret = modeConfig.tags.extTag; + ret = mwModeConfig.tags.extTag; stream.skipToEnd(); } else { ret = `mw-tag-${ state.extName } ` + @@ -643,7 +643,7 @@ class CodeMirrorModeMediaWiki { stream.match( '{|' ); stream.eatSpace(); state.tokenize = this.inTableDefinition.bind( this ); - return modeConfig.tags.tableBracket; + return mwModeConfig.tags.tableBracket; } inTableDefinition( stream, state ) { @@ -651,7 +651,7 @@ class CodeMirrorModeMediaWiki { state.tokenize = this.inTable.bind( this ); return this.inTable( stream, state ); } - return this.eatWikiText( modeConfig.tags.tableDefinition )( stream, state ); + return this.eatWikiText( mwModeConfig.tags.tableDefinition )( stream, state ); } inTable( stream, state ) { @@ -661,25 +661,25 @@ class CodeMirrorModeMediaWiki { if ( stream.eat( '-' ) ) { stream.eatSpace(); state.tokenize = this.inTableDefinition.bind( this ); - return this.makeLocalStyle( modeConfig.tags.tableDelimiter, state ); + return this.makeLocalStyle( mwModeConfig.tags.tableDelimiter, state ); } if ( stream.eat( '+' ) ) { stream.eatSpace(); state.tokenize = this.eatTableRow( true, false, true ); - return this.makeLocalStyle( modeConfig.tags.tableDelimiter, state ); + return this.makeLocalStyle( mwModeConfig.tags.tableDelimiter, state ); } if ( stream.eat( '}' ) ) { state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.tableBracket, state ); + return this.makeLocalStyle( mwModeConfig.tags.tableBracket, state ); } stream.eatSpace(); state.tokenize = this.eatTableRow( true, false ); - return this.makeLocalStyle( modeConfig.tags.tableDelimiter, state ); + return this.makeLocalStyle( mwModeConfig.tags.tableDelimiter, state ); } if ( stream.eat( '!' ) ) { stream.eatSpace(); state.tokenize = this.eatTableRow( true, true ); - return this.makeLocalStyle( modeConfig.tags.tableDelimiter, state ); + return this.makeLocalStyle( mwModeConfig.tags.tableDelimiter, state ); } } return this.eatWikiText( '' )( stream, state ); @@ -689,9 +689,9 @@ class CodeMirrorModeMediaWiki { eatTableRow( isStart, isHead, isCaption ) { let tag = ''; if ( isCaption ) { - tag = modeConfig.tags.tableCaption; + tag = mwModeConfig.tags.tableCaption; } else if ( isHead ) { - tag = modeConfig.tags.strong; + tag = mwModeConfig.tags.strong; } return ( stream, state ) => { if ( stream.sol() ) { @@ -707,11 +707,11 @@ class CodeMirrorModeMediaWiki { this.isBold = false; this.isItalic = false; state.tokenize = this.eatTableRow( true, isHead, isCaption ); - return this.makeLocalStyle( modeConfig.tags.tableDelimiter, state ); + return this.makeLocalStyle( mwModeConfig.tags.tableDelimiter, state ); } if ( isStart && stream.eat( '|' ) ) { state.tokenize = this.eatTableRow( false, isHead, isCaption ); - return this.makeLocalStyle( modeConfig.tags.tableDelimiter, state ); + return this.makeLocalStyle( mwModeConfig.tags.tableDelimiter, state ); } } return this.eatWikiText( tag )( stream, state ); @@ -721,7 +721,7 @@ class CodeMirrorModeMediaWiki { eatFreeExternalLinkProtocol( stream, state ) { stream.match( this.urlProtocols ); state.tokenize = this.eatFreeExternalLink.bind( this ); - return this.makeLocalStyle( modeConfig.tags.freeExtLinkProtocol, state ); + return this.makeLocalStyle( mwModeConfig.tags.freeExtLinkProtocol, state ); } eatFreeExternalLink( stream, state ) { @@ -731,24 +731,24 @@ class CodeMirrorModeMediaWiki { if ( stream.peek() === '~' ) { if ( !stream.match( /^~~~+/, false ) ) { stream.match( /^~*/ ); - return this.makeLocalStyle( modeConfig.tags.freeExtLink, state ); + return this.makeLocalStyle( mwModeConfig.tags.freeExtLink, state ); } } else if ( stream.peek() === '{' ) { if ( !stream.match( '{{', false ) ) { stream.next(); - return this.makeLocalStyle( modeConfig.tags.freeExtLink, state ); + return this.makeLocalStyle( mwModeConfig.tags.freeExtLink, state ); } } else if ( stream.peek() === '\'' ) { if ( !stream.match( '\'\'', false ) ) { stream.next(); - return this.makeLocalStyle( modeConfig.tags.freeExtLink, state ); + return this.makeLocalStyle( mwModeConfig.tags.freeExtLink, state ); } } else if ( stream.match( /^[).,]+(?=[^\s\u00a0{[\]<>~).,])/ ) ) { - return this.makeLocalStyle( modeConfig.tags.freeExtLink, state ); + return this.makeLocalStyle( mwModeConfig.tags.freeExtLink, state ); } } state.tokenize = state.stack.pop(); - return this.makeLocalStyle( modeConfig.tags.freeExtLink, state ); + return this.makeLocalStyle( mwModeConfig.tags.freeExtLink, state ); } eatList( stream, state ) { @@ -757,7 +757,7 @@ class CodeMirrorModeMediaWiki { if ( mt && !this.isNested( state ) && mt[ 0 ].includes( ';' ) ) { state.nDt += mt[ 0 ].split( ';' ).length - 1; } - return this.makeLocalStyle( modeConfig.tags.list, state ); + return this.makeLocalStyle( mwModeConfig.tags.list, state ); } /** @@ -781,13 +781,13 @@ class CodeMirrorModeMediaWiki { if ( !stream.match( '//', false ) && stream.match( this.urlProtocols ) ) { state.stack.push( state.tokenize ); state.tokenize = this.eatFreeExternalLink.bind( this ); - return this.makeLocalStyle( modeConfig.tags.freeExtLinkProtocol, state ); + return this.makeLocalStyle( mwModeConfig.tags.freeExtLinkProtocol, state ); } ch = stream.next(); switch ( ch ) { case '-': if ( stream.match( /^---+/ ) ) { - return modeConfig.tags.hr; + return mwModeConfig.tags.hr; } break; case '=': @@ -798,7 +798,7 @@ class CodeMirrorModeMediaWiki { stream.backUp( tmp[ 2 ].length ); state.stack.push( state.tokenize ); state.tokenize = this.eatSectionHeader( tmp[ 3 ].length ); - return modeConfig.tags.sectionHeader + ' ' + + return mwModeConfig.tags.sectionHeader + ' ' + /** * Tokens used here include: * - cm-mw-section-1 @@ -808,12 +808,12 @@ class CodeMirrorModeMediaWiki { * - cm-mw-section-5 * - cm-mw-section-6 */ - modeConfig.tags[ `sectionHeader${ tmp[ 1 ].length + 1 }` ]; + mwModeConfig.tags[ `sectionHeader${ tmp[ 1 ].length + 1 }` ]; } break; case ';': stream.backUp( 1 ); - // fall through + // fall through case '*': case '#': return this.eatList( stream, state ); @@ -831,11 +831,11 @@ class CodeMirrorModeMediaWiki { if ( stream.match( /^:+/ ) ) { // ::{| state.stack.push( state.tokenize ); state.tokenize = this.eatStartTable.bind( this ); - return modeConfig.tags.indenting; + return mwModeConfig.tags.indenting; } stream.eat( '{' ); } else { - return modeConfig.tags.skipFormatting; + return mwModeConfig.tags.skipFormatting; } // break is not necessary here // falls through @@ -844,7 +844,7 @@ class CodeMirrorModeMediaWiki { stream.eatSpace(); state.stack.push( state.tokenize ); state.tokenize = this.inTableDefinition.bind( this ); - return modeConfig.tags.tableBracket; + return mwModeConfig.tags.tableBracket; } } } else { @@ -867,10 +867,10 @@ class CodeMirrorModeMediaWiki { this.prepareItalicForCorrection( stream ); } this.isBold = !this.isBold; - return this.makeLocalStyle( modeConfig.tags.apostrophesBold, state ); + return this.makeLocalStyle( mwModeConfig.tags.apostrophesBold, state ); } else if ( stream.eat( '\'' ) ) { // italic this.isItalic = !this.isItalic; - return this.makeLocalStyle( modeConfig.tags.apostrophesItalic, state ); + return this.makeLocalStyle( mwModeConfig.tags.apostrophesItalic, state ); } break; case '[': @@ -880,7 +880,7 @@ class CodeMirrorModeMediaWiki { state.nLink++; state.stack.push( state.tokenize ); state.tokenize = this.inLink.bind( this ); - return this.makeLocalStyle( modeConfig.tags.linkBracket, state ); + return this.makeLocalStyle( mwModeConfig.tags.linkBracket, state ); } } else { mt = stream.match( this.urlProtocols ); @@ -889,7 +889,7 @@ class CodeMirrorModeMediaWiki { stream.backUp( mt[ 0 ].length ); state.stack.push( state.tokenize ); state.tokenize = this.eatExternalLinkProtocol( mt[ 0 ].length ); - return this.makeLocalStyle( modeConfig.tags.extLinkBracket, state ); + return this.makeLocalStyle( mwModeConfig.tags.extLinkBracket, state ); } } break; @@ -901,7 +901,7 @@ class CodeMirrorModeMediaWiki { state.stack.push( state.tokenize ); state.tokenize = this.inVariable.bind( this ); return this.makeLocalStyle( - modeConfig.tags.templateVariableBracket, + mwModeConfig.tags.templateVariableBracket, state ); } else if ( stream.match( /^{(?!{(?!{))[\s\u00a0]*/ ) ) { @@ -911,7 +911,7 @@ class CodeMirrorModeMediaWiki { state.stack.push( state.tokenize ); state.tokenize = this.inParserFunctionName.bind( this ); return this.makeLocalStyle( - modeConfig.tags.parserFunctionBracket, + mwModeConfig.tags.parserFunctionBracket, state ); } @@ -931,7 +931,7 @@ class CodeMirrorModeMediaWiki { state.stack.push( state.tokenize ); state.tokenize = this.inParserFunctionName.bind( this ); return this.makeLocalStyle( - modeConfig.tags.parserFunctionBracket, + mwModeConfig.tags.parserFunctionBracket, state ); } @@ -940,39 +940,39 @@ class CodeMirrorModeMediaWiki { state.nTemplate++; state.stack.push( state.tokenize ); state.tokenize = this.eatTemplatePageName( false ); - return this.makeLocalStyle( modeConfig.tags.templateBracket, state ); + return this.makeLocalStyle( mwModeConfig.tags.templateBracket, state ); } break; case '<': isCloseTag = !!stream.eat( '/' ); tagname = stream.match( /^[^>/\s\u00a0.*,[\]{}$^+?|/\\'`~<=!@#%&()-]+/ ); if ( stream.match( '!--' ) ) { // comment - return chain( this.eatBlock( modeConfig.tags.comment, '-->' ) ); + return chain( this.eatBlock( mwModeConfig.tags.comment, '-->' ) ); } if ( tagname ) { tagname = tagname[ 0 ].toLowerCase(); if ( tagname in this.config.tags ) { // Parser function if ( isCloseTag === true ) { - return modeConfig.tags.error; + return mwModeConfig.tags.error; } stream.backUp( tagname.length ); state.stack.push( state.tokenize ); state.tokenize = this.eatTagName( tagname.length, isCloseTag, false ); - return this.makeLocalStyle( `${ modeConfig.tags.extTagBracket } mw-ext-${ tagname }`, state ); + return this.makeLocalStyle( `${ mwModeConfig.tags.extTagBracket } mw-ext-${ tagname }`, state ); } - if ( tagname in modeConfig.permittedHtmlTags ) { + if ( tagname in mwModeConfig.permittedHtmlTags ) { // Html tag if ( isCloseTag === true && tagname !== state.inHtmlTag.pop() ) { // Increment position so that the closing '>' gets highlighted red. stream.pos++; - return modeConfig.tags.error; + return mwModeConfig.tags.error; } if ( isCloseTag === true && - tagname in modeConfig.implicitlyClosedHtmlTags + tagname in mwModeConfig.implicitlyClosedHtmlTags ) { - return modeConfig.tags.error; + return mwModeConfig.tags.error; } stream.backUp( tagname.length ); state.stack.push( state.tokenize ); @@ -980,17 +980,17 @@ class CodeMirrorModeMediaWiki { tagname.length, // Opening void tags should also be treated as the closing tag. isCloseTag || - ( tagname in modeConfig.implicitlyClosedHtmlTags ), + ( tagname in mwModeConfig.implicitlyClosedHtmlTags ), true ); - return this.makeLocalStyle( modeConfig.tags.htmlTagBracket, state ); + return this.makeLocalStyle( mwModeConfig.tags.htmlTagBracket, state ); } stream.backUp( tagname.length ); } break; case '~': if ( stream.match( /^~{2,4}/ ) ) { - return modeConfig.tags.signature; + return mwModeConfig.tags.signature; } break; // Maybe double underscored Magic Word such as __TOC__ @@ -1008,7 +1008,7 @@ class CodeMirrorModeMediaWiki { } // Optimization: skip regex function for EOL and backup-ed symbols return this.makeStyle( style, state ); - // Check on double underscore Magic Word + // Check on double underscore Magic Word } else if ( tmp === 2 ) { // The same as the end of function except '_' inside and '__' at the end. name = stream.match( /^([^\s\u00a0>}[\]<{'|&:~]+?)__/ ); @@ -1017,7 +1017,7 @@ class CodeMirrorModeMediaWiki { '__' + name[ 0 ].toLowerCase() in this.config.doubleUnderscore[ 0 ] || '__' + name[ 0 ] in this.config.doubleUnderscore[ 1 ] ) { - return modeConfig.tags.doubleUnderscore; + return mwModeConfig.tags.doubleUnderscore; } if ( !stream.eol() ) { // Two underscore symbols at the end can be the @@ -1032,7 +1032,7 @@ class CodeMirrorModeMediaWiki { case ':': if ( state.nDt > 0 && !this.isNested( state ) ) { state.nDt--; - return modeConfig.tags.indenting; + return mwModeConfig.tags.indenting; } break; default: @@ -1266,14 +1266,14 @@ class CodeMirrorModeMediaWiki { * @return {LanguageSupport} * @stable to call */ -export default ( config = { bidiIsolation: false }, mwConfig = null ) => { +const mediaWikiLang = ( config = { bidiIsolation: false }, mwConfig = null ) => { mwConfig = mwConfig || mw.config.get( 'extCodeMirrorConfig' ); const mode = new CodeMirrorModeMediaWiki( mwConfig ); const parser = mode.mediawiki; const lang = StreamLanguage.define( parser ); const langExtension = [ syntaxHighlighting( HighlightStyle.define( - modeConfig.getTagStyles( parser ) + mwModeConfig.getTagStyles( parser ) ) ) ]; @@ -1292,3 +1292,5 @@ export default ( config = { bidiIsolation: false }, mwConfig = null ) => { return new LanguageSupport( lang, langExtension ); }; + +module.exports = mediaWikiLang; diff --git a/resources/mode/mediawiki/mediawiki.less b/resources/codemirror.mediawiki.less similarity index 100% rename from resources/mode/mediawiki/mediawiki.less rename to resources/codemirror.mediawiki.less diff --git a/src/codemirror.templateFolding.js b/resources/codemirror.mediawiki.templateFolding.js similarity index 95% rename from src/codemirror.templateFolding.js rename to resources/codemirror.mediawiki.templateFolding.js index c0dc57ea..bcdee46b 100644 --- a/src/codemirror.templateFolding.js +++ b/resources/codemirror.mediawiki.templateFolding.js @@ -1,8 +1,22 @@ -import { showTooltip, keymap, Tooltip, KeyBinding } from '@codemirror/view'; -import { StateField, Extension, EditorState } from '@codemirror/state'; -import { foldEffect, syntaxTree, ensureSyntaxTree, foldedRanges, unfoldAll, unfoldEffect, codeFolding } from '@codemirror/language'; -import { SyntaxNode, Tree } from '@lezer/common'; -import { mwModeConfig as modeConfig } from './codemirror.mode.mediawiki.config'; +const { + EditorState, + Extension, + KeyBinding, + StateField, + SyntaxNode, + Tree, + Tooltip, + codeFolding, + ensureSyntaxTree, + foldEffect, + foldedRanges, + keymap, + showTooltip, + syntaxTree, + unfoldAll, + unfoldEffect +} = require( 'ext.CodeMirror.v6.lib' ); +const modeConfig = require( './codemirror.mediawiki.config.js' ); /** * Check if a SyntaxNode is a template bracket (`{{` or `}}`) @@ -280,7 +294,7 @@ const foldKeymap = [ * @module CodeMirrorTemplateFolding * @type {Extension} */ -export default [ +const templateFoldingExtension = [ codeFolding( { placeholderDOM( view ) { const element = document.createElement( 'span' ); @@ -314,3 +328,5 @@ export default [ } ), keymap.of( foldKeymap ) ]; + +module.exports = templateFoldingExtension; diff --git a/src/codemirror.textSelection.js b/resources/codemirror.textSelection.js similarity index 97% rename from src/codemirror.textSelection.js rename to resources/codemirror.textSelection.js index 0549839e..72cb3f44 100644 --- a/src/codemirror.textSelection.js +++ b/resources/codemirror.textSelection.js @@ -1,5 +1,4 @@ -import { EditorView } from '@codemirror/view'; -import { EditorSelection } from '@codemirror/state'; +const { EditorSelection, EditorView } = require( 'ext.CodeMirror.v6.lib' ); /** * [jQuery.textSelection]{@link jQuery.fn.textSelection} implementation for CodeMirror. @@ -230,4 +229,4 @@ class CodeMirrorTextSelection { } } -export default CodeMirrorTextSelection; +module.exports = CodeMirrorTextSelection; diff --git a/src/codemirror.wikieditor.js b/resources/codemirror.wikieditor.js similarity index 96% rename from src/codemirror.wikieditor.js rename to resources/codemirror.wikieditor.js index beb73d3e..8edb6af6 100644 --- a/src/codemirror.wikieditor.js +++ b/resources/codemirror.wikieditor.js @@ -1,7 +1,10 @@ -import CodeMirror from './codemirror'; -import { EditorSelection, Extension } from '@codemirror/state'; -import { EditorView } from '@codemirror/view'; -import { LanguageSupport } from '@codemirror/language'; +const { + EditorSelection, + EditorView, + Extension, + LanguageSupport +} = require( 'ext.CodeMirror.v6.lib' ); +const CodeMirror = require( 'ext.CodeMirror.v6' ); /** * CodeMirror integration with @@ -242,4 +245,4 @@ class CodeMirrorWikiEditor extends CodeMirror { } } -export default CodeMirrorWikiEditor; +module.exports = CodeMirrorWikiEditor; diff --git a/src/codemirror.wikieditor.mediawiki.js b/resources/codemirror.wikieditor.mediawiki.init.js similarity index 76% rename from src/codemirror.wikieditor.mediawiki.js rename to resources/codemirror.wikieditor.mediawiki.init.js index 5b9bf615..1404bae4 100644 --- a/src/codemirror.wikieditor.mediawiki.js +++ b/resources/codemirror.wikieditor.mediawiki.init.js @@ -1,5 +1,5 @@ -import CodeMirrorWikiEditor from './codemirror.wikieditor'; -import mediaWikiLang from './codemirror.mode.mediawiki'; +const CodeMirrorWikiEditor = require( 'ext.CodeMirror.v6.WikiEditor' ); +const mediaWikiLang = require( 'ext.CodeMirror.v6.mode.mediawiki' ); // TODO: remove URL feature flag once bidi isolation is more stable. const urlParams = new URLSearchParams( window.location.search ); diff --git a/resources/dist/codemirror.js b/resources/dist/codemirror.js deleted file mode 100644 index d82681b9..00000000 --- a/resources/dist/codemirror.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var e=require("ext.CodeMirror.v6.lib"),t=function(){function t(r){e._classCallCheck(this,t),this.view=r,this.$cmDom=$(r.dom)}return e._createClass(t,[{key:"getContents",value:function(){return this.view.state.doc.toString()}},{key:"setContents",value:function(e){return this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:e}}),this.$cmDom}},{key:"getCaretPosition",value:function(e){return e.startAndEnd?[this.view.state.selection.main.from,this.view.state.selection.main.to]:this.view.state.selection.main.head}},{key:"scrollToCaretPosition",value:function(){var t=e.EditorView.scrollIntoView(this.view.state.selection.main.head);return t.value.isSnapshot=!0,this.view.dispatch({effects:t}),this.$cmDom}},{key:"getSelection",value:function(){return this.view.state.sliceDoc(this.view.state.selection.main.from,this.view.state.selection.main.to)}},{key:"setSelection",value:function(e){return this.view.dispatch({selection:{anchor:e.start,head:e.end||e.start}}),this.view.focus(),this.$cmDom}},{key:"replaceSelection",value:function(e){return this.view.dispatch(this.view.state.replaceSelection(e)),this.$cmDom}},{key:"encapsulateSelection",value:function(t){var r,i=!1;this.view.focus(),void 0!==t.selectionStart&&this.setSelection({start:t.selectionStart,end:t.selectionEnd||t.selectionStart}),r=this.getSelection();var o=this.getCaretPosition({startAndEnd:!0}),s=e._slicedToArray(o,1)[0];!function(){if(r)if(t.replace)r=t.peri;else{for(;" "===r.charAt(r.length-1);)r=r.slice(0,-1),t.post+=" ";for(;" "===r.charAt(0);)r=r.slice(1),t.pre=" "+t.pre}else r=t.peri,i=!0}();var n=t.pre+r+t.post;return this.view.state.selection.ranges.length>1?(this.view.dispatch(this.view.state.changeByRange((function(r){return{changes:[{from:r.from,insert:t.pre},{from:r.to,insert:t.post}],range:e.EditorSelection.range(r.to+t.pre.length+t.post.length,r.to+t.pre.length+t.post.length)}}))),this.$cmDom):(this.replaceSelection(n),i&&t.selectPeri?this.setSelection({start:s+t.pre.length,end:s+t.pre.length+r.length}):this.setSelection({start:s+n.length}),this.$cmDom)}}]),t}();require("../ext.CodeMirror.data.js");var r=new WeakSet,i=function(){function i(t){e._classCallCheck(this,i),e._classPrivateMethodInitSpec(this,r),this.$textarea=$(t),this.view=null,this.state=null,this.readOnly=this.$textarea.prop("readonly"),this.editRecoveryHandler=null,this.textSelection=null,this.dirCompartment=new e.Compartment}return e._createClass(i,[{key:"defaultExtensions",get:function(){var t=this,r=[this.contentAttributesExtension,this.phrasesExtension,this.specialCharsExtension,this.heightExtension,this.updateExtension,this.bracketMatchingExtension,this.dirExtension,e.EditorState.readOnly.of(this.readOnly),e.EditorView.domEventHandlers({blur:function(){return t.$textarea.triggerHandler("blur")},focus:function(){return t.$textarea.triggerHandler("focus")}}),e.EditorView.lineWrapping,e.keymap.of([].concat(e._toConsumableArray(e.defaultKeymap),e._toConsumableArray(e.searchKeymap))),e.EditorState.allowMultipleSelections.of(!0),e.drawSelection(),e.rectangularSelection(),e.crosshairCursor()];this.readOnly||(r.push(e.EditorView.updateListener.of((function(e){e.docChanged&&"function"==typeof t.editRecoveryHandler&&t.editRecoveryHandler()}))),r.push(e.history()),r.push(e.keymap.of(e.historyKeymap)));var i=mw.config.get("extCodeMirrorConfig").lineNumberingNamespaces;return i&&!i.includes(mw.config.get("wgNamespaceNumber"))||r.push(e.lineNumbers()),r}},{key:"bracketMatchingExtension",get:function(){return e.bracketMatching("wikitext"===mw.config.get("wgPageContentModel")?{brackets:"()[]{}()【】[]{}"}:{})}},{key:"updateExtension",get:function(){return e.EditorView.updateListener.of((function(e){e.docChanged&&mw.hook("ext.CodeMirror.input").fire(e)}))}},{key:"heightExtension",get:function(){return e.EditorView.theme({"&":{height:"".concat(this.$textarea.outerHeight(),"px")},".cm-scroller":{overflow:"auto"}})}},{key:"contentAttributesExtension",get:function(){var t=[],r=Array.from(this.$textarea[0].classList).find((function(e){return e.startsWith("mw-editfont-")}));return r&&t.push(r),mw.user.options.get("usecodemirror-colorblind")&&"wikitext"===mw.config.get("wgPageContentModel")&&t.push("cm-mw-colorblind-colors"),[e.EditorView.contentAttributes.of({accesskey:this.$textarea.attr("accesskey"),class:t.join(" "),spellcheck:"true",tabindex:this.$textarea.attr("tabindex")}),e.EditorView.editorAttributes.of({lang:this.$textarea.attr("lang")}),e.EditorView.theme({".cm-panels":{direction:document.dir}})]}},{key:"phrasesExtension",get:function(){return e.EditorState.phrases.of({Find:mw.msg("codemirror-find"),next:mw.msg("codemirror-next"),previous:mw.msg("codemirror-previous"),all:mw.msg("codemirror-all"),"match case":mw.msg("codemirror-match-case"),regexp:mw.msg("codemirror-regexp"),"by word":mw.msg("codemirror-by-word"),replace:mw.msg("codemirror-replace"),Replace:mw.msg("codemirror-replace-placeholder"),"replace all":mw.msg("codemirror-replace-all"),"Control character":mw.msg("codemirror-control-character")})}},{key:"specialCharsExtension",get:function(){var t={0:mw.msg("codemirror-special-char-null"),7:mw.msg("codemirror-special-char-bell"),8:mw.msg("codemirror-special-char-backspace"),10:mw.msg("codemirror-special-char-newline"),11:mw.msg("codemirror-special-char-vertical-tab"),13:mw.msg("codemirror-special-char-carriage-return"),27:mw.msg("codemirror-special-char-escape"),160:mw.msg("codemirror-special-char-nbsp"),8203:mw.msg("codemirror-special-char-zero-width-space"),8204:mw.msg("codemirror-special-char-zero-width-non-joiner"),8205:mw.msg("codemirror-special-char-zero-width-joiner"),8206:mw.msg("codemirror-special-char-left-to-right-mark"),8207:mw.msg("codemirror-special-char-right-to-left-mark"),8232:mw.msg("codemirror-special-char-line-separator"),8237:mw.msg("codemirror-special-char-left-to-right-override"),8238:mw.msg("codemirror-special-char-right-to-left-override"),8239:mw.msg("codemirror-special-char-narrow-nbsp"),8294:mw.msg("codemirror-special-char-left-to-right-isolate"),8295:mw.msg("codemirror-special-char-right-to-left-isolate"),8297:mw.msg("codemirror-special-char-pop-directional-isolate"),8233:mw.msg("codemirror-special-char-paragraph-separator"),65279:mw.msg("codemirror-special-char-zero-width-no-break-space"),65532:mw.msg("codemirror-special-char-object-replacement")};return e.highlightSpecialChars({render:function(e,r,i){r=t[e]||mw.msg("codemirror-control-character",e);var o=document.createElement("span");return o.className="cm-specialChar",160!==e&&8239!==e||(i="·",o.className="cm-special-char-nbsp"),o.textContent=i,o.title=r,o.setAttribute("aria-label",r),o},addSpecialChars:/[\u00a0\u202f]/g})}},{key:"dirExtension",get:function(){var t=this;return[this.dirCompartment.of(e.EditorView.editorAttributes.of({dir:this.$textarea.attr("dir")})),e.keymap.of([{key:"Mod-Shift-x",run:function(r){var i="rtl"===t.$textarea.attr("dir")?"ltr":"rtl";return t.$textarea.attr("dir",i),r.dispatch({effects:t.dirCompartment.reconfigure(e.EditorView.editorAttributes.of({dir:i}))}),!0}}])]}},{key:"initialize",value:function(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.defaultExtensions;mw.hook("ext.CodeMirror.initialize").fire(this.$textarea),mw.hook("editRecovery.loadEnd").add((function(e){t.editRecoveryHandler=e.fieldChangeHandler})),this.state=e.EditorState.create({doc:this.$textarea.textSelection("getContents"),extensions:i}),e._classPrivateMethodGet(this,r,o).call(this),this.$textarea.hide(),this.$textarea[0].form&&this.$textarea[0].form.addEventListener("submit",(function(){t.$textarea.val(t.view.state.doc.toString());var e=document.getElementById("wpScrolltop");e&&(e.value=t.view.scrollDOM.scrollTop)})),$(this.view.dom).textSelection("register",this.cmTextSelection),this.$textarea.textSelection("register",this.cmTextSelection),mw.hook("ext.CodeMirror.ready").fire($(this.view.dom))}},{key:"destroy",value:function(){var e=this.view.scrollDOM.scrollTop,t=this.view.hasFocus,r=this.view.state.selection.ranges[0],i=r.from,o=r.to;$(this.view.dom).textSelection("unregister"),this.$textarea.textSelection("unregister"),this.$textarea.unwrap(".ext-codemirror-wrapper"),this.$textarea.val(this.view.state.doc.toString()),this.view.destroy(),this.view=null,this.$textarea.show(),t&&this.$textarea.trigger("focus"),this.$textarea.prop("selectionStart",Math.min(i,o)).prop("selectionEnd",Math.max(o,i)),this.$textarea.scrollTop(e),this.textSelection=null,mw.hook("ext.CodeMirror.destroy").fire(this.$textarea)}},{key:"logUsage",value:function(e){var t=Object.assign({session_token:mw.user.sessionId(),user_id:mw.user.getId()},e),r=mw.config.get("wgUserEditCountBucket");null!==r&&(t.user_edit_count_bucket=r),mw.track("event.CodeMirrorUsage",t)}},{key:"setCodeMirrorPreference",value:function(e){mw.user.isNamed()&&((new mw.Api).saveOption("usecodemirror",e?1:0),mw.user.options.set("usecodemirror",e?1:0))}},{key:"cmTextSelection",get:function(){var e=this;return this.textSelection||(this.textSelection=new t(this.view)),{getContents:function(){return e.textSelection.getContents()},setContents:function(t){return e.textSelection.setContents(t)},getCaretPosition:function(t){return e.textSelection.getCaretPosition(t)},scrollToCaretPosition:function(){return e.textSelection.scrollToCaretPosition()},getSelection:function(){return e.textSelection.getSelection()},setSelection:function(t){return e.textSelection.setSelection(t)},replaceSelection:function(t){return e.textSelection.replaceSelection(t)},encapsulateSelection:function(t){return e.textSelection.encapsulateSelection(t)}}}}]),i}();function o(){this.$textarea.wrap('
'),this.view=new e.EditorView({state:this.state,parent:this.$textarea.parent()[0]})}module.exports=i; diff --git a/resources/dist/codemirror.mediawiki.js b/resources/dist/codemirror.mediawiki.js deleted file mode 100644 index 225b6bd5..00000000 --- a/resources/dist/codemirror.mediawiki.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var e=require("ext.CodeMirror.v6"),i=require("ext.CodeMirror.v6.mode.mediawiki");require("ext.CodeMirror.v6.lib");var r=new e(document.getElementById("wpTextbox1")),o=new URLSearchParams(window.location.search);r.initialize([r.defaultExtensions,i({bidiIsolation:o.get("cm6bidi")})]); diff --git a/resources/dist/codemirror.mode.mediawiki.js b/resources/dist/codemirror.mode.mediawiki.js deleted file mode 100644 index 36fe92a8..00000000 --- a/resources/dist/codemirror.mode.mediawiki.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var t=require("ext.CodeMirror.v6.lib"),e=new WeakMap;function a(){return{em:"mw-em",error:"mw-error",extNowiki:"mw-ext-nowiki",extPre:"mw-ext-pre",extTag:"mw-exttag",extTagAttribute:"mw-exttag-attribute",extTagBracket:"mw-exttag-bracket",extTagName:"mw-exttag-name",freeExtLink:"mw-free-extlink",freeExtLinkProtocol:"mw-free-extlink-protocol",htmlEntity:"mw-html-entity",link:"mw-link",linkPageName:"mw-link-pagename",nowiki:"mw-tag-nowiki",pageName:"mw-pagename",pre:"mw-tag-pre",section:"mw-section",skipFormatting:"mw-skipformatting",strong:"mw-strong",tableCaption:"mw-table-caption",templateVariableDelimiter:"mw-templatevariable-delimiter"}}var i=new(function(){function i(){t._classCallCheck(this,i),t._classPrivateFieldInitSpec(this,e,{get:a,set:void 0}),this.extHighlightStyles=[],this.tokenTable=this.defaultTokenTable}return t._createClass(i,[{key:"addTag",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.tokenTable["mw-tag-".concat(t)]||(this.addToken("mw-tag-".concat(t),e),this.addToken("mw-ext-".concat(t),e))}},{key:"addToken",value:function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.tokenTable[e]||(this.tokenTable[e]=t.Tag.define(a),this.extHighlightStyles.push({tag:this.tokenTable[e],class:"cm-".concat(e)}))}},{key:"permittedHtmlTags",get:function(){return{b:!0,bdi:!0,del:!0,i:!0,ins:!0,u:!0,font:!0,big:!0,small:!0,sub:!0,sup:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,cite:!0,code:!0,em:!0,s:!0,strike:!0,strong:!0,tt:!0,var:!0,div:!0,center:!0,blockquote:!0,q:!0,ol:!0,ul:!0,dl:!0,table:!0,caption:!0,pre:!0,ruby:!0,rb:!0,rp:!0,rt:!0,rtc:!0,p:!0,span:!0,abbr:!0,dfn:!0,kbd:!0,samp:!0,data:!0,time:!0,mark:!0,br:!0,wbr:!0,hr:!0,li:!0,dt:!0,dd:!0,td:!0,th:!0,tr:!0,noinclude:!0,includeonly:!0,onlyinclude:!0}}},{key:"implicitlyClosedHtmlTags",get:function(){return{br:!0,hr:!0,wbr:!0}}},{key:"tags",get:function(){return t._objectSpread2({apostrophes:"character",apostrophesBold:"strong",apostrophesItalic:"emphasis",comment:"comment",doubleUnderscore:"controlKeyword",extLink:"url",extLinkBracket:"modifier",extLinkProtocol:"namespace",extLinkText:"labelName",hr:"contentSeparator",htmlTagAttribute:"attributeName",htmlTagBracket:"angleBracket",htmlTagName:"tagName",indenting:"operatorKeyword",linkBracket:"squareBracket",linkDelimiter:"operator",linkText:"string",linkToSection:"className",list:"list",parserFunction:"unit",parserFunctionBracket:"paren",parserFunctionDelimiter:"punctuation",parserFunctionName:"keyword",sectionHeader:"heading",sectionHeader1:"heading1",sectionHeader2:"heading2",sectionHeader3:"heading3",sectionHeader4:"heading4",sectionHeader5:"heading5",sectionHeader6:"heading6",signature:"quote",tableBracket:"null",tableDefinition:"definitionOperator",tableDelimiter:"typeOperator",template:"attributeValue",templateArgumentName:"definitionKeyword",templateBracket:"bracket",templateDelimiter:"separator",templateName:"moduleKeyword",templateVariable:"atom",templateVariableBracket:"brace",templateVariableName:"variableName"},t._classPrivateFieldGet(this,e))}},{key:"defaultTokenTable",get:function(){var e;return e={},t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(e,this.tags.em,t.Tag.define()),this.tags.error,t.Tag.define()),this.tags.extNowiki,t.Tag.define()),this.tags.extPre,t.Tag.define()),this.tags.extTag,t.Tag.define()),this.tags.extTagAttribute,t.Tag.define()),this.tags.extTagBracket,t.Tag.define()),this.tags.extTagName,t.Tag.define()),this.tags.freeExtLink,t.Tag.define()),this.tags.freeExtLinkProtocol,t.Tag.define()),t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(t._defineProperty(e,this.tags.htmlEntity,t.Tag.define()),this.tags.link,t.Tag.define()),this.tags.linkPageName,t.Tag.define()),this.tags.nowiki,t.Tag.define()),this.tags.pageName,t.Tag.define()),this.tags.pre,t.Tag.define()),this.tags.section,t.Tag.define()),this.tags.skipFormatting,t.Tag.define()),this.tags.strong,t.Tag.define()),this.tags.tableCaption,t.Tag.define()),t._defineProperty(e,this.tags.templateVariableDelimiter,t.Tag.define())}},{key:"getTagStyles",value:function(e){return[{tag:t.tags[this.tags.apostrophes],class:"cm-mw-apostrophes"},{tag:t.tags[this.tags.apostrophesBold],class:"cm-mw-apostrophes-bold"},{tag:t.tags[this.tags.apostrophesItalic],class:"cm-mw-apostrophes-italic"},{tag:t.tags[this.tags.comment],class:"cm-mw-comment"},{tag:t.tags[this.tags.doubleUnderscore],class:"cm-mw-double-underscore"},{tag:t.tags[this.tags.extLink],class:"cm-mw-extlink"},{tag:t.tags[this.tags.extLinkBracket],class:"cm-mw-extlink-bracket"},{tag:t.tags[this.tags.extLinkProtocol],class:"cm-mw-extlink-protocol"},{tag:t.tags[this.tags.extLinkText],class:"cm-mw-extlink-text"},{tag:t.tags[this.tags.hr],class:"cm-mw-hr"},{tag:t.tags[this.tags.htmlTagAttribute],class:"cm-mw-htmltag-attribute"},{tag:t.tags[this.tags.htmlTagBracket],class:"cm-mw-htmltag-bracket"},{tag:t.tags[this.tags.htmlTagName],class:"cm-mw-htmltag-name"},{tag:t.tags[this.tags.indenting],class:"cm-mw-indenting"},{tag:t.tags[this.tags.linkBracket],class:"cm-mw-link-bracket"},{tag:t.tags[this.tags.linkDelimiter],class:"cm-mw-link-delimiter"},{tag:t.tags[this.tags.linkText],class:"cm-mw-link-text"},{tag:t.tags[this.tags.linkToSection],class:"cm-mw-link-tosection"},{tag:t.tags[this.tags.list],class:"cm-mw-list"},{tag:t.tags[this.tags.parserFunction],class:"cm-mw-parserfunction"},{tag:t.tags[this.tags.parserFunctionBracket],class:"cm-mw-parserfunction-bracket"},{tag:t.tags[this.tags.parserFunctionDelimiter],class:"cm-mw-parserfunction-delimiter"},{tag:t.tags[this.tags.parserFunctionName],class:"cm-mw-parserfunction-name"},{tag:t.tags[this.tags.sectionHeader],class:"cm-mw-section-header"},{tag:t.tags[this.tags.sectionHeader1],class:"cm-mw-section-1"},{tag:t.tags[this.tags.sectionHeader2],class:"cm-mw-section-2"},{tag:t.tags[this.tags.sectionHeader3],class:"cm-mw-section-3"},{tag:t.tags[this.tags.sectionHeader4],class:"cm-mw-section-4"},{tag:t.tags[this.tags.sectionHeader5],class:"cm-mw-section-5"},{tag:t.tags[this.tags.sectionHeader6],class:"cm-mw-section-6"},{tag:t.tags[this.tags.signature],class:"cm-mw-signature"},{tag:t.tags[this.tags.tableBracket],class:"cm-mw-table-bracket"},{tag:t.tags[this.tags.tableDefinition],class:"cm-mw-table-definition"},{tag:t.tags[this.tags.tableDelimiter],class:"cm-mw-table-delimiter"},{tag:t.tags[this.tags.template],class:"cm-mw-template"},{tag:t.tags[this.tags.templateArgumentName],class:"cm-mw-template-argument-name"},{tag:t.tags[this.tags.templateBracket],class:"cm-mw-template-bracket"},{tag:t.tags[this.tags.templateDelimiter],class:"cm-mw-template-delimiter"},{tag:t.tags[this.tags.templateName],class:"cm-mw-pagename cm-mw-template-name"},{tag:t.tags[this.tags.templateVariable],class:"cm-mw-templatevariable"},{tag:t.tags[this.tags.templateVariableBracket],class:"cm-mw-templatevariable-bracket"},{tag:t.tags[this.tags.templateVariableName],class:"cm-mw-templatevariable-name"},{tag:e.tokenTable[this.tags.em],class:"cm-mw-em"},{tag:e.tokenTable[this.tags.error],class:"cm-mw-error"},{tag:e.tokenTable[this.tags.extNowiki],class:"cm-mw-ext-nowiki"},{tag:e.tokenTable[this.tags.extPre],class:"cm-mw-ext-pre"},{tag:e.tokenTable[this.tags.extTagBracket],class:"cm-mw-exttag-bracket"},{tag:e.tokenTable[this.tags.extTag],class:"cm-mw-exttag"},{tag:e.tokenTable[this.tags.extTagAttribute],class:"cm-mw-exttag-attribute"},{tag:e.tokenTable[this.tags.extTagName],class:"cm-mw-exttag-name"},{tag:e.tokenTable[this.tags.freeExtLink],class:"cm-mw-free-extlink"},{tag:e.tokenTable[this.tags.freeExtLinkProtocol],class:"cm-mw-free-extlink-protocol"},{tag:e.tokenTable[this.tags.htmlEntity],class:"cm-mw-html-entity"},{tag:e.tokenTable[this.tags.link],class:"cm-mw-link"},{tag:e.tokenTable[this.tags.linkPageName],class:"cm-mw-link-pagename"},{tag:e.tokenTable[this.tags.nowiki],class:"cm-mw-tag-nowiki"},{tag:e.tokenTable[this.tags.pageName],class:"cm-mw-pagename"},{tag:e.tokenTable[this.tags.pre],class:"cm-mw-tag-pre"},{tag:e.tokenTable[this.tags.section],class:"cm-mw-section"},{tag:e.tokenTable[this.tags.skipFormatting],class:"cm-mw-skipformatting"},{tag:e.tokenTable[this.tags.strong],class:"cm-mw-strong"},{tag:e.tokenTable[this.tags.tableCaption],class:"cm-mw-table-caption"},{tag:e.tokenTable[this.tags.templateVariableDelimiter],class:"cm-mw-templatevariable-delimiter"}].concat(t._toConsumableArray(this.extHighlightStyles))}}]),i}()),n=function(t){return t.name.split("_").includes(i.tags.templateBracket)},s=function(t){return t.name.split("_").includes(i.tags.templateDelimiter)},r=function(t){return/\x2Dtemplate[\x2D0-9a-z]+ground/.test(t.name)&&!n(t)},o=function(t,e){return"{"===t.sliceDoc(e.from,e.from+1)?1:-1},l=function(e,a,i){if("number"==typeof a&&(i=t.ensureSyntaxTree(e,a)),!i)return null;var l;if("number"==typeof a?(l=i.resolve(a,-1),r(l)||(l=i.resolve(a,1))):l=a,!r(l))return null;for(var c=l,m=c.prevSibling,g=c.nextSibling,k=1,u=s(l)?l:null;g;){if(n(g)){if(0===(k+=o(e,g)))break}else!u&&1===k&&s(g)&&(u=g);g=g.nextSibling}if(!g)return null;for(k=-1;m;){if(n(m)){if(0===(k+=o(e,m)))break}else-1===k&&s(m)&&(u=m);m=m.prevSibling}var h=u&&u.to,p=g.from;return h&&h0){var f=e.dom.querySelector(".cm-tooltip-fold");return f&&f.remove(),e.dispatch({effects:s,selection:{anchor:c}}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function(e){var a,i=e.state,n=i.selection,s=[],r=t.foldedRanges(i),o=t._createForOfIteratorHelper(n.ranges);try{for(o.s();!(a=o.n()).done;){var l=a.value,c=l.from,m=l.to;r.between(c,m,(function(e,a){s.push(t.unfoldEffect.of({from:e,to:a}))}))}}catch(t){o.e(t)}finally{o.f()}return s.length>0&&(e.dispatch({effects:s,selection:n}),!0)}},{key:"Ctrl-Alt-[",run:function(e){for(var a=e.state,i=t.syntaxTree(a),n=[],s=Math.max.apply(Math,t._toConsumableArray(a.selection.ranges.map((function(t){return t.to})))),r=i.topNode.firstChild;r;){var o=l(a,r,i);if(o){n.push(t.foldEffect.of(o));var c=o.from,m=o.to;r=i.resolve(m,1),c<=s&&m>s&&(s=m)}else r=r.nextSibling}if(n.length>0){var g=e.dom.querySelector(".cm-tooltip-fold");return g&&g.remove(),e.dispatch({effects:n,selection:{anchor:s}}),!0}return!1}},{key:"Ctrl-Alt-]",run:t.unfoldAll}],g=[t.codeFolding({placeholderDOM:function(e){var a=document.createElement("span");return a.textContent="…",a.setAttribute("aria-label",mw.msg("codemirror-folded-code")),a.title=mw.msg("codemirror-unfold"),a.className="cm-foldPlaceholder",a.onclick=function(a){var i=a.target,n=e.posAtDOM(i),s=e.state,r=s.selection;t.foldedRanges(s).between(n,n,(function(a,i){a===n&&e.dispatch({effects:t.unfoldEffect.of({from:a,to:i}),selection:r})}))},a}}),t.StateField.define({create:c,update:function(t,e){var a=e.state,i=e.docChanged,n=e.selection;return i||n?c(a):t},provide:function(e){return t.showTooltip.from(e)}}),t.keymap.of(m)],k=t.Decoration.mark({class:"cm-bidi-isolate",bidiIsolate:t.Direction.LTR});function u(e){var a=new t.RangeSetBuilder;if("rtl"===e.editorAttrs.dir){var n,s=t._createForOfIteratorHelper(e.visibleRanges);try{var r=function(){var s=n.value,r=s.from,o=s.to,l=null;t.syntaxTree(e.state).iterate({from:r,to:o,enter:function(t){var e=t.name.split("_").some((function(t){return[i.tags.htmlTagBracket,i.tags.extTagBracket].includes(t)}));null===l&&e?l=t.from:e&&(a.add(l,t.to,k),l=null)}})};for(s.s();!(n=s.n()).done;)r()}catch(t){s.e(t)}finally{s.f()}}return a.finish()}var h=function(){function e(a){t._classCallCheck(this,e),this.isolates=u(a),this.tree=t.syntaxTree(a.state),this.dir=a.textDirection}return t._createClass(e,[{key:"update",value:function(e){(e.docChanged||e.viewportChanged||t.syntaxTree(e.state)!==this.tree||e.view.textDirection!==this.dir)&&(this.isolates=u(e.view),this.tree=t.syntaxTree(e.state))}}]),e}(),p={provide:function(e){var a=function(a){return a.plugin(e)&&a.plugin(e).isolates||t.Decoration.none};return t.Prec.lowest([t.EditorView.decorations.of(a),t.EditorView.bidiIsolatedRanges.of(a)])}},f=t.ViewPlugin.fromClass(h,p),d=function(){function e(a){t._classCallCheck(this,e),this.config=a,this.urlProtocols=new RegExp("^(?:".concat(this.config.urlProtocols,")(?=[^\\s {[\\]<>~).,'])"),"i"),this.isBold=!1,this.wasBold=!1,this.isItalic=!1,this.wasItalic=!1,this.firstSingleLetterWord=null,this.firstMultiLetterWord=null,this.firstSpace=null,this.oldStyle=null,this.tokens=[],this.oldTokens=[],this.tokenTable=i.tokenTable,this.registerGroundTokens(),Object.keys(this.config.tags).forEach((function(t){return i.addTag(t)}))}return t._createClass(e,[{key:"registerGroundTokens",value:function(){["mw-ext-ground","mw-ext-link-ground","mw-ext2-ground","mw-ext2-link-ground","mw-ext3-ground","mw-ext3-link-ground","mw-link-ground","mw-template-ext-ground","mw-template-ext-link-ground","mw-template-ext2-ground","mw-template-ext2-link-ground","mw-template-ext3-ground","mw-template-ext3-link-ground","mw-template-ground","mw-template-link-ground","mw-template2-ext-ground","mw-template2-ext-link-ground","mw-template2-ext2-ground","mw-template2-ext2-link-ground","mw-template2-ext3-ground","mw-template2-ext3-link-ground","mw-template2-ground","mw-template2-link-ground","mw-template3-ext-ground","mw-template3-ext-link-ground","mw-template3-ext2-ground","mw-template3-ext2-link-ground","mw-template3-ext3-ground","mw-template3-ext3-link-ground","mw-template3-ground","mw-template3-link-ground"].forEach((function(t){return i.addToken(t)}))}},{key:"eatHtmlEntity",value:function(t,e){return(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w.\-:]/)&&t.eat(";"))?i.tags.htmlEntity:e}},{key:"isNested",value:function(t){return t.nExt>0||t.nTemplate>0||t.nLink>0}},{key:"makeStyle",value:function(t,e,a){return(this.isBold||e.nDt>0)&&(t+=" "+i.tags.strong),this.isItalic&&(t+=" "+i.tags.em),this.makeLocalStyle(t,e,a)}},{key:"makeLocalStyle",value:function(t,e,a){var i="";switch(e.nTemplate){case 0:break;case 1:i+="-template";break;case 2:i+="-template2";break;default:i+="-template3"}switch(e.nExt){case 0:break;case 1:i+="-ext";break;case 2:i+="-ext2";break;default:i+="-ext3"}return e.nLink>0&&(i+="-link"),""!==i&&(t="mw".concat(i,"-ground ").concat(t)),a&&e[a]--,t.trim()}},{key:"eatBlock",value:function(t,e,a){var i=this;return function(n,s){return n.skipTo(e)?(!1!==a&&n.match(e),s.tokenize=s.stack.pop()):n.skipToEnd(),i.makeLocalStyle(t,s)}}},{key:"eatEnd",value:function(t){var e=this;return function(a,i){return a.skipToEnd(),i.tokenize=i.stack.pop(),e.makeLocalStyle(t,i)}}},{key:"eatChar",value:function(t,e){var a=this;return function(n,s){return s.tokenize=s.stack.pop(),n.eat(t)?a.makeLocalStyle(e,s):a.makeLocalStyle(i.tags.error,s)}}},{key:"eatSectionHeader",value:function(t){var e=this;return function(a,n){return a.match(/^[^&<[{~]+/)?(a.eol()?(a.backUp(t),n.tokenize=e.eatEnd(i.tags.sectionHeader)):a.match(/^.*?=)/,!1)&&(a.backUp(t),n.tokenize=e.eatBlock(i.tags.sectionHeader,"\x3c!--",!1)),i.tags.section):e.eatWikiText(i.tags.section)(a,n)}}},{key:"inVariable",value:function(t,e){return t.match(/^[^{}|]+/)?this.makeLocalStyle(i.tags.templateVariableName,e):t.eat("|")?(e.tokenize=this.inVariableDefault.bind(this),this.makeLocalStyle(i.tags.templateVariableDelimiter,e)):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.templateVariableBracket,e)):t.match("{{{")?(e.stack.push(e.tokenize),this.makeLocalStyle(i.tags.templateVariableBracket,e)):(t.next(),this.makeLocalStyle(i.tags.templateVariableName,e))}},{key:"inVariableDefault",value:function(t,e){return t.match(/^[^{}[<&~]+/)?this.makeLocalStyle(i.tags.templateVariable,e):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.templateVariableBracket,e)):this.eatWikiText(i.tags.templateVariable)(t,e)}},{key:"inParserFunctionName",value:function(t,e){return t.match(/^#?[^:}{~]+/)?this.makeLocalStyle(i.tags.parserFunctionName,e):t.eat(":")?(e.tokenize=this.inParserFunctionArguments.bind(this),this.makeLocalStyle(i.tags.parserFunctionDelimiter,e)):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(i.tags.parserFunction)(t,e)}},{key:"inParserFunctionArguments",value:function(t,e){return t.match(/^[^|}{[<&~]+/)?this.makeLocalStyle(i.tags.parserFunction,e):t.eat("|")?this.makeLocalStyle(i.tags.parserFunctionDelimiter,e):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(i.tags.parserFunction)(t,e)}},{key:"eatTemplatePageName",value:function(t){var e=this;return function(a,n){return a.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(i.tags.templateDelimiter,n)):a.match(/^[\s\u00a0]*\}\}/)?(n.tokenize=n.stack.pop(),e.makeLocalStyle(i.tags.templateBracket,n,"nTemplate")):a.match(/^[\s\u00a0]*/)?e.makeLocalStyle(i.tags.comment,n):t&&a.sol()?(n.nTemplate--,void(n.tokenize=n.stack.pop())):a.match(/^[\s\u00a0]*[^\s\u00a0|}<{&~]+/)?(n.tokenize=e.eatTemplatePageName(!0),e.makeLocalStyle(i.tags.templateName,n)):a.eatSpace()?(a.eol(),e.makeLocalStyle(i.tags.templateName,n)):e.eatWikiText(i.tags.templateName)(a,n)}}},{key:"eatTemplateArgument",value:function(t){var e=this;return function(a,n){return t&&a.eatWhile(/[^=|}{[<&~]/)?a.eat("=")?(n.tokenize=e.eatTemplateArgument(!1),e.makeLocalStyle(i.tags.templateArgumentName,n)):e.makeLocalStyle(i.tags.template,n):a.eatWhile(/[^|}{[<&~]/)?e.makeLocalStyle(i.tags.template,n):a.eat("|")?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(i.tags.templateDelimiter,n)):a.match("}}")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(i.tags.templateBracket,n,"nTemplate")):e.eatWikiText(i.tags.template)(a,n)}}},{key:"eatExternalLinkProtocol",value:function(t){var e=this;return function(a,n){for(;t>0;)t--,a.next();return a.eol()?(n.nLink--,n.tokenize=n.stack.pop()):n.tokenize=e.inExternalLink.bind(e),e.makeLocalStyle(i.tags.extLinkProtocol,n)}}},{key:"inExternalLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.extLinkBracket,e,"nLink")):t.eatSpace()?(e.tokenize=this.inExternalLinkText.bind(this),this.makeStyle("",e)):t.match(/^[^\s\u00a0\]{&~']+/)||t.eatSpace()?("'"===t.peek()&&(t.match("''",!1)?e.tokenize=this.inExternalLinkText.bind(this):t.next()),this.makeStyle(i.tags.extLink,e)):this.eatWikiText(i.tags.extLink)(t,e)}},{key:"inExternalLinkText",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.eat("]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.extLinkBracket,e,"nLink")):t.match(/^[^'\]{&~<]+/)?this.makeStyle(i.tags.extLinkText,e):this.eatWikiText(i.tags.extLinkText)(t,e)}},{key:"inLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*#[\s\u00a0]*/)?(e.tokenize=this.inLinkToSection.bind(this),this.makeLocalStyle(i.tags.link,e)):t.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(i.tags.linkDelimiter,e)):t.match(/^[\s\u00a0]*\]\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.linkBracket,e,"nLink")):t.match(/^[\s\u00a0]*[^\s\u00a0#|\]&~{]+/)||t.eatSpace()?this.makeStyle("".concat(i.tags.linkPageName," ").concat(i.tags.pageName),e):this.eatWikiText("".concat(i.tags.linkPageName," ").concat(i.tags.pageName))(t,e)}},{key:"inLinkToSection",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[^|\]&~{}]+/)?this.makeLocalStyle(i.tags.linkToSection,e):t.eat("|")?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(i.tags.linkDelimiter,e)):t.match("]]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.linkBracket,e,"nLink")):this.eatWikiText(i.tags.linkToSection)(t,e)}},{key:"eatLinkText",value:function(){var t,e,a=this;return function(n,s){var r;return n.match("]]")?(s.tokenize=s.stack.pop(),a.makeLocalStyle(i.tags.linkBracket,s,"nLink")):n.match("'''")?(t=!t,a.makeLocalStyle("".concat(i.tags.linkText," ").concat(i.tags.apostrophes),s)):n.match("''")?(e=!e,a.makeLocalStyle("".concat(i.tags.linkText," ").concat(i.tags.apostrophes),s)):(r=i.tags.linkText,t&&(r+=" "+i.tags.strong),e&&(r+=" "+i.tags.em),n.match(/^[^'\]{&~<]+/)?a.makeStyle(r,s):a.eatWikiText(r)(n,s))}}},{key:"eatTagName",value:function(t,e,a){var n=this;return function(s,r){for(var o="";t>0;)t--,o+=s.next();return s.eatSpace(),o=o.toLowerCase(),a?(e&&!i.implicitlyClosedHtmlTags[o]?r.tokenize=n.eatChar(">",i.tags.htmlTagBracket):r.tokenize=n.eatHtmlTagAttribute(o),n.makeLocalStyle(i.tags.htmlTagName,r)):(r.tokenize=e?n.eatChar(">","".concat(i.tags.extTagBracket," mw-ext-").concat(o)):n.eatExtTagAttribute(o),n.makeLocalStyle("".concat(i.tags.extTagName," mw-ext-").concat(o),r))}}},{key:"eatHtmlTagAttribute",value:function(t){var e=this;return function(a,n){return a.match(/^(?:"[^<">]*"|'[^<'>]*'|[^>/<{&~])+/)?e.makeLocalStyle(i.tags.htmlTagAttribute,n):a.eat(">")?(t in i.implicitlyClosedHtmlTags||n.inHtmlTag.push(t),n.tokenize=n.stack.pop(),e.makeLocalStyle(i.tags.htmlTagBracket,n)):a.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(i.tags.htmlTagBracket,n)):e.eatWikiText(i.tags.htmlTagAttribute)(a,n)}}},{key:"eatNowiki",value:function(){var t=this;return function(e){return e.match(/^[^&]+/)?"":(e.next(),t.eatHtmlEntity(e,""))}}},{key:"eatExtTagAttribute",value:function(t){var e=this;return function(a,n){if(a.match(/^(?:"[^">]*"|'[^'>]*'|[^>/<{&~])+/))return e.makeLocalStyle("".concat(i.tags.extTagAttribute," mw-ext-").concat(t),n);if(a.eat(">")){if(n.extName=t,"nowiki"===t||"pre"===t)n.extMode={startState:function(){},copyState:function(){},token:e.eatNowiki()};else if(t in e.config.tagModes){var s=e.config.tagModes[t];"mediawiki"!==s&&"text/mediawiki"!==s||(n.extMode=e.mediawiki,n.extState=n.extMode.startState())}return n.tokenize=e.eatExtTagArea(t),e.makeLocalStyle("".concat(i.tags.extTagBracket," mw-ext-").concat(t),n)}return a.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle("".concat(i.tags.extTagBracket," mw-ext-").concat(t),n)):e.eatWikiText("".concat(i.tags.extTagAttribute," mw-ext-").concat(t))(a,n)}}},{key:"eatExtTagArea",value:function(t){var e=this;return function(a,i){var n,s=a.pos,r=new RegExp(""),"i").exec(s?a.string.slice(s):a.string),o=!1;if(r){if(0===r.index)return i.tokenize=e.eatExtCloseTag(t),i.extName=!1,!1!==i.extMode&&(i.extMode=!1,i.extState=!1),i.tokenize(a,i);n=r.index+s,o=a.string,a.string=o.slice(0,n)}return i.stack.push(i.tokenize),i.tokenize=e.eatExtTokens(o),i.tokenize(a,i)}}},{key:"eatExtCloseTag",value:function(t){var e=this;return function(a,n){return a.next(),a.next(),n.tokenize=e.eatTagName(t.length,!0,!1),e.makeLocalStyle("".concat(i.tags.extTagBracket," mw-ext-").concat(t),n)}}},{key:"eatExtTokens",value:function(t){var e=this;return function(a,n){var s;return!1===n.extMode?(s=i.tags.extTag,a.skipToEnd()):s="mw-tag-".concat(n.extName," ")+n.extMode.token(a,n.extState,!1===t),a.eol()&&(!1!==t&&(a.string=t),n.tokenize=n.stack.pop()),e.makeLocalStyle(s,n)}}},{key:"eatStartTable",value:function(t,e){return t.match("{|"),t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),i.tags.tableBracket}},{key:"inTableDefinition",value:function(t,e){return t.sol()?(e.tokenize=this.inTable.bind(this),this.inTable(t,e)):this.eatWikiText(i.tags.tableDefinition)(t,e)}},{key:"inTable",value:function(t,e){if(t.sol()){if(t.eatSpace(),t.eat("|"))return t.eat("-")?(t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),this.makeLocalStyle(i.tags.tableDelimiter,e)):t.eat("+")?(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1,!0),this.makeLocalStyle(i.tags.tableDelimiter,e)):t.eat("}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.tableBracket,e)):(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1),this.makeLocalStyle(i.tags.tableDelimiter,e));if(t.eat("!"))return t.eatSpace(),e.tokenize=this.eatTableRow(!0,!0),this.makeLocalStyle(i.tags.tableDelimiter,e)}return this.eatWikiText("")(t,e)}},{key:"eatTableRow",value:function(t,e,a){var n=this,s="";return a?s=i.tags.tableCaption:e&&(s=i.tags.strong),function(r,o){if(r.sol()){if(r.match(/^[\s\u00a0]*[|!]/,!1))return o.tokenize=n.inTable.bind(n),n.inTable(r,o)}else{if(r.match(/^[^'|{[<&~!]+/))return n.makeStyle(s,o);if(r.match("||")||e&&r.match("!!"))return n.isBold=!1,n.isItalic=!1,o.tokenize=n.eatTableRow(!0,e,a),n.makeLocalStyle(i.tags.tableDelimiter,o);if(t&&r.eat("|"))return o.tokenize=n.eatTableRow(!1,e,a),n.makeLocalStyle(i.tags.tableDelimiter,o)}return n.eatWikiText(s)(r,o)}}},{key:"eatFreeExternalLinkProtocol",value:function(t,e){return t.match(this.urlProtocols),e.tokenize=this.eatFreeExternalLink.bind(this),this.makeLocalStyle(i.tags.freeExtLinkProtocol,e)}},{key:"eatFreeExternalLink",value:function(t,e){if(t.eol());else if(t.match(/^[^\s\u00a0{[\]<>~).,']*/))if("~"===t.peek()){if(!t.match(/^~~~+/,!1))return t.match(/^~*/),this.makeLocalStyle(i.tags.freeExtLink,e)}else if("{"===t.peek()){if(!t.match("{{",!1))return t.next(),this.makeLocalStyle(i.tags.freeExtLink,e)}else if("'"===t.peek()){if(!t.match("''",!1))return t.next(),this.makeLocalStyle(i.tags.freeExtLink,e)}else if(t.match(/^[).,]+(?=[^\s\u00a0{[\]<>~).,])/))return this.makeLocalStyle(i.tags.freeExtLink,e);return e.tokenize=e.stack.pop(),this.makeLocalStyle(i.tags.freeExtLink,e)}},{key:"eatList",value:function(t,e){var a=t.match(/^[#\*:;]*/);return a&&!this.isNested(e)&&a[0].includes(";")&&(e.nDt+=a[0].split(";").length-1),this.makeLocalStyle(i.tags.list,e)}},{key:"eatWikiText",value:function(t){var e=this;return function(a,n){var s,r,o,l,c,m,g;if(a.sol()){if(!a.match("//",!1)&&a.match(e.urlProtocols))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLink.bind(e),e.makeLocalStyle(i.tags.freeExtLinkProtocol,n);switch(s=a.next()){case"-":if(a.match(/^---+/))return i.tags.hr;break;case"=":if(r=a.match(/^(={0,5})(.+?(=\1\s*)(.*\S).*?)?)$/))return a.backUp(r[2].length),n.stack.push(n.tokenize),n.tokenize=e.eatSectionHeader(r[3].length),i.tags.sectionHeader+" "+i.tags["sectionHeader".concat(r[1].length+1)];break;case";":a.backUp(1);case"*":case"#":return e.eatList(a,n);case":":return a.match(/^:*{\|/,!1)&&(n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e)),e.eatList(a,n);case" ":if(!a.match(/^[\s\u00a0]*:*{\|/,!1))return i.tags.skipFormatting;if(a.eatSpace(),a.match(/^:+/))return n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e),i.tags.indenting;a.eat("{");case"{":if(a.eat("|"))return a.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inTableDefinition.bind(e),i.tags.tableBracket}}else s=a.next();switch(s){case"&":return e.makeStyle(e.eatHtmlEntity(a,t),n);case"'":if(a.match(/^'*(?=''''')/)||a.match(/^'''(?!')/,!1))break;if(a.match("''"))return e.firstSingleLetterWord||a.match("''",!1)||e.prepareItalicForCorrection(a),e.isBold=!e.isBold,e.makeLocalStyle(i.tags.apostrophesBold,n);if(a.eat("'"))return e.isItalic=!e.isItalic,e.makeLocalStyle(i.tags.apostrophesItalic,n);break;case"[":if(a.eat("[")){if(a.eatSpace(),/[^\]|[]/.test(a.peek()))return n.nLink++,n.stack.push(n.tokenize),n.tokenize=e.inLink.bind(e),e.makeLocalStyle(i.tags.linkBracket,n)}else if(o=a.match(e.urlProtocols))return n.nLink++,a.backUp(o[0].length),n.stack.push(n.tokenize),n.tokenize=e.eatExternalLinkProtocol(o[0].length),e.makeLocalStyle(i.tags.extLinkBracket,n);break;case"{":if(a.match(/^{{(?!{|[^{}]*}}(?!}))/))return a.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inVariable.bind(e),e.makeLocalStyle(i.tags.templateVariableBracket,n);if(a.match(/^{(?!{(?!{))[\s\u00a0]*/))return"#"===a.peek()?(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(i.tags.parserFunctionBracket,n)):!(l=a.match(/^([^\s\u00a0}[\]<{'|&:]+)(:|[\s\u00a0]*)(\}\}?)?(.)?/))||(a.backUp(l[0].length),":"!==l[2]&&void 0!==l[4]&&"}}"!==l[3]||!(l[1].toLowerCase()in e.config.functionSynonyms[0])&&!(l[1]in e.config.functionSynonyms[1]))?(n.nTemplate++,n.stack.push(n.tokenize),n.tokenize=e.eatTemplatePageName(!1),e.makeLocalStyle(i.tags.templateBracket,n)):(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(i.tags.parserFunctionBracket,n));break;case"<":if(c=!!a.eat("/"),m=a.match(/^[^>/\s\u00a0.*,[\]{}$^+?|/\\'`~<=!@#%&()-]+/),a.match("!--"))return g=e.eatBlock(i.tags.comment,"--\x3e"),n.stack.push(n.tokenize),n.tokenize=g,g(a,n);if(m){if((m=m[0].toLowerCase())in e.config.tags)return!0===c?i.tags.error:(a.backUp(m.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(m.length,c,!1),e.makeLocalStyle("".concat(i.tags.extTagBracket," mw-ext-").concat(m),n));if(m in i.permittedHtmlTags)return!0===c&&m!==n.inHtmlTag.pop()?(a.pos++,i.tags.error):!0===c&&m in i.implicitlyClosedHtmlTags?i.tags.error:(a.backUp(m.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(m.length,c||m in i.implicitlyClosedHtmlTags,!0),e.makeLocalStyle(i.tags.htmlTagBracket,n));a.backUp(m.length)}break;case"~":if(a.match(/^~{2,4}/))return i.tags.signature;break;case"_":for(r=1;a.eat("_");)r++;if(r>2)return a.eol()||a.backUp(2),e.makeStyle(t,n);if(2===r&&(l=a.match(/^([^\s\u00a0>}[\]<{'|&:~]+?)__/))&&l[0])return"__"+l[0].toLowerCase()in e.config.doubleUnderscore[0]||"__"+l[0]in e.config.doubleUnderscore[1]?i.tags.doubleUnderscore:(a.eol()||a.backUp(2),e.makeStyle(t,n));break;case":":if(n.nDt>0&&!e.isNested(n))return n.nDt--,i.tags.indenting;break;default:if(/[\s\u00a0]/.test(s)&&(a.eatSpace(),a.match(e.urlProtocols,!1)&&!a.match("//")))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLinkProtocol.bind(e),e.makeStyle(t,n)}return a.match(/^[^\s\u00a0_>}[\]<{'|&:~=]+/),e.makeStyle(t,n)}}},{key:"prepareItalicForCorrection",value:function(t){var e=t.pos,a=t.string.slice(0,e-3),i=a.slice(-1),n=a.slice(-2,-1);if(" "===i){if(this.firstMultiLetterWord||this.firstSpace)return;this.firstSpace=e}else if(" "===n)this.firstSingleLetterWord=e;else{if(this.firstMultiLetterWord)return;this.firstMultiLetterWord=e}this.wasBold=this.isBold,this.wasItalic=this.isItalic}},{key:"mediawiki",get:function(){var t=this;return{name:"mediawiki",startState:function(){return{tokenize:t.eatWikiText(""),stack:[],inHtmlTag:[],extName:!1,extMode:!1,extState:!1,nTemplate:0,nLink:0,nExt:0,nDt:0}},copyState:function(t){return{tokenize:t.tokenize,stack:t.stack.concat([]),inHtmlTag:t.inHtmlTag.concat([]),extName:t.extName,extMode:t.extMode,extState:!1!==t.extMode&&t.extMode.copyState(t.extState),nTemplate:t.nTemplate,nLink:t.nLink,nExt:t.nExt,nDt:t.nDt}},token:function(e,a){var i,n,s,r,o=[],l=[];if(t.oldTokens.length>0)return s=t.oldTokens.shift(),e.pos=s.pos,a=s.state,s.style;e.sol()&&(a.nDt=0,t.isBold=!1,t.isItalic=!1,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null);do{if(i=a.tokenize(e,a),!(r=t.firstSingleLetterWord||t.firstMultiLetterWord||t.firstSpace))return t.oldStyle=i,i;r!==n&&(n=r,l.length>0&&(o=o.concat(l),l=[])),l.push({pos:e.pos,style:i,state:(a.extMode||t.mediawiki).copyState(a)})}while(!e.eol());if(t.isBold&&t.isItalic){if(t.isItalic=t.wasItalic,t.isBold=t.wasBold,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null,!(o.length>0))return e.pos=l[0].pos-2,t.oldStyle;o[o.length-1].pos++,t.oldTokens=o}else t.oldTokens=o.concat(l);return s=t.oldTokens.shift(),e.pos=s.pos,a=s.state,s.style},blankLine:function(t){t.extMode&&t.extMode.blankLine&&t.extMode.blankLine(t.extState)},tokenTable:this.tokenTable}}}]),e}();module.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{bidiIsolation:!1},a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;a=a||mw.config.get("extCodeMirrorConfig");var n=new d(a).mediawiki,s=t.StreamLanguage.define(n),r=[t.syntaxHighlighting(t.HighlightStyle.define(i.getTagStyles(n)))],o=a.templateFoldingNamespaces;return o&&!o.includes(mw.config.get("wgNamespaceNumber"))||r.push(g),e.bidiIsolation&&r.push(f),new t.LanguageSupport(s,r)}; diff --git a/resources/dist/codemirror.wikieditor.js b/resources/dist/codemirror.wikieditor.js deleted file mode 100644 index 06314f14..00000000 --- a/resources/dist/codemirror.wikieditor.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var e=require("ext.CodeMirror.v6.lib"),t=function(t){function r(t,i){var o;return e._classCallCheck(this,r),(o=e._callSuper(this,r,[t])).langExtension=i,o.useCodeMirror=mw.user.options.get("usecodemirror")>0,o.realtimePreviewHandler=null,o}return e._inherits(r,t),e._createClass(r,[{key:"setCodeMirrorPreference",value:function(t){this.useCodeMirror=t,e._get(e._getPrototypeOf(r.prototype),"setCodeMirrorPreference",this).call(this,t)}},{key:"enableCodeMirror",value:function(){var t=this;if(!this.view){var r=this.$textarea.prop("selectionStart"),i=this.$textarea.prop("selectionEnd"),o=this.$textarea.scrollTop(),a=this.$textarea.is(":focus"),s=[this.defaultExtensions,this.langExtension,e.EditorView.updateListener.of((function(e){e.docChanged&&"function"==typeof t.realtimePreviewHandler&&t.realtimePreviewHandler()}))];if(this.initialize(s),this.addRealtimePreviewHandler(),requestAnimationFrame((function(){t.view.scrollDOM.scrollTop=o})),0!==r||0!==i){var n=e.EditorSelection.range(r,i),d=e.EditorView.scrollIntoView(n);d.value.isSnapshot=!0,this.view.dispatch({selection:e.EditorSelection.create([n]),effects:d})}a&&this.view.focus(),mw.hook("ext.CodeMirror.switch").fire(!0,$(this.view.dom))}}},{key:"addRealtimePreviewHandler",value:function(){var e=this;mw.hook("ext.WikiEditor.realtimepreview.enable").add((function(t){e.realtimePreviewHandler=t.getEventHandler().bind(t)})),mw.hook("ext.WikiEditor.realtimepreview.disable").add((function(){e.realtimePreviewHandler=null}))}},{key:"addCodeMirrorToWikiEditor",value:function(){var e=this,t=this.$textarea.data("wikiEditor-context"),r=t&&t.modules&&t.modules.toolbar;r&&(this.$textarea.wikiEditor("addToToolbar",{section:"main",groups:{codemirror:{tools:{CodeMirror:{label:mw.msg("codemirror-toggle-label"),type:"toggle",oouiIcon:"highlight",action:{type:"callback",execute:function(){return e.switchCodeMirror()}}}}}}}),r.$toolbar.find(".tool[rel=CodeMirror]").attr("id","mw-editbutton-codemirror"),this.readOnly&&this.$textarea.data("wikiEditor-context").$ui.addClass("ext-codemirror-readonly"),this.useCodeMirror&&this.enableCodeMirror(),this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!1,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0}))}},{key:"updateToolbarButton",value:function(){var e=$("#mw-editbutton-codemirror");e.toggleClass("mw-editbutton-codemirror-active",this.useCodeMirror),e.data("setActive")&&e.data("setActive")(this.useCodeMirror)}},{key:"switchCodeMirror",value:function(){this.view?(this.setCodeMirrorPreference(!1),this.destroy(),mw.hook("ext.CodeMirror.switch").fire(!1,this.$textarea)):(this.enableCodeMirror(),this.setCodeMirrorPreference(!0)),this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!0,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0})}}]),r}(require("ext.CodeMirror.v6"));module.exports=t; diff --git a/resources/dist/codemirror.wikieditor.mediawiki.js b/resources/dist/codemirror.wikieditor.mediawiki.js deleted file mode 100644 index 86cc50fd..00000000 --- a/resources/dist/codemirror.wikieditor.mediawiki.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var r=require("ext.CodeMirror.v6.WikiEditor"),i=require("ext.CodeMirror.v6.mode.mediawiki");require("ext.CodeMirror.v6.lib"),require("ext.CodeMirror.v6");var e=new URLSearchParams(window.location.search);mw.loader.getState("ext.wikiEditor")&&mw.hook("wikiEditor.toolbarReady").add((function(o){new r(o,i({bidiIsolation:"rtl"===o.attr("dir")&&e.get("cm6bidi")})).addCodeMirrorToWikiEditor()})); diff --git a/resources/dist/vendor.js b/resources/dist/vendor.js deleted file mode 100644 index 55e157ec..00000000 --- a/resources/dist/vendor.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(t=function(){return!!e})()}function e(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function i(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function n(t,e){for(var n=0;nt.length)&&(e=t.length);for(var i=0,n=new Array(e);ithis.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),d.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let i=[];return this.decompose(t,e,i,0),d.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new m(this),r=new m(t);for(let t=e,s=e;;){if(n.next(t),r.next(t),t=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(s+=n.value.length,n.done||s>=i)return!0}}iter(t=1){return new m(this,t)}iterRange(t,e=this.length){return new v(this,t,e)}iterLines(t,e){let i;if(null==t)i=this.iter();else{null==e&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new w(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new f(t):d.from(f.split(t,[])):u.empty}}class f extends u{constructor(t,e=function(t){let e=-1;for(let i of t)e+=i.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let r=0;;r++){let s=this.text[r],o=n+s.length;if((e?i:o)>=t)return new y(n,o,i,s);n=o+1,i++}}decompose(t,e,i,n){let r=t<=0&&e>=this.length?this:new f(g(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&n){let t=i.pop(),e=p(r.text,t.text.slice(),0,r.length);if(e.length<=32)i.push(new f(e,t.length+r.length));else{let t=e.length>>1;i.push(new f(e.slice(0,t)),new f(e.slice(t)))}}else i.push(r)}replace(t,e,i){if(!(i instanceof f))return super.replace(t,e,i);let n=p(this.text,p(i.text,g(this.text,0,t)),e),r=this.length+i.length-(e-t);return n.length<=32?new f(n,r):d.from(f.split(n,[]),r)}sliceString(t,e=this.length,i="\n"){let n="";for(let r=0,s=0;r<=e&&st&&s&&(n+=i),tr&&(n+=o.slice(Math.max(0,t-r),e-r)),r=l+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],n=-1;for(let r of t)i.push(r),n+=r.length+1,32==i.length&&(e.push(new f(i,n)),i=[],n=-1);return n>-1&&e.push(new f(i,n)),e}}class d extends u{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,i,n){for(let r=0;;r++){let s=this.children[r],o=n+s.length,l=i+s.lines-1;if((e?l:o)>=t)return s.lineInner(t,e,i,n);n=o+1,i=l+1}}decompose(t,e,i,n){for(let r=0,s=0;s<=e&&r=s){let r=n&((s<=t?1:0)|(l>=e?2:0));s>=t&&l<=e&&!r?i.push(o):o.decompose(t-s,e-s,i,r)}s=l+1}}replace(t,e,i){if(i.lines=r&&e<=o){let l=s.replace(t-r,e-r,i),h=this.lines-s.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[n]=l,new d(r,this.length-(e-t)+i.length)}return super.replace(r,o,l)}r=o+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i="\n"){let n="";for(let r=0,s=0;rt&&r&&(n+=i),ts&&(n+=o.sliceString(t-s,e-s,i)),s=l+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof d))return 0;let i=0,[n,r,s,o]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,r+=e){if(n==s||r==o)return i;let l=this.children[n],h=t.children[r];if(l!=h)return i+l.scanIdentical(h,e);i+=l.length+1}}static from(t,e=t.reduce(((t,e)=>t+e.length+1),-1)){let i=0;for(let e of t)i+=e.lines;if(i<32){let i=[];for(let e of t)e.flatten(i);return new f(i,e)}let n=Math.max(32,i>>5),r=n<<1,s=n>>1,o=[],l=0,h=-1,a=[];function c(t){let e;if(t.lines>r&&t instanceof d)for(let e of t.children)c(e);else t.lines>s&&(l>s||!l)?(u(),o.push(t)):t instanceof f&&l&&(e=a[a.length-1])instanceof f&&t.lines+e.lines<=32?(l+=t.lines,h+=t.length+1,a[a.length-1]=new f(e.text.concat(t.text),e.length+1+t.length)):(l+t.lines>n&&u(),l+=t.lines,h+=t.length+1,a.push(t))}function u(){0!=l&&(o.push(1==a.length?a[0]:d.from(a,h)),h=-1,l=a.length=0)}for(let e of t)c(e);return u(),1==o.length?o[0]:new d(o,e)}}function p(t,e,i=0,n=1e9){for(let r=0,s=0,o=!0;s=i&&(h>n&&(l=l.slice(0,n-r)),r0?1:(t instanceof f?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],s=r>>1,o=n instanceof f?n.text.length:n.children.length;if(s==(e>0?o:0)){if(0==i)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[i]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(n instanceof f){let r=n.text[s+(e<0?-1:0)];if(this.offsets[i]+=e,r.length>Math.max(0,t))return this.value=0==t?r:e>0?r.slice(t):r.slice(0,r.length-t),this;t-=r.length}else{let r=n.children[s+(e<0?-1:0)];t>r.length?(t-=r.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(r),this.offsets.push(e>0?1:(r instanceof f?r.text.length:r.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class v{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new m(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class w{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(u.prototype[Symbol.iterator]=function(){return this.iter()},m.prototype[Symbol.iterator]=v.prototype[Symbol.iterator]=w.prototype[Symbol.iterator]=function(){return this});class y{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}let b="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((t=>t?parseInt(t,36):1));for(let t=1;tt)return b[e-1]<=t;return!1}function k(t){return t>=127462&&t<=127487}const S=8205;function A(t,e,i=!0,n=!0){return(i?M:C)(t,e,n)}function M(t,e,i){if(e==t.length)return e;e&&O(t.charCodeAt(e))&&D(t.charCodeAt(e-1))&&e--;let n=T(t,e);for(e+=R(n);e=0&&k(T(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function C(t,e,i){for(;e>0;){let n=M(t,e-2,i);if(n=56320&&t<57344}function D(t){return t>=55296&&t<56320}function T(t,e){let i=t.charCodeAt(e);if(!D(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return O(n)?n-56320+(i-55296<<10)+65536:i}function E(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function R(t){return t<65536?1:2}const P=/\r\n?|\n/;var B=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(B||(B={}));class L{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return r+(t-n);r+=o}else{if(i!=B.Simple&&h>=t&&(i==B.TrackDel&&nt||i==B.TrackBefore&&nt))return null;if(h>t||h==t&&e<0&&!o)return t==n||e<0?r:r+l;r+=l}n=h}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return r}touchesRange(t,e=t){for(let i=0,n=0;i=0&&n<=e&&r>=t)return!(ne)||"cover";n=r}return!1}toString(){let t="";for(let e=0;e=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some((t=>"number"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new L(t)}static create(t){return new L(t)}}class N extends L{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return H(this,((e,i,n,r,s)=>t=t.replace(n,n+(i-e),s)),!1),t}mapDesc(t,e=!1){return W(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let n=0,r=0;n=0){e[n]=o,e[n+1]=s;let l=n>>1;for(;i.length0&&V(i,e,r.text),r.forward(t),o+=t}let h=t[s++];for(;o>1].toJSON()))}return t}static of(t,e,i){let n=[],r=[],s=0,o=null;function l(t=!1){if(!t&&!n.length)return;so||t<0||o>e)throw new RangeError(`Invalid change range ${t} to ${o} (in doc of length ${e})`);let c=a?"string"==typeof a?u.of(a.split(i||P)):a:u.empty,f=c.length;if(t==o&&0==f)return;ts&&I(n,t-s,-1),I(n,o-t,f),V(r,n,c),s=o}}(t),l(!o),o}static empty(t){return new N(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let n=0;ne&&"string"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)e.push(r[0],0);else{for(;i.length=0&&i<=0&&i==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=i:n?(t[r]+=e,t[r+1]+=i):t.push(e,i)}function V(t,e,i){if(0==i.length)return;let n=e.length-2>>1;if(n>1])),!(i||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],h=t.sections[o++];e(r,a,s,c,f),r=a,s=c}}}function W(t,e,i,n=!1){let r=[],s=n?[]:null,o=new z(t),l=new z(e);for(let t=-1;;)if(-1==o.ins&&-1==l.ins){let t=Math.min(o.len,l.len);I(r,t,-1),o.forward(t),l.forward(t)}else if(l.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(l.len=0&&t=0)){if(o.done&&l.done)return s?N.createSet(r,s):L.create(r);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==l.ins){let t=Math.min(i,l.len);e+=t,i-=t,l.forward(t)}else{if(!(0==l.ins&&l.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),s.forward2(e),o.forward(e)}}else I(n,0,o.ins,t),r&&V(r,n,o.text),o.next()}}class z{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?u.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?u.empty:e[i].slice(this.off,null==t?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class _{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return 16&this.flags?this.to:this.from}get head(){return 16&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 4&this.flags?-1:8&this.flags?1:0}get bidiLevel(){let t=3&this.flags;return 3==t?null:t}get goalColumn(){let t=this.flags>>5;return 33554431==t?void 0:t}map(t,e=-1){let i,n;return this.empty?i=n=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new _(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return q.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return q.range(this.anchor,i)}eq(t){return this.anchor==t.anchor&&this.head==t.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return q.range(t.anchor,t.head)}static create(t,e,i){return new _(t,e,i)}}class q{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:q.create(this.ranges.map((i=>i.map(t,e))),this.mainIndex)}eq(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let e=0;et.toJSON())),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new q(t.ranges.map((t=>_.fromJSON(t))),t.main)}static single(t,e=t){return new q([q.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;nt?4:0)|r)}static normalized(t,e=0){let i=t[e];t.sort(((t,e)=>t.from-e.from)),e=t.indexOf(i);for(let i=1;in.head?q.range(o,s):q.range(s,o))}}return new q(t,e)}}function j(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let K=0;class ${constructor(t,e,i,n,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=K++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}static define(t={}){return new $(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:G),!!t.static,t.enables)}of(t){return new U([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new U(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new U(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function G(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class U{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=K++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,r=this.id,s=t[r]>>1,o=2==this.type,l=!1,h=!1,a=[];for(let i of this.dependencies)"doc"==i?l=!0:"selection"==i?h=!0:0==(1&(null!==(e=t[i.id])&&void 0!==e?e:1))&&a.push(t[i.id]);return{create:t=>(t.values[s]=i(t),1),update(t,e){if(l&&e.docChanged||h&&(e.docChanged||e.selection)||Y(t,a)){let e=i(t);if(o?!J(e,t.values[s],n):!n(e,t.values[s]))return t.values[s]=e,1}return 0},reconfigure:(t,e)=>{let l,h=e.config.address[r];if(null!=h){let r=ut(e,h);if(this.dependencies.every((i=>i instanceof $?e.facet(i)===t.facet(i):!(i instanceof Z)||e.field(i,!1)==t.field(i,!1)))||(o?J(l=i(t),r,n):n(l=i(t),r)))return t.values[s]=r,0}else l=i(t);return t.values[s]=l,1}}}}function J(t,e,i){if(t.length!=e.length)return!1;for(let n=0;nt[e.id])),r=i.map((t=>t.type)),s=n.filter((t=>!(1&t))),o=t[e.id]>>1;function l(t){let i=[];for(let e=0;et===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Q).find((t=>t.field==this));return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,i)=>{let n=t.values[e],r=this.updateF(n,i);return this.compareF(n,r)?0:(t.values[e]=r,1)},reconfigure:(t,i)=>null!=i.config.address[this.id]?(t.values[e]=i.field(this),0):(t.values[e]=this.create(t),1)}}init(t){return[this,Q.of({field:this,create:t})]}get extension(){return this}}const tt=4,et=3,it=2,nt=1;function rt(t){return e=>new ot(e,t)}const st={highest:rt(0),high:rt(nt),default:rt(it),low:rt(et),lowest:rt(tt)};class ot{constructor(t,e){this.inner=t,this.prec=e}}class lt{of(t){return new ht(this,t)}reconfigure(t){return lt.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class ht{constructor(t,e){this.compartment=t,this.inner=e}}class at{constructor(t,e,i,n,r,s){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,i){let n=[],r=Object.create(null),s=new Map;for(let i of function(t,e,i){let n=[[],[],[],[],[]],r=new Map;function s(t,o){let l=r.get(t);if(null!=l){if(l<=o)return;let e=n[l].indexOf(t);e>-1&&n[l].splice(e,1),t instanceof ht&&i.delete(t.compartment)}if(r.set(t,o),Array.isArray(t))for(let e of t)s(e,o);else if(t instanceof ht){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),s(n,o)}else if(t instanceof ot)s(t.inner,t.prec);else if(t instanceof Z)n[o].push(t),t.provides&&s(t.provides,o);else if(t instanceof U)n[o].push(t),t.facet.extensions&&s(t.facet.extensions,it);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(e,o)}}return s(t,it),n.reduce(((t,e)=>t.concat(e)))}(t,e,s))i instanceof Z?n.push(i):(r[i.facet.id]||(r[i.facet.id]=[])).push(i);let o=Object.create(null),l=[],h=[];for(let t of n)o[t.id]=h.length<<1,h.push((e=>t.slot(e)));let a=null==i?void 0:i.config.facets;for(let t in r){let e=r[t],n=e[0].facet,s=a&&a[t]||[];if(e.every((t=>0==t.type)))if(o[n.id]=l.length<<1|1,G(s,e))l.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));l.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=l.length<<1|1,l.push(t.value)):(o[t.id]=h.length<<1,h.push((e=>t.dynamicSlot(e))));o[n.id]=h.length<<1,h.push((t=>X(t,n,e)))}}let c=h.map((t=>t(o)));return new at(t,s,c,o,l,r)}}function ct(t,e){if(1&e)return 2;let i=e>>1,n=t.status[i];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;t.status[i]=4;let r=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|r}function ut(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const ft=$.define(),dt=$.define({combine:t=>t.some((t=>t)),static:!0}),pt=$.define({combine:t=>t.length?t[0]:void 0,static:!0}),gt=$.define(),mt=$.define(),vt=$.define(),wt=$.define({combine:t=>!!t.length&&t[0]});class yt{constructor(t,e){this.type=t,this.value=e}static define(){return new bt}}class bt{of(t){return new yt(this,t)}}class xt{constructor(t){this.map=t}of(t){return new kt(this,t)}}class kt{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new kt(this.type,e)}is(t){return this.type==t}static define(t={}){return new xt(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let t=n.map(e);t&&i.push(t)}return i}}kt.reconfigure=kt.define(),kt.appendConfig=kt.define();class St{constructor(t,e,i,n,r,s){this.startState=t,this.changes=e,this.selection=i,this.effects=n,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,i&&j(i,e.newLength),r.some((t=>t.type==St.time))||(this.annotations=r.concat(St.time.of(Date.now())))}static create(t,e,i,n,r,s){return new St(t,e,i,n,r,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(St.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function At(t,e){let i=[];for(let n=0,r=0;;){let s,o;if(n=t[n]))s=t[n++],o=t[n++];else{if(!(r=0;r--){let s=i[r](t);s&&Object.keys(s).length&&(n=Mt(n,Ct(e,s,t.changes.newLength),!0))}return n==t?t:St.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(t){let e=t.startState,i=!0;for(let n of e.facet(gt)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:At(i,e))}if(!0!==i){let n,r;if(!1===i)r=t.changes.invertedDesc,n=N.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,r=e.filtered.mapDesc(e.changes).invertedDesc}t=St.create(e,n,t.selection&&t.selection.map(r),kt.mapEffects(t.effects,r),t.annotations,t.scrollIntoView)}let n=e.facet(mt);for(let i=n.length-1;i>=0;i--){let r=n[i](t);t=r instanceof St?r:Array.isArray(r)&&1==r.length&&r[0]instanceof St?r[0]:Ot(e,Tt(r),!1)}return t}(r):r)}St.time=yt.define(),St.userEvent=yt.define(),St.addToHistory=yt.define(),St.remote=yt.define();const Dt=[];function Tt(t){return null==t?Dt:Array.isArray(t)?t:[t]}var Et=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Et||(Et={}));const Rt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Pt;try{Pt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function Bt(t){return e=>{if(!/\S/.test(e))return Et.Space;if(function(t){if(Pt)return Pt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||Rt.test(i)))return!0}return!1}(e))return Et.Word;for(let i=0;i-1)return Et.Word;return Et.Other}}class Lt{constructor(t,e,i,n,r,s){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let t=0;tr.set(e,t))),i=null),r.set(e.value.compartment,e.value.extension)):e.is(kt.reconfigure)?(i=null,n=e.value):e.is(kt.appendConfig)&&(i=null,n=Tt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=at.resolve(n,r,this),e=new Lt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new Lt(i,t.newDoc,t.newSelection,e,((e,i)=>i.update(e,t)),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t},range:q.cursor(e.from+t.length)})))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),r=[i.range],s=Tt(i.effects);for(let i=1;ir.spec.fromJSON(s,t))))}return Lt.create({doc:t.doc,selection:q.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let e=at.resolve(t.extensions||[],new Map),i=t.doc instanceof u?t.doc:u.of((t.doc||"").split(e.staticFacet(Lt.lineSeparator)||P)),n=t.selection?t.selection instanceof q?t.selection:q.single(t.selection.anchor,t.selection.head):q.single(0);return j(n,i.length),e.staticFacet(dt)||(n=n.asSingle()),new Lt(e,i,n,e.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(Lt.tabSize)}get lineBreak(){return this.facet(Lt.lineSeparator)||"\n"}get readOnly(){return this.facet(wt)}phrase(t,...e){for(let e of this.facet(Lt.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,((t,i)=>{if("$"==i)return"$";let n=+(i||1);return!n||n>e.length?t:e[n-1]}))),t}languageDataAt(t,e,i=-1){let n=[];for(let r of this.facet(ft))for(let s of r(this,e,i))Object.prototype.hasOwnProperty.call(s,t)&&n.push(s[t]);return n}charCategorizer(t){return Bt(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:i,length:n}=this.doc.lineAt(t),r=this.charCategorizer(t),s=t-i,o=t-i;for(;s>0;){let t=A(e,s,!1);if(r(e.slice(t,s))!=Et.Word)break;s=t}for(;ot.length?t[0]:4}),Lt.lineSeparator=pt,Lt.readOnly=wt,Lt.phrases=$.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every((i=>t[i]==e[i]))}}),Lt.languageData=ft,Lt.changeFilter=gt,Lt.transactionFilter=mt,Lt.transactionExtender=vt,lt.reconfigure=kt.define();class It{eq(t){return this==t}range(t,e=t){return Vt.create(t,e,this)}}It.prototype.startSide=It.prototype.endSide=0,It.prototype.point=!1,It.prototype.mapMode=B.TrackDel;let Vt=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Ht(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Wt{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let r=i?this.to:this.from;for(let s=n,o=r.length;;){if(s==o)return s;let n=s+o>>1,l=r[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==s)return l>=0?s:o;l>=0?o=n:s=n+1}}between(t,e,i,n){for(let r=this.findIndex(e,-1e9,!0),s=this.findIndex(i,1e9,!1,r);ra||h==a&&c.startSide>0&&c.endSide<=0)continue;(a-h||c.endSide-c.startSide)<0||(s<0&&(s=h),c.point&&(o=Math.max(o,a-h)),i.push(c),n.push(h-s),r.push(a-s))}return{mapped:i.length?new Wt(n,r,i,o):null,pos:s}}}class Ft{constructor(t,e,i,n){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}static create(t,e,i,n){return new Ft(t,e,i,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:n=0,filterTo:r=this.length}=t,s=t.filter;if(0==e.length&&!s)return this;if(i&&(e=e.slice().sort(Ht)),this.isEmpty)return e.length?Ft.of(e):this;let o=new qt(this,null,-1).goto(0),l=0,h=[],a=new zt;for(;o.value||l=0){let t=e[l++];a.addInner(t.from,t.to,t.value)||h.push(t)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||ro.to||r=r&&t<=r+s.length&&!1===s.between(r,t-r,e-r,i))return}this.nextLayer.between(t,e,i)}}iter(t=0){return jt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return jt.from(t).goto(e)}static compare(t,e,i,n,r=-1){let s=t.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r)),o=e.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r)),l=_t(s,o,i),h=new $t(s,l,r),a=new $t(o,l,r);i.iterGaps(((t,e,i)=>Gt(h,t,a,e,i,n))),i.empty&&0==i.length&&Gt(h,0,a,0,0,n)}static eq(t,e,i=0,n){null==n&&(n=999999999);let r=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0)),s=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0));if(r.length!=s.length)return!1;if(!r.length)return!0;let o=_t(r,s),l=new $t(r,o,0).goto(i),h=new $t(s,o,0).goto(i);for(;;){if(l.to!=h.to||!Ut(l.active,h.active)||l.point&&(!h.point||!l.point.eq(h.point)))return!1;if(l.to>n)return!0;l.next(),h.next()}}static spans(t,e,i,n,r=-1){let s=new $t(t,null,r).goto(e),o=e,l=s.openStart;for(;;){let t=Math.min(s.to,i);if(s.point){let i=s.activeForPoint(s.to),r=s.pointFromo&&(n.span(o,t,s.active,l),l=s.openEnd(t));if(s.to>i)return l+(s.point&&s.to>i?1:0);o=s.to,s.next()}}static of(t,e=!1){let i=new zt;for(let n of t instanceof Vt?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Ht);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}Ft.empty=new Ft([],[],null,-1),Ft.empty.nextLayer=Ft.empty;class zt{finishChunk(t){this.chunks.push(new Wt(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new zt)).add(t,e,i)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(Ft.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=Ft.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function _t(t,e,i){let n=new Map;for(let e of t)for(let t=0;t=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&n.push(new qt(s,e,i,r));return 1==n.length?n[0]:new jt(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let t=this.heap.length>>1;t>=0;t--)Kt(this.heap,t);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let t=this.heap.length>>1;t>=0;t--)Kt(this.heap,t);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Kt(this.heap,0)}}}function Kt(t,e){for(let i=t[e];;){let n=1+(e<<1);if(n>=t.length)break;let r=t[n];if(n+1=0&&(r=t[n+1],n++),i.compare(r)<0)break;t[n]=i,t[e]=r,e=n}}class $t{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=jt.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Jt(this.active,t),Jt(this.activeTo,t),Jt(this.activeRank,t),this.minActive=Xt(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:r}=this.cursor;for(;e-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Jt(i,n)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from=0&&i[e]=0&&!(this.activeRank[i]t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function Gt(t,e,i,n,r,s){t.goto(e),i.goto(n);let o=n+r,l=n,h=n-e;for(;;){let e=t.to+h-i.to||t.endSide-i.endSide,n=e<0?t.to+h:i.to,r=Math.min(n,o);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&Ut(t.activeForPoint(t.to),i.activeForPoint(i.to))||s.comparePoint(l,r,t.point,i.point):r>l&&!Ut(t.active,i.active)&&s.compareRange(l,r,t.active,i.active),n>o)break;l=n,e<=0&&t.next(),e>=0&&i.next()}}function Ut(t,e){if(t.length!=e.length)return!1;for(let i=0;i=e;i--)t[i+1]=t[i];t[e]=i}function Xt(t,e){let i=-1,n=1e9;for(let r=0;r=e)return n;if(n==t.length)break;r+=9==t.charCodeAt(n)?i-r%i:1,n=A(t,n)}return!0===n?-1:t.length}const te="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),ee="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class ne{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function r(t,e,s,o){let l=[],h=/^@(\w+)\b/.exec(t[0]),a=h&&"keyframes"==h[1];if(h&&null==e)return s.push(t[0]+";");for(let i in e){let o=e[i];if(/&/.test(i))r(i.split(/,\s*/).map((e=>t.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),o,s);else if(o&&"object"==typeof o){if(!h)throw new RangeError("The value of a property ("+i+") should be a primitive value.");r(n(i),o,l,a)}else null!=o&&l.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(l.length||a)&&s.push((!i||h||o?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}")}for(let e in t)r(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=ie[te]||1;return ie[te]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[ee],r=i&&i.nonce;n?r&&n.setNonce(r):n=new se(t,r),n.mount(Array.isArray(e)?e:[e])}}let re=new Map;class se{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=re.get(i);if(e)return t.adoptedStyleSheets=[e.sheet,...t.adoptedStyleSheets],t[ee]=e;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],re.set(i,this)}else{this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);let n=t.head||t;n.insertBefore(this.styleTag,n.firstChild)}this.modules=[],t[ee]=this}mount(t){let e=this.sheet,i=0,n=0;for(let r=0;r-1&&(this.modules.splice(o,1),n--,o=-1),-1==o){if(this.modules.splice(n++,0,s),e)for(let t=0;t",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},he="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),ae="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ce=0;ce<10;ce++)oe[48+ce]=oe[96+ce]=String(ce);for(ce=1;ce<=24;ce++)oe[ce+111]="F"+ce;for(ce=65;ce<=90;ce++)oe[ce]=String.fromCharCode(ce+32),le[ce]=String.fromCharCode(ce);for(var ue in oe)le.hasOwnProperty(ue)||(le[ue]=oe[ue]);function fe(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function de(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function pe(t,e){if(!e.anchorNode)return!1;try{return de(t,e.anchorNode)}catch(t){return!1}}function ge(t){return 3==t.nodeType?Oe(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function me(t,e,i,n){return!!i&&(we(t,e,i,n,-1)||we(t,e,i,n,1))}function ve(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function we(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:ye(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ve(t)+(r<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?ye(t):0}}}function ye(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function be(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function xe(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function ke(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}class Se{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?ye(e):0),i,Math.min(t.focusOffset,i?ye(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let Ae,Me=null;function Ce(t){if(t.setActive)return t.setActive();if(Me)return t.focus(Me);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Me?{get preventScroll(){return Me={preventScroll:!0},!0}}:void 0),!Me){Me=!1;for(let t=0;tMath.max(1,t.scrollHeight-t.clientHeight-4)}class Re{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new Re(t.parentNode,ve(t),e)}static after(t,e){return new Re(t.parentNode,ve(t)+1,e)}}const Pe=[];class Be{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(2&this.flags){let i,n=this.dom,r=null;for(let s of this.children){if(7&s.flags){if(!s.dom&&(i=r?r.nextSibling:n.firstChild)){let t=Be.get(i);(!t||!t.parent&&t.canReuseDOM(s))&&s.reuseDOM(i)}s.sync(t,e),s.flags&=-8}if(i=r?r.nextSibling:n.firstChild,e&&!e.written&&e.node==n&&i!=s.dom&&(e.written=!0),s.dom.parentNode==n)for(;i&&i!=s.dom;)i=Le(i);else n.insertBefore(s.dom,i);r=s.dom}for(i=r?r.nextSibling:n.firstChild,i&&e&&e.node==n&&(e.written=!0);i;)i=Le(i)}else if(1&this.flags)for(let i of this.children)7&i.flags&&(i.sync(t,e),i.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let n=0==ye(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==n&&e.firstChild!=e.lastChild&&(n=t==e.firstChild?-1:1),t=e}i=n<0?t:t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!Be.get(i);)i=i.nextSibling;if(!i)return this.length;for(let t=0,e=0;;t++){let n=this.children[t];if(n.dom==i)return e;e+=n.length+n.breakAfter}}domBoundsAround(t,e,i=0){let n=-1,r=-1,s=-1,o=-1;for(let l=0,h=i,a=i;le)return i.domBoundsAround(t,e,h);if(c>=t&&-1==n&&(n=l,r=h),h>e&&i.dom.parentNode==this.dom){s=l,o=a;break}a=c,h=c+i.breakAfter}return{from:r,to:o<0?i+this.length:o,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s=0?this.children[s].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=Pe){this.markDirty();for(let n=t;nthis.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Ie(t,e,i,n,r,s,o,l,h){let{children:a}=t,c=a.length?a[e]:null,u=s.length?s[s.length-1]:null,f=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!f&&s.length<2&&c.merge(i,r,s.length?u:null,0==i,l,h))){if(n0&&(!o&&s.length&&c.merge(i,c.length,s[0],!1,l,0)?c.breakAfter=s.shift().breakAfter:(i2);var Je={mac:Ue||/Mac/.test(He.platform),windows:/Win/.test(He.platform),linux:/Linux|X11/.test(He.platform),ie:qe,ie_version:ze?We.documentMode||6:_e?+_e[1]:Fe?+Fe[1]:0,gecko:je,gecko_version:je?+(/Firefox\/(\d+)/.exec(He.userAgent)||[0,0])[1]:0,chrome:!!Ke,chrome_version:Ke?+Ke[1]:0,ios:Ue,android:/Android\b/.test(He.userAgent),webkit:$e,safari:Ge,webkit_version:$e?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=We.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Ye extends Be{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof Ye)||this.length-(e-t)+i.length>256||8&i.flags))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new Ye(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new Re(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,i){let n=t.nodeValue.length;e>n&&(e=n);let r=e,s=e,o=0;0==e&&i<0||e==n&&i>=0?Je.chrome||Je.gecko||(e?(r--,o=1):s=0)?0:l.length-1];Je.safari&&!o&&0==h.width&&(h=Array.prototype.find.call(l,(t=>t.width))||h);return o?be(h,o<0):h||null}(this.dom,t,e)}}class Xe extends Be{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let t of e)t.setParent(this)}setAttrs(t){if(Te(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,n,r,s){return(!i||!(!(i instanceof Xe&&i.mark.eq(this.mark))||t&&r<=0||et&&e.push(i=t&&(n=r),i=o,r++}let s=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new Xe(this.mark,e,s)}domAtPos(t){return ti(this,t)}coordsAt(t,e){return ii(this,t,e)}}class Qe extends Be{static create(t,e,i){return new Qe(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=Qe.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof Qe&&this.widget.compare(i.widget))||t>0&&r<=0||e0)?Re.before(this.dom):Re.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);if(i)return i;let n=this.dom.getClientRects(),r=null;if(!n.length)return null;let s=this.side?this.side<0:t>0;for(let e=s?n.length-1:0;r=n[e],!(t>0?0==e:e==n.length-1||r.top0?Re.before(this.dom):Re.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return u.empty}get isHidden(){return!0}}function ti(t,e){let i=t.dom,{children:n}=t,r=0;for(let t=0;rt&&e0;t--){let e=n[t-1];if(e.dom.parentNode==i)return e.domAtPos(e.length)}for(let t=r;t0&&e instanceof Xe&&r.length&&(n=r[r.length-1])instanceof Xe&&n.mark.eq(e.mark)?ei(n,e.children[0],i-1):(r.push(e),e.setParent(t)),t.length+=e.length}function ii(t,e,i){let n=null,r=-1,s=null,o=-1;!function t(e,l){for(let h=0,a=0;h=l&&(c.children.length?t(c,l-a):(!s||s.isHidden&&i>0)&&(u>l||a==u&&c.getSide()>0)?(s=c,o=l-a):(a-1?1:0)!=r.length-(i&&r.indexOf(i)>-1?1:0))return!1;for(let s of n)if(s!=i&&(-1==r.indexOf(s)||t[s]!==e[s]))return!1;return!0}function oi(t,e,i){let n=!1;if(e)for(let r in e)i&&r in i||(n=!0,"style"==r?t.style.cssText="":t.removeAttribute(r));if(i)for(let r in i)e&&e[r]==i[r]||(n=!0,"style"==r?t.style.cssText=i[r]:t.setAttribute(r,i[r]));return n}function li(t){let e=Object.create(null);for(let i=0;i0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){si(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){ei(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=ni(e,this.attrs||{})),i&&(this.attrs=ni({class:i},this.attrs||{}))}domAtPos(t){return ti(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?4&this.flags&&(Te(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(oi(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&Be.get(n)instanceof Xe;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Be.get(n))||void 0===i?void 0:i.isEditable)||Je.ios&&this.children.some((t=>t instanceof Ye))))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let i of this.children){if(!(i instanceof Ye)||/[^ -~]/.test(i.text))return null;let n=ge(i.dom);if(1!=n.length)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let i=ii(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=i.bottom-i.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight=e){if(r instanceof hi)return r;if(s>e)break}n=s+r.breakAfter}return null}}class ai extends Be{constructor(t,e,i){super(),this.widget=t,this.length=e,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,n,r,s){return!(i&&(!(i instanceof ai&&this.widget.compare(i.widget))||t>0&&r<=0||e0)}}class ci{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}destroy(t){}}var ui=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(ui||(ui={}));class fi extends It{constructor(t,e,i,n){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(t){return new di(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new gi(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,n=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:r,end:s}=mi(t,n);e=(r?n?-3e8:-1:5e8)-1,i=1+(s?n?2e8:1:-6e8)}return new gi(t,e,i,n,t.widget||null,!0)}static line(t){return new pi(t)}static set(t,e=!1){return Ft.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}fi.none=Ft.empty;class di extends fi{constructor(t){let{start:e,end:i}=mi(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,i;return this==t||t instanceof di&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(i=t.attrs)||void 0===i?void 0:i.class))&&si(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}di.prototype.point=!1;class pi extends fi{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof pi&&this.spec.class==t.spec.class&&si(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}pi.prototype.mapMode=B.TrackBefore,pi.prototype.point=!0;class gi extends fi{constructor(t,e,i,n,r,s){super(e,i,r,t),this.block=n,this.isReplace=s,this.mapMode=n?e<=0?B.TrackBefore:B.TrackAfter:B.TrackDel}get type(){return this.startSide!=this.endSide?ui.WidgetRange:this.startSide<=0?ui.WidgetBefore:ui.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof gi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function mi(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return null==i&&(i=t.inclusive),null==n&&(n=t.inclusive),{start:null!=i?i:e,end:null!=n?n:e}}function vi(t,e,i,n=0){let r=i.length-1;r>=0&&i[r]+n>=t?i[r]=Math.max(i[r],e):i.push(t,e)}gi.prototype.point=!0;class wi{constructor(t,e,i,n){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof ai&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new hi),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(yi(new Ze(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof ai||this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(yi(new Ye(this.text.slice(this.textOff,this.textOff+n)),e),i),this.atCursorPos=!0,this.textOff+=n,t-=n,i=0}}span(t,e,i,n){this.buildText(e-t,i,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,i,n,r,s){if(this.disallowBlockEffectsFor[s]&&i instanceof gi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof gi)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ai(i.widget||new bi("div"),o,i));else{let s=Qe.create(i.widget||new bi("span"),o,o?0:i.startSide),l=this.atCursorPos&&!s.isEditable&&r<=n.length&&(t0),h=!s.isEditable&&(tn.length||i.startSide<=0),a=this.getLine();2!=this.pendingBuffer||l||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),l&&(a.append(yi(new Ze(1),n),r),r=n.length+Math.max(0,r-n.length)),a.append(yi(s,n),r),this.atCursorPos=h,this.pendingBuffer=h?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}static build(t,e,i,n,r){let s=new wi(t,e,i,r);return s.openEnd=Ft.spans(n,e,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function yi(t,e){for(let i of e)t=new Xe(i,[t],t.length);return t}class bi extends ci{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const xi=$.define(),ki=$.define(),Si=$.define(),Ai=$.define(),Mi=$.define(),Ci=$.define(),Oi=$.define(),Di=$.define({combine:t=>t.some((t=>t))}),Ti=$.define({combine:t=>t.some((t=>t))});class Ei{constructor(t,e="nearest",i="nearest",n=5,r=5,s=!1){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=r,this.isSnapshot=s}map(t){return t.empty?this:new Ei(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Ei(q.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ri=kt.define({map:(t,e)=>t.map(e)});function Pi(t,e,i){let n=t.facet(Ai);n.length?n[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}const Bi=$.define({combine:t=>!t.length||t[0]});let Li=0;const Ni=$.define();class Ii{constructor(t,e,i,n,r){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=n,this.extension=r(this)}static define(t,e){const{eventHandlers:i,eventObservers:n,provide:r,decorations:s}=e||{};return new Ii(Li++,t,i,n,(t=>{let e=[Ni.of(t)];return s&&e.push(Fi.of((e=>{let i=e.plugin(t);return i?s(i):fi.none}))),r&&e.push(r(t)),e}))}static fromClass(t,e){return Ii.define((e=>new t(e)),e)}}class Vi{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(Pi(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){Pi(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){Pi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Hi=$.define(),Wi=$.define(),Fi=$.define(),zi=$.define(),_i=$.define();function qi(t,e,i){let n=t.state.facet(_i);if(!n.length)return n;let r=n.map((e=>e instanceof Function?e(t):e)),s=[];return Ft.spans(r,e,i,{point(){},span(t,e,i,n){let r=s;for(let s=i.length-1;s>=0;s--,n--){let o,l=i[s].spec.bidiIsolate;if(null!=l)if(n>0&&r.length&&(o=r[r.length-1]).to==t&&o.direction==l)o.to=e,r=o.inner;else{let i={from:t,to:e,direction:l,inner:[]};r.push(i),r=i.inner}}}}),s}const ji=$.define();function Ki(t){let e=0,i=0,n=0,r=0;for(let s of t.state.facet(ji)){let o=s(t);o&&(null!=o.left&&(e=Math.max(e,o.left)),null!=o.right&&(i=Math.max(i,o.right)),null!=o.top&&(n=Math.max(n,o.top)),null!=o.bottom&&(r=Math.max(r,o.bottom)))}return{left:e,right:i,top:n,bottom:r}}const $i=$.define();class Gi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Gi(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toAa)break;r+=2}if(!l)return i;new Gi(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),s=l.toA,o=l.toB}}}class Ui{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=N.empty(this.startState.doc.length);for(let t of i)this.changes=this.changes.compose(t.changes);let n=[];this.changes.iterChangedRanges(((t,e,i,r)=>n.push(new Gi(t,e,i,r)))),this.changedRanges=n}static create(t,e,i){return new Ui(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((t=>t.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}exports.Direction=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(exports.Direction||(exports.Direction={}));const Ji=exports.Direction.LTR,Yi=exports.Direction.RTL;function Xi(t){let e=[];for(let i=0;i=e){if(o.level==i)return s;(r<0||(0!=n?n<0?o.frome:t[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function sn(t,e){if(t.length!=e.length)return!1;for(let i=0;ih&&o.push(new rn(h,p.from,f)),hn(t,p.direction==Ji!=!(f%2)?n+1:n,r,p.inner,p.from,p.to,o),h=p.to}d=p.to}else{if(d==i||(e?on[d]!=l:on[d]==l))break;d++}u?ln(t,h,d,n+1,r,u,o):he;){let i=!0,c=!1;if(!a||h>s[a-1].to){let t=on[h-1];t!=l&&(i=!1,c=16==t)}let u=i||1!=l?null:[],f=i?n:n+1,d=h;t:for(;;)if(a&&d==s[a-1].to){if(c)break t;let p=s[--a];if(!i)for(let t=p.from,i=a;;){if(t==e)break t;if(!i||s[i-1].to!=t){if(on[t-1]==l)break t;break}t=s[--i].from}if(u)u.push(p);else{p.to=0;t-=3)if(en[t+1]==-i){let e=en[t+2],i=2&e?r:4&e?1&e?s:r:0;i&&(on[o]=on[en[t]]=i),l=t;break}}else{if(189==en.length)break;en[l++]=o,en[l++]=e,en[l++]=h}else if(2==(n=on[o])||1==n){let t=n==r;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=en[e+2];if(2&i)break;if(t)en[e+2]|=2;else{if(4&i)break;en[e+2]|=4}}}}}(t,r,s,n,l),function(t,e,i,n){for(let r=0,s=n;r<=i.length;r++){let o=r?i[r-1].to:t,l=rh;)e==s&&(e=i[--n].from,s=n?i[n-1].to:t),on[--e]=c;h=o}else s=o,h++}}}(r,s,n,l),ln(t,r,s,e,i,n,o)}function an(t){return[new rn(0,t,0)]}let cn="";function un(t,e,i,n,r){var s;let o=n.head-t.from,l=-1;if(0==o){if(!r||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),l=0)}else if(o==t.length){if(r)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),l=e.length-1)}l<0&&(l=rn.find(e,o,null!==(s=n.bidiLevel)&&void 0!==s?s:-1,n.assoc));let h=e[l];o==h.side(r,i)&&(h=e[l+=r?1:-1],o=h.side(!r,i));let a=r==(h.dir==i),c=A(t.text,o,a);if(cn=t.text.slice(Math.min(o,c),Math.max(o,c)),c>h.from&&c0&&i.length&&(i.every((({fromA:t,toA:e})=>ethis.minWidthTo))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?n=this.domChanged.newSel.head:function(t,e){let i=!1;e&&t.iterChangedRanges(((t,n)=>{te.from&&(i=!0)}));return i}(t.changes,this.hasComposition)||t.selectionSet||(n=t.state.selection.main.head));let r=n>-1?function(t,e,i){let n=pn(t,i);if(!n)return null;let{node:r,from:s,to:o}=n,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(n.from,n.to)!=l)return null;let h=e.invertedDesc,a=new Gi(h.mapPos(s),h.mapPos(o),s,o),c=[];for(let e=r.parentNode;;e=e.parentNode){let i=Be.get(e);if(i instanceof Xe)c.push({node:e,deco:i.mark});else{if(i instanceof hi||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:a,text:r,marks:c,line:e};if(e==t.contentDOM)return null;c.push({node:e,deco:new di({inclusive:!0,attributes:li(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:n}=this.hasComposition;i=new Gi(e,n,t.changes.mapPos(e,-1),t.changes.mapPos(n,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Je.ie||Je.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=function(t,e,i){let n=new mn;return Ft.compare(t,e,i,n),n.changes}(this.decorations,this.updateDeco(),t.changes);return i=Gi.extendWithRanges(i,s),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);let{observer:n}=this.view;n.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=Je.chrome||Je.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||n.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((t=>t.flags&=-9));let r=[];if(this.view.viewport.from||this.view.viewport.to=0?n[t]:null;if(!e)break;let s,o,l,h,{fromA:a,toA:c,fromB:u,toB:f}=e;if(i&&i.range.fromBu){let t=wi.build(this.view.state.doc,u,i.range.fromB,this.decorations,this.dynamicDecorationMap),e=wi.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);o=t.breakAtStart,l=t.openStart,h=e.openEnd;let n=this.compositionView(i);e.breakAtStart?n.breakAfter=1:e.content.length&&n.merge(n.length,n.length,e.content[0],!1,e.openStart,0)&&(n.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&n.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),s=t.content.concat(n).concat(e.content)}else({content:s,breakAtStart:o,openStart:l,openEnd:h}=wi.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:d,off:p}=r.findPos(c,1),{i:g,off:m}=r.findPos(a,-1);Ie(this,g,m,d,p,s,o,l,h)}i&&this.fixCompositionDOM(i)}compositionView(t){let e=new Ye(t.text.nodeValue);e.flags|=8;for(let{deco:i}of t.marks)e=new Xe(i,[e],e.length);let i=new hi;return i.append(e,0),i}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some((t=>7&t.flags))?1:0),this.markedForComposition.add(e);let i=Be.get(t);i&&i!=e&&(i.dom=null),e.setDOM(t)},i=this.childPos(t.range.fromB,1),n=this.children[i.i];e(t.line,n);for(let r=t.marks.length-1;r>=-1;r--)i=n.childPos(i.off,1),n=n.children[i.i],e(r>=0?t.marks[r].node:t.text,n)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,r=!n&&pe(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||e||r))return;let s=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(o.anchor)),h=o.empty?l:this.moveToLine(this.domAtPos(o.head));if(Je.gecko&&o.empty&&!this.hasComposition&&(1==(a=l).node.nodeType&&a.node.firstChild&&(0==a.offset||"false"==a.node.childNodes[a.offset-1].contentEditable)&&(a.offset==a.node.childNodes.length||"false"==a.node.childNodes[a.offset].contentEditable))){let t=document.createTextNode("");this.view.observer.ignore((()=>l.node.insertBefore(t,l.node.childNodes[l.offset]||null))),l=h=new Re(t,0),s=!0}var a;let c=this.view.observer.selectionRange;!s&&c.focusNode&&me(l.node,l.offset,c.anchorNode,c.anchorOffset)&&me(h.node,h.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{Je.android&&Je.chrome&&this.dom.contains(c.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=fe(this.view.root);if(t)if(o.empty){if(Je.gecko){let t=(e=l.node,n=l.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([l,h]=[h,l]),e.setEnd(h.node,h.offset),e.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(l,h)),this.impreciseAnchor=l.precise?null:new Re(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new Re(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=fe(t.root),{anchorNode:n,anchorOffset:r}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let s=hi.find(this,e.head);if(!s)return;let o=s.posAtStart;if(e.head==o||e.head==o+s.length)return;let l=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!l||!h||l.bottom>h.top)return;let a=this.domAtPos(e.head+e.assoc);i.collapse(a.node,a.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,r)}moveToLine(t){let e,i=this.dom;if(t.node!=i)return t;for(let n=t.offset;!e&&n=0;n--){let t=Be.get(i.childNodes[n]);t instanceof hi&&(e=t.domAtPos(t.length))}return e?new Re(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=Be.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e=0;s--){let o=this.children[s],l=r-o.breakAfter,h=l-o.length;if(lt||o.covers(1))&&(!i||o instanceof hi&&!(i instanceof hi&&e>=0))&&(i=o,n=h),r=h}return i?i.coordsAt(t-n,e):null}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),n=this.children[e];if(!(n instanceof hi))return null;for(;n.children.length;){let{i:t,off:e}=n.childPos(i,1);for(;;t++){if(t==n.children.length)return null;if((n=n.children[t]).length)break}i=e}if(!(n instanceof Ye))return null;let r=A(n.text,i);if(r==i)return null;let s=Oe(n.dom,i,r).getClientRects();for(let t=0;tMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==exports.Direction.LTR;for(let t=0,h=0;hn)break;if(t>=i){let i=a.dom.getBoundingClientRect();if(e.push(i.height),s){let e=a.dom.lastChild,n=e?ge(e):[];if(n.length){let e=n[n.length-1],s=l?e.right-i.left:i.right-e.left;s>o&&(o=s,this.minWidth=r,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+a.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?exports.Direction.RTL:exports.Direction.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){let e=t.measureTextSize();if(e)return e}let t,e,i,n=document.createElement("div");return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let r=ge(n.firstChild)[0];t=n.getBoundingClientRect().height,e=r?r.width/27:7,i=r?r.height:t,n.remove()})),{lineHeight:t,charWidth:e,textHeight:i}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new Ne(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let r=n==e.viewports.length?null:e.viewports[n],s=r?r.from-1:this.length;if(s>i){let n=(e.lineBlockAt(s).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(fi.replace({widget:new dn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!r)break;i=r.to+1}return fi.set(t)}updateDeco(){let t=this.view.state.facet(Fi).map(((t,e)=>(this.dynamicDecorationMap[e]="function"==typeof t)?t(this.view):t));for(let e=t.length;ei.anchor?-1:1);if(!n)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,e.left),top:Math.min(n.top,e.top),right:Math.max(n.right,e.right),bottom:Math.max(n.bottom,e.bottom)});let r=Ki(this.view),s={left:n.left-r.left,top:n.top-r.top,right:n.right+r.right,bottom:n.bottom+r.bottom},{offsetWidth:o,offsetHeight:l}=this.view.scrollDOM;!function(t,e,i,n,r,s,o,l){let h=t.ownerDocument,a=h.defaultView||window;for(let c=t,u=!1;c&&!u;)if(1==c.nodeType){let t,f=c==h.body,d=1,p=1;if(f)t=xe(a);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();({scaleX:d,scaleY:p}=ke(c,e)),t={left:e.left,right:e.left+c.clientWidth*d,top:e.top,bottom:e.top+c.clientHeight*p}}let g=0,m=0;if("nearest"==r)e.top0&&e.bottom>t.bottom+m&&(m=e.bottom-t.bottom+m+o)):e.bottom>t.bottom&&(m=e.bottom-t.bottom+o,i<0&&e.top-m0&&e.right>t.right+g&&(g=e.right-t.right+g+s)):e.right>t.right&&(g=e.right-t.right+s,i<0&&e.left0))break;i=i.childNodes[n-1],n=ye(i)}if(i>=0)for(let n=t,r=e;;){if(3==n.nodeType)return{node:n,offset:r};if(!(1==n.nodeType&&r=0))break;n=n.childNodes[r],r=0}return null}let mn=class{constructor(){this.changes=[]}compareRange(t,e){vi(t,e,this.changes)}comparePoint(t,e){vi(t,e,this.changes)}};function vn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function wn(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function yn(t,e){return t.tope.top+1}function bn(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function kn(t,e,i){let n,r,s,o,l,h,a,c,u=!1;for(let f=t.firstChild;f;f=f.nextSibling){let t=ge(f);for(let d=0;dm||o==m&&s>g){n=f,r=p,s=g,o=m;let l=m?i0?d0)}0==g?i>p.bottom&&(!a||a.bottomp.top)&&(h=f,c=p):a&&yn(a,p)?a=xn(a,p.bottom):c&&yn(c,p)&&(c=bn(c,p.top))}}if(a&&a.bottom>=i?(n=l,r=a):c&&c.top<=i&&(n=h,r=c),!n)return{node:t,offset:0};let f=Math.max(r.left,Math.min(r.right,e));return 3==n.nodeType?Sn(n,f,i):u&&"false"!=n.contentEditable?kn(n,f,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(r.left+r.right)/2?1:0)}}function Sn(t,e,i){let n=t.nodeValue.length,r=-1,s=1e9,o=0;for(let l=0;li?a.top-i:i-a.bottom)-1;if(a.left-1<=e&&a.right+1>=e&&c=(a.left+a.right)/2,n=i;if(Je.chrome||Je.gecko){Oe(t,l).getBoundingClientRect().left==a.right&&(n=!i)}if(c<=0)return{node:t,offset:l+(n?1:0)};r=l+(n?1:0),s=c}}}return{node:t,offset:r>-1?r:o>0?t.nodeValue.length:0}}function An(t,e,i,n=-1){var r,s;let o,l=t.contentDOM.getBoundingClientRect(),h=l.top+t.viewState.paddingTop,{docHeight:a}=t.viewState,{x:c,y:u}=e,f=u-h;if(f<0)return 0;if(f>a)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,r=!1;o=t.elementAtHeight(f),o.type!=ui.Text;)for(;f=n>0?o.bottom+e:o.top-e,!(f>=0&&f<=a);){if(r)return i?null:0;r=!0,n=-n}u=h+f;let d=o.from;if(dt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:Mn(t,l,o,c,u);let p=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:p,m=g.elementFromPoint(c,u);m&&!t.contentDOM.contains(m)&&(m=null),m||(c=Math.max(l.left+1,Math.min(l.right-1,c)),m=g.elementFromPoint(c,u),m&&!t.contentDOM.contains(m)&&(m=null));let v,w=-1;if(m&&0!=(null===(r=t.docView.nearest(m))||void 0===r?void 0:r.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:v,offset:w}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:v,startOffset:w}=e),(!t.contentDOM.contains(v)||Je.safari&&function(t,e,i){let n;if(3!=t.nodeType||e!=(n=t.nodeValue.length))return!1;for(let e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return!1;return Oe(t,n-1,n).getBoundingClientRect().left>i}(v,w,c)||Je.chrome&&function(t,e,i){if(0!=e)return!1;for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}let n=1==t.nodeType?t.getBoundingClientRect():Oe(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(v,w,c))&&(v=void 0))}if(!v||!t.docView.dom.contains(v)){let e=hi.find(t.docView,d);if(!e)return f>o.top+o.height/2?o.to:o.from;({node:v,offset:w}=kn(e.dom,c,u))}let y=t.docView.nearest(v);if(!y)return null;if(y.isWidget&&1==(null===(s=y.dom)||void 0===s?void 0:s.nodeType)){let t=y.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;s+=Math.floor((r-i.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+Zt(o,s,t.state.tabSize)}function Cn(t,e){let i=t.lineBlockAt(e);if(Array.isArray(i.type))for(let t of i.type)if(t.to>e||t.to==e&&(t.to==i.to||t.type==ui.Text))return t;return i}function On(t,e,i,n){let r=t.state.doc.lineAt(e.head),s=t.bidiSpans(r),o=t.textDirectionAt(r.from);for(let l=e,h=null;;){let e=un(r,s,o,l,i),a=cn;if(!e){if(r.number==(i?t.state.doc.lines:1))return l;a="\n",r=t.state.doc.line(r.number+(i?1:-1)),s=t.bidiSpans(r),e=q.cursor(i?r.from:r.to)}if(h){if(!h(a))return l}else{if(!n)return e;h=n(a)}l=e}}function Dn(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,((t,r,s)=>{if(e>t&&ee(t))),i.from,e.head>i.from?-1:1);return n==i.from?i:q.cursor(n,nnull)),Je.gecko&&function(t){nr.has(t)||(nr.add(t),t.addEventListener("copy",(()=>{})),t.addEventListener("cut",(()=>{})))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=Be.get(n))&&i.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||this.runHandlers(t.type,t))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let t of i.observers)t(this.view,e);for(let t of i.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=Pn(t),i=this.handlers,n=this.view.contentDOM;for(let t in e)if("scroll"!=t){let r=!e[t].handlers.length,s=i[t];s&&r!=!s.handlers.length&&(n.removeEventListener(t,this.handleEvent),s=null),s||n.addEventListener(t,this.handleEvent,{passive:r})}for(let t in i)"scroll"==t||e[t]||n.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&Date.now()e.keyCode==t.keyCode)))&&!t.ctrlKey||Ln.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(){let t=this.pendingIOSKey;return!!t&&(this.pendingIOSKey=void 0,De(this.view.contentDOM,t.key,t.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Je.safari&&!Je.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Rn(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(t){Pi(i.state,t)}}}function Pn(t){let e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let e of t){let t=e.spec;if(t&&t.domEventHandlers)for(let n in t.domEventHandlers){let r=t.domEventHandlers[n];r&&i(n).handlers.push(Rn(e.value,r))}if(t&&t.domEventObservers)for(let n in t.domEventObservers){let r=t.domEventObservers[n];r&&i(n).observers.push(Rn(e.value,r))}}for(let t in Hn)i(t).handlers.push(Hn[t]);for(let t in Wn)i(t).observers.push(Wn[t]);return e}const Bn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Ln="dthko",Nn=[16,17,18,20,91,92,224,225];function In(t){return.7*Math.max(0,t)+8}class Vn{constructor(t,e,i,n){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){let e=t.ownerDocument;for(let i=t.parentNode;i&&i!=e.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}(t.contentDOM),this.atoms=t.state.facet(zi).map((e=>e(t)));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Lt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(xi);return i.length?i[0](e):Je.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=fe(t.root);if(!n||0==n.rangeCount)return!0;let r=n.getRangeAt(0).getClientRects();for(let t=0;t=e.clientX&&i.top<=e.clientY&&i.bottom>=e.clientY)return!0}return!1}(t,e)||1!=Xn(e))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){var e,i,n;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,n=t,Math.max(Math.abs(i.clientX-n.clientX),Math.abs(i.clientY-n.clientY))<10))return;this.select(this.lastEvent=t);let r=0,s=0,o=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=Ki(this.view);t.clientX-l.left<=o.left+6?r=-In(o.left-t.clientX):t.clientX+l.right>=o.right-6&&(r=In(t.clientX-o.right)),t.clientY-l.top<=o.top+6?s=-In(o.top-t.clientY):t.clientY+l.bottom>=o.bottom-6&&(s=In(t.clientY-o.bottom)),this.setScrollSpeed(r,s)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let i=0;ithis.select(this.lastEvent)),20)}}const Hn=Object.create(null),Wn=Object.create(null),Fn=Je.ie&&Je.ie_version<15||Je.ios&&Je.webkit_version<604;function zn(t,e){let i,{state:n}=t,r=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(null!=Zn&&n.selection.ranges.every((t=>t.empty))&&Zn==s.toString()){let t=-1;i=n.changeByRange((i=>{let l=n.doc.lineAt(i.from);if(l.from==t)return{range:i};t=l.from;let h=n.toText((o?s.line(r++).text:e)+n.lineBreak);return{changes:{from:l.from,insert:h},range:q.cursor(i.from+h.length)}}))}else i=o?n.changeByRange((t=>{let e=s.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:q.cursor(t.from+e.length)}})):n.replaceSelection(s);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function _n(t,e,i,n){if(1==n)return q.cursor(e,i);if(2==n)return function(t,e,i=1){let n=t.charCategorizer(e),r=t.doc.lineAt(e),s=e-r.from;if(0==r.length)return q.cursor(e);0==s?i=1:s==r.length&&(i=-1);let o=s,l=s;i<0?o=A(r.text,s,!1):l=A(r.text,s);let h=n(r.text.slice(o,l));for(;o>0;){let t=A(r.text,o,!1);if(n(r.text.slice(t,o))!=h)break;o=t}for(;l{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},Hn.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now()),!1),Wn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Wn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Hn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of t.state.facet(Si))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=$n(t,e),n=Xn(e),r=t.state.selection;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),r=r.map(t.changes))},get(e,s,o){let l,h=$n(t,e),a=_n(t,h.pos,h.bias,n);if(i.pos!=h.pos&&!s){let e=_n(t,i.pos,i.bias,n),r=Math.min(e.from,a.from),s=Math.max(e.to,a.to);a=r1&&(l=function(t,e){for(let i=0;i=e)return q.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(r,h.pos))?l:o?r.addRange(a):q.create([a])}}}(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new Vn(t,e,i,n)),n&&t.observer.ignore((()=>Ce(t.contentDOM)));let r=t.inputState.mouseSelection;if(r)return r.start(e),!1===r.dragging}return!1};let qn=(t,e)=>t>=e.top&&t<=e.bottom,jn=(t,e,i)=>qn(e,i)&&t>=i.left&&t<=i.right;function Kn(t,e,i,n){let r=hi.find(t.docView,e);if(!r)return 1;let s=e-r.posAtStart;if(0==s)return 1;if(s==r.length)return-1;let o=r.coordsAt(s,-1);if(o&&jn(i,n,o))return-1;let l=r.coordsAt(s,1);return l&&jn(i,n,l)?1:o&&qn(n,o)?-1:1}function $n(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Kn(t,i,e.clientX,e.clientY)}}const Gn=Je.ie&&Je.ie_version<=11;let Un=null,Jn=0,Yn=0;function Xn(t){if(!Gn)return t.detail;let e=Un,i=Yn;return Un=t,Yn=Date.now(),Jn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Jn+1)%3:1}function Qn(t,e,i,n){if(!i)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=n&&s&&function(t,e){let i=t.state.facet(ki);return i.length?i[0](e):Je.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:s.from,to:s.to}:null,l={from:r,insert:i},h=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Hn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let n=t.docView.nearest(e.target);if(n&&n.isWidget){let t=n.posAtStart,e=t+n.length;(t>=i.to||e<=i.from)&&(i=q.range(t,e))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove"),!1},Hn.dragend=t=>(t.inputState.draggedContent=null,!1),Hn.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),r=0,s=()=>{++r==i.length&&Qn(t,e,n.filter((t=>null!=t)).join(t.state.lineBreak),!1)};for(let t=0;t{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(n[t]=e.result),s()},e.readAsText(i[t])}return!0}{let i=e.dataTransfer.getData("Text");if(i)return Qn(t,e,i,!0),!0}return!1},Hn.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=Fn?null:e.clipboardData;return i?(zn(t,i.getData("text/plain")||i.getData("text/uri-text")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout((()=>{t.focus(),i.remove(),zn(t,i.value)}),50)}(t),!1)};let Zn=null;Hn.copy=Hn.cut=(t,e)=>{let{text:i,ranges:n,linewise:r}=function(t){let e=[],i=[],n=!1;for(let n of t.selection.ranges)n.empty||(e.push(t.sliceDoc(n.from,n.to)),i.push(n));if(!e.length){let r=-1;for(let{from:n}of t.selection.ranges){let s=t.doc.lineAt(n);s.number>r&&(e.push(s.text),i.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),r=s.number}n=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:n}}(t.state);if(!i&&!r)return!1;Zn=r?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=Fn?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",i),!0):(function(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout((()=>{n.remove(),t.focus()}),50)}(t,i),!1)};const tr=yt.define();function er(t,e){let i=[];for(let n of t.facet(Oi)){let r=n(t,e);r&&i.push(r)}return i?t.update({effects:i,annotations:tr.of(!0)}):null}function ir(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=er(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Wn.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),ir(t)},Wn.blur=t=>{t.observer.clearSelectionRange(),ir(t)},Wn.compositionstart=Wn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Wn.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Je.chrome&&Je.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50)},Wn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Hn.beforeinput=(t,e)=>{var i;let n;if(Je.chrome&&Je.android&&(n=Bn.find((t=>t.inputType==e.inputType)))&&(t.observer.delayAndroidKey(n.key,n.keyCode),"Backspace"==n.key||"Delete"==n.key)){let e=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}return!1};const nr=new Set;const rr=["pre-wrap","normal","pre-line","break-spaces"];class sr{constructor(t){this.lineWrapping=t,this.doc=u.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return rr.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=r,l){this.heightSamples={};for(let t=0;t0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>ar&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return cr.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let r=this,s=i.doc;for(let o=n.length-1;o>=0;o--){let{fromA:l,toA:h,fromB:a,toB:c}=n[o],u=r.lineAt(l,hr.ByPosNoHeight,i.setDoc(e),0,0),f=u.to>=h?u:r.lineAt(h,hr.ByPosNoHeight,i,0,0);for(c+=f.to-h,h=f.to;o>0&&u.from<=n[o-1].toA;)l=n[o-1].fromA,a=n[o-1].fromB,o--,l2*r){let r=t[e-1];r.break?t.splice(--e,1,r.left,null,r.right):t.splice(--e,1,r.left,r.right),i+=1+r.break,n-=r.size}else{if(!(r>2*n))break;{let e=t[i];e.break?t.splice(i,1,e.left,null,e.right):t.splice(i,1,e.left,e.right),i+=2+e.break,r-=e.size}}else if(n=r&&s(this.blockAt(0,i,n,r))}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class fr extends ur{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,n){return new lr(n,this.length,i,this.height,this.breaks)}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof fr||n instanceof dr&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof dr?n=new fr(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):cr.of(i)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class dr extends cr{constructor(t){super(t,0)}heightMetrics(t,e){let i,n=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,s=r-n+1,o=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*s);i=e/s,this.length>s+1&&(o=(this.height-e)/(this.length-s-1))}else i=this.height/s;return{firstLine:n,lastLine:r,perLine:i,perChar:o}}blockAt(t,e,i,n){let{firstLine:r,lastLine:s,perLine:o,perChar:l}=this.heightMetrics(e,n);if(e.lineWrapping){let r=n+Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length),s=e.doc.lineAt(r),h=o+s.length*l,a=Math.max(i,t-h/2);return new lr(s.from,s.length,a,h,0)}{let n=Math.max(0,Math.min(s-r,Math.floor((t-i)/o))),{from:l,length:h}=e.doc.line(r+n);return new lr(l,h,i+o*n,o,0)}}lineAt(t,e,i,n,r){if(e==hr.ByHeight)return this.blockAt(t,i,n,r);if(e==hr.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new lr(e,n-e,0,0,0)}let{firstLine:s,perLine:o,perChar:l}=this.heightMetrics(i,r),h=i.doc.lineAt(t),a=o+h.length*l,c=h.number-s,u=n+o*c+l*(h.from-r-c);return new lr(h.from,h.length,Math.max(n,Math.min(u,n+this.height-a)),a,0)}forEachLine(t,e,i,n,r,s){t=Math.max(t,r),e=Math.min(e,r+this.length);let{firstLine:o,perLine:l,perChar:h}=this.heightMetrics(i,r);for(let a=t,c=n;a<=e;){let e=i.doc.lineAt(a);if(a==t){let i=e.number-o;c+=l*i+h*(t-r-i)}let n=l+h*e.length;s(new lr(e.from,e.length,c,n,0)),c+=n,a=e.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let t=i[i.length-1];t instanceof dr?i[i.length-1]=new dr(t.length+n):i.push(null,new dr(n-1))}if(t>0){let e=i[0];e instanceof dr?i[0]=new dr(t+e.length):i.unshift(new dr(t-1),null)}return cr.of(i)}decomposeLeft(t,e){e.push(new dr(t-1),null)}decomposeRight(t,e){e.push(null,new dr(this.length-t-1))}updateHeight(t,e=0,i=!1,n){let r=e+this.length;if(n&&n.from<=e+this.length&&n.more){let i=[],s=Math.max(e,n.from),o=-1;for(n.from>e&&i.push(new dr(n.from-e-1).updateHeight(t,e));s<=r&&n.more;){let e=t.doc.lineAt(s).length;i.length&&i.push(null);let r=n.heights[n.index++];-1==o?o=r:Math.abs(r-o)>=ar&&(o=-2);let l=new fr(e,r);l.outdated=!1,i.push(l),s+=e+1}s<=r&&i.push(null,new dr(r-s).updateHeight(t,s));let l=cr.of(i);return(o<0||Math.abs(l.height-this.height)>=ar||Math.abs(o-this.heightMetrics(t,e).perLine)>=ar)&&(t.heightChanged=!0),l}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class pr extends cr{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let r=i+this.left.height;return to))return h;let a=e==hr.ByPosNoHeight?hr.ByPosNoHeight:hr.ByPos;return l?h.join(this.right.lineAt(o,a,i,s,o)):this.left.lineAt(o,a,i,n,r).join(h)}forEachLine(t,e,i,n,r,s){let o=n+this.left.height,l=r+this.left.length+this.break;if(this.break)t=l&&this.right.forEachLine(t,e,i,o,l,s);else{let h=this.lineAt(l,hr.ByPos,i,n,r);t=t&&h.from<=e&&s(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,o,l,s)}}replace(t,e,i){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let r=[];t>0&&this.decomposeLeft(t,r);let s=r.length;for(let t of i)r.push(t);if(t>0&&gr(r,s-1),e=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?cr.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:r,right:s}=this,o=e+r.length+this.break,l=null;return n&&n.from<=e+r.length&&n.more?l=r=r.updateHeight(t,e,i,n):r.updateHeight(t,e,i),n&&n.from<=o+s.length&&n.more?l=s=s.updateHeight(t,o,i,n):s.updateHeight(t,o,i),l?this.balanced(r,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function gr(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof dr&&(n=t[e+1])instanceof dr&&t.splice(e-1,3,new dr(i.length+1+n.length))}class mr{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof fr?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new fr(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t=5)&&this.addLineDeco(n,r,s)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new fr(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new dr(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof fr)return t;let e=new fr(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof fr||this.isCovered?(this.writtenToi.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=n.overflow){let n=i.getBoundingClientRect();s=Math.max(s,n.left),o=Math.min(o,n.right),l=Math.max(l,n.top),h=e==t.parentNode?n.bottom:Math.min(h,n.bottom)}e="absolute"==n.position||"fixed"==n.position?i.offsetParent:i.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:s-i.left,right:Math.max(s,o)-i.left,top:l-(i.top+e),bottom:Math.max(l,h)-(i.top+e)}}function yr(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class br{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i"function"!=typeof t&&"cm-lineWrapping"==t.class));this.heightOracle=new sr(e),this.stateDeco=t.facet(Fi).filter((t=>"function"!=typeof t)),this.heightMap=cr.empty().applyChanges(this.stateDeco,u.empty,this.heightOracle.setDoc(t.doc),[new Gi(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=fi.set(this.lineGaps.map((t=>t.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some((({from:t,to:e})=>n>=t&&n<=e))){let{from:e,to:i}=this.lineBlockAt(n);t.push(new Sr(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?Or:new Dr(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(t=>{this.viewportLines.push(1==this.scaler.scale?t:Tr(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Fi).filter((t=>"function"!=typeof t));let n=t.changedRanges,r=Gi.extendWithRanges(n,function(t,e,i){let n=new vr;return Ft.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:N.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=s&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let h=!t.changes.empty||2&t.flags||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Ti)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),n=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?exports.Direction.RTL:exports.Direction.LTR;let s=this.heightOracle.mustRefreshForWrapping(r),o=e.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let h=0,a=0;if(o.width&&o.height){let{scaleX:t,scaleY:i}=ke(e,o);this.scaleX==t&&this.scaleY==i||(this.scaleX=t,this.scaleY=i,h|=8,s=l=!0)}let c=(parseInt(i.paddingTop)||0)*this.scaleY,f=(parseInt(i.paddingBottom)||0)*this.scaleY;this.paddingTop==c&&this.paddingBottom==f||(this.paddingTop=c,this.paddingBottom=f,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let d=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Ee(t.scrollDOM);let p=(this.printing?yr:wr)(e,this.paddingTop),g=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let w=o.width;if(this.contentDOMWidth==w&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=o.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),l){let e=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(e)&&(s=!0),s||n.lineWrapping&&Math.abs(w-this.contentDOMWidth)>n.charWidth){let{lineHeight:i,charWidth:o,textHeight:l}=t.docView.measureTextSize();s=i>0&&n.refresh(r,i,o,l,w/o,e),s&&(t.docView.minWidth=0,h|=8)}g>0&&m>0?a=Math.max(g,m):g<0&&m<0&&(a=Math.min(g,m)),n.heightChanged=!1;for(let i of this.viewports){let r=i.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(i);this.heightMap=(s?cr.empty().applyChanges(this.stateDeco,u.empty,this.heightOracle,[new Gi(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,s,new or(i.from,r))}n.heightChanged&&(h|=2)}let y=!this.viewportIsAppropriate(this.viewport,a)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(this.viewport=this.getViewport(a,this.scrollTarget)),this.updateForViewport(),(2&h||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,l=new Sr(n.lineAt(s-1e3*i,hr.ByHeight,r,0,0).from,n.lineAt(o+1e3*(1-i),hr.ByHeight,r,0,0).to);if(e){let{head:t}=e.range;if(tl.to){let i,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,hr.ByPos,r,0,0);i="center"==e.y?(o.top+o.bottom)/2-s/2:"start"==e.y||"nearest"==e.y&&t=o+Math.max(10,Math.min(i,250)))&&n>s-2e3&&r>1,s=n<<1;if(this.defaultTextDirection!=exports.Direction.LTR&&!i)return[];let o=[],l=(n,s,h,a)=>{if(s-nn&&tt.from>=h.from&&t.to<=h.to&&Math.abs(t.from-n)t.frome))));if(!f){if(st.from<=s&&t.to>=s))){let t=e.moveToLineBoundary(q.cursor(s),!1,!0).head;t>n&&(s=t)}f=new br(n,s,this.gapSize(h,n,s,a))}o.push(f)};for(let t of this.viewportLines){if(t.lengtht.from&&l(t.from,r,t,e),ot.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];Ft.spans(t,this.viewport.from,this.viewport.to,{span(t,i){e.push({from:t,to:i})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some(((t,i)=>t.from!=e[i].from||t.to!=e[i].to));return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((e=>e.from<=t&&e.to>=t))||Tr(this.heightMap.lineAt(t,hr.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Tr(this.heightMap.lineAt(this.scaler.fromDOM(t),hr.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Tr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Sr{constructor(t,e){this.from=t,this.to=e}}function Ar(t,e,i){let n=[],r=t,s=0;return Ft.spans(i,t,e,{span(){},point(t,e){t>r&&(n.push({from:r,to:t}),s+=t-r),r=e}},20),r=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let t=0;;t++){let{from:i,to:r}=e[t],s=r-i;if(n<=s)return i+n;n-=s}}function Cr(t,e){let i=0;for(let{from:n,to:r}of t.ranges){if(e<=r){i+=e-n;break}i+=r-n}return i/t.total}const Or={toDOM:t=>t,fromDOM:t=>t,scale:1};class Dr{constructor(t,e,i){let n=0,r=0,s=0;this.viewports=i.map((({from:i,to:r})=>{let s=e.lineAt(i,hr.ByPos,t,0,0).top,o=e.lineAt(r,hr.ByPos,t,0,0).bottom;return n+=o-s,{from:i,to:r,top:s,bottom:o,domTop:0,domBottom:0}})),this.scale=(7e6-n)/(e.height-n);for(let t of this.viewports)t.domTop=s+(t.top-r)*this.scale,s=t.domBottom=t.domTop+(t.bottom-t.top),r=t.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let r=eTr(t,e))):t._content)}const Er=$.define({combine:t=>t.join(" ")}),Rr=$.define({combine:t=>t.indexOf(!0)>-1}),Pr=ne.newName(),Br=ne.newName(),Lr=ne.newName(),Nr={"&light":"."+Br,"&dark":"."+Lr};function Ir(t,e,i){return new ne(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,(e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError(`Unsupported selector: ${e}`);return i[e]})):t+" "+e})}const Vr=Ir("."+Pr,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Nr),Hr="￿";class Wr{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(Lt.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Hr}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let t=this.text.length;this.readNode(n);let r=n.nextSibling;if(r==e)break;let s=Be.get(n),o=Be.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:zr(n))||zr(r)&&("BR"!=n.nodeName||n.cmIgnore)&&this.text.length>t)&&this.lineBreak(),n=r}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(r=n.exec(e))&&(s=r.index,o=r[0].length),this.append(e.slice(i,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=o-1);i=s+o}}readNode(t){if(t.cmIgnore)return;let e=Be.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let t=i.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(Fr(t,i.node,i.offset)?e:0))}}function Fr(t,e,i){for(;;){if(!e||i-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let e=r||s?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:s}=t.observer.selectionRange;i&&(e.push(new _r(i,n)),r==i&&s==n||e.push(new _r(r,s)));return e}(t),i=new Wr(e,t.state);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,n=2==t.length?t[1].pos:i;return i>-1&&n>-1?q.single(i+e,n+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=r&&r.node==e.focusNode&&r.offset==e.focusOffset||!de(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),n=s&&s.node==e.anchorNode&&s.offset==e.anchorOffset||!de(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=q.single(n,i)}}}function jr(t,e){let i,{newSel:n}=e,r=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:n,to:o}=e.bounds,l=r.from,h=null;(8===s||Je.android&&e.text.length0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if("end"==n){i-=o+Math.max(0,s-Math.min(o,l))-s}if(o=o?s-i:0,l=s+(l-o),o=s}else if(l=l?s-i:0,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}(t.state.doc.sliceString(n,o,Hr),e.text,l-n,h);a&&(Je.chrome&&13==s&&a.toB==a.from+2&&e.text.slice(a.from,a.toB)==Hr+Hr&&a.toB--,i={from:n+a.from,to:n+a.toA,insert:u.of(e.text.slice(a.from,a.toB).split(Hr))})}else n&&(!t.hasFocus&&t.state.facet(Bi)||n.main.eq(r))&&(n=null);if(!i&&!n)return!1;if(!i&&e.typeOver&&!r.empty&&n&&n.main.empty?i={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:i&&i.from>=r.from&&i.to<=r.to&&(i.from!=r.from||i.to!=r.to)&&r.to-r.from-(i.to-i.from)<=4?i={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,r.to))}:(Je.mac||Je.android)&&i&&i.from==i.to&&i.from==r.head-1&&/^\. ?$/.test(i.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(n&&2==i.insert.length&&(n=q.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:u.of([" "])}):Je.chrome&&i&&i.from==i.to&&i.from==r.head&&"\n "==i.insert.toString()&&t.lineWrapping&&(n&&(n=q.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:u.of([" "])}),i){if(Je.ios&&t.inputState.flushIOSKey())return!0;if(Je.android&&(i.from==r.from&&i.to==r.to&&1==i.insert.length&&2==i.insert.lines&&De(t.contentDOM,"Enter",13)||(i.from==r.from-1&&i.to==r.to&&0==i.insert.length||8==s&&i.insert.lengthr.head)&&De(t.contentDOM,"Backspace",8)||i.from==r.from&&i.to==r.to+1&&0==i.insert.length&&De(t.contentDOM,"Delete",46)))return!0;let e,o=i.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l=()=>e||(e=function(t,e,i){let n,r=t.state,s=r.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let i=s.frome.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(t.state.toText(i+e.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let o=r.changes(e),l=i&&i.main.to<=o.newLength?i.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let h,a=t.state.sliceDoc(e.from,e.to),c=i&&pn(t,i.main.head);if(c){let t=e.insert.length-(e.to-e.from);h={from:c.from,to:c.to-t}}else h=t.state.doc.lineAt(s.head);let u=s.to-e.to,f=s.to-s.from;n=r.changeByRange((i=>{if(i.from==s.from&&i.to==s.to)return{changes:o,range:l||i.map(o)};let n=i.to-u,c=n-a.length;if(i.to-i.from!=f||t.state.sliceDoc(c,n)!=a||i.to>=h.from&&i.from<=h.to)return{range:i};let d=r.changes({from:c,to:n,insert:e.insert}),p=i.to-s.to;return{changes:d,range:l?q.range(Math.max(0,l.anchor+p),Math.max(0,l.head+p)):i.map(d)}}))}else n={changes:o,selection:l&&r.selection.replaceRange(l)}}let o="input.type";(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1));return r.update(n,{userEvent:o,scrollIntoView:!0})}(t,i,n));return t.state.facet(Ci).some((e=>e(t,i.from,i.to,o,l)))||t.dispatch(l()),!0}if(n&&!n.main.eq(r)){let e=!1,i="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(e=!0),i=t.inputState.lastSelectionOrigin),t.dispatch({selection:n,scrollIntoView:e,userEvent:i}),!0}return!1}const Kr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},$r=Je.ie&&Je.ie_version<=11;class Gr{constructor(t){this.view=t,this.active=!1,this.selectionRange=new Se,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver((e=>{for(let t of e)this.queue.push(t);(Je.ie&&Je.ie_version<=11||Je.ios&&t.composing)&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),$r&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(((e,i)=>e!=t[i])))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(Bi)?i.root.activeElement!=this.dom:!pe(i.dom,n))return;let r=n.anchorNode&&i.docView.nearest(n.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Je.ie&&Je.ie_version<=11||Je.android&&Je.chrome)&&!i.state.selection.main.empty&&n.focusNode&&me(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Je.safari&&11==t.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){let e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;let n=e.startContainer,r=e.startOffset,s=e.endContainer,o=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);me(l.node,l.offset,s,o)&&([n,r,s,o]=[s,o,n,r]);return{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:o}}(this.view)||fe(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=pe(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;if(t){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&De(this.dom,t.key,t.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let r of t){let t=this.readMutation(r);t&&(t.typeOver&&(n=!0),-1==e?({from:e,to:i}=t):(e=Math.min(t.from,e),i=Math.max(t.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&pe(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new qr(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,n=jr(this.view,e);return this.view.state==i&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let i=Ur(e,t.previousSibling||t.target.previousSibling,-1),n=Ur(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Ur(t,e,i){for(;e;){let n=Be.get(e);if(n&&n.parent==t)return n;let r=e.parentNode;e=r!=t.dom?r:i>0?e.nextSibling:e.previousSibling}return null}class Jr{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(t=>t.forEach((t=>e(t,this))))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new kr(t.state||Lt.create(t)),t.scrollTo&&t.scrollTo.is(Ri)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ni).map((t=>new Vi(t)));for(let t of this.plugins)t.update(this);this.observer=new Gr(this),this.inputState=new En(this),this.inputState.ensureHandlers(this.plugins),this.docView=new fn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}dispatch(...t){let e=1==t.length&&t[0]instanceof St?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,i=!1,n=!1,r=this.state;for(let e of t){if(e.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=e.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,l=null;t.some((t=>t.annotation(tr)))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=er(r,s),l||(o=1));let h=this.observer.delayedAndroidKey,a=null;if(h?(this.observer.clearDelayedAndroidKey(),a=this.observer.readChange(),(a&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(a=null)):this.observer.clear(),r.facet(Lt.phrases)!=this.state.facet(Lt.phrases))return this.setState(r);e=Ui.create(this,r,t),e.flags|=o;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(c&&(c=c.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;c=new Ei(t.empty?t:q.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(Ri)&&(c=t.value.clip(this.state))}this.viewState.update(e,c),this.bidiCache=Qr.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet($i)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some((t=>t.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(e.startState.facet(Er)!=e.state.facet(Er)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(Mi))try{t(e)}catch(t){Pi(this.state,t,"update listener")}(l||a)&&Promise.resolve().then((()=>{l&&this.state==l.startState&&this.dispatch(l),a&&!jr(this,a)&&h.force&&De(this.contentDOM,h.key,h.keyCode)}))}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new kr(t),this.plugins=t.facet(Ni).map((t=>new Vi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new fn(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Ni),i=t.state.facet(Ni);if(e!=i){let n=[];for(let r of i){let i=e.indexOf(r);if(i<0)n.push(new Vi(r));else{let e=this.plugins[i];e.mustUpdate=t,n.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(s<0)if(Ee(i))r=-1,s=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(n);r=t.from,s=t.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&o||([this.measureRequests,l]=[l,this.measureRequests]);let h=l.map((t=>{try{return t.read(this)}catch(t){return Pi(this.state,t),Xr}})),a=Ui.create(this,this.state,[]),c=!1;a.flags|=o,e?e.flags|=o:e=a,this.updateState=2,a.empty||(this.updatePlugins(a),this.inputState.update(a),this.updateAttrs(),c=this.docView.update(a));for(let t=0;t1||t<-1){n+=t,i.scrollTop=n/this.scaleY,s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(Mi))t(e)}get themeClasses(){return Pr+" "+(this.state.facet(Rr)?Lr:Br)+" "+this.state.facet(Er)}updateAttrs(){let t=Zr(this,Hi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Bi)?"true":"false",class:"cm-content",style:`${Je.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Zr(this,Wi,e);let i=this.observer.ignore((()=>{let i=oi(this.contentDOM,this.contentAttrs,e),n=oi(this.dom,this.editorAttrs,t);return i||n}));return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let t of i.effects)if(t.is(Jr.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet($i);let t=this.state.facet(Jr.cspNonce);ne.mount(this.root,this.styleModules.concat(Vr).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;ee.spec==t))||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return Tn(this,t,On(this,t,e,i))}moveByGroup(t,e){return Tn(this,t,On(this,t,e,(e=>function(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return t=>{let e=n(t);return r==Et.Space&&(r=e),r==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let r=Cn(t,e.head),s=n&&r.type==ui.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(s){let e=t.dom.getBoundingClientRect(),n=t.textDirectionAt(r.from),o=t.posAtCoords({x:i==(n==exports.Direction.LTR)?e.right-1:e.left+1,y:(s.top+s.bottom)/2});if(null!=o)return q.cursor(o,i?-1:1)}return q.cursor(i?r.to:r.from,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return Tn(this,t,function(t,e,i,n){let r=e.head,s=i?1:-1;if(r==(i?t.state.doc.length:0))return q.cursor(r,e.assoc);let o,l=e.goalColumn,h=t.contentDOM.getBoundingClientRect(),a=t.coordsAtPos(r,e.assoc||-1),c=t.documentTop;if(a)null==l&&(l=a.left-h.left),o=s<0?a.top:a.bottom;else{let e=t.viewState.lineBlockAt(r);null==l&&(l=Math.min(h.right-h.left,t.defaultCharacterWidth*(r-e.from))),o=(s<0?e.top:e.bottom)+c}let u=h.left+l,f=null!=n?n:t.viewState.heightOracle.textHeight>>1;for(let e=0;;e+=10){let i=o+(f+e)*s,n=An(t,{x:u,y:i},!1,s);if(ih.bottom||(s<0?nr)){let e=t.docView.coordsForChar(n),r=!e||i0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(Di)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Yr)return an(t.length);let e,i=this.textDirectionAt(t.from);for(let n of this.bidiCache)if(n.from==t.from&&n.dir==i&&(n.fresh||sn(n.isolates,e=qi(this,t.from,t.to))))return n.order;e||(e=qi(this,t.from,t.to));let n=function(t,e,i){if(!t)return[new rn(0,0,e==Yi?1:0)];if(e==Ji&&!i.length&&!nn.test(t))return an(t.length);if(i.length)for(;t.length>on.length;)on[on.length]=256;let n=[],r=e==Ji?0:1;return hn(t,r,r,i,0,t.length,n),n}(t.text,i,e);return this.bidiCache.push(new Qr(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Je.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{Ce(this.contentDOM),this.docView.updateSelection()}))}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return Ri.of(new Ei("number"==typeof t?q.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return Ri.of(new Ei(q.cursor(i.from),"start","start",i.top-t,e,!0))}static domEventHandlers(t){return Ii.define((()=>({})),{eventHandlers:t})}static domEventObservers(t){return Ii.define((()=>({})),{eventObservers:t})}static theme(t,e){let i=ne.newName(),n=[Er.of(i),$i.of(Ir(`.${i}`,t))];return e&&e.dark&&n.push(Rr.of(!0)),n}static baseTheme(t){return st.lowest($i.of(Ir("."+Pr,t,Nr)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Be.get(i)||Be.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Jr.styleModule=$i,Jr.inputHandler=Ci,Jr.focusChangeEffect=Oi,Jr.perLineTextDirection=Di,Jr.exceptionSink=Ai,Jr.updateListener=Mi,Jr.editable=Bi,Jr.mouseSelectionStyle=Si,Jr.dragMovesSelection=ki,Jr.clickAddsSelectionRange=xi,Jr.decorations=Fi,Jr.atomicRanges=zi,Jr.bidiIsolatedRanges=_i,Jr.scrollMargins=ji,Jr.darkTheme=Rr,Jr.cspNonce=$.define({combine:t=>t.length?t[0]:""}),Jr.contentAttributes=Wi,Jr.editorAttributes=Hi,Jr.lineWrapping=Jr.contentAttributes.of({class:"cm-lineWrapping"}),Jr.announce=kt.define();const Yr=4096,Xr={};class Qr{constructor(t,e,i,n,r,s){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=r,this.order=s}static update(t,e){if(e.empty&&!t.some((t=>t.fresh)))return t;let i=[],n=t.length?t[t.length-1].dir:exports.Direction.LTR;for(let r=Math.max(0,t.length-10);r=0;r--){let e=n[r],s="function"==typeof e?e(t):e;s&&ni(s,i)}return i}const ts=Je.mac?"mac":Je.windows?"win":Je.linux?"linux":"key";function es(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}const is=st.default(Jr.domEventHandlers({keydown:(t,e)=>hs(ss(e.state),t,e,"editor")})),ns=$.define({enables:is}),rs=new WeakMap;function ss(t){let e=t.facet(ns),i=rs.get(e);return i||rs.set(e,i=function(t,e=ts){let i=Object.create(null),n=Object.create(null),r=(t,e)=>{let i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},s=(t,n,s,o,l)=>{var h,a;let c=i[t]||(i[t]=Object.create(null)),u=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,r,s,o,l=i[i.length-1];"Space"==l&&(l=" ");for(let t=0;t{let n=os={view:e,prefix:i,scope:t};return setTimeout((()=>{os==n&&(os=null)}),ls),!0}]})}let f=u.join(" ");r(f,!1);let d=c[f]||(c[f]={preventDefault:!1,stopPropagation:!1,run:(null===(a=null===(h=c._any)||void 0===h?void 0:h.run)||void 0===a?void 0:a.slice())||[]});s&&d.run.push(s),o&&(d.preventDefault=!0),l&&(d.stopPropagation=!0)};for(let n of t){let t=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let e in t)t[e].run.push(n.any)}let r=n[e]||n.key;if(r)for(let e of t)s(e,r,n.run,n.preventDefault,n.stopPropagation),n.shift&&s(e,"Shift-"+r,n.shift,n.preventDefault,n.stopPropagation)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let os=null;const ls=4e3;function hs(t,e,i,n){let r=function(t){var e=!(he&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ae&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?le:oe)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),s=R(T(r,0))==r.length&&" "!=r,o="",l=!1,h=!1,a=!1;os&&os.view==i&&os.scope==n&&(o=os.prefix+" ",Nn.indexOf(e.keyCode)<0&&(h=!0,os=null));let c,u,f=new Set,d=t=>{if(t){for(let n of t.run)if(!f.has(n)&&(f.add(n),n(i,e)))return t.stopPropagation&&(a=!0),!0;t.preventDefault&&(t.stopPropagation&&(a=!0),h=!0)}return!1},p=t[n];return p&&(d(p[o+es(r,e,!s)])?l=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Je.windows&&e.ctrlKey&&e.altKey)&&(c=oe[e.keyCode])&&c!=r?(d(p[o+es(c,e,!0)])||e.shiftKey&&(u=le[e.keyCode])!=r&&u!=c&&d(p[o+es(u,e,!1)]))&&(l=!0):s&&e.shiftKey&&d(p[o+es(r,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),h&&(l=!0),l&&a&&e.stopPropagation(),l}class as{constructor(t,e,i,n,r){this.className=t,this.left=e,this.top=i,this.width=n,this.height=r}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let r=cs(t);return[new as(e,n.left-r.left,n.top-r.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),s=t.textDirection==exports.Direction.LTR,o=t.contentDOM,l=o.getBoundingClientRect(),h=cs(t),a=o.querySelector(".cm-line"),c=a&&window.getComputedStyle(a),u=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=l.right-(c?parseInt(c.paddingRight):0),d=Cn(t,n),p=Cn(t,r),g=d.type==ui.Text?d:null,m=p.type==ui.Text?p:null;g&&(t.lineWrapping||d.widgetLineBreaks)&&(g=us(t,n,g));m&&(t.lineWrapping||p.widgetLineBreaks)&&(m=us(t,r,m));if(g&&m&&g.from==m.from)return w(y(i.from,i.to,g));{let e=g?y(i.from,null,g):b(d,!1),n=m?y(null,i.to,m):b(p,!0),r=[];return(g||d).to<(m||p).from-(g&&m?1:0)||d.widgetLineBreaks>1&&e.bottom+t.defaultLineHeight/2a&&n.from=s)break;l>r&&h(Math.max(t,r),null==e&&t<=a,Math.min(l,s),null==i&&l>=c,o.dir)}if(r=n.to+1,r>=s)break}return 0==l.length&&h(a,null==e,c,null==i,t.textDirection),{top:r,bottom:o,horizontal:l}}function b(t,e){let i=l.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function cs(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==exports.Direction.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function us(t,e,i){let n=q.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ui.Text}}class fs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(ds)!=t.state.facet(ds)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}setOrder(t){let e=0,i=t.facet(ds);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const ds=$.define();function ps(t){return[Ii.define((e=>new fs(e,t))),ds.of(t)]}const gs=!Je.ios,ms=$.define({combine:t=>Nt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function vs(t){return t.startState.facet(ms)!=t.state.facet(ms)}const ws=ps({above:!0,markers(t){let{state:e}=t,i=e.facet(ms),n=[];for(let r of e.selection.ranges){let s=r==e.selection.main;if(r.empty?!s||gs:i.drawRangeCursor){let e=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=r.empty?r:q.cursor(r.head,r.head>r.anchor?-1:1);for(let r of as.forRange(t,e,i))n.push(r)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=vs(t);return i&&ys(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){ys(e.state,t)},class:"cm-cursorLayer"});function ys(t,e){e.style.animationDuration=t.facet(ms).cursorBlinkRate+"ms"}const bs=ps({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:as.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||vs(t),class:"cm-selectionLayer"}),xs={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};gs&&(xs[".cm-line"].caretColor="transparent !important",xs[".cm-content"]={caretColor:"transparent !important"});const ks=st.highest(Jr.theme(xs));function Ss(t,e,i,n,r){e.lastIndex=0;for(let s,o=t.iterRange(i,n),l=i;!o.next().done;l+=o.value.length)if(!o.lineBreak)for(;s=e.exec(o.value);)r(l+s.index,s)}class As{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:r,maxLength:s=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,r)=>n(r,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,r)=>{let s=i(t,e,n);s&&r(n,n+t[0].length,s)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,r)=>r(n,n+t[0].length,i)}this.boundary=r,this.maxLength=s}createDeco(t){let e=new zt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:r,to:s}of i)r=Math.max(t.state.doc.lineAt(r).from,r-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=r?n[n.length-1].to=s:n.push({from:r,to:s});return n}(t,this.maxLength))Ss(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,r,s,o)=>{o>t.view.viewport.from&&s1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let r of t.visibleRanges){let s=Math.max(r.from,i),o=Math.min(r.to,n);if(o>s){let i=t.state.doc.lineAt(s),n=i.toi.from;s--)if(this.boundary.test(i.text[s-1-i.from])){l=s;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=l-i.from;(a=this.regexp.exec(i.text))&&a.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:l,filterTo:h,filter:(t,e)=>th,add:c})}}return e}}const Ms=null!=/x/.unicode?"gu":"g",Cs=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Ms),Os={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ds=null;const Ts=$.define({combine(t){let e=Nt(t,{render:null,specialChars:Cs,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==Ds&&"undefined"!=typeof document&&document.body){let e=document.body.style;Ds=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return Ds||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Ms)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Ms)),e}});let Es=null;class Rs extends ci{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(Os[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Ps extends ci{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}const Bs=2e3;function Ls(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),r=i-n.from,s=r>Bs?-1:r==n.length?function(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}(t,e.clientX):Qt(n.text,t.state.tabSize,i-n.from);return{line:n.number,col:s,off:r}}function Ns(t,e){let i=Ls(t,e),n=t.state.selection;return i?{update(t){if(t.docChanged){let e=t.changes.mapPos(t.startState.doc.line(i.line).from),r=t.state.doc.lineAt(e);i={line:r.number,col:i.col,off:Math.min(i.off,r.length)},n=n.map(t.changes)}},get(e,r,s){let o=Ls(t,e);if(!o)return n;let l=function(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),s=[];if(e.off>Bs||i.off>Bs||e.col<0||i.col<0){let o=Math.min(e.off,i.off),l=Math.max(e.off,i.off);for(let e=n;e<=r;e++){let i=t.doc.line(e);i.length<=l&&s.push(q.range(i.from+o,i.to+l))}}else{let o=Math.min(e.col,i.col),l=Math.max(e.col,i.col);for(let e=n;e<=r;e++){let i=t.doc.line(e),n=Zt(i.text,o,t.tabSize,!0);if(n<0)s.push(q.cursor(i.to));else{let e=Zt(i.text,l,t.tabSize);s.push(q.range(i.from+n,i.from+e))}}}return s}(t.state,i,o);return l.length?s?q.create(l.concat(n.ranges)):q.create(l):n}}:null}const Is={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},Vs={style:"cursor: crosshair"};const Hs="-10000px";class Ws{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t,e){var i;let n=t.state.facet(this.facet),r=n.filter((t=>t));if(n===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[],o=e?[]:null;for(let i=0;ie[i]=t)),e.length=o.length),this.input=n,this.tooltips=r,this.tooltipViews=s,!0}}function Fs(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const zs=$.define({combine:t=>{var e,i,n;return{position:Je.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Fs}}}),_s=new WeakMap,qs=Ii.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(zs);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Ws(t,$s,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(zs);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Hs,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);this.parent&&this.container.remove(),null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,i=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:t}=this.manager.tooltipViews[0];if(Je.gecko)n=t.offsetParent!=this.container.ownerDocument.body;else if(1!=this.view.scaleX||1!=this.view.scaleY)n=!0;else if(t.style.top==Hs&&"0px"==t.style.left){let e=t.getBoundingClientRect();n=Math.abs(e.top+1e4)>1||Math.abs(e.left)>1}}if(n||"absolute"==this.position)if(this.parent){let t=this.parent.getBoundingClientRect();t.width&&t.height&&(e=t.width/this.parent.offsetWidth,i=t.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:i}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(zs).tooltipSpace(this.view),scaleX:e,scaleY:i,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let t of this.manager.tooltipViews)t.dom.style.position="absolute"}let{editor:i,space:n,scaleX:r,scaleY:s}=t,o=[];for(let l=0;l=Math.min(i.bottom,n.bottom)||u.rightMath.min(i.right,n.right)+.1){c.style.top=Hs;continue}let d=h.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,g=f.right-f.left,m=null!==(e=_s.get(a))&&void 0!==e?e:f.bottom-f.top,v=a.offset||Ks,w=this.view.textDirection==exports.Direction.LTR,y=f.width>n.right-n.left?w?n.left:n.right-f.width:w?Math.min(u.left-(d?14:0)+v.x,n.right-g):Math.max(n.left,u.left-g+(d?14:0)-v.x),b=this.above[l];!h.strictSide&&(b?u.top-(f.bottom-f.top)-v.yn.bottom)&&b==n.bottom-u.bottom>u.top-n.top&&(b=this.above[l]=!b);let x=(b?u.top-n.top:n.bottom-u.bottom)-p;if(xy&&t.topk&&(k=b?t.top-m-2-p:t.bottom+p+2);if("absolute"==this.position?(c.style.top=(k-t.parent.top)/s+"px",c.style.left=(y-t.parent.left)/r+"px"):(c.style.top=k/s+"px",c.style.left=y/r+"px"),d){let t=u.left+(w?v.x:-v.x)-(y+14-7);d.style.left=t/r+"px"}!0!==a.overlap&&o.push({left:y,top:k,right:S,bottom:k+m}),c.classList.toggle("cm-tooltip-above",b),c.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Hs}},{eventObservers:{scroll(){this.maybeMeasure()}}}),js=Jr.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ks={x:0,y:0},$s=$.define({enables:[qs,js]}),Gs=$.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});function Us(t,e){let i=t.plugin(Js),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Js=Ii.fromClass(class{constructor(t){this.input=t.state.facet(Qs),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Gs);this.top=new Ys(t,!0,e.topContainer),this.bottom=new Ys(t,!1,e.bottomContainer),this.top.sync(this.panels.filter((t=>t.top))),this.bottom.sync(this.panels.filter((t=>!t.top)));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(Gs);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ys(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ys(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Qs);if(i!=this.input){let e=i.filter((t=>t)),n=[],r=[],s=[],o=[];for(let i of e){let e,l=this.specs.indexOf(i);l<0?(e=i(t.view),o.push(e)):(e=this.panels[l],e.update&&e.update(t)),n.push(e),(e.top?r:s).push(e)}this.specs=e,this.panels=n,this.top.sync(r),this.bottom.sync(s);for(let t of o)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Jr.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Ys{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Xs(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Xs(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function Xs(t){let e=t.nextSibling;return t.remove(),e}const Qs=$.define({enables:Js});class Zs extends It{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Zs.prototype.elementClass="",Zs.prototype.toDOM=void 0,Zs.prototype.mapMode=B.TrackBefore,Zs.prototype.startSide=Zs.prototype.endSide=-1,Zs.prototype.point=!0;const to=$.define(),eo=$.define(),io=$.define({combine:t=>t.some((t=>t))});function no(t){let e=[ro];return t&&!1===t.fixed&&e.push(io.of(!0)),e}const ro=Ii.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(eo).map((e=>new ho(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(io),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(io)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let i=Ft.iter(this.view.state.facet(to),this.view.viewport.from),n=[],r=this.gutters.map((t=>new lo(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(t.type)){let e=!0;for(let s of t.type)if(s.type==ui.Text&&e){oo(i,n,s.from);for(let t of r)t.line(this.view,s,n);e=!1}else if(s.widget)for(let t of r)t.widget(this.view,s)}else if(t.type==ui.Text){oo(i,n,t.from);for(let e of r)e.line(this.view,t,n)}else if(t.widget)for(let e of r)e.widget(this.view,t);for(let t of r)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(eo),i=t.state.facet(eo),n=t.docChanged||t.heightChanged||t.viewportChanged||!Ft.eq(t.startState.facet(to),t.state.facet(to),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let e of this.gutters)e.update(t)&&(n=!0);else{n=!0;let r=[];for(let n of i){let i=e.indexOf(n);i<0?r.push(new ho(this.view,n)):(this.gutters[i].update(t),r.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove(),r.indexOf(t)<0&&t.destroy();for(let t of r)this.dom.appendChild(t.dom);this.gutters=r}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>Jr.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==exports.Direction.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null}))});function so(t){return Array.isArray(t)?t:[t]}function oo(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class lo{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=Ft.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:n}=this,r=(e.top-this.height)/t.scaleY,s=e.height/t.scaleY;if(this.i==n.elements.length){let e=new ao(t,s,r,i);n.elements.push(e),n.dom.appendChild(e.dom)}else n.elements[this.i].update(t,s,r,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];oo(this.cursor,n,e.from),i.length&&(n=n.concat(i));let r=this.gutter.config.lineMarker(t,e,n);r&&n.unshift(r);let s=this.gutter;(0!=n.length||s.config.renderEmptyElements)&&this.addElement(t,e,n)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class ho{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,(n=>{let r,s=n.target;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let t=s.getBoundingClientRect();r=(t.top+t.bottom)/2}else r=n.clientY;let o=t.lineBlockAtHeight(r-t.documentTop);e.domEventHandlers[i](t,o,n)&&n.preventDefault()}));this.markers=so(e.markers(t)),e.initialSpacer&&(this.spacer=new ao(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=so(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let i=t.view.viewport;return!Ft.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class ao{constructor(t,e,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,n)}update(t,e,i,n){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;iNt(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let t in e){let n=i[t],r=e[t];i[t]=n?(t,e,i)=>n(t,e,i)||r(t,e,i):r}return i}})});class fo extends Zs{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function po(t,e){return t.state.facet(uo).formatNumber(e,t.state)}const go=eo.compute([uo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(co),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new fo(po(t,t.state.doc.lineAt(e.from).number)),widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(uo)!=t.state.facet(uo),initialSpacer:t=>new fo(po(t,mo(t.state.doc.lines))),updateSpacer(t,e){let i=po(e.view,mo(e.view.state.doc.lines));return i==t.number?t:new fo(i)},domEventHandlers:t.facet(uo).domEventHandlers})));function mo(t){let e=9;for(;e{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=So.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}bo.closedBy=new bo({deserialize:t=>t.split(" ")}),bo.openedBy=new bo({deserialize:t=>t.split(" ")}),bo.group=new bo({deserialize:t=>t.split(" ")}),bo.isolate=new bo({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),bo.contextHash=new bo({perNode:!0}),bo.lookAhead=new bo({perNode:!0}),bo.mounted=new bo({perNode:!0});class xo{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[bo.mounted.id]}}const ko=Object.create(null);class So{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):ko,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new So(t.name||"",e,t.id,i);if(t.props)for(let i of t.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[i[0].id]=i[1]}return n}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(bo.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(bo.group),n=-1;n<(i?i.length:0);n++){let r=e[n<0?t.name:i[n]];if(r)return r}}}}So.none=new So("",Object.create(null),0,8);class Ao{constructor(t){this.types=t;for(let e=0;e=e){let o=new Lo(s.tree,s.overlay[0].from+t.from,-1,t);(r||(r=[n])).push(Po(o,e,i,!1))}}return r?Wo(r):n}(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:r=this.length}=t,s=t.mode||0,o=(s&Oo.IncludeAnonymous)>0;for(let t=this.cursor(s|Oo.IncludeAnonymous);;){let s=!1;if(t.from<=r&&t.to>=n&&(!o&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;s=!0}for(;s&&i&&(o||!t.type.isAnonymous)&&i(t),!t.nextSibling();){if(!t.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ko(So.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new Do(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new Do(So.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:r=vo,reused:s=[],minRepeatType:o=n.types.length}=t,l=Array.isArray(i)?new To(i,i.length):i,h=n.types,a=0,c=0;function u(t,e,i,w,y,b){let{id:x,start:k,end:S,size:A}=l,M=c;for(;A<0;){if(l.next(),-1==A){let e=s[x];return i.push(e),void w.push(k-t)}if(-3==A)return void(a=x);if(-4==A)return void(c=x);throw new RangeError(`Unrecognized record size: ${A}`)}let C,O,D=h[x],T=k-t;if(S-k<=r&&(O=m(l.pos-e,y))){let e=new Uint16Array(O.size-O.skip),i=l.pos-O.size,r=e.length;for(;l.pos>i;)r=v(O.start,e,r);C=new Eo(e,S-O.start,n),T=O.start-t}else{let t=l.pos-A;l.next();let e=[],i=[],n=x>=o?x:-1,s=0,h=S;for(;l.pos>t;)n>=0&&l.id==n&&l.size>=0?(l.end<=h-r&&(p(e,i,k,s,l.end,h,n,M),s=e.length,h=l.end),l.next()):b>2500?f(k,t,e,i):u(k,t,e,i,n,b+1);if(n>=0&&s>0&&s-1&&s>0){let t=d(D);C=Ko(D,e,i,0,e.length,0,S-k,t,t)}else C=g(D,e,i,S-k,M-S)}i.push(C),w.push(T)}function f(t,e,i,s){let o=[],h=0,a=-1;for(;l.pos>e;){let{id:t,start:e,end:i,size:n}=l;if(n>4)l.next();else{if(a>-1&&e=0;t-=3)e[i++]=o[t],e[i++]=o[t+1]-r,e[i++]=o[t+2]-r,e[i++]=i;i.push(new Eo(e,o[2]-r,n)),s.push(r-t)}}function d(t){return(e,i,n)=>{let r,s,o=0,l=e.length-1;if(l>=0&&(r=e[l])instanceof Do){if(!l&&r.type==t&&r.length==n)return r;(s=r.prop(bo.lookAhead))&&(o=i[l]+r.length+s)}return g(t,e,i,n,o)}}function p(t,e,i,r,s,o,l,h){let a=[],c=[];for(;t.length>r;)a.push(t.pop()),c.push(e.pop()+i-s);t.push(g(n.types[l],a,c,o-s,h-o)),e.push(s-i)}function g(t,e,i,n,r=0,s){if(a){let t=[bo.contextHash,a];s=s?[t].concat(s):[t]}if(r>25){let t=[bo.lookAhead,r];s=s?[t].concat(s):[t]}return new Do(t,e,i,n,s)}function m(t,e){let i=l.fork(),n=0,s=0,h=0,a=i.end-r,c={size:0,start:0,skip:0};t:for(let r=i.pos-t;i.pos>r;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=s,c.skip=h,h+=4,n+=4,i.next();continue}let l=i.pos-t;if(t<0||l=o?4:0,f=i.start;for(i.next();i.pos>l;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}s=f,n+=t,h+=u}return(e<0||n==t)&&(c.size=n,c.start=s,c.skip=h),c.size>4?c:void 0}function v(t,e,i){let{id:n,start:r,end:s,size:h}=l;if(l.next(),h>=0&&n4){let n=l.pos-(h-4);for(;l.pos>n;)i=v(t,e,i)}e[--i]=o,e[--i]=s-t,e[--i]=r-t,e[--i]=n}else-3==h?a=n:-4==h&&(c=n);return i}let w=[],y=[];for(;l.pos>0;)u(t.start||0,t.bufferStart||0,w,y,-1,0);let b=null!==(e=t.length)&&void 0!==e?e:w.length?y[0]+w[0].length:0;return new Do(h[t.topID],w.reverse(),y.reverse(),b)}(t)}}Do.empty=new Do(So.none,[],[],0);class To{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new To(this.buffer,this.index)}}class Eo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return So.none}toString(){let t=[];for(let e=0;e0));l=s[l+3]);return o}slice(t,e,i){let n=this.buffer,r=new Uint16Array(e-t),s=0;for(let o=t,l=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function Po(t,e,i,n){for(var r;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to0?o.length:-1;t!=h;t+=e){let h=o[t],a=l[t]+s.from;if(Ro(n,i,a,a+h.length))if(h instanceof Eo){if(r&Oo.ExcludeBuffers)continue;let o=h.findChild(0,h.buffer.length,e,i-a,n);if(o>-1)return new Ho(new Vo(s,h,t,a),null,o)}else if(r&Oo.IncludeAnonymous||!h.type.isAnonymous||_o(h)){let o;if(!(r&Oo.IgnoreMounts)&&(o=xo.get(h))&&!o.overlay)return new Lo(o.tree,a,t,s);let l=new Lo(h,a,t,s);return r&Oo.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?h.children.length-1:0,e,i,n)}}if(r&Oo.IncludeAnonymous||!s.type.isAnonymous)return null;if(t=s.index>=0?s.index+e:e<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,i=0){let n;if(!(i&Oo.IgnoreOverlays)&&(n=xo.get(this._tree))&&n.overlay){let i=t-this.from;for(let{from:t,to:r}of n.overlay)if((e>0?t<=i:t=i:r>i))return new Lo(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function No(t,e,i,n){let r=t.cursor(),s=[];if(!r.firstChild())return s;if(null!=i)for(;!r.type.is(i);)if(!r.nextSibling())return s;for(;;){if(null!=n&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return null==n?s:[]}}function Io(t,e,i=e.length-1){for(let n=t.parent;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class Vo{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Ho extends Bo{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new Ho(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,i=0){if(i&Oo.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new Ho(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Ho(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Ho(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let s=i.buffer[this.index+1];t.push(i.slice(n,r,s)),e.push(0)}return new Do(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Wo(t){if(!t.length)return null;let e=0,i=t[0];for(let n=1;ni.from||r.to0){if(this.index-1)for(let n=e+t,r=t<0?-1:i._tree.children.length;n!=r;n+=t){let t=i._tree.children[n];if(this.mode&Oo.IncludeAnonymous||t instanceof Eo||!t.type.isAnonymous||_o(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let s=t;s;s=s._parent)if(s.index==n){if(n==this.index)return s;e=s,i=r+1;break t}n=this.stack[--r]}for(let t=i;t=0;r--){if(r<0)return Io(this.node,t,n);let s=i[e.buffer[this.stack[r]]];if(!s.isAnonymous){if(t[n]&&t[n]!=s.name)return!1;n--}}return!0}}function _o(t){return t.children.some((t=>t instanceof Eo||!t.type.isAnonymous||_o(t)))}const qo=new WeakMap;function jo(t,e){if(!t.isAnonymous||e instanceof Eo||e.type!=t)return 1;let i=qo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof Do)){i=1;break}i+=jo(t,n)}qo.set(e,i)}return i}function Ko(t,e,i,n,r,s,o,l,h){let a=0;for(let i=n;i=c)break;p+=e}if(a==r+1){if(p>c){let t=i[r];e(t.children,t.positions,0,t.children.length,n[r]+l);continue}u.push(i[r])}else{let e=n[a-1]+i[a-1].length-d;u.push(Ko(t,i,n,r,a,d,e,null,h))}f.push(d+l-s)}}(e,i,n,r,0),(l||h)(u,f,o)}class $o{constructor(t,e,i,n,r=!1,s=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(r?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],i=!1){let n=[new $o(0,t.length,t,0,!1,i)];for(let i of e)i.to>t.length&&n.push(i);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],r=1,s=t.length?t[0]:null;for(let o=0,l=0,h=0;;o++){let a=o=i)for(;s&&s.from=e.from||c<=e.to||h){let t=Math.max(e.from,l)-h,i=Math.min(e.to,c)-h;e=t>=i?null:new $o(t,i,e.tree,e.offset+h,o>0,!!a)}if(e&&n.push(e),s.to>c)break;s=rnew yo(t.from,t.to))):[new yo(0,0)]:[new yo(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let t=n.advance();if(t)return t}}}class Uo{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new bo({perNode:!0});let Jo=0;class Yo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Jo++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Yo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new Qo;return e=>e.modified.indexOf(t)>-1?e:Qo.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Xo=0;class Qo{constructor(){this.instances=[],this.id=Xo++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find((i=>{return i.base==t&&(n=e,r=i.modified,n.length==r.length&&n.every(((t,e)=>t==r[e])));var n,r}));if(i)return i;let n=[],r=new Yo(n,t,e);for(let t of e)t.instances.push(r);let s=function(t){let e=[[]];for(let i=0;ie.length-t.length))}(e);for(let e of t.set)if(!e.modified.length)for(let t of s)n.push(Qo.get(e,t));return r}}function Zo(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],r=2,s=t;for(let e=0;;){if("..."==s&&e>0&&e+3==t.length){r=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);s=t.slice(e)}let o=i.length-1,l=i[o];if(!l)throw new RangeError("Invalid path: "+t);let h=new el(n,r,o>0?i.slice(0,o):null);e[l]=h.sort(e[l])}}return tl.add(e)}const tl=new bo;class el{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth{let e=r;for(let n of t)for(let t of n.set){let n=i[t.id];if(n){e=e?e+" "+n:n;break}}return e},scope:n}}function nl(t,e,i,n=0,r=t.length){let s=new rl(n,Array.isArray(e)?e:[e],i);s.highlightRange(t.cursor(),n,r,"",s.highlighters),s.flush(r)}el.empty=new el([],2,null);class rl{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,r){let{type:s,from:o,to:l}=t;if(o>=i||l<=e)return;s.isTop&&(r=this.highlighters.filter((t=>!t.scope||t.scope(s))));let h=n,a=function(t){let e=t.type.prop(tl);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||el.empty,c=function(t,e){let i=null;for(let n of t){let t=n.style(e);t&&(i=i?i+" "+t:t)}return i}(r,a.tags);if(c&&(h&&(h+=" "),h+=c,1==a.mode&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(e,o),h),a.opaque)return;let u=t.tree&&t.tree.prop(bo.mounted);if(u&&u.overlay){let s=t.node.enter(u.overlay[0].from+o,1),a=this.highlighters.filter((t=>!t.scope||t.scope(u.tree.type))),c=t.firstChild();for(let f=0,d=o;;f++){let p=f=g)&&t.nextSibling()););if(!p||g>i)break;d=p.to+o,d>e&&(this.highlightRange(s.cursor(),Math.max(e,p.from+o),Math.min(i,d),"",a),this.startSpan(Math.min(i,d),h))}c&&t.parent()}else if(t.firstChild()){u&&(n="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,r),this.startSpan(Math.min(i,t.to),h)}}while(t.nextSibling());t.parent()}}}const sl=Yo.define,ol=sl(),ll=sl(),hl=sl(ll),al=sl(ll),cl=sl(),ul=sl(cl),fl=sl(cl),dl=sl(),pl=sl(dl),gl=sl(),ml=sl(),vl=sl(),wl=sl(vl),yl=sl(),bl={comment:ol,lineComment:sl(ol),blockComment:sl(ol),docComment:sl(ol),name:ll,variableName:sl(ll),typeName:hl,tagName:sl(hl),propertyName:al,attributeName:sl(al),className:sl(ll),labelName:sl(ll),namespace:sl(ll),macroName:sl(ll),literal:cl,string:ul,docString:sl(ul),character:sl(ul),attributeValue:sl(ul),number:fl,integer:sl(fl),float:sl(fl),bool:sl(cl),regexp:sl(cl),escape:sl(cl),color:sl(cl),url:sl(cl),keyword:gl,self:sl(gl),null:sl(gl),atom:sl(gl),unit:sl(gl),modifier:sl(gl),operatorKeyword:sl(gl),controlKeyword:sl(gl),definitionKeyword:sl(gl),moduleKeyword:sl(gl),operator:ml,derefOperator:sl(ml),arithmeticOperator:sl(ml),logicOperator:sl(ml),bitwiseOperator:sl(ml),compareOperator:sl(ml),updateOperator:sl(ml),definitionOperator:sl(ml),typeOperator:sl(ml),controlOperator:sl(ml),punctuation:vl,separator:sl(vl),bracket:wl,angleBracket:sl(wl),squareBracket:sl(wl),paren:sl(wl),brace:sl(wl),content:dl,heading:pl,heading1:sl(pl),heading2:sl(pl),heading3:sl(pl),heading4:sl(pl),heading5:sl(pl),heading6:sl(pl),contentSeparator:sl(dl),list:sl(dl),quote:sl(dl),emphasis:sl(dl),strong:sl(dl),link:sl(dl),monospace:sl(dl),strikethrough:sl(dl),inserted:sl(),deleted:sl(),changed:sl(),invalid:sl(),meta:yl,documentMeta:sl(yl),annotation:sl(yl),processingInstruction:sl(yl),definition:Yo.defineModifier(),constant:Yo.defineModifier(),function:Yo.defineModifier(),standard:Yo.defineModifier(),local:Yo.defineModifier(),special:Yo.defineModifier()};var xl;il([{tag:bl.link,class:"tok-link"},{tag:bl.heading,class:"tok-heading"},{tag:bl.emphasis,class:"tok-emphasis"},{tag:bl.strong,class:"tok-strong"},{tag:bl.keyword,class:"tok-keyword"},{tag:bl.atom,class:"tok-atom"},{tag:bl.bool,class:"tok-bool"},{tag:bl.url,class:"tok-url"},{tag:bl.labelName,class:"tok-labelName"},{tag:bl.inserted,class:"tok-inserted"},{tag:bl.deleted,class:"tok-deleted"},{tag:bl.literal,class:"tok-literal"},{tag:bl.string,class:"tok-string"},{tag:bl.number,class:"tok-number"},{tag:[bl.regexp,bl.escape,bl.special(bl.string)],class:"tok-string2"},{tag:bl.variableName,class:"tok-variableName"},{tag:bl.local(bl.variableName),class:"tok-variableName tok-local"},{tag:bl.definition(bl.variableName),class:"tok-variableName tok-definition"},{tag:bl.special(bl.variableName),class:"tok-variableName2"},{tag:bl.definition(bl.propertyName),class:"tok-propertyName tok-definition"},{tag:bl.typeName,class:"tok-typeName"},{tag:bl.namespace,class:"tok-namespace"},{tag:bl.className,class:"tok-className"},{tag:bl.macroName,class:"tok-macroName"},{tag:bl.propertyName,class:"tok-propertyName"},{tag:bl.operator,class:"tok-operator"},{tag:bl.comment,class:"tok-comment"},{tag:bl.meta,class:"tok-meta"},{tag:bl.invalid,class:"tok-invalid"},{tag:bl.punctuation,class:"tok-punctuation"}]);const kl=new bo;const Sl=new bo;class Al{constructor(t,e,i=[],n=""){this.data=t,this.name=n,Lt.prototype.hasOwnProperty("tree")||Object.defineProperty(Lt.prototype,"tree",{get(){return Cl(this)}}),this.parser=e,this.extension=[Nl.of(this),Lt.languageData.of(((t,e,i)=>{let n=Ml(t,e,i),r=n.type.prop(kl);if(!r)return[];let s=t.facet(r),o=n.type.prop(Sl);if(o){let r=n.resolve(e-n.from,i);for(let e of o)if(e.test(r,t)){let i=t.facet(e.facet);return"replace"==e.type?i:i.concat(s)}}return s}))].concat(i)}isActiveAt(t,e,i=-1){return Ml(t,e,i).type.prop(kl)==this.data}findRegions(t){let e=t.facet(Nl);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(t,e)=>{if(t.prop(kl)==this.data)return void i.push({from:e,to:e+t.length});let r=t.prop(bo.mounted);if(r){if(r.tree.prop(kl)==this.data){if(r.overlay)for(let t of r.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(r.overlay){let t=i.length;if(n(r.tree,r.overlay[0].from+e),i.length>t)return}}for(let i=0;i=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Dl=null;class Tl{constructor(t,e,i=[],n,r,s,o,l){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=r,this.viewport=s,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Tl(t,e,[],Do.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Ol(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=Do.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var i;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext((()=>{for(;!(e=this.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped($o.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Dl;Dl=this;try{return t()}finally{Dl=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=El(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges(((t,i,n,r)=>e.push({fromA:t,toA:i,fromB:n,toB:r}))),i=$o.applyChanges(i,e),n=Do.empty,r=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){o=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);it.from&&(this.fragments=El(this.fragments,i,n),this.skipped.splice(e--,1))}return!(this.skipped.length>=e)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Go{createParse(e,i,n){let r=n[0].from,s=n[n.length-1].to;return{parsedPos:r,advance(){let e=Dl;if(e){for(let t of n)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=s,new Do(So.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return Dl}}function El(t,e,i){return $o.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Rl{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new Rl(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Tl.create(t.facet(Nl).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Rl(i)}}Al.state=Z.define({create:Rl.init,update(t,e){for(let t of e.effects)if(t.is(Al.setState))return t.value;return e.startState.facet(Nl)!=e.state.facet(Nl)?Rl.init(e.state):t.apply(e)}});let Pl=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Pl=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Bl="undefined"!=typeof navigator&&(null===(xl=navigator.scheduling)||void 0===xl?void 0:xl.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ll=Ii.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Al.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Al.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Pl(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,l=r.context.work((()=>Bl&&Bl()||Date.now()>s),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Al.setState.of(new Rl(r.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Pi(this.view.state,t))).then((()=>this.workScheduled--)),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Nl=$.define({combine:t=>t.length?t[0]:null,enables:t=>[Al.state,Ll,Jr.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});const Il=$.define(),Vl=$.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some((t=>t!=e[0])))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Hl(t){let e=t.facet(Vl);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Wl(t,e){let i="",n=t.tabSize,r=t.facet(Vl)[0];if("\t"==r){for(;e>=n;)i+="\t",e-=n;r=" "}for(let t=0;t=e?function(t,e,i){let n=e.resolveStack(i),r=n.node.enterUnfinishedNodesBefore(i);if(r!=n.node){let t=[];for(let e=r;e!=n.node;e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return ql(n,t,i)}(t,i,e):null}class zl{constructor(t,e={}){this.state=t,this.options=e,this.unit=Hl(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:r}=this.options;return null!=n&&n>=i.from&&n<=i.to?r&&n==t?{text:"",from:t}:(e<0?n-1&&(r+=s-this.countColumn(i,i.search(/\S|$/))),r}countColumn(t,e=t.length){return Qt(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),r=this.options.overrideIndentation;if(r){let t=r(n);if(t>-1)return t}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const _l=new bo;function ql(t,e,i){for(let n=t;n;n=n.next){let t=jl(n.node);if(t)return t($l.create(e,i,n))}return 0}function jl(t){let e=t.type.prop(_l);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(bo.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>function(t,e,i,n,r){let s=t.textAfter,o=s.match(/^\s*/)[0].length,l=n&&s.slice(o,o+n.length)==n||r==t.pos+o,h=e?function(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let r=t.options.simulateBreak,s=t.state.doc.lineAt(i.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let t=i.to;;){let r=e.childAfter(t);if(!r||r==n)return null;if(!r.type.isSkipped)return r.from=n?void 0:{from:i,to:n}}const Jl=kt.define({map:Ul}),Yl=kt.define({map:Ul}),Xl=Z.define({create:()=>fi.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)if(i.is(Jl)&&!Ql(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(th),r=n?fi.replace({widget:new nh(n(e.state,i.value))}):ih;t=t.update({add:[r.range(i.value.from,i.value.to)]})}else i.is(Yl)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Jr.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{t==e&&r==i&&(n=!0)})),n}const Zl={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},th=$.define({combine:t=>Nt(t,Zl)});function eh(t,e){let{state:i}=t,n=i.facet(th),r=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=function(t,e,i){var n;let r=null;return null===(n=t.field(Xl,!1))||void 0===n||n.between(e,i,((t,e)=>{(!r||r.from>t)&&(r={from:t,to:e})})),r}(t.state,i.from,i.to);n&&t.dispatch({effects:Yl.of(n)}),e.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,r,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",i.phrase("folded code")),s.title=i.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const ih=fi.replace({widget:new class extends ci{toDOM(t){return eh(t,null)}}});class nh extends ci{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return eh(t,this.value)}}const rh=Jr.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class sh{constructor(t,e){let i;function n(t){let e=ne.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const r="string"==typeof e.all?e.all:e.all?n(e.all):void 0,s=e.scope;this.scope=s instanceof Al?t=>t.prop(kl)==s.data:s?t=>t==s:void 0,this.style=il(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:r}).style,this.module=i?new ne(i):null,this.themeType=e.themeType}static define(t,e){return new sh(t,e||{})}}const oh=$.define(),lh=$.define({combine:t=>t.length?[t[0]]:null});function hh(t){let e=t.facet(oh);return e.length?e:t.facet(lh)}class ah{constructor(t){this.markCache=Object.create(null),this.tree=Cl(t.state),this.decorations=this.buildDeco(t,hh(t.state))}update(t){let e=Cl(t.state),i=hh(t.state),n=i!=hh(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=fi.mark({class:n})))}),n,r);return i.finish()}}const ch=st.high(Ii.fromClass(ah,{decorations:t=>t.decorations})),uh=Jr.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),fh=1e4,dh="()[]{}",ph=$.define({combine:t=>Nt(t,{afterCursor:!0,brackets:dh,maxScanDistance:fh,renderMatch:vh})}),gh=fi.mark({class:"cm-matchingBracket"}),mh=fi.mark({class:"cm-nonmatchingBracket"});function vh(t){let e=[],i=t.matched?gh:mh;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}const wh=Z.define({create:()=>fi.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(ph);for(let t of e.state.selection.ranges){if(!t.empty)continue;let r=Sh(e.state,t.head,-1,n)||t.head>0&&Sh(e.state,t.head-1,1,n)||n.afterCursor&&(Sh(e.state,t.head,1,n)||t.headJr.decorations.from(t)}),yh=[wh,uh];const bh=new bo;function xh(t,e,i){let n=t.prop(e<0?bo.openedBy:bo.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function kh(t){let e=t.type.prop(bh);return e?e(t.node):t}function Sh(t,e,i,n={}){let r=n.maxScanDistance||fh,s=n.brackets||dh,o=Cl(t),l=o.resolveInner(e,i);for(let n=l;n;n=n.parent){let r=xh(n.type,i,s);if(r&&n.from0?e>=o.from&&eo.from&&e<=o.to))return Ah(t,e,i,n,o,r,s)}}return function(t,e,i,n,r,s,o){let l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),h=o.indexOf(l);if(h<0||h%2==0!=i>0)return null;let a={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let t=0;!c.next().done&&t<=s;){let s=c.value;i<0&&(t+=s.length);let l=e+t*i;for(let t=i>0?0:s.length-1,e=i>0?s.length:-1;t!=e;t+=i){let e=o.indexOf(s[t]);if(!(e<0||n.resolveInner(l+t,1).type!=r))if(e%2==0==i>0)u++;else{if(1==u)return{start:a,end:{from:l+t,to:l+t+1},matched:e>>1==h>>1};u--}}i>0&&(t+=s.length)}return c.done?{start:a,matched:!1}:null}(t,e,i,o,l.type,r,s)}function Ah(t,e,i,n,r,s,o){let l=n.parent,h={from:r.from,to:r.to},a=0,c=null==l?void 0:l.cursor();if(c&&(i<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(i<0?c.to<=n.from:c.from>=n.to){if(0==a&&s.indexOf(c.type.name)>-1&&c.from=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pose}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosi?t.toLowerCase():t;return n(this.string.substr(this.pos,t.length))==n(t)?(!1!==e&&(this.pos+=t.length),!0):null}{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function Oh(t){if("object"!=typeof t)return t;let e={};for(let i in t){let n=t[i];e[i]=n instanceof Array?n.slice():n}return e}const Dh=new WeakMap;class Th extends Al{constructor(t){let e=(i=t.languageData,$.define({combine:i?t=>t.concat(i):void 0}));var i;let n,r={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||Oh,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||Lh};var s;super(e,new class extends Go{createParse(t,e,i){return new Ph(n,t,e,i)}},[Il.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=So.define({id:Nh.length,name:"Document",props:[kl.add((()=>t))],top:!0});return Nh.push(e),e}(e),n=this,this.streamParser=r,this.stateAfter=new bo({perNode:!0}),this.tokenTable=t.tokenTable?new Fh(r.tokenTable):zh}static define(t){return new Th(t)}getIndent(t,e){let i,n=Cl(t.state),r=n.resolve(e);for(;r&&r.type!=this.topNode;)r=r.parent;if(!r)return null;let{overrideIndentation:s}=t.options;s&&(i=Dh.get(t.state),null!=i&&i1e4)return null;for(;o=n&&i+e.length<=r&&e.prop(t.stateAfter);if(s)return{state:t.streamParser.copyState(s),pos:i+e.length};for(let s=e.children.length-1;s>=0;s--){let o=e.children[s],l=i+e.positions[s],h=o instanceof Do&&l=e.length)return e;r||e.type!=t.topNode||(r=!0);for(let s=e.children.length-1;s>=0;s--){let o,l=e.positions[s],h=e.children[s];if(li&&Eh(t,n.tree,0-n.offset,i,s);if(o&&(e=Rh(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?Hl(n):4),tree:Do.empty}}(t,i,s,null==r?void 0:r.state);this.state=o,this.parsedPos=this.chunkStart=s+l.length;for(let t=0;t=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let e=this.input.chunk(t);if(this.input.lineChunks)"\n"==e&&(e="");else{let t=e.indexOf("\n");t>-1&&(e=e.slice(0,t))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let t=this.rangeIndex;;){let n=this.ranges[t].to;if(n>=i)break;if(e=e.slice(0,n-(i-e.length)),t++,t==this.ranges.length)break;let r=this.ranges[t].from,s=this.lineAfter(r);e+=s,i=r+s.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let n=this.ranges[this.rangeIndex].to,r=t+e;if(i>0?n>r:n>=r)break;e+=this.ranges[++this.rangeIndex].from-n}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){e+=r=this.skipGapsTo(e,r,1);let t=this.chunk.length;i+=r=this.skipGapsTo(i,r,-1),n+=this.chunk.length-t}return this.chunk.push(t,e,i,n),r}parseLine(t){let{line:e,end:i}=this.nextLine(),n=0,{streamParser:r}=this.lang,s=new Ch(e,t?t.state.tabSize:4,t?Hl(t.state):2);if(s.eol())r.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let t=Bh(r.token,s,this.state);if(t&&(n=this.emitToken(this.lang.tokenTable.resolve(t),this.parsedPos+s.start,this.parsedPos+s.pos,4,n)),s.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return n}throw new Error("Stream parser failed to advance stream.")}const Lh=Object.create(null),Nh=[So.none],Ih=new Ao(Nh),Vh=[],Hh=Object.create(null),Wh=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Wh[t]=qh(Lh,e);class Fh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),Wh)}resolve(t){return t?this.table[t]||(this.table[t]=qh(this.extra,t)):0}}const zh=new Fh(Lh);function _h(t,e){Vh.indexOf(t)>-1||(Vh.push(t),console.warn(e))}function qh(t,e){let i=[];for(let n of e.split(" ")){let e=[];for(let i of n.split(".")){let n=t[i]||bl[i];n?"function"==typeof n?e.length?e=e.map(n):_h(i,`Modifier ${i} used at start of tag`):e.length?_h(i,`Tag ${i} used as modifier`):e=Array.isArray(n)?n:[n]:_h(i,`Unknown highlighting tag ${i}`)}for(let t of e)i.push(t)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map((t=>t.id)),s=Hh[r];if(s)return s.id;let o=Hh[r]=So.define({id:Nh.length,name:n,props:[Zo({[n]:i})]});return Nh.push(o),o.id}function jh(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return!!r&&(n(i.update(r)),!0)}}const Kh=jh(Xh,0),$h=jh(Yh,0),Gh=jh(((t,e)=>Yh(t,e,function(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to),s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}(e))),0);function Uh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const Jh=50;function Yh(t,e,i=e.selection.ranges){let n=i.map((t=>Uh(e,t.from).block));if(!n.every((t=>t)))return null;let r=i.map(((t,i)=>function(t,{open:e,close:i},n,r){let s,o,l=t.sliceDoc(n-Jh,n),h=t.sliceDoc(r,r+Jh),a=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(h)[0].length,u=l.length-a;if(l.slice(u-e.length,u)==e&&h.slice(c,c+i.length)==i)return{open:{pos:n-a,margin:a&&1},close:{pos:r+c,margin:c&&1}};r-n<=2*Jh?s=o=t.sliceDoc(n,r):(s=t.sliceDoc(n,n+Jh),o=t.sliceDoc(r-Jh,r));let f=/^\s*/.exec(s)[0].length,d=/\s*$/.exec(o)[0].length,p=o.length-d-i.length;return s.slice(f,f+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+f+e.length,margin:/\s/.test(s.charAt(f+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(e,n[i],t.from,t.to)));if(2!=t&&!r.every((t=>t)))return{changes:e.changes(i.map(((t,e)=>r[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}])))};if(1!=t&&r.some((t=>t))){let t=[];for(let e,i=0;ir&&(t==s||s>h.from)){r=h.from;let t=/^\s*/.exec(h.text)[0].length,e=t==h.length,i=h.text.slice(t,t+l.length)==l?t:-1;tt.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:e,token:i,indent:r,empty:s,single:o}of n)!o&&s||t.push({from:e.from+r,insert:i+" "});let i=e.changes(t);return{changes:i,selection:e.selection.map(i,1)}}if(1!=t&&n.some((t=>t.comment>=0))){let t=[];for(let{line:e,comment:i,token:r}of n)if(i>=0){let n=e.from+i,s=n+r.length;" "==e.text[s-e.from]&&s++,t.push({from:n,to:s})}return{changes:t}}return null}const Qh=yt.define(),Zh=yt.define(),ta=$.define(),ea=$.define({combine:t=>Nt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(i,n)=>t(i,n)||e(i,n)})});const ia=Z.define({create:()=>wa.empty,update(t,e){let i=e.state.facet(ea),n=e.annotation(Qh);if(n){let r=e.docChanged?q.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,s=ha.fromTransaction(e,r),o=n.side,l=0==o?t.undone:t.done;return l=s?aa(l,l.length,i.minDepth,s):da(l,e.startState.selection),new wa(0==o?n.rest:l,0==o?l:n.rest)}let r=e.annotation(Zh);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(St.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let s=ha.fromTransaction(e),o=e.annotation(St.time),l=e.annotation(St.userEvent);return s?t=t.addChanges(s,o,l,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,i.newGroupDelay)),"full"!=r&&"after"!=r||(t=t.isolate()),t},toJSON:t=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new wa(t.done.map(ha.fromJSON),t.undone.map(ha.fromJSON))});function na(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(ia,!1);if(!r)return!1;let s=r.pop(t,i,e);return!!s&&(n(s),!0)}}const ra=na(0,!1),sa=na(1,!1),oa=na(0,!0),la=na(1,!0);class ha{constructor(t,e,i,n,r){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=r}setSelAfter(t){return new ha(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map((t=>t.toJSON()))}}static fromJSON(t){return new ha(t.changes&&N.fromJSON(t.changes),[],t.mapped&&L.fromJSON(t.mapped),t.startSelection&&q.fromJSON(t.startSelection),t.selectionsAfter.map(q.fromJSON))}static fromTransaction(t,e){let i=ua;for(let e of t.startState.facet(ta)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new ha(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,ua)}static selection(t){return new ha(void 0,ua,void 0,void 0,t)}}function aa(t,e,i,n){let r=e+1>i+20?e-i-1:0,s=t.slice(r,e);return s.push(n),s}function ca(t,e){return t.length?e.length?t.concat(e):t:e}const ua=[],fa=200;function da(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-fa));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),aa(t,t.length-1,1e9,i.setSelAfter(n)))}return[ha.selection([e])]}function pa(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function ga(t,e){if(!t.length)return t;let i=t.length,n=ua;for(;i;){let r=ma(t[i-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let e=t.slice(0,i);return e[i-1]=r,e}e=r.mapped,i--,n=r.selectionsAfter}return n.length?[ha.selection(n)]:ua}function ma(t,e,i){let n=ca(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):ua,i);if(!t.changes)return ha.selection(n);let r=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new ha(r,kt.mapEffects(t.effects,e),o,t.startSelection.map(s),n)}const va=/^(input\.type|delete)($|\.)/;class wa{constructor(t,e,i=0,n=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new wa(this.done,this.undone):this}addChanges(t,e,i,n,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&t.changes&&(!i||va.test(i))&&(!o.selectionsAfter.length&&e-this.prevTimei.push(t,e))),e.iterChangedRanges(((t,e,r,s)=>{for(let t=0;t=e&&r<=o&&(n=!0)}})),n}(o.changes,t.changes))||"input.type.compose"==i)?aa(s,s.length-1,n.minDepth,new ha(t.changes.compose(o.changes),ca(t.effects,o.effects),o.mapped,o.startSelection,ua)):aa(s,s.length,n.minDepth,t),new wa(s,ua,e,i)}addSelection(t,e,i,n){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:ua;return r.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new wa(da(this.done,t),this.undone,e,i);var s,o}addMapping(t){return new wa(ga(this.done,t),ga(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=0==t?this.done:this.undone;if(0==n.length)return null;let r=n[n.length-1];if(i&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Qh.of({side:t,rest:pa(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let i=1==n.length?ua:n.slice(0,n.length-1);return r.mapped&&(i=ga(i,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Qh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}wa.empty=new wa(ua,ua);const ya=[{key:"Mod-z",run:ra,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:sa,preventDefault:!0},{linux:"Ctrl-Shift-z",run:sa,preventDefault:!0},{key:"Mod-u",run:oa,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:la,preventDefault:!0}];function ba(t,e){return q.create(t.ranges.map(e),t.mainIndex)}function xa(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ka({state:t,dispatch:e},i){let n=ba(t.selection,i);return!n.eq(t.selection)&&(e(xa(t,n)),!0)}function Sa(t,e){return q.cursor(e?t.to:t.from)}function Aa(t,e){return ka(t,(i=>i.empty?t.moveByChar(i,e):Sa(i,e)))}function Ma(t){return t.textDirectionAt(t.state.selection.main.head)==exports.Direction.LTR}const Ca=t=>Aa(t,!Ma(t)),Oa=t=>Aa(t,Ma(t));function Da(t,e){return ka(t,(i=>i.empty?t.moveByGroup(i,e):Sa(i,e)))}function Ta(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ea(t,e,i){let n,r,s=Cl(t).resolveInner(e.head),o=i?bo.closedBy:bo.openedBy;for(let n=e.head;;){let e=i?s.childAfter(n):s.childBefore(n);if(!e)break;Ta(t,e,o)?s=e:n=i?e.to:e.from}return r=s.type.prop(o)&&(n=i?Sh(t,s.from,1):Sh(t,s.to,-1))&&n.matched?i?n.end.to:n.end.from:i?s.to:s.from,q.cursor(r,i?-1:1)}function Ra(t,e){return ka(t,(i=>{if(!i.empty)return Sa(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Pa=t=>Ra(t,!1),Ba=t=>Ra(t,!0);function La(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Sa(i,e)));if(s.eq(r.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),l=o.top+n.marginTop,h=o.bottom-n.marginBottom;e&&e.top>l&&e.bottomNa(t,!1),Va=t=>Na(t,!0);function Ha(t,e,i){let n=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?n.to:n.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(r=q.cursor(n.from+i))}return r}function Wa(t,e){let i=ba(t.state.selection,(t=>{let i=e(t);return q.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(xa(t.state,i)),!0)}function Fa(t,e){return Wa(t,(i=>t.moveByChar(i,e)))}const za=t=>Fa(t,!Ma(t)),_a=t=>Fa(t,Ma(t));function qa(t,e){return Wa(t,(i=>t.moveByGroup(i,e)))}function ja(t,e){return Wa(t,(i=>t.moveVertically(i,e)))}const Ka=t=>ja(t,!1),$a=t=>ja(t,!0);function Ga(t,e){return Wa(t,(i=>t.moveVertically(i,e,La(t).height)))}const Ua=t=>Ga(t,!1),Ja=t=>Ga(t,!0),Ya=({state:t,dispatch:e})=>(e(xa(t,{anchor:0})),!0),Xa=({state:t,dispatch:e})=>(e(xa(t,{anchor:t.doc.length})),!0),Qa=({state:t,dispatch:e})=>(e(xa(t,{anchor:t.selection.main.anchor,head:0})),!0),Za=({state:t,dispatch:e})=>(e(xa(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function tc(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,r=n.changeByRange((n=>{let{from:r,to:s}=n;if(r==s){let n=e(r);nr&&(i="delete.forward",n=ec(t,n,!0)),r=Math.min(r,n),s=Math.max(s,n)}else r=ec(t,r,!1),s=ec(t,s,!0);return r==s?{range:n}:{changes:{from:r,to:s},range:q.cursor(r)}}));return!r.changes.empty&&(t.dispatch(n.update(r,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Jr.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function ec(t,e,i){if(t instanceof Jr)for(let n of t.state.facet(Jr.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const ic=(t,e)=>tc(t,(i=>{let n,r,{state:s}=t,o=s.doc.lineAt(i);if(!e&&i>o.from&&iic(t,!1),rc=t=>ic(t,!0),sc=(t,e)=>tc(t,(i=>{let n=i,{state:r}=t,s=r.doc.lineAt(n),o=r.charCategorizer(n);for(let t=null;;){if(n==(e?s.to:s.from)){n==i&&s.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let l=A(s.text,n-s.from,e)+s.from,h=s.text.slice(Math.min(n,l)-s.from,Math.max(n,l)-s.from),a=o(h);if(null!=t&&a!=t)break;" "==h&&n==i||(t=a),n=l}return n})),oc=t=>sc(t,!1),lc=t=>tc(t,(e=>{let i=t.lineBlockAt(e).to;return e=r.number){let t=e[e.length-1];t.to=s.to,t.ranges.push(n)}else e.push({from:r.from,to:s.to,ranges:[n]});i=s.number+1}return e}function ac(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let e of hc(t)){if(i?e.to==t.doc.length:0==e.from)continue;let s=t.doc.lineAt(i?e.to+1:e.from-1),o=s.length+1;if(i){n.push({from:e.to,to:s.to},{from:e.from,insert:s.text+t.lineBreak});for(let i of e.ranges)r.push(q.range(Math.min(t.doc.length,i.anchor+o),Math.min(t.doc.length,i.head+o)))}else{n.push({from:s.from,to:e.from},{from:e.to,insert:t.lineBreak+s.text});for(let t of e.ranges)r.push(q.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:q.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function cc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of hc(t))i?n.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):n.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const uc=fc(!1);function fc(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange((i=>{let{from:n,to:r}=i,s=e.doc.lineAt(n),o=!t&&n==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Cl(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e);return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(bo.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}(e,n);t&&(n=r=(r<=s.to?s:e.doc.lineAt(r)).to);let l=new zl(e,{simulateBreak:n,simulateDoubleBreak:!!o}),h=Fl(l,n);for(null==h&&(h=Qt(/^\s*/.exec(e.doc.lineAt(n).text)[0],e.tabSize));rs.from&&n{let r=[];for(let s=n.from;s<=n.to;){let o=t.doc.lineAt(s);o.number>i&&(n.empty||n.to>o.from)&&(e(o,r,n),i=o.number),s=o.to+1}let s=t.changes(r);return{changes:r,range:q.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}}))}const pc=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>ka(t,(e=>Ea(t.state,e,!Ma(t)))),shift:t=>Wa(t,(e=>Ea(t.state,e,!Ma(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>ka(t,(e=>Ea(t.state,e,Ma(t)))),shift:t=>Wa(t,(e=>Ea(t.state,e,Ma(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>ac(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>cc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>ac(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>cc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=q.create([i.main]):i.main.empty||(n=q.create([q.cursor(i.main.head)])),!!n&&(e(xa(t,n)),!0)}},{key:"Mod-Enter",run:fc(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=hc(t).map((({from:e,to:i})=>q.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:q.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=ba(t.selection,(e=>{var i;let n=Cl(t).resolveInner(e.head,1);for(;!(n.from=e.to||n.to>e.to&&n.from<=e.from)&&(null===(i=n.parent)||void 0===i?void 0:i.parent);)n=n.parent;return q.range(n.to,n.from)}));return e(xa(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(dc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let r=Qt(n,t.tabSize),s=0,o=Wl(t,Math.max(0,r-Hl(t)));for(;s!t.readOnly&&(e(t.update(dc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(Vl)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new zl(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),r=dc(t,((e,r,s)=>{let o=Fl(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let l=/^\s*/.exec(e.text)[0],h=Wl(t,o);(l!=h||s.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(hc(e).map((({from:t,to:i})=>(t>0?t--:it.moveVertically(e,!0))).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>function(t,e,i){let n=!1,r=ba(t.selection,(e=>{let r=Sh(t,e.head,-1)||Sh(t,e.head,1)||e.head>0&&Sh(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Uh(t.state,i.from);return n.line?Kh(t):!!n.block&&Gh(t)}},{key:"Alt-A",run:$h}].concat([{key:"ArrowLeft",run:Ca,shift:za,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Da(t,!Ma(t)),shift:t=>qa(t,!Ma(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>ka(t,(e=>Ha(t,e,!Ma(t)))),shift:t=>Wa(t,(e=>Ha(t,e,!Ma(t)))),preventDefault:!0},{key:"ArrowRight",run:Oa,shift:_a,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Da(t,Ma(t)),shift:t=>qa(t,Ma(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>ka(t,(e=>Ha(t,e,Ma(t)))),shift:t=>Wa(t,(e=>Ha(t,e,Ma(t)))),preventDefault:!0},{key:"ArrowUp",run:Pa,shift:Ka,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ya,shift:Qa},{mac:"Ctrl-ArrowUp",run:Ia,shift:Ua},{key:"ArrowDown",run:Ba,shift:$a,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Xa,shift:Za},{mac:"Ctrl-ArrowDown",run:Va,shift:Ja},{key:"PageUp",run:Ia,shift:Ua},{key:"PageDown",run:Va,shift:Ja},{key:"Home",run:t=>ka(t,(e=>Ha(t,e,!1))),shift:t=>Wa(t,(e=>Ha(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:Ya,shift:Qa},{key:"End",run:t=>ka(t,(e=>Ha(t,e,!0))),shift:t=>Wa(t,(e=>Ha(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:Xa,shift:Za},{key:"Enter",run:uc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:nc,shift:nc},{key:"Delete",run:rc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:oc},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>sc(t,!0)},{mac:"Mod-Backspace",run:t=>tc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:lc}].concat([{key:"Ctrl-b",run:Ca,shift:za,preventDefault:!0},{key:"Ctrl-f",run:Oa,shift:_a},{key:"Ctrl-p",run:Pa,shift:Ka},{key:"Ctrl-n",run:Ba,shift:$a},{key:"Ctrl-a",run:t=>ka(t,(e=>q.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>Wa(t,(e=>q.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>ka(t,(e=>q.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>Wa(t,(e=>q.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:rc},{key:"Ctrl-h",run:nc},{key:"Ctrl-k",run:lc},{key:"Ctrl-Alt-h",run:oc},{key:"Ctrl-o",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:u.of(["",""])},range:q.cursor(t.from)})));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let i=e.from,n=t.doc.lineAt(i),r=i==n.from?i-1:A(n.text,i-n.from,!1)+n.from,s=i==n.to?i+1:A(n.text,i-n.from,!0)+n.from;return{changes:{from:r,to:s,insert:t.doc.slice(i,s).append(t.doc.slice(r,i))},range:q.cursor(s)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Va}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function gc(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];"string"==typeof r?t.setAttribute(n,r):null!=r&&(t[n]=r)}e++}for(;et.normalize("NFKD"):t=>t;class wc{constructor(t,e,i=0,n=t.length,r,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,n),this.bufferStart=i,this.normalize=r?t=>r(vc(t)):vc,this.query=this.normalize(e)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return T(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=E(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=R(t);let n=this.normalize(e);for(let t=0,r=i;;t++){let s=n.charCodeAt(t),o=this.match(s,r);if(t==n.length-1){if(o)return this.value=o,this;break}r==i&&tthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let i=this.curLineStart+e.index,n=i+e[0].length;if(this.matchPos=Mc(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,n,e)))return this.value={from:i,to:n,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=i||n.to<=e){let n=new Sc(e,t.sliceString(e,i));return kc.set(t,n),n}if(n.from==e&&n.to==i)return n;let{text:r,from:s}=n;return s>e&&(r=t.sliceString(e,s)+r,s=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let t=this.flat.from+e.index,i=t+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,i,e)))return this.value={from:t,to:i,match:e},this.matchPos=Mc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Sc.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Mc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Cc(t){let e=gc("input",{class:"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function i(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;let{state:n}=t,r=n.doc.lineAt(n.selection.main.head),[,s,o,l,h]=i,a=l?+l.slice(1):0,c=o?+o:r.number;if(o&&h){let t=c/100;s&&(t=t*("-"==s?-1:1)+r.number/n.doc.lines),c=Math.round(n.doc.lines*t)}else o&&s&&(c=c*("-"==s?-1:1)+r.number);let u=n.doc.line(Math.max(1,Math.min(n.doc.lines,c))),f=q.cursor(u.from+Math.max(0,Math.min(a,u.length)));t.dispatch({effects:[Oc.of(!1),Jr.scrollIntoView(f.from,{y:"center"})],selection:f}),t.focus()}return{dom:gc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Oc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},gc("label",t.state.phrase("Go to line"),": ",e)," ",gc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(xc.prototype[Symbol.iterator]=Ac.prototype[Symbol.iterator]=function(){return this});const Oc=kt.define(),Dc=Z.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Oc)&&(t=i.value);return t},provide:t=>Qs.from(t,(t=>t?Cc:null))}),Tc=Jr.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}});const Ec=$.define({combine:t=>Nt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new su(t),scrollToMatch:t=>Jr.scrollIntoView(t)})});class Rc{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,bc),!0}catch(t){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,((t,e)=>"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"))}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new Hc(this):new Lc(this)}getCursor(t,e=0,i){let n=t.doc?t:Lt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?Nc(this,n,e,i):Bc(this,n,e,i)}}class Pc{constructor(t){this.spec=t}}function Bc(t,e,i,n){return new wc(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:t=>t.toLowerCase(),t.wholeWord?function(t,e){return(i,n,r,s)=>((s>i||s+r.length=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let r=Bc(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}function Nc(t,e,i,n){return new xc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(r(Ic(i.input,i.index))!=Et.Word||r(Vc(i.input,i.index))!=Et.Word)&&(r(Vc(i.input,i.index+i[0].length))!=Et.Word||r(Ic(i.input,i.index+i[0].length))!=Et.Word)):void 0},i,n);var r}function Ic(t,e){return t.slice(A(t,e,!1),e)}function Vc(t,e){return t.slice(e,A(t,e))}class Hc extends Pc{nextMatch(t,e,i){let n=Nc(this.spec,t,i,t.doc.length).next();return n.done&&(n=Nc(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,i){for(let n=1;;n++){let r=Math.max(e,i-1e4*n),s=Nc(this.spec,t,r,i),o=null;for(;!s.next().done;)o=s.value;if(o&&(r==e||o.from>r+10))return o;if(r==e)return null}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,((e,i)=>"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let r=Nc(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}const Wc=kt.define(),Fc=kt.define(),zc=Z.define({create:t=>new _c(Zc(t).create(),null),update(t,e){for(let i of e.effects)i.is(Wc)?t=new _c(i.value.create(),t.panel):i.is(Fc)&&(t=new _c(t.query,i.value?Qc:null));return t},provide:t=>Qs.from(t,(t=>t.panel))});class _c{constructor(t,e){this.query=t,this.panel=e}}const qc=fi.mark({class:"cm-searchMatch"}),jc=fi.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Kc=Ii.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(zc))}update(t){let e=t.state.field(zc);(e!=t.startState.field(zc)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return fi.none;let{view:i}=this,n=new zt;for(let e=0,r=i.visibleRanges,s=r.length;er[e+1].from-500;)l=r[++e].to;t.highlight(i.state,o,l,((t,e)=>{let r=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,r?jc:qc)}))}return n.finish()}},{decorations:t=>t.decorations});function $c(t){return e=>{let i=e.state.field(zc,!1);return i&&i.query.spec.valid?t(e,i):iu(e)}}const Gc=$c(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=q.single(n.from,n.to),s=t.state.facet(Ec);return t.dispatch({selection:r,effects:[au(t,n),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),eu(t),!0})),Uc=$c(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let s=q.single(r.from,r.to),o=t.state.facet(Ec);return t.dispatch({selection:s,effects:[au(t,r),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),eu(t),!0})),Jc=$c(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:q.create(i.map((t=>q.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),Yc=$c(((t,{query:e})=>{let{state:i}=t,{from:n,to:r}=i.selection.main;if(i.readOnly)return!1;let s=e.nextMatch(i,n,n);if(!s)return!1;let o,l,h=[],a=[];if(s.from==n&&s.to==r&&(l=i.toText(e.getReplacement(s)),h.push({from:s.from,to:s.to,insert:l}),s=e.nextMatch(i,s.from,s.to),a.push(Jr.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),s){let e=0==h.length||h[0].from>=s.to?0:s.to-s.from-l.length;o=q.single(s.from-e,s.to-e),a.push(au(t,s)),a.push(i.facet(Ec).scrollToMatch(o.main,t))}return t.dispatch({changes:h,selection:o,effects:a,userEvent:"input.replace"}),!0})),Xc=$c(((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map((t=>{let{from:i,to:n}=t;return{from:i,to:n,insert:e.getReplacement(t)}}));if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Jr.announce.of(n),userEvent:"input.replace.all"}),!0}));function Qc(t){return t.state.facet(Ec).createPanel(t)}function Zc(t,e){var i,n,r,s,o;let l=t.selection.main,h=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!h)return e;let a=t.facet(Ec);return new Rc({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:a.literal)?h:h.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:a.caseSensitive,literal:null!==(r=null==e?void 0:e.literal)&&void 0!==r?r:a.literal,regexp:null!==(s=null==e?void 0:e.regexp)&&void 0!==s?s:a.regexp,wholeWord:null!==(o=null==e?void 0:e.wholeWord)&&void 0!==o?o:a.wholeWord})}function tu(t){let e=Us(t,Qc);return e&&e.dom.querySelector("[main-field]")}function eu(t){let e=tu(t);e&&e==t.root.activeElement&&e.select()}const iu=t=>{let e=t.state.field(zc,!1);if(e&&e.panel){let i=tu(t);if(i&&i!=t.root.activeElement){let n=Zc(t.state,e.query.spec);n.valid&&t.dispatch({effects:Wc.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[Fc.of(!0),e?Wc.of(Zc(t.state,e.query.spec)):kt.appendConfig.of(uu)]});return!0},nu=t=>{let e=t.state.field(zc,!1);if(!e||!e.panel)return!1;let i=Us(t,Qc);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Fc.of(!1)}),!0},ru=[{key:"Mod-f",run:iu,scope:"editor search-panel"},{key:"F3",run:Gc,shift:Uc,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Gc,shift:Uc,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:nu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:r}=i.main,s=[],o=0;for(let e=new wc(t.doc,t.sliceDoc(n,r));!e.next().done;){if(s.length>1e3)return!1;e.value.from==n&&(o=s.length),s.push(q.range(e.value.from,e.value.to))}return e(t.update({selection:q.create(s,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Us(t,Cc);if(!e){let i=[Oc.of(!0)];null==t.state.field(Dc,!1)&&i.push(kt.appendConfig.of([Dc,Tc])),t.dispatch({effects:i}),e=Us(t,Cc)}return e&&e.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some((t=>t.from===t.to)))return(({state:t,dispatch:e})=>{let{selection:i}=t,n=q.create(i.ranges.map((e=>t.wordAt(e.head)||q.cursor(e.head))),i.mainIndex);return!n.eq(i)&&(e(t.update({selection:n})),!0)})({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some((e=>t.sliceDoc(e.from,e.to)!=n)))return!1;let r=function(t,e){let{main:i,ranges:n}=t.selection,r=t.wordAt(i.head),s=r&&r.from==i.from&&r.to==i.to;for(let i=!1,r=new wc(t.doc,e,n[n.length-1].to);;){if(r.next(),!r.done){if(i&&n.some((t=>t.from==r.value.from)))continue;if(s){let e=t.wordAt(r.value.from);if(!e||e.from!=r.value.from||e.to!=r.value.to)continue}return r.value}if(i)return null;r=new wc(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),i=!0}}(t,n);return!!r&&(e(t.update({selection:t.selection.addRange(q.range(r.from,r.to),!1),effects:Jr.scrollIntoView(r.to)})),!0)},preventDefault:!0}];class su{constructor(t){this.view=t;let e=this.query=t.state.field(zc).query.spec;function i(t,e,i){return gc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=gc("input",{value:e.search,placeholder:ou(t,"Find"),"aria-label":ou(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=gc("input",{value:e.replace,placeholder:ou(t,"Replace"),"aria-label":ou(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=gc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=gc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=gc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=gc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>Gc(t)),[ou(t,"next")]),i("prev",(()=>Uc(t)),[ou(t,"previous")]),i("select",(()=>Jc(t)),[ou(t,"all")]),gc("label",null,[this.caseField,ou(t,"match case")]),gc("label",null,[this.reField,ou(t,"regexp")]),gc("label",null,[this.wordField,ou(t,"by word")]),...t.state.readOnly?[]:[gc("br"),this.replaceField,i("replace",(()=>Yc(t)),[ou(t,"replace")]),i("replaceAll",(()=>Xc(t)),[ou(t,"replace all")])],gc("button",{name:"close",onclick:()=>nu(t),"aria-label":ou(t,"close"),type:"button"},["×"])])}commit(){let t=new Rc({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Wc.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",hs(ss(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Uc:Gc)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),Yc(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Wc)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ec).top}}function ou(t,e){return t.state.phrase(e)}const lu=30,hu=/[\s\.,:;?!]/;function au(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,s=Math.max(n.from,e-lu),o=Math.min(r,i+lu),l=t.state.sliceDoc(s,o);if(s!=n.from)for(let t=0;tl.length-lu;t--)if(!hu.test(l[t-1])&&hu.test(l[t])){l=l.slice(0,t);break}return Jr.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${n.number}.`)}const cu=Jr.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),uu=[zc,st.low(Kc),cu];exports.Compartment=lt,exports.Decoration=fi,exports.EditorSelection=q,exports.EditorState=Lt,exports.EditorView=Jr,exports.HighlightStyle=sh,exports.LanguageSupport=class{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}},exports.Prec=st,exports.RangeSetBuilder=zt,exports.StateField=Z,exports.StreamLanguage=Th,exports.Tag=Yo,exports.ViewPlugin=Ii,exports._callSuper=function(e,i,n){return i=s(i),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(e,t()?Reflect.construct(i,n||[],s(e).constructor):i.apply(e,n))},exports._classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},exports._classPrivateFieldGet=function(t,e){var i=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}(t,e,"get");return function(t,e){if(e.get)return e.get.call(t);return e.value}(t,i)},exports._classPrivateFieldInitSpec=function(t,e,i){c(t,e),e.set(t,i)},exports._classPrivateMethodGet=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i},exports._classPrivateMethodInitSpec=function(t,e){c(t,e),e.add(t)},exports._createClass=function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t},exports._createForOfIteratorHelper=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=h(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,l=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){l=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw s}}}},exports._defineProperty=r,exports._get=l,exports._getPrototypeOf=s,exports._inherits=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)},exports._objectSpread2=function(t){for(var i=1;i{var e;return(null===(e=t.plugin(n))||void 0===e?void 0:e.isDown)?Vs:null}))]},exports.defaultKeymap=pc,exports.drawSelection=function(t={}){return[ms.of(t),ws,bs,ks,Ti.of(!0)]},exports.ensureSyntaxTree=function(t,e,i=50){var n;let r=null===(n=t.field(Al.state,!1))||void 0===n?void 0:n.context;if(!r)return null;let s=r.viewport;r.updateViewport({from:0,to:e});let o=r.isDone(e)||r.work(i,e)?r.tree:null;return r.updateViewport(s),o},exports.foldEffect=Jl,exports.foldedRanges=function(t){return t.field(Xl,!1)||Ft.empty},exports.highlightSpecialChars=function(t={}){return[Ts.of(t),Es||(Es=Ii.fromClass(class{constructor(t){this.view=t,this.decorations=fi.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Ts)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new As({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,s=T(e[0],0);if(9==s){let t=r.lineAt(n),e=i.state.tabSize,s=Qt(t.text,e,n-t.from);return fi.replace({widget:new Ps((e-s%e)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=fi.replace({widget:new Rs(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Ts);t.startState.facet(Ts)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]},exports.history=function(t={}){return[ia,ea.of(t),Jr.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?ra:"historyRedo"==t.inputType?sa:null;return!!i&&(t.preventDefault(),i(e))}})]},exports.historyKeymap=ya,exports.keymap=ns,exports.lineNumbers=function(t={}){return[uo.of(t),no(),go]},exports.rectangularSelection=function(t){let e=(null==t?void 0:t.eventFilter)||(t=>t.altKey&&0==t.button);return Jr.mouseSelectionStyle.of(((t,i)=>e(i)?Ns(t,i):null))},exports.searchKeymap=ru,exports.showTooltip=$s,exports.syntaxHighlighting=function(t,e){let i,n=[ch];return t instanceof sh&&(t.module&&n.push(Jr.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(lh.of(t)):i?n.push(oh.computeN([Jr.darkTheme],(e=>e.facet(Jr.darkTheme)==("dark"==i)?[t]:[]))):n.push(oh.of(t)),n},exports.syntaxTree=Cl,exports.tags=bl,exports.unfoldAll=t=>{let e=t.state.field(Xl,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,((t,e)=>{i.push(Yl.of({from:t,to:e}))})),t.dispatch({effects:i}),!0},exports.unfoldEffect=Yl; diff --git a/resources/legacy/.eslintrc.json b/resources/legacy/.eslintrc.json new file mode 100644 index 00000000..f1981060 --- /dev/null +++ b/resources/legacy/.eslintrc.json @@ -0,0 +1,29 @@ +{ + "root": true, + "extends": [ + "wikimedia/client", + "wikimedia/jquery", + "wikimedia/mediawiki" + ], + "parserOptions": { + "sourceType": "commonjs" + }, + "globals": { + "CodeMirror": "readonly" + }, + "rules": { + "max-len": "off", + "es-x/no-object-assign": "warn" + }, + "overrides": [ + { + "files": [ + "addon/*.js" + ], + "rules": { + "computed-property-spacing": [ "error", "never" ], + "indent": [ "error", 2 ] + } + } + ] +} diff --git a/resources/addon/edit/matchbrackets-wmde.js b/resources/legacy/addon/matchbrackets-wmde.js similarity index 100% rename from resources/addon/edit/matchbrackets-wmde.js rename to resources/legacy/addon/matchbrackets-wmde.js diff --git a/resources/lib/codemirror-fixes.less b/resources/legacy/codemirror-fixes.less similarity index 100% rename from resources/lib/codemirror-fixes.less rename to resources/legacy/codemirror-fixes.less diff --git a/resources/ext.CodeMirror.WikiEditor.js b/resources/legacy/ext.CodeMirror.WikiEditor.js similarity index 99% rename from resources/ext.CodeMirror.WikiEditor.js rename to resources/legacy/ext.CodeMirror.WikiEditor.js index 0e3c29fb..ec28c4b1 100644 --- a/resources/ext.CodeMirror.WikiEditor.js +++ b/resources/legacy/ext.CodeMirror.WikiEditor.js @@ -146,7 +146,6 @@ function init() { */ function enableCodeMirror() { const config = mw.config.get( 'extCodeMirrorConfig' ); - mw.loader.using( codeMirrorCoreModules.concat( config.pluginModules ), () => { const selectionStart = $textbox1.prop( 'selectionStart' ), selectionEnd = $textbox1.prop( 'selectionEnd' ), diff --git a/resources/ext.CodeMirror.js b/resources/legacy/ext.CodeMirror.js similarity index 100% rename from resources/ext.CodeMirror.js rename to resources/legacy/ext.CodeMirror.js diff --git a/resources/ext.CodeMirror.less b/resources/legacy/ext.CodeMirror.less similarity index 100% rename from resources/ext.CodeMirror.less rename to resources/legacy/ext.CodeMirror.less diff --git a/resources/mode/mediawiki/mediawiki.js b/resources/legacy/mode/mediawiki/mediawiki.js similarity index 100% rename from resources/mode/mediawiki/mediawiki.js rename to resources/legacy/mode/mediawiki/mediawiki.js diff --git a/resources/mode/mediawiki/tests/qunit/.eslintrc.json b/resources/legacy/mode/mediawiki/tests/qunit/.eslintrc.json similarity index 100% rename from resources/mode/mediawiki/tests/qunit/.eslintrc.json rename to resources/legacy/mode/mediawiki/tests/qunit/.eslintrc.json diff --git a/resources/mode/mediawiki/tests/qunit/CodeMirror.mediawiki.test.js b/resources/legacy/mode/mediawiki/tests/qunit/CodeMirror.mediawiki.test.js similarity index 100% rename from resources/mode/mediawiki/tests/qunit/CodeMirror.mediawiki.test.js rename to resources/legacy/mode/mediawiki/tests/qunit/CodeMirror.mediawiki.test.js diff --git a/resources/modules/ve-cm/.eslintrc.json b/resources/legacy/modules/ve-cm/.eslintrc.json similarity index 100% rename from resources/modules/ve-cm/.eslintrc.json rename to resources/legacy/modules/ve-cm/.eslintrc.json diff --git a/resources/modules/ve-cm/ve.ui.CodeMirror.less b/resources/legacy/modules/ve-cm/ve.ui.CodeMirror.less similarity index 100% rename from resources/modules/ve-cm/ve.ui.CodeMirror.less rename to resources/legacy/modules/ve-cm/ve.ui.CodeMirror.less diff --git a/resources/modules/ve-cm/ve.ui.CodeMirrorAction.js b/resources/legacy/modules/ve-cm/ve.ui.CodeMirrorAction.js similarity index 100% rename from resources/modules/ve-cm/ve.ui.CodeMirrorAction.js rename to resources/legacy/modules/ve-cm/ve.ui.CodeMirrorAction.js diff --git a/resources/modules/ve-cm/ve.ui.CodeMirrorTool.js b/resources/legacy/modules/ve-cm/ve.ui.CodeMirrorTool.js similarity index 100% rename from resources/modules/ve-cm/ve.ui.CodeMirrorTool.js rename to resources/legacy/modules/ve-cm/ve.ui.CodeMirrorTool.js diff --git a/resources/lib/codemirror6.bundle.dist.js b/resources/lib/codemirror6.bundle.dist.js new file mode 100644 index 00000000..c22877eb --- /dev/null +++ b/resources/lib/codemirror6.bundle.dist.js @@ -0,0 +1,22861 @@ +'use strict'; + +/** +The data structure for documents. @nonabstract +*/ +class Text { + /** + Get the line description around the given position. + */ + lineAt(pos) { + if (pos < 0 || pos > this.length) + throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`); + return this.lineInner(pos, false, 1, 0); + } + /** + Get the description for the given (1-based) line number. + */ + line(n) { + if (n < 1 || n > this.lines) + throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`); + return this.lineInner(n, true, 1, 0); + } + /** + Replace a range of the text with the given content. + */ + replace(from, to, text) { + let parts = []; + this.decompose(0, from, parts, 2 /* Open.To */); + if (text.length) + text.decompose(0, text.length, parts, 1 /* Open.From */ | 2 /* Open.To */); + this.decompose(to, this.length, parts, 1 /* Open.From */); + return TextNode.from(parts, this.length - (to - from) + text.length); + } + /** + Append another document to this one. + */ + append(other) { + return this.replace(this.length, this.length, other); + } + /** + Retrieve the text between the given points. + */ + slice(from, to = this.length) { + let parts = []; + this.decompose(from, to, parts, 0); + return TextNode.from(parts, to - from); + } + /** + Test whether this text is equal to another instance. + */ + eq(other) { + if (other == this) + return true; + if (other.length != this.length || other.lines != this.lines) + return false; + let start = this.scanIdentical(other, 1), end = this.length - this.scanIdentical(other, -1); + let a = new RawTextCursor(this), b = new RawTextCursor(other); + for (let skip = start, pos = start;;) { + a.next(skip); + b.next(skip); + skip = 0; + if (a.lineBreak != b.lineBreak || a.done != b.done || a.value != b.value) + return false; + pos += a.value.length; + if (a.done || pos >= end) + return true; + } + } + /** + Iterate over the text. When `dir` is `-1`, iteration happens + from end to start. This will return lines and the breaks between + them as separate strings. + */ + iter(dir = 1) { return new RawTextCursor(this, dir); } + /** + Iterate over a range of the text. When `from` > `to`, the + iterator will run in reverse. + */ + iterRange(from, to = this.length) { return new PartialTextCursor(this, from, to); } + /** + Return a cursor that iterates over the given range of lines, + _without_ returning the line breaks between, and yielding empty + strings for empty lines. + + When `from` and `to` are given, they should be 1-based line numbers. + */ + iterLines(from, to) { + let inner; + if (from == null) { + inner = this.iter(); + } + else { + if (to == null) + to = this.lines + 1; + let start = this.line(from).from; + inner = this.iterRange(start, Math.max(start, to == this.lines + 1 ? this.length : to <= 1 ? 0 : this.line(to - 1).to)); + } + return new LineCursor(inner); + } + /** + Return the document as a string, using newline characters to + separate lines. + */ + toString() { return this.sliceString(0); } + /** + Convert the document to an array of lines (which can be + deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)). + */ + toJSON() { + let lines = []; + this.flatten(lines); + return lines; + } + /** + @internal + */ + constructor() { } + /** + Create a `Text` instance for the given array of lines. + */ + static of(text) { + if (text.length == 0) + throw new RangeError("A document must have at least one line"); + if (text.length == 1 && !text[0]) + return Text.empty; + return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, [])); + } +} +// Leaves store an array of line strings. There are always line breaks +// between these strings. Leaves are limited in size and have to be +// contained in TextNode instances for bigger documents. +class TextLeaf extends Text { + constructor(text, length = textLength(text)) { + super(); + this.text = text; + this.length = length; + } + get lines() { return this.text.length; } + get children() { return null; } + lineInner(target, isLine, line, offset) { + for (let i = 0;; i++) { + let string = this.text[i], end = offset + string.length; + if ((isLine ? line : end) >= target) + return new Line(offset, end, line, string); + offset = end + 1; + line++; + } + } + decompose(from, to, target, open) { + let text = from <= 0 && to >= this.length ? this + : new TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from)); + if (open & 1 /* Open.From */) { + let prev = target.pop(); + let joined = appendText(text.text, prev.text.slice(), 0, text.length); + if (joined.length <= 32 /* Tree.Branch */) { + target.push(new TextLeaf(joined, prev.length + text.length)); + } + else { + let mid = joined.length >> 1; + target.push(new TextLeaf(joined.slice(0, mid)), new TextLeaf(joined.slice(mid))); + } + } + else { + target.push(text); + } + } + replace(from, to, text) { + if (!(text instanceof TextLeaf)) + return super.replace(from, to, text); + let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to); + let newLen = this.length + text.length - (to - from); + if (lines.length <= 32 /* Tree.Branch */) + return new TextLeaf(lines, newLen); + return TextNode.from(TextLeaf.split(lines, []), newLen); + } + sliceString(from, to = this.length, lineSep = "\n") { + let result = ""; + for (let pos = 0, i = 0; pos <= to && i < this.text.length; i++) { + let line = this.text[i], end = pos + line.length; + if (pos > from && i) + result += lineSep; + if (from < end && to > pos) + result += line.slice(Math.max(0, from - pos), to - pos); + pos = end + 1; + } + return result; + } + flatten(target) { + for (let line of this.text) + target.push(line); + } + scanIdentical() { return 0; } + static split(text, target) { + let part = [], len = -1; + for (let line of text) { + part.push(line); + len += line.length + 1; + if (part.length == 32 /* Tree.Branch */) { + target.push(new TextLeaf(part, len)); + part = []; + len = -1; + } + } + if (len > -1) + target.push(new TextLeaf(part, len)); + return target; + } +} +// Nodes provide the tree structure of the `Text` type. They store a +// number of other nodes or leaves, taking care to balance themselves +// on changes. There are implied line breaks _between_ the children of +// a node (but not before the first or after the last child). +class TextNode extends Text { + constructor(children, length) { + super(); + this.children = children; + this.length = length; + this.lines = 0; + for (let child of children) + this.lines += child.lines; + } + lineInner(target, isLine, line, offset) { + for (let i = 0;; i++) { + let child = this.children[i], end = offset + child.length, endLine = line + child.lines - 1; + if ((isLine ? endLine : end) >= target) + return child.lineInner(target, isLine, line, offset); + offset = end + 1; + line = endLine + 1; + } + } + decompose(from, to, target, open) { + for (let i = 0, pos = 0; pos <= to && i < this.children.length; i++) { + let child = this.children[i], end = pos + child.length; + if (from <= end && to >= pos) { + let childOpen = open & ((pos <= from ? 1 /* Open.From */ : 0) | (end >= to ? 2 /* Open.To */ : 0)); + if (pos >= from && end <= to && !childOpen) + target.push(child); + else + child.decompose(from - pos, to - pos, target, childOpen); + } + pos = end + 1; + } + } + replace(from, to, text) { + if (text.lines < this.lines) + for (let i = 0, pos = 0; i < this.children.length; i++) { + let child = this.children[i], end = pos + child.length; + // Fast path: if the change only affects one child and the + // child's size remains in the acceptable range, only update + // that child + if (from >= pos && to <= end) { + let updated = child.replace(from - pos, to - pos, text); + let totalLines = this.lines - child.lines + updated.lines; + if (updated.lines < (totalLines >> (5 /* Tree.BranchShift */ - 1)) && + updated.lines > (totalLines >> (5 /* Tree.BranchShift */ + 1))) { + let copy = this.children.slice(); + copy[i] = updated; + return new TextNode(copy, this.length - (to - from) + text.length); + } + return super.replace(pos, end, updated); + } + pos = end + 1; + } + return super.replace(from, to, text); + } + sliceString(from, to = this.length, lineSep = "\n") { + let result = ""; + for (let i = 0, pos = 0; i < this.children.length && pos <= to; i++) { + let child = this.children[i], end = pos + child.length; + if (pos > from && i) + result += lineSep; + if (from < end && to > pos) + result += child.sliceString(from - pos, to - pos, lineSep); + pos = end + 1; + } + return result; + } + flatten(target) { + for (let child of this.children) + child.flatten(target); + } + scanIdentical(other, dir) { + if (!(other instanceof TextNode)) + return 0; + let length = 0; + let [iA, iB, eA, eB] = dir > 0 ? [0, 0, this.children.length, other.children.length] + : [this.children.length - 1, other.children.length - 1, -1, -1]; + for (;; iA += dir, iB += dir) { + if (iA == eA || iB == eB) + return length; + let chA = this.children[iA], chB = other.children[iB]; + if (chA != chB) + return length + chA.scanIdentical(chB, dir); + length += chA.length + 1; + } + } + static from(children, length = children.reduce((l, ch) => l + ch.length + 1, -1)) { + let lines = 0; + for (let ch of children) + lines += ch.lines; + if (lines < 32 /* Tree.Branch */) { + let flat = []; + for (let ch of children) + ch.flatten(flat); + return new TextLeaf(flat, length); + } + let chunk = Math.max(32 /* Tree.Branch */, lines >> 5 /* Tree.BranchShift */), maxChunk = chunk << 1, minChunk = chunk >> 1; + let chunked = [], currentLines = 0, currentLen = -1, currentChunk = []; + function add(child) { + let last; + if (child.lines > maxChunk && child instanceof TextNode) { + for (let node of child.children) + add(node); + } + else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) { + flush(); + chunked.push(child); + } + else if (child instanceof TextLeaf && currentLines && + (last = currentChunk[currentChunk.length - 1]) instanceof TextLeaf && + child.lines + last.lines <= 32 /* Tree.Branch */) { + currentLines += child.lines; + currentLen += child.length + 1; + currentChunk[currentChunk.length - 1] = new TextLeaf(last.text.concat(child.text), last.length + 1 + child.length); + } + else { + if (currentLines + child.lines > chunk) + flush(); + currentLines += child.lines; + currentLen += child.length + 1; + currentChunk.push(child); + } + } + function flush() { + if (currentLines == 0) + return; + chunked.push(currentChunk.length == 1 ? currentChunk[0] : TextNode.from(currentChunk, currentLen)); + currentLen = -1; + currentLines = currentChunk.length = 0; + } + for (let child of children) + add(child); + flush(); + return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length); + } +} +Text.empty = /*@__PURE__*/new TextLeaf([""], 0); +function textLength(text) { + let length = -1; + for (let line of text) + length += line.length + 1; + return length; +} +function appendText(text, target, from = 0, to = 1e9) { + for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) { + let line = text[i], end = pos + line.length; + if (end >= from) { + if (end > to) + line = line.slice(0, to - pos); + if (pos < from) + line = line.slice(from - pos); + if (first) { + target[target.length - 1] += line; + first = false; + } + else + target.push(line); + } + pos = end + 1; + } + return target; +} +function sliceText(text, from, to) { + return appendText(text, [""], from, to); +} +class RawTextCursor { + constructor(text, dir = 1) { + this.dir = dir; + this.done = false; + this.lineBreak = false; + this.value = ""; + this.nodes = [text]; + this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1]; + } + nextInner(skip, dir) { + this.done = this.lineBreak = false; + for (;;) { + let last = this.nodes.length - 1; + let top = this.nodes[last], offsetValue = this.offsets[last], offset = offsetValue >> 1; + let size = top instanceof TextLeaf ? top.text.length : top.children.length; + if (offset == (dir > 0 ? size : 0)) { + if (last == 0) { + this.done = true; + this.value = ""; + return this; + } + if (dir > 0) + this.offsets[last - 1]++; + this.nodes.pop(); + this.offsets.pop(); + } + else if ((offsetValue & 1) == (dir > 0 ? 0 : 1)) { + this.offsets[last] += dir; + if (skip == 0) { + this.lineBreak = true; + this.value = "\n"; + return this; + } + skip--; + } + else if (top instanceof TextLeaf) { + // Move to the next string + let next = top.text[offset + (dir < 0 ? -1 : 0)]; + this.offsets[last] += dir; + if (next.length > Math.max(0, skip)) { + this.value = skip == 0 ? next : dir > 0 ? next.slice(skip) : next.slice(0, next.length - skip); + return this; + } + skip -= next.length; + } + else { + let next = top.children[offset + (dir < 0 ? -1 : 0)]; + if (skip > next.length) { + skip -= next.length; + this.offsets[last] += dir; + } + else { + if (dir < 0) + this.offsets[last]--; + this.nodes.push(next); + this.offsets.push(dir > 0 ? 1 : (next instanceof TextLeaf ? next.text.length : next.children.length) << 1); + } + } + } + } + next(skip = 0) { + if (skip < 0) { + this.nextInner(-skip, (-this.dir)); + skip = this.value.length; + } + return this.nextInner(skip, this.dir); + } +} +class PartialTextCursor { + constructor(text, start, end) { + this.value = ""; + this.done = false; + this.cursor = new RawTextCursor(text, start > end ? -1 : 1); + this.pos = start > end ? text.length : 0; + this.from = Math.min(start, end); + this.to = Math.max(start, end); + } + nextInner(skip, dir) { + if (dir < 0 ? this.pos <= this.from : this.pos >= this.to) { + this.value = ""; + this.done = true; + return this; + } + skip += Math.max(0, dir < 0 ? this.pos - this.to : this.from - this.pos); + let limit = dir < 0 ? this.pos - this.from : this.to - this.pos; + if (skip > limit) + skip = limit; + limit -= skip; + let { value } = this.cursor.next(skip); + this.pos += (value.length + skip) * dir; + this.value = value.length <= limit ? value : dir < 0 ? value.slice(value.length - limit) : value.slice(0, limit); + this.done = !this.value; + return this; + } + next(skip = 0) { + if (skip < 0) + skip = Math.max(skip, this.from - this.pos); + else if (skip > 0) + skip = Math.min(skip, this.to - this.pos); + return this.nextInner(skip, this.cursor.dir); + } + get lineBreak() { return this.cursor.lineBreak && this.value != ""; } +} +class LineCursor { + constructor(inner) { + this.inner = inner; + this.afterBreak = true; + this.value = ""; + this.done = false; + } + next(skip = 0) { + let { done, lineBreak, value } = this.inner.next(skip); + if (done) { + this.done = true; + this.value = ""; + } + else if (lineBreak) { + if (this.afterBreak) { + this.value = ""; + } + else { + this.afterBreak = true; + this.next(); + } + } + else { + this.value = value; + this.afterBreak = false; + } + return this; + } + get lineBreak() { return false; } +} +if (typeof Symbol != "undefined") { + Text.prototype[Symbol.iterator] = function () { return this.iter(); }; + RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] = + LineCursor.prototype[Symbol.iterator] = function () { return this; }; +} +/** +This type describes a line in the document. It is created +on-demand when lines are [queried](https://codemirror.net/6/docs/ref/#state.Text.lineAt). +*/ +class Line { + /** + @internal + */ + constructor( + /** + The position of the start of the line. + */ + from, + /** + The position at the end of the line (_before_ the line break, + or at the end of document for the last line). + */ + to, + /** + This line's line number (1-based). + */ + number, + /** + The line's content. + */ + text) { + this.from = from; + this.to = to; + this.number = number; + this.text = text; + } + /** + The length of the line (not including any line break after it). + */ + get length() { return this.to - this.from; } +} + +// Compressed representation of the Grapheme_Cluster_Break=Extend +// information from +// http://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt. +// Each pair of elements represents a range, as an offet from the +// previous range and a length. Numbers are in base-36, with the empty +// string being a shorthand for 1. +let extend = /*@__PURE__*/"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(s => s ? parseInt(s, 36) : 1); +// Convert offsets into absolute values +for (let i = 1; i < extend.length; i++) + extend[i] += extend[i - 1]; +function isExtendingChar(code) { + for (let i = 1; i < extend.length; i += 2) + if (extend[i] > code) + return extend[i - 1] <= code; + return false; +} +function isRegionalIndicator(code) { + return code >= 0x1F1E6 && code <= 0x1F1FF; +} +const ZWJ = 0x200d; +/** +Returns a next grapheme cluster break _after_ (not equal to) +`pos`, if `forward` is true, or before otherwise. Returns `pos` +itself if no further cluster break is available in the string. +Moves across surrogate pairs, extending characters (when +`includeExtending` is true), characters joined with zero-width +joiners, and flag emoji. +*/ +function findClusterBreak(str, pos, forward = true, includeExtending = true) { + return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending); +} +function nextClusterBreak(str, pos, includeExtending) { + if (pos == str.length) + return pos; + // If pos is in the middle of a surrogate pair, move to its start + if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) + pos--; + let prev = codePointAt(str, pos); + pos += codePointSize(prev); + while (pos < str.length) { + let next = codePointAt(str, pos); + if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) { + pos += codePointSize(next); + prev = next; + } + else if (isRegionalIndicator(next)) { + let countBefore = 0, i = pos - 2; + while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) { + countBefore++; + i -= 2; + } + if (countBefore % 2 == 0) + break; + else + pos += 2; + } + else { + break; + } + } + return pos; +} +function prevClusterBreak(str, pos, includeExtending) { + while (pos > 0) { + let found = nextClusterBreak(str, pos - 2, includeExtending); + if (found < pos) + return found; + pos--; + } + return 0; +} +function surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000; } +function surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00; } +/** +Find the code point at the given position in a string (like the +[`codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) +string method). +*/ +function codePointAt(str, pos) { + let code0 = str.charCodeAt(pos); + if (!surrogateHigh(code0) || pos + 1 == str.length) + return code0; + let code1 = str.charCodeAt(pos + 1); + if (!surrogateLow(code1)) + return code0; + return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000; +} +/** +Given a Unicode codepoint, return the JavaScript string that +respresents it (like +[`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint)). +*/ +function fromCodePoint(code) { + if (code <= 0xffff) + return String.fromCharCode(code); + code -= 0x10000; + return String.fromCharCode((code >> 10) + 0xd800, (code & 1023) + 0xdc00); +} +/** +The amount of positions a character takes up a JavaScript string. +*/ +function codePointSize(code) { return code < 0x10000 ? 1 : 2; } + +const DefaultSplit = /\r\n?|\n/; +/** +Distinguishes different ways in which positions can be mapped. +*/ +exports.MapMode = /*@__PURE__*/(function (MapMode) { + /** + Map a position to a valid new position, even when its context + was deleted. + */ + MapMode[MapMode["Simple"] = 0] = "Simple"; + /** + Return null if deletion happens across the position. + */ + MapMode[MapMode["TrackDel"] = 1] = "TrackDel"; + /** + Return null if the character _before_ the position is deleted. + */ + MapMode[MapMode["TrackBefore"] = 2] = "TrackBefore"; + /** + Return null if the character _after_ the position is deleted. + */ + MapMode[MapMode["TrackAfter"] = 3] = "TrackAfter"; +return MapMode})(exports.MapMode || (exports.MapMode = {})); +/** +A change description is a variant of [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) +that doesn't store the inserted text. As such, it can't be +applied, but is cheaper to store and manipulate. +*/ +class ChangeDesc { + // Sections are encoded as pairs of integers. The first is the + // length in the current document, and the second is -1 for + // unaffected sections, and the length of the replacement content + // otherwise. So an insertion would be (0, n>0), a deletion (n>0, + // 0), and a replacement two positive numbers. + /** + @internal + */ + constructor( + /** + @internal + */ + sections) { + this.sections = sections; + } + /** + The length of the document before the change. + */ + get length() { + let result = 0; + for (let i = 0; i < this.sections.length; i += 2) + result += this.sections[i]; + return result; + } + /** + The length of the document after the change. + */ + get newLength() { + let result = 0; + for (let i = 0; i < this.sections.length; i += 2) { + let ins = this.sections[i + 1]; + result += ins < 0 ? this.sections[i] : ins; + } + return result; + } + /** + False when there are actual changes in this set. + */ + get empty() { return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; } + /** + Iterate over the unchanged parts left by these changes. `posA` + provides the position of the range in the old document, `posB` + the new position in the changed document. + */ + iterGaps(f) { + for (let i = 0, posA = 0, posB = 0; i < this.sections.length;) { + let len = this.sections[i++], ins = this.sections[i++]; + if (ins < 0) { + f(posA, posB, len); + posB += len; + } + else { + posB += ins; + } + posA += len; + } + } + /** + Iterate over the ranges changed by these changes. (See + [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a + variant that also provides you with the inserted text.) + `fromA`/`toA` provides the extent of the change in the starting + document, `fromB`/`toB` the extent of the replacement in the + changed document. + + When `individual` is true, adjacent changes (which are kept + separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are + reported separately. + */ + iterChangedRanges(f, individual = false) { + iterChanges(this, f, individual); + } + /** + Get a description of the inverted form of these changes. + */ + get invertedDesc() { + let sections = []; + for (let i = 0; i < this.sections.length;) { + let len = this.sections[i++], ins = this.sections[i++]; + if (ins < 0) + sections.push(len, ins); + else + sections.push(ins, len); + } + return new ChangeDesc(sections); + } + /** + Compute the combined effect of applying another set of changes + after this one. The length of the document after this set should + match the length before `other`. + */ + composeDesc(other) { return this.empty ? other : other.empty ? this : composeSets(this, other); } + /** + Map this description, which should start with the same document + as `other`, over another set of changes, so that it can be + applied after it. When `before` is true, map as if the changes + in `other` happened before the ones in `this`. + */ + mapDesc(other, before = false) { return other.empty ? this : mapSet(this, other, before); } + mapPos(pos, assoc = -1, mode = exports.MapMode.Simple) { + let posA = 0, posB = 0; + for (let i = 0; i < this.sections.length;) { + let len = this.sections[i++], ins = this.sections[i++], endA = posA + len; + if (ins < 0) { + if (endA > pos) + return posB + (pos - posA); + posB += len; + } + else { + if (mode != exports.MapMode.Simple && endA >= pos && + (mode == exports.MapMode.TrackDel && posA < pos && endA > pos || + mode == exports.MapMode.TrackBefore && posA < pos || + mode == exports.MapMode.TrackAfter && endA > pos)) + return null; + if (endA > pos || endA == pos && assoc < 0 && !len) + return pos == posA || assoc < 0 ? posB : posB + ins; + posB += ins; + } + posA = endA; + } + if (pos > posA) + throw new RangeError(`Position ${pos} is out of range for changeset of length ${posA}`); + return posB; + } + /** + Check whether these changes touch a given range. When one of the + changes entirely covers the range, the string `"cover"` is + returned. + */ + touchesRange(from, to = from) { + for (let i = 0, pos = 0; i < this.sections.length && pos <= to;) { + let len = this.sections[i++], ins = this.sections[i++], end = pos + len; + if (ins >= 0 && pos <= to && end >= from) + return pos < from && end > to ? "cover" : true; + pos = end; + } + return false; + } + /** + @internal + */ + toString() { + let result = ""; + for (let i = 0; i < this.sections.length;) { + let len = this.sections[i++], ins = this.sections[i++]; + result += (result ? " " : "") + len + (ins >= 0 ? ":" + ins : ""); + } + return result; + } + /** + Serialize this change desc to a JSON-representable value. + */ + toJSON() { return this.sections; } + /** + Create a change desc from its JSON representation (as produced + by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON). + */ + static fromJSON(json) { + if (!Array.isArray(json) || json.length % 2 || json.some(a => typeof a != "number")) + throw new RangeError("Invalid JSON representation of ChangeDesc"); + return new ChangeDesc(json); + } + /** + @internal + */ + static create(sections) { return new ChangeDesc(sections); } +} +/** +A change set represents a group of modifications to a document. It +stores the document length, and can only be applied to documents +with exactly that length. +*/ +class ChangeSet extends ChangeDesc { + constructor(sections, + /** + @internal + */ + inserted) { + super(sections); + this.inserted = inserted; + } + /** + Apply the changes to a document, returning the modified + document. + */ + apply(doc) { + if (this.length != doc.length) + throw new RangeError("Applying change set to a document with the wrong length"); + iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false); + return doc; + } + mapDesc(other, before = false) { return mapSet(this, other, before, true); } + /** + Given the document as it existed _before_ the changes, return a + change set that represents the inverse of this set, which could + be used to go from the document created by the changes back to + the document as it existed before the changes. + */ + invert(doc) { + let sections = this.sections.slice(), inserted = []; + for (let i = 0, pos = 0; i < sections.length; i += 2) { + let len = sections[i], ins = sections[i + 1]; + if (ins >= 0) { + sections[i] = ins; + sections[i + 1] = len; + let index = i >> 1; + while (inserted.length < index) + inserted.push(Text.empty); + inserted.push(len ? doc.slice(pos, pos + len) : Text.empty); + } + pos += len; + } + return new ChangeSet(sections, inserted); + } + /** + Combine two subsequent change sets into a single set. `other` + must start in the document produced by `this`. If `this` goes + `docA` → `docB` and `other` represents `docB` → `docC`, the + returned value will represent the change `docA` → `docC`. + */ + compose(other) { return this.empty ? other : other.empty ? this : composeSets(this, other, true); } + /** + Given another change set starting in the same document, maps this + change set over the other, producing a new change set that can be + applied to the document produced by applying `other`. When + `before` is `true`, order changes as if `this` comes before + `other`, otherwise (the default) treat `other` as coming first. + + Given two changes `A` and `B`, `A.compose(B.map(A))` and + `B.compose(A.map(B, true))` will produce the same document. This + provides a basic form of [operational + transformation](https://en.wikipedia.org/wiki/Operational_transformation), + and can be used for collaborative editing. + */ + map(other, before = false) { return other.empty ? this : mapSet(this, other, before, true); } + /** + Iterate over the changed ranges in the document, calling `f` for + each, with the range in the original document (`fromA`-`toA`) + and the range that replaces it in the new document + (`fromB`-`toB`). + + When `individual` is true, adjacent changes are reported + separately. + */ + iterChanges(f, individual = false) { + iterChanges(this, f, individual); + } + /** + Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change + set. + */ + get desc() { return ChangeDesc.create(this.sections); } + /** + @internal + */ + filter(ranges) { + let resultSections = [], resultInserted = [], filteredSections = []; + let iter = new SectionIter(this); + done: for (let i = 0, pos = 0;;) { + let next = i == ranges.length ? 1e9 : ranges[i++]; + while (pos < next || pos == next && iter.len == 0) { + if (iter.done) + break done; + let len = Math.min(iter.len, next - pos); + addSection(filteredSections, len, -1); + let ins = iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0; + addSection(resultSections, len, ins); + if (ins > 0) + addInsert(resultInserted, resultSections, iter.text); + iter.forward(len); + pos += len; + } + let end = ranges[i++]; + while (pos < end) { + if (iter.done) + break done; + let len = Math.min(iter.len, end - pos); + addSection(resultSections, len, -1); + addSection(filteredSections, len, iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0); + iter.forward(len); + pos += len; + } + } + return { changes: new ChangeSet(resultSections, resultInserted), + filtered: ChangeDesc.create(filteredSections) }; + } + /** + Serialize this change set to a JSON-representable value. + */ + toJSON() { + let parts = []; + for (let i = 0; i < this.sections.length; i += 2) { + let len = this.sections[i], ins = this.sections[i + 1]; + if (ins < 0) + parts.push(len); + else if (ins == 0) + parts.push([len]); + else + parts.push([len].concat(this.inserted[i >> 1].toJSON())); + } + return parts; + } + /** + Create a change set for the given changes, for a document of the + given length, using `lineSep` as line separator. + */ + static of(changes, length, lineSep) { + let sections = [], inserted = [], pos = 0; + let total = null; + function flush(force = false) { + if (!force && !sections.length) + return; + if (pos < length) + addSection(sections, length - pos, -1); + let set = new ChangeSet(sections, inserted); + total = total ? total.compose(set.map(total)) : set; + sections = []; + inserted = []; + pos = 0; + } + function process(spec) { + if (Array.isArray(spec)) { + for (let sub of spec) + process(sub); + } + else if (spec instanceof ChangeSet) { + if (spec.length != length) + throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`); + flush(); + total = total ? total.compose(spec.map(total)) : spec; + } + else { + let { from, to = from, insert } = spec; + if (from > to || from < 0 || to > length) + throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`); + let insText = !insert ? Text.empty : typeof insert == "string" ? Text.of(insert.split(lineSep || DefaultSplit)) : insert; + let insLen = insText.length; + if (from == to && insLen == 0) + return; + if (from < pos) + flush(); + if (from > pos) + addSection(sections, from - pos, -1); + addSection(sections, to - from, insLen); + addInsert(inserted, sections, insText); + pos = to; + } + } + process(changes); + flush(!total); + return total; + } + /** + Create an empty changeset of the given length. + */ + static empty(length) { + return new ChangeSet(length ? [length, -1] : [], []); + } + /** + Create a changeset from its JSON representation (as produced by + [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON). + */ + static fromJSON(json) { + if (!Array.isArray(json)) + throw new RangeError("Invalid JSON representation of ChangeSet"); + let sections = [], inserted = []; + for (let i = 0; i < json.length; i++) { + let part = json[i]; + if (typeof part == "number") { + sections.push(part, -1); + } + else if (!Array.isArray(part) || typeof part[0] != "number" || part.some((e, i) => i && typeof e != "string")) { + throw new RangeError("Invalid JSON representation of ChangeSet"); + } + else if (part.length == 1) { + sections.push(part[0], 0); + } + else { + while (inserted.length < i) + inserted.push(Text.empty); + inserted[i] = Text.of(part.slice(1)); + sections.push(part[0], inserted[i].length); + } + } + return new ChangeSet(sections, inserted); + } + /** + @internal + */ + static createSet(sections, inserted) { + return new ChangeSet(sections, inserted); + } +} +function addSection(sections, len, ins, forceJoin = false) { + if (len == 0 && ins <= 0) + return; + let last = sections.length - 2; + if (last >= 0 && ins <= 0 && ins == sections[last + 1]) + sections[last] += len; + else if (len == 0 && sections[last] == 0) + sections[last + 1] += ins; + else if (forceJoin) { + sections[last] += len; + sections[last + 1] += ins; + } + else + sections.push(len, ins); +} +function addInsert(values, sections, value) { + if (value.length == 0) + return; + let index = (sections.length - 2) >> 1; + if (index < values.length) { + values[values.length - 1] = values[values.length - 1].append(value); + } + else { + while (values.length < index) + values.push(Text.empty); + values.push(value); + } +} +function iterChanges(desc, f, individual) { + let inserted = desc.inserted; + for (let posA = 0, posB = 0, i = 0; i < desc.sections.length;) { + let len = desc.sections[i++], ins = desc.sections[i++]; + if (ins < 0) { + posA += len; + posB += len; + } + else { + let endA = posA, endB = posB, text = Text.empty; + for (;;) { + endA += len; + endB += ins; + if (ins && inserted) + text = text.append(inserted[(i - 2) >> 1]); + if (individual || i == desc.sections.length || desc.sections[i + 1] < 0) + break; + len = desc.sections[i++]; + ins = desc.sections[i++]; + } + f(posA, endA, posB, endB, text); + posA = endA; + posB = endB; + } + } +} +function mapSet(setA, setB, before, mkSet = false) { + // Produce a copy of setA that applies to the document after setB + // has been applied (assuming both start at the same document). + let sections = [], insert = mkSet ? [] : null; + let a = new SectionIter(setA), b = new SectionIter(setB); + // Iterate over both sets in parallel. inserted tracks, for changes + // in A that have to be processed piece-by-piece, whether their + // content has been inserted already, and refers to the section + // index. + for (let inserted = -1;;) { + if (a.ins == -1 && b.ins == -1) { + // Move across ranges skipped by both sets. + let len = Math.min(a.len, b.len); + addSection(sections, len, -1); + a.forward(len); + b.forward(len); + } + else if (b.ins >= 0 && (a.ins < 0 || inserted == a.i || a.off == 0 && (b.len < a.len || b.len == a.len && !before))) { + // If there's a change in B that comes before the next change in + // A (ordered by start pos, then len, then before flag), skip + // that (and process any changes in A it covers). + let len = b.len; + addSection(sections, b.ins, -1); + while (len) { + let piece = Math.min(a.len, len); + if (a.ins >= 0 && inserted < a.i && a.len <= piece) { + addSection(sections, 0, a.ins); + if (insert) + addInsert(insert, sections, a.text); + inserted = a.i; + } + a.forward(piece); + len -= piece; + } + b.next(); + } + else if (a.ins >= 0) { + // Process the part of a change in A up to the start of the next + // non-deletion change in B (if overlapping). + let len = 0, left = a.len; + while (left) { + if (b.ins == -1) { + let piece = Math.min(left, b.len); + len += piece; + left -= piece; + b.forward(piece); + } + else if (b.ins == 0 && b.len < left) { + left -= b.len; + b.next(); + } + else { + break; + } + } + addSection(sections, len, inserted < a.i ? a.ins : 0); + if (insert && inserted < a.i) + addInsert(insert, sections, a.text); + inserted = a.i; + a.forward(a.len - left); + } + else if (a.done && b.done) { + return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections); + } + else { + throw new Error("Mismatched change set lengths"); + } + } +} +function composeSets(setA, setB, mkSet = false) { + let sections = []; + let insert = mkSet ? [] : null; + let a = new SectionIter(setA), b = new SectionIter(setB); + for (let open = false;;) { + if (a.done && b.done) { + return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections); + } + else if (a.ins == 0) { // Deletion in A + addSection(sections, a.len, 0, open); + a.next(); + } + else if (b.len == 0 && !b.done) { // Insertion in B + addSection(sections, 0, b.ins, open); + if (insert) + addInsert(insert, sections, b.text); + b.next(); + } + else if (a.done || b.done) { + throw new Error("Mismatched change set lengths"); + } + else { + let len = Math.min(a.len2, b.len), sectionLen = sections.length; + if (a.ins == -1) { + let insB = b.ins == -1 ? -1 : b.off ? 0 : b.ins; + addSection(sections, len, insB, open); + if (insert && insB) + addInsert(insert, sections, b.text); + } + else if (b.ins == -1) { + addSection(sections, a.off ? 0 : a.len, len, open); + if (insert) + addInsert(insert, sections, a.textBit(len)); + } + else { + addSection(sections, a.off ? 0 : a.len, b.off ? 0 : b.ins, open); + if (insert && !b.off) + addInsert(insert, sections, b.text); + } + open = (a.ins > len || b.ins >= 0 && b.len > len) && (open || sections.length > sectionLen); + a.forward2(len); + b.forward(len); + } + } +} +class SectionIter { + constructor(set) { + this.set = set; + this.i = 0; + this.next(); + } + next() { + let { sections } = this.set; + if (this.i < sections.length) { + this.len = sections[this.i++]; + this.ins = sections[this.i++]; + } + else { + this.len = 0; + this.ins = -2; + } + this.off = 0; + } + get done() { return this.ins == -2; } + get len2() { return this.ins < 0 ? this.len : this.ins; } + get text() { + let { inserted } = this.set, index = (this.i - 2) >> 1; + return index >= inserted.length ? Text.empty : inserted[index]; + } + textBit(len) { + let { inserted } = this.set, index = (this.i - 2) >> 1; + return index >= inserted.length && !len ? Text.empty + : inserted[index].slice(this.off, len == null ? undefined : this.off + len); + } + forward(len) { + if (len == this.len) + this.next(); + else { + this.len -= len; + this.off += len; + } + } + forward2(len) { + if (this.ins == -1) + this.forward(len); + else if (len == this.ins) + this.next(); + else { + this.ins -= len; + this.off += len; + } + } +} + +/** +A single selection range. When +[`allowMultipleSelections`](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections) +is enabled, a [selection](https://codemirror.net/6/docs/ref/#state.EditorSelection) may hold +multiple ranges. By default, selections hold exactly one range. +*/ +class SelectionRange { + constructor( + /** + The lower boundary of the range. + */ + from, + /** + The upper boundary of the range. + */ + to, flags) { + this.from = from; + this.to = to; + this.flags = flags; + } + /** + The anchor of the range—the side that doesn't move when you + extend it. + */ + get anchor() { return this.flags & 16 /* RangeFlag.Inverted */ ? this.to : this.from; } + /** + The head of the range, which is moved when the range is + [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend). + */ + get head() { return this.flags & 16 /* RangeFlag.Inverted */ ? this.from : this.to; } + /** + True when `anchor` and `head` are at the same position. + */ + get empty() { return this.from == this.to; } + /** + If this is a cursor that is explicitly associated with the + character on one of its sides, this returns the side. -1 means + the character before its position, 1 the character after, and 0 + means no association. + */ + get assoc() { return this.flags & 4 /* RangeFlag.AssocBefore */ ? -1 : this.flags & 8 /* RangeFlag.AssocAfter */ ? 1 : 0; } + /** + The bidirectional text level associated with this cursor, if + any. + */ + get bidiLevel() { + let level = this.flags & 3 /* RangeFlag.BidiLevelMask */; + return level == 3 ? null : level; + } + /** + The goal column (stored vertical offset) associated with a + cursor. This is used to preserve the vertical position when + [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across + lines of different length. + */ + get goalColumn() { + let value = this.flags >> 5 /* RangeFlag.GoalColumnOffset */; + return value == 33554431 /* RangeFlag.NoGoalColumn */ ? undefined : value; + } + /** + Map this range through a change, producing a valid range in the + updated document. + */ + map(change, assoc = -1) { + let from, to; + if (this.empty) { + from = to = change.mapPos(this.from, assoc); + } + else { + from = change.mapPos(this.from, 1); + to = change.mapPos(this.to, -1); + } + return from == this.from && to == this.to ? this : new SelectionRange(from, to, this.flags); + } + /** + Extend this range to cover at least `from` to `to`. + */ + extend(from, to = from) { + if (from <= this.anchor && to >= this.anchor) + return EditorSelection.range(from, to); + let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to; + return EditorSelection.range(this.anchor, head); + } + /** + Compare this range to another range. + */ + eq(other) { + return this.anchor == other.anchor && this.head == other.head; + } + /** + Return a JSON-serializable object representing the range. + */ + toJSON() { return { anchor: this.anchor, head: this.head }; } + /** + Convert a JSON representation of a range to a `SelectionRange` + instance. + */ + static fromJSON(json) { + if (!json || typeof json.anchor != "number" || typeof json.head != "number") + throw new RangeError("Invalid JSON representation for SelectionRange"); + return EditorSelection.range(json.anchor, json.head); + } + /** + @internal + */ + static create(from, to, flags) { + return new SelectionRange(from, to, flags); + } +} +/** +An editor selection holds one or more selection ranges. +*/ +class EditorSelection { + constructor( + /** + The ranges in the selection, sorted by position. Ranges cannot + overlap (but they may touch, if they aren't empty). + */ + ranges, + /** + The index of the _main_ range in the selection (which is + usually the range that was added last). + */ + mainIndex) { + this.ranges = ranges; + this.mainIndex = mainIndex; + } + /** + Map a selection through a change. Used to adjust the selection + position for changes. + */ + map(change, assoc = -1) { + if (change.empty) + return this; + return EditorSelection.create(this.ranges.map(r => r.map(change, assoc)), this.mainIndex); + } + /** + Compare this selection to another selection. + */ + eq(other) { + if (this.ranges.length != other.ranges.length || + this.mainIndex != other.mainIndex) + return false; + for (let i = 0; i < this.ranges.length; i++) + if (!this.ranges[i].eq(other.ranges[i])) + return false; + return true; + } + /** + Get the primary selection range. Usually, you should make sure + your code applies to _all_ ranges, by using methods like + [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange). + */ + get main() { return this.ranges[this.mainIndex]; } + /** + Make sure the selection only has one range. Returns a selection + holding only the main range from this selection. + */ + asSingle() { + return this.ranges.length == 1 ? this : new EditorSelection([this.main], 0); + } + /** + Extend this selection with an extra range. + */ + addRange(range, main = true) { + return EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1); + } + /** + Replace a given range with another range, and then normalize the + selection to merge and sort ranges if necessary. + */ + replaceRange(range, which = this.mainIndex) { + let ranges = this.ranges.slice(); + ranges[which] = range; + return EditorSelection.create(ranges, this.mainIndex); + } + /** + Convert this selection to an object that can be serialized to + JSON. + */ + toJSON() { + return { ranges: this.ranges.map(r => r.toJSON()), main: this.mainIndex }; + } + /** + Create a selection from a JSON representation. + */ + static fromJSON(json) { + if (!json || !Array.isArray(json.ranges) || typeof json.main != "number" || json.main >= json.ranges.length) + throw new RangeError("Invalid JSON representation for EditorSelection"); + return new EditorSelection(json.ranges.map((r) => SelectionRange.fromJSON(r)), json.main); + } + /** + Create a selection holding a single range. + */ + static single(anchor, head = anchor) { + return new EditorSelection([EditorSelection.range(anchor, head)], 0); + } + /** + Sort and merge the given set of ranges, creating a valid + selection. + */ + static create(ranges, mainIndex = 0) { + if (ranges.length == 0) + throw new RangeError("A selection needs at least one range"); + for (let pos = 0, i = 0; i < ranges.length; i++) { + let range = ranges[i]; + if (range.empty ? range.from <= pos : range.from < pos) + return EditorSelection.normalized(ranges.slice(), mainIndex); + pos = range.to; + } + return new EditorSelection(ranges, mainIndex); + } + /** + Create a cursor selection range at the given position. You can + safely ignore the optional arguments in most situations. + */ + static cursor(pos, assoc = 0, bidiLevel, goalColumn) { + return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 4 /* RangeFlag.AssocBefore */ : 8 /* RangeFlag.AssocAfter */) | + (bidiLevel == null ? 3 : Math.min(2, bidiLevel)) | + ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */)); + } + /** + Create a selection range. + */ + static range(anchor, head, goalColumn, bidiLevel) { + let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) | + (bidiLevel == null ? 3 : Math.min(2, bidiLevel)); + return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags) + : SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags); + } + /** + @internal + */ + static normalized(ranges, mainIndex = 0) { + let main = ranges[mainIndex]; + ranges.sort((a, b) => a.from - b.from); + mainIndex = ranges.indexOf(main); + for (let i = 1; i < ranges.length; i++) { + let range = ranges[i], prev = ranges[i - 1]; + if (range.empty ? range.from <= prev.to : range.from < prev.to) { + let from = prev.from, to = Math.max(range.to, prev.to); + if (i <= mainIndex) + mainIndex--; + ranges.splice(--i, 2, range.anchor > range.head ? EditorSelection.range(to, from) : EditorSelection.range(from, to)); + } + } + return new EditorSelection(ranges, mainIndex); + } +} +function checkSelection(selection, docLength) { + for (let range of selection.ranges) + if (range.to > docLength) + throw new RangeError("Selection points outside of document"); +} + +let nextID = 0; +/** +A facet is a labeled value that is associated with an editor +state. It takes inputs from any number of extensions, and combines +those into a single output value. + +Examples of uses of facets are the [tab +size](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize), [editor +attributes](https://codemirror.net/6/docs/ref/#view.EditorView^editorAttributes), and [update +listeners](https://codemirror.net/6/docs/ref/#view.EditorView^updateListener). +*/ +class Facet { + constructor( + /** + @internal + */ + combine, + /** + @internal + */ + compareInput, + /** + @internal + */ + compare, isStatic, enables) { + this.combine = combine; + this.compareInput = compareInput; + this.compare = compare; + this.isStatic = isStatic; + /** + @internal + */ + this.id = nextID++; + this.default = combine([]); + this.extensions = typeof enables == "function" ? enables(this) : enables; + } + /** + Define a new facet. + */ + static define(config = {}) { + return new Facet(config.combine || ((a) => a), config.compareInput || ((a, b) => a === b), config.compare || (!config.combine ? sameArray$1 : (a, b) => a === b), !!config.static, config.enables); + } + /** + Returns an extension that adds the given value to this facet. + */ + of(value) { + return new FacetProvider([], this, 0 /* Provider.Static */, value); + } + /** + Create an extension that computes a value for the facet from a + state. You must take care to declare the parts of the state that + this value depends on, since your function is only called again + for a new state when one of those parts changed. + + In cases where your value depends only on a single field, you'll + want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead. + */ + compute(deps, get) { + if (this.isStatic) + throw new Error("Can't compute a static facet"); + return new FacetProvider(deps, this, 1 /* Provider.Single */, get); + } + /** + Create an extension that computes zero or more values for this + facet from a state. + */ + computeN(deps, get) { + if (this.isStatic) + throw new Error("Can't compute a static facet"); + return new FacetProvider(deps, this, 2 /* Provider.Multi */, get); + } + from(field, get) { + if (!get) + get = x => x; + return this.compute([field], state => get(state.field(field))); + } +} +function sameArray$1(a, b) { + return a == b || a.length == b.length && a.every((e, i) => e === b[i]); +} +class FacetProvider { + constructor(dependencies, facet, type, value) { + this.dependencies = dependencies; + this.facet = facet; + this.type = type; + this.value = value; + this.id = nextID++; + } + dynamicSlot(addresses) { + var _a; + let getter = this.value; + let compare = this.facet.compareInput; + let id = this.id, idx = addresses[id] >> 1, multi = this.type == 2 /* Provider.Multi */; + let depDoc = false, depSel = false, depAddrs = []; + for (let dep of this.dependencies) { + if (dep == "doc") + depDoc = true; + else if (dep == "selection") + depSel = true; + else if ((((_a = addresses[dep.id]) !== null && _a !== void 0 ? _a : 1) & 1) == 0) + depAddrs.push(addresses[dep.id]); + } + return { + create(state) { + state.values[idx] = getter(state); + return 1 /* SlotStatus.Changed */; + }, + update(state, tr) { + if ((depDoc && tr.docChanged) || (depSel && (tr.docChanged || tr.selection)) || ensureAll(state, depAddrs)) { + let newVal = getter(state); + if (multi ? !compareArray(newVal, state.values[idx], compare) : !compare(newVal, state.values[idx])) { + state.values[idx] = newVal; + return 1 /* SlotStatus.Changed */; + } + } + return 0; + }, + reconfigure: (state, oldState) => { + let newVal, oldAddr = oldState.config.address[id]; + if (oldAddr != null) { + let oldVal = getAddr(oldState, oldAddr); + if (this.dependencies.every(dep => { + return dep instanceof Facet ? oldState.facet(dep) === state.facet(dep) : + dep instanceof StateField ? oldState.field(dep, false) == state.field(dep, false) : true; + }) || (multi ? compareArray(newVal = getter(state), oldVal, compare) : compare(newVal = getter(state), oldVal))) { + state.values[idx] = oldVal; + return 0; + } + } + else { + newVal = getter(state); + } + state.values[idx] = newVal; + return 1 /* SlotStatus.Changed */; + } + }; + } +} +function compareArray(a, b, compare) { + if (a.length != b.length) + return false; + for (let i = 0; i < a.length; i++) + if (!compare(a[i], b[i])) + return false; + return true; +} +function ensureAll(state, addrs) { + let changed = false; + for (let addr of addrs) + if (ensureAddr(state, addr) & 1 /* SlotStatus.Changed */) + changed = true; + return changed; +} +function dynamicFacetSlot(addresses, facet, providers) { + let providerAddrs = providers.map(p => addresses[p.id]); + let providerTypes = providers.map(p => p.type); + let dynamic = providerAddrs.filter(p => !(p & 1)); + let idx = addresses[facet.id] >> 1; + function get(state) { + let values = []; + for (let i = 0; i < providerAddrs.length; i++) { + let value = getAddr(state, providerAddrs[i]); + if (providerTypes[i] == 2 /* Provider.Multi */) + for (let val of value) + values.push(val); + else + values.push(value); + } + return facet.combine(values); + } + return { + create(state) { + for (let addr of providerAddrs) + ensureAddr(state, addr); + state.values[idx] = get(state); + return 1 /* SlotStatus.Changed */; + }, + update(state, tr) { + if (!ensureAll(state, dynamic)) + return 0; + let value = get(state); + if (facet.compare(value, state.values[idx])) + return 0; + state.values[idx] = value; + return 1 /* SlotStatus.Changed */; + }, + reconfigure(state, oldState) { + let depChanged = ensureAll(state, providerAddrs); + let oldProviders = oldState.config.facets[facet.id], oldValue = oldState.facet(facet); + if (oldProviders && !depChanged && sameArray$1(providers, oldProviders)) { + state.values[idx] = oldValue; + return 0; + } + let value = get(state); + if (facet.compare(value, oldValue)) { + state.values[idx] = oldValue; + return 0; + } + state.values[idx] = value; + return 1 /* SlotStatus.Changed */; + } + }; +} +const initField = /*@__PURE__*/Facet.define({ static: true }); +/** +Fields can store additional information in an editor state, and +keep it in sync with the rest of the state. +*/ +class StateField { + constructor( + /** + @internal + */ + id, createF, updateF, compareF, + /** + @internal + */ + spec) { + this.id = id; + this.createF = createF; + this.updateF = updateF; + this.compareF = compareF; + this.spec = spec; + /** + @internal + */ + this.provides = undefined; + } + /** + Define a state field. + */ + static define(config) { + let field = new StateField(nextID++, config.create, config.update, config.compare || ((a, b) => a === b), config); + if (config.provide) + field.provides = config.provide(field); + return field; + } + create(state) { + let init = state.facet(initField).find(i => i.field == this); + return ((init === null || init === void 0 ? void 0 : init.create) || this.createF)(state); + } + /** + @internal + */ + slot(addresses) { + let idx = addresses[this.id] >> 1; + return { + create: (state) => { + state.values[idx] = this.create(state); + return 1 /* SlotStatus.Changed */; + }, + update: (state, tr) => { + let oldVal = state.values[idx]; + let value = this.updateF(oldVal, tr); + if (this.compareF(oldVal, value)) + return 0; + state.values[idx] = value; + return 1 /* SlotStatus.Changed */; + }, + reconfigure: (state, oldState) => { + if (oldState.config.address[this.id] != null) { + state.values[idx] = oldState.field(this); + return 0; + } + state.values[idx] = this.create(state); + return 1 /* SlotStatus.Changed */; + } + }; + } + /** + Returns an extension that enables this field and overrides the + way it is initialized. Can be useful when you need to provide a + non-default starting value for the field. + */ + init(create) { + return [this, initField.of({ field: this, create })]; + } + /** + State field instances can be used as + [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a + given state. + */ + get extension() { return this; } +} +const Prec_ = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 }; +function prec(value) { + return (ext) => new PrecExtension(ext, value); +} +/** +By default extensions are registered in the order they are found +in the flattened form of nested array that was provided. +Individual extension values can be assigned a precedence to +override this. Extensions that do not have a precedence set get +the precedence of the nearest parent with a precedence, or +[`default`](https://codemirror.net/6/docs/ref/#state.Prec.default) if there is no such parent. The +final ordering of extensions is determined by first sorting by +precedence and then by order within each precedence. +*/ +const Prec = { + /** + The highest precedence level, for extensions that should end up + near the start of the precedence ordering. + */ + highest: /*@__PURE__*/prec(Prec_.highest), + /** + A higher-than-default precedence, for extensions that should + come before those with default precedence. + */ + high: /*@__PURE__*/prec(Prec_.high), + /** + The default precedence, which is also used for extensions + without an explicit precedence. + */ + default: /*@__PURE__*/prec(Prec_.default), + /** + A lower-than-default precedence. + */ + low: /*@__PURE__*/prec(Prec_.low), + /** + The lowest precedence level. Meant for things that should end up + near the end of the extension order. + */ + lowest: /*@__PURE__*/prec(Prec_.lowest) +}; +class PrecExtension { + constructor(inner, prec) { + this.inner = inner; + this.prec = prec; + } +} +/** +Extension compartments can be used to make a configuration +dynamic. By [wrapping](https://codemirror.net/6/docs/ref/#state.Compartment.of) part of your +configuration in a compartment, you can later +[replace](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure) that part through a +transaction. +*/ +class Compartment { + /** + Create an instance of this compartment to add to your [state + configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions). + */ + of(ext) { return new CompartmentInstance(this, ext); } + /** + Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that + reconfigures this compartment. + */ + reconfigure(content) { + return Compartment.reconfigure.of({ compartment: this, extension: content }); + } + /** + Get the current content of the compartment in the state, or + `undefined` if it isn't present. + */ + get(state) { + return state.config.compartments.get(this); + } +} +class CompartmentInstance { + constructor(compartment, inner) { + this.compartment = compartment; + this.inner = inner; + } +} +class Configuration { + constructor(base, compartments, dynamicSlots, address, staticValues, facets) { + this.base = base; + this.compartments = compartments; + this.dynamicSlots = dynamicSlots; + this.address = address; + this.staticValues = staticValues; + this.facets = facets; + this.statusTemplate = []; + while (this.statusTemplate.length < dynamicSlots.length) + this.statusTemplate.push(0 /* SlotStatus.Unresolved */); + } + staticFacet(facet) { + let addr = this.address[facet.id]; + return addr == null ? facet.default : this.staticValues[addr >> 1]; + } + static resolve(base, compartments, oldState) { + let fields = []; + let facets = Object.create(null); + let newCompartments = new Map(); + for (let ext of flatten(base, compartments, newCompartments)) { + if (ext instanceof StateField) + fields.push(ext); + else + (facets[ext.facet.id] || (facets[ext.facet.id] = [])).push(ext); + } + let address = Object.create(null); + let staticValues = []; + let dynamicSlots = []; + for (let field of fields) { + address[field.id] = dynamicSlots.length << 1; + dynamicSlots.push(a => field.slot(a)); + } + let oldFacets = oldState === null || oldState === void 0 ? void 0 : oldState.config.facets; + for (let id in facets) { + let providers = facets[id], facet = providers[0].facet; + let oldProviders = oldFacets && oldFacets[id] || []; + if (providers.every(p => p.type == 0 /* Provider.Static */)) { + address[facet.id] = (staticValues.length << 1) | 1; + if (sameArray$1(oldProviders, providers)) { + staticValues.push(oldState.facet(facet)); + } + else { + let value = facet.combine(providers.map(p => p.value)); + staticValues.push(oldState && facet.compare(value, oldState.facet(facet)) ? oldState.facet(facet) : value); + } + } + else { + for (let p of providers) { + if (p.type == 0 /* Provider.Static */) { + address[p.id] = (staticValues.length << 1) | 1; + staticValues.push(p.value); + } + else { + address[p.id] = dynamicSlots.length << 1; + dynamicSlots.push(a => p.dynamicSlot(a)); + } + } + address[facet.id] = dynamicSlots.length << 1; + dynamicSlots.push(a => dynamicFacetSlot(a, facet, providers)); + } + } + let dynamic = dynamicSlots.map(f => f(address)); + return new Configuration(base, newCompartments, dynamic, address, staticValues, facets); + } +} +function flatten(extension, compartments, newCompartments) { + let result = [[], [], [], [], []]; + let seen = new Map(); + function inner(ext, prec) { + let known = seen.get(ext); + if (known != null) { + if (known <= prec) + return; + let found = result[known].indexOf(ext); + if (found > -1) + result[known].splice(found, 1); + if (ext instanceof CompartmentInstance) + newCompartments.delete(ext.compartment); + } + seen.set(ext, prec); + if (Array.isArray(ext)) { + for (let e of ext) + inner(e, prec); + } + else if (ext instanceof CompartmentInstance) { + if (newCompartments.has(ext.compartment)) + throw new RangeError(`Duplicate use of compartment in extensions`); + let content = compartments.get(ext.compartment) || ext.inner; + newCompartments.set(ext.compartment, content); + inner(content, prec); + } + else if (ext instanceof PrecExtension) { + inner(ext.inner, ext.prec); + } + else if (ext instanceof StateField) { + result[prec].push(ext); + if (ext.provides) + inner(ext.provides, prec); + } + else if (ext instanceof FacetProvider) { + result[prec].push(ext); + if (ext.facet.extensions) + inner(ext.facet.extensions, Prec_.default); + } + else { + let content = ext.extension; + if (!content) + throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`); + inner(content, prec); + } + } + inner(extension, Prec_.default); + return result.reduce((a, b) => a.concat(b)); +} +function ensureAddr(state, addr) { + if (addr & 1) + return 2 /* SlotStatus.Computed */; + let idx = addr >> 1; + let status = state.status[idx]; + if (status == 4 /* SlotStatus.Computing */) + throw new Error("Cyclic dependency between fields and/or facets"); + if (status & 2 /* SlotStatus.Computed */) + return status; + state.status[idx] = 4 /* SlotStatus.Computing */; + let changed = state.computeSlot(state, state.config.dynamicSlots[idx]); + return state.status[idx] = 2 /* SlotStatus.Computed */ | changed; +} +function getAddr(state, addr) { + return addr & 1 ? state.config.staticValues[addr >> 1] : state.values[addr >> 1]; +} + +const languageData = /*@__PURE__*/Facet.define(); +const allowMultipleSelections = /*@__PURE__*/Facet.define({ + combine: values => values.some(v => v), + static: true +}); +const lineSeparator = /*@__PURE__*/Facet.define({ + combine: values => values.length ? values[0] : undefined, + static: true +}); +const changeFilter = /*@__PURE__*/Facet.define(); +const transactionFilter = /*@__PURE__*/Facet.define(); +const transactionExtender = /*@__PURE__*/Facet.define(); +const readOnly = /*@__PURE__*/Facet.define({ + combine: values => values.length ? values[0] : false +}); + +/** +Annotations are tagged values that are used to add metadata to +transactions in an extensible way. They should be used to model +things that effect the entire transaction (such as its [time +stamp](https://codemirror.net/6/docs/ref/#state.Transaction^time) or information about its +[origin](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent)). For effects that happen +_alongside_ the other changes made by the transaction, [state +effects](https://codemirror.net/6/docs/ref/#state.StateEffect) are more appropriate. +*/ +class Annotation { + /** + @internal + */ + constructor( + /** + The annotation type. + */ + type, + /** + The value of this annotation. + */ + value) { + this.type = type; + this.value = value; + } + /** + Define a new type of annotation. + */ + static define() { return new AnnotationType(); } +} +/** +Marker that identifies a type of [annotation](https://codemirror.net/6/docs/ref/#state.Annotation). +*/ +class AnnotationType { + /** + Create an instance of this annotation. + */ + of(value) { return new Annotation(this, value); } +} +/** +Representation of a type of state effect. Defined with +[`StateEffect.define`](https://codemirror.net/6/docs/ref/#state.StateEffect^define). +*/ +class StateEffectType { + /** + @internal + */ + constructor( + // The `any` types in these function types are there to work + // around TypeScript issue #37631, where the type guard on + // `StateEffect.is` mysteriously stops working when these properly + // have type `Value`. + /** + @internal + */ + map) { + this.map = map; + } + /** + Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this + type. + */ + of(value) { return new StateEffect(this, value); } +} +/** +State effects can be used to represent additional effects +associated with a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction.effects). They +are often useful to model changes to custom [state +fields](https://codemirror.net/6/docs/ref/#state.StateField), when those changes aren't implicit in +document or selection changes. +*/ +class StateEffect { + /** + @internal + */ + constructor( + /** + @internal + */ + type, + /** + The value of this effect. + */ + value) { + this.type = type; + this.value = value; + } + /** + Map this effect through a position mapping. Will return + `undefined` when that ends up deleting the effect. + */ + map(mapping) { + let mapped = this.type.map(this.value, mapping); + return mapped === undefined ? undefined : mapped == this.value ? this : new StateEffect(this.type, mapped); + } + /** + Tells you whether this effect object is of a given + [type](https://codemirror.net/6/docs/ref/#state.StateEffectType). + */ + is(type) { return this.type == type; } + /** + Define a new effect type. The type parameter indicates the type + of values that his effect holds. It should be a type that + doesn't include `undefined`, since that is used in + [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is + removed. + */ + static define(spec = {}) { + return new StateEffectType(spec.map || (v => v)); + } + /** + Map an array of effects through a change set. + */ + static mapEffects(effects, mapping) { + if (!effects.length) + return effects; + let result = []; + for (let effect of effects) { + let mapped = effect.map(mapping); + if (mapped) + result.push(mapped); + } + return result; + } +} +/** +This effect can be used to reconfigure the root extensions of +the editor. Doing this will discard any extensions +[appended](https://codemirror.net/6/docs/ref/#state.StateEffect^appendConfig), but does not reset +the content of [reconfigured](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure) +compartments. +*/ +StateEffect.reconfigure = /*@__PURE__*/StateEffect.define(); +/** +Append extensions to the top-level configuration of the editor. +*/ +StateEffect.appendConfig = /*@__PURE__*/StateEffect.define(); +/** +Changes to the editor state are grouped into transactions. +Typically, a user action creates a single transaction, which may +contain any number of document changes, may change the selection, +or have other effects. Create a transaction by calling +[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update), or immediately +dispatch one by calling +[`EditorView.dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch). +*/ +class Transaction { + constructor( + /** + The state from which the transaction starts. + */ + startState, + /** + The document changes made by this transaction. + */ + changes, + /** + The selection set by this transaction, or undefined if it + doesn't explicitly set a selection. + */ + selection, + /** + The effects added to the transaction. + */ + effects, + /** + @internal + */ + annotations, + /** + Whether the selection should be scrolled into view after this + transaction is dispatched. + */ + scrollIntoView) { + this.startState = startState; + this.changes = changes; + this.selection = selection; + this.effects = effects; + this.annotations = annotations; + this.scrollIntoView = scrollIntoView; + /** + @internal + */ + this._doc = null; + /** + @internal + */ + this._state = null; + if (selection) + checkSelection(selection, changes.newLength); + if (!annotations.some((a) => a.type == Transaction.time)) + this.annotations = annotations.concat(Transaction.time.of(Date.now())); + } + /** + @internal + */ + static create(startState, changes, selection, effects, annotations, scrollIntoView) { + return new Transaction(startState, changes, selection, effects, annotations, scrollIntoView); + } + /** + The new document produced by the transaction. Contrary to + [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't + force the entire new state to be computed right away, so it is + recommended that [transaction + filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter + when they need to look at the new document. + */ + get newDoc() { + return this._doc || (this._doc = this.changes.apply(this.startState.doc)); + } + /** + The new selection produced by the transaction. If + [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined, + this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's + current selection through the changes made by the transaction. + */ + get newSelection() { + return this.selection || this.startState.selection.map(this.changes); + } + /** + The new state created by the transaction. Computed on demand + (but retained for subsequent access), so it is recommended not to + access it in [transaction + filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible. + */ + get state() { + if (!this._state) + this.startState.applyTransaction(this); + return this._state; + } + /** + Get the value of the given annotation type, if any. + */ + annotation(type) { + for (let ann of this.annotations) + if (ann.type == type) + return ann.value; + return undefined; + } + /** + Indicates whether the transaction changed the document. + */ + get docChanged() { return !this.changes.empty; } + /** + Indicates whether this transaction reconfigures the state + (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or + with a top-level configuration + [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure). + */ + get reconfigured() { return this.startState.config != this.state.config; } + /** + Returns true if the transaction has a [user + event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to + or more specific than `event`. For example, if the transaction + has `"select.pointer"` as user event, `"select"` and + `"select.pointer"` will match it. + */ + isUserEvent(event) { + let e = this.annotation(Transaction.userEvent); + return !!(e && (e == event || e.length > event.length && e.slice(0, event.length) == event && e[event.length] == ".")); + } +} +/** +Annotation used to store transaction timestamps. Automatically +added to every transaction, holding `Date.now()`. +*/ +Transaction.time = /*@__PURE__*/Annotation.define(); +/** +Annotation used to associate a transaction with a user interface +event. Holds a string identifying the event, using a +dot-separated format to support attaching more specific +information. The events used by the core libraries are: + + - `"input"` when content is entered + - `"input.type"` for typed input + - `"input.type.compose"` for composition + - `"input.paste"` for pasted input + - `"input.drop"` when adding content with drag-and-drop + - `"input.complete"` when autocompleting + - `"delete"` when the user deletes content + - `"delete.selection"` when deleting the selection + - `"delete.forward"` when deleting forward from the selection + - `"delete.backward"` when deleting backward from the selection + - `"delete.cut"` when cutting to the clipboard + - `"move"` when content is moved + - `"move.drop"` when content is moved within the editor through drag-and-drop + - `"select"` when explicitly changing the selection + - `"select.pointer"` when selecting with a mouse or other pointing device + - `"undo"` and `"redo"` for history actions + +Use [`isUserEvent`](https://codemirror.net/6/docs/ref/#state.Transaction.isUserEvent) to check +whether the annotation matches a given event. +*/ +Transaction.userEvent = /*@__PURE__*/Annotation.define(); +/** +Annotation indicating whether a transaction should be added to +the undo history or not. +*/ +Transaction.addToHistory = /*@__PURE__*/Annotation.define(); +/** +Annotation indicating (when present and true) that a transaction +represents a change made by some other actor, not the user. This +is used, for example, to tag other people's changes in +collaborative editing. +*/ +Transaction.remote = /*@__PURE__*/Annotation.define(); +function joinRanges(a, b) { + let result = []; + for (let iA = 0, iB = 0;;) { + let from, to; + if (iA < a.length && (iB == b.length || b[iB] >= a[iA])) { + from = a[iA++]; + to = a[iA++]; + } + else if (iB < b.length) { + from = b[iB++]; + to = b[iB++]; + } + else + return result; + if (!result.length || result[result.length - 1] < from) + result.push(from, to); + else if (result[result.length - 1] < to) + result[result.length - 1] = to; + } +} +function mergeTransaction(a, b, sequential) { + var _a; + let mapForA, mapForB, changes; + if (sequential) { + mapForA = b.changes; + mapForB = ChangeSet.empty(b.changes.length); + changes = a.changes.compose(b.changes); + } + else { + mapForA = b.changes.map(a.changes); + mapForB = a.changes.mapDesc(b.changes, true); + changes = a.changes.compose(mapForA); + } + return { + changes, + selection: b.selection ? b.selection.map(mapForB) : (_a = a.selection) === null || _a === void 0 ? void 0 : _a.map(mapForA), + effects: StateEffect.mapEffects(a.effects, mapForA).concat(StateEffect.mapEffects(b.effects, mapForB)), + annotations: a.annotations.length ? a.annotations.concat(b.annotations) : b.annotations, + scrollIntoView: a.scrollIntoView || b.scrollIntoView + }; +} +function resolveTransactionInner(state, spec, docSize) { + let sel = spec.selection, annotations = asArray$1(spec.annotations); + if (spec.userEvent) + annotations = annotations.concat(Transaction.userEvent.of(spec.userEvent)); + return { + changes: spec.changes instanceof ChangeSet ? spec.changes + : ChangeSet.of(spec.changes || [], docSize, state.facet(lineSeparator)), + selection: sel && (sel instanceof EditorSelection ? sel : EditorSelection.single(sel.anchor, sel.head)), + effects: asArray$1(spec.effects), + annotations, + scrollIntoView: !!spec.scrollIntoView + }; +} +function resolveTransaction(state, specs, filter) { + let s = resolveTransactionInner(state, specs.length ? specs[0] : {}, state.doc.length); + if (specs.length && specs[0].filter === false) + filter = false; + for (let i = 1; i < specs.length; i++) { + if (specs[i].filter === false) + filter = false; + let seq = !!specs[i].sequential; + s = mergeTransaction(s, resolveTransactionInner(state, specs[i], seq ? s.changes.newLength : state.doc.length), seq); + } + let tr = Transaction.create(state, s.changes, s.selection, s.effects, s.annotations, s.scrollIntoView); + return extendTransaction(filter ? filterTransaction(tr) : tr); +} +// Finish a transaction by applying filters if necessary. +function filterTransaction(tr) { + let state = tr.startState; + // Change filters + let result = true; + for (let filter of state.facet(changeFilter)) { + let value = filter(tr); + if (value === false) { + result = false; + break; + } + if (Array.isArray(value)) + result = result === true ? value : joinRanges(result, value); + } + if (result !== true) { + let changes, back; + if (result === false) { + back = tr.changes.invertedDesc; + changes = ChangeSet.empty(state.doc.length); + } + else { + let filtered = tr.changes.filter(result); + changes = filtered.changes; + back = filtered.filtered.mapDesc(filtered.changes).invertedDesc; + } + tr = Transaction.create(state, changes, tr.selection && tr.selection.map(back), StateEffect.mapEffects(tr.effects, back), tr.annotations, tr.scrollIntoView); + } + // Transaction filters + let filters = state.facet(transactionFilter); + for (let i = filters.length - 1; i >= 0; i--) { + let filtered = filters[i](tr); + if (filtered instanceof Transaction) + tr = filtered; + else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction) + tr = filtered[0]; + else + tr = resolveTransaction(state, asArray$1(filtered), false); + } + return tr; +} +function extendTransaction(tr) { + let state = tr.startState, extenders = state.facet(transactionExtender), spec = tr; + for (let i = extenders.length - 1; i >= 0; i--) { + let extension = extenders[i](tr); + if (extension && Object.keys(extension).length) + spec = mergeTransaction(spec, resolveTransactionInner(state, extension, tr.changes.newLength), true); + } + return spec == tr ? tr : Transaction.create(state, tr.changes, tr.selection, spec.effects, spec.annotations, spec.scrollIntoView); +} +const none$1 = []; +function asArray$1(value) { + return value == null ? none$1 : Array.isArray(value) ? value : [value]; +} + +/** +The categories produced by a [character +categorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer). These are used +do things like selecting by word. +*/ +exports.CharCategory = /*@__PURE__*/(function (CharCategory) { + /** + Word characters. + */ + CharCategory[CharCategory["Word"] = 0] = "Word"; + /** + Whitespace. + */ + CharCategory[CharCategory["Space"] = 1] = "Space"; + /** + Anything else. + */ + CharCategory[CharCategory["Other"] = 2] = "Other"; +return CharCategory})(exports.CharCategory || (exports.CharCategory = {})); +const nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; +let wordChar; +try { + wordChar = /*@__PURE__*/new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u"); +} +catch (_) { } +function hasWordChar(str) { + if (wordChar) + return wordChar.test(str); + for (let i = 0; i < str.length; i++) { + let ch = str[i]; + if (/\w/.test(ch) || ch > "\x80" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))) + return true; + } + return false; +} +function makeCategorizer(wordChars) { + return (char) => { + if (!/\S/.test(char)) + return exports.CharCategory.Space; + if (hasWordChar(char)) + return exports.CharCategory.Word; + for (let i = 0; i < wordChars.length; i++) + if (char.indexOf(wordChars[i]) > -1) + return exports.CharCategory.Word; + return exports.CharCategory.Other; + }; +} + +/** +The editor state class is a persistent (immutable) data structure. +To update a state, you [create](https://codemirror.net/6/docs/ref/#state.EditorState.update) a +[transaction](https://codemirror.net/6/docs/ref/#state.Transaction), which produces a _new_ state +instance, without modifying the original object. + +As such, _never_ mutate properties of a state directly. That'll +just break things. +*/ +class EditorState { + constructor( + /** + @internal + */ + config, + /** + The current document. + */ + doc, + /** + The current selection. + */ + selection, + /** + @internal + */ + values, computeSlot, tr) { + this.config = config; + this.doc = doc; + this.selection = selection; + this.values = values; + this.status = config.statusTemplate.slice(); + this.computeSlot = computeSlot; + // Fill in the computed state immediately, so that further queries + // for it made during the update return this state + if (tr) + tr._state = this; + for (let i = 0; i < this.config.dynamicSlots.length; i++) + ensureAddr(this, i << 1); + this.computeSlot = null; + } + field(field, require = true) { + let addr = this.config.address[field.id]; + if (addr == null) { + if (require) + throw new RangeError("Field is not present in this state"); + return undefined; + } + ensureAddr(this, addr); + return getAddr(this, addr); + } + /** + Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this + state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec) + can be passed. Unless + [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the + [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec + are assumed to start in the _current_ document (not the document + produced by previous specs), and its + [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and + [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer + to the document created by its _own_ changes. The resulting + transaction contains the combined effect of all the different + specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later + specs take precedence over earlier ones. + */ + update(...specs) { + return resolveTransaction(this, specs, true); + } + /** + @internal + */ + applyTransaction(tr) { + let conf = this.config, { base, compartments } = conf; + for (let effect of tr.effects) { + if (effect.is(Compartment.reconfigure)) { + if (conf) { + compartments = new Map; + conf.compartments.forEach((val, key) => compartments.set(key, val)); + conf = null; + } + compartments.set(effect.value.compartment, effect.value.extension); + } + else if (effect.is(StateEffect.reconfigure)) { + conf = null; + base = effect.value; + } + else if (effect.is(StateEffect.appendConfig)) { + conf = null; + base = asArray$1(base).concat(effect.value); + } + } + let startValues; + if (!conf) { + conf = Configuration.resolve(base, compartments, this); + let intermediateState = new EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null); + startValues = intermediateState.values; + } + else { + startValues = tr.startState.values.slice(); + } + new EditorState(conf, tr.newDoc, tr.newSelection, startValues, (state, slot) => slot.update(state, tr), tr); + } + /** + Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that + replaces every selection range with the given content. + */ + replaceSelection(text) { + if (typeof text == "string") + text = this.toText(text); + return this.changeByRange(range => ({ changes: { from: range.from, to: range.to, insert: text }, + range: EditorSelection.cursor(range.from + text.length) })); + } + /** + Create a set of changes and a new selection by running the given + function for each range in the active selection. The function + can return an optional set of changes (in the coordinate space + of the start document), plus an updated range (in the coordinate + space of the document produced by the call's own changes). This + method will merge all the changes and ranges into a single + changeset and selection, and return it as a [transaction + spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to + [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update). + */ + changeByRange(f) { + let sel = this.selection; + let result1 = f(sel.ranges[0]); + let changes = this.changes(result1.changes), ranges = [result1.range]; + let effects = asArray$1(result1.effects); + for (let i = 1; i < sel.ranges.length; i++) { + let result = f(sel.ranges[i]); + let newChanges = this.changes(result.changes), newMapped = newChanges.map(changes); + for (let j = 0; j < i; j++) + ranges[j] = ranges[j].map(newMapped); + let mapBy = changes.mapDesc(newChanges, true); + ranges.push(result.range.map(mapBy)); + changes = changes.compose(newMapped); + effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray$1(result.effects), mapBy)); + } + return { + changes, + selection: EditorSelection.create(ranges, sel.mainIndex), + effects + }; + } + /** + Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change + description, taking the state's document length and line + separator into account. + */ + changes(spec = []) { + if (spec instanceof ChangeSet) + return spec; + return ChangeSet.of(spec, this.doc.length, this.facet(EditorState.lineSeparator)); + } + /** + Using the state's [line + separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a + [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string. + */ + toText(string) { + return Text.of(string.split(this.facet(EditorState.lineSeparator) || DefaultSplit)); + } + /** + Return the given range of the document as a string. + */ + sliceDoc(from = 0, to = this.doc.length) { + return this.doc.sliceString(from, to, this.lineBreak); + } + /** + Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet). + */ + facet(facet) { + let addr = this.config.address[facet.id]; + if (addr == null) + return facet.default; + ensureAddr(this, addr); + return getAddr(this, addr); + } + /** + Convert this state to a JSON-serializable object. When custom + fields should be serialized, you can pass them in as an object + mapping property names (in the resulting object, which should + not use `doc` or `selection`) to fields. + */ + toJSON(fields) { + let result = { + doc: this.sliceDoc(), + selection: this.selection.toJSON() + }; + if (fields) + for (let prop in fields) { + let value = fields[prop]; + if (value instanceof StateField && this.config.address[value.id] != null) + result[prop] = value.spec.toJSON(this.field(fields[prop]), this); + } + return result; + } + /** + Deserialize a state from its JSON representation. When custom + fields should be deserialized, pass the same object you passed + to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as + third argument. + */ + static fromJSON(json, config = {}, fields) { + if (!json || typeof json.doc != "string") + throw new RangeError("Invalid JSON representation for EditorState"); + let fieldInit = []; + if (fields) + for (let prop in fields) { + if (Object.prototype.hasOwnProperty.call(json, prop)) { + let field = fields[prop], value = json[prop]; + fieldInit.push(field.init(state => field.spec.fromJSON(value, state))); + } + } + return EditorState.create({ + doc: json.doc, + selection: EditorSelection.fromJSON(json.selection), + extensions: config.extensions ? fieldInit.concat([config.extensions]) : fieldInit + }); + } + /** + Create a new state. You'll usually only need this when + initializing an editor—updated states are created by applying + transactions. + */ + static create(config = {}) { + let configuration = Configuration.resolve(config.extensions || [], new Map); + let doc = config.doc instanceof Text ? config.doc + : Text.of((config.doc || "").split(configuration.staticFacet(EditorState.lineSeparator) || DefaultSplit)); + let selection = !config.selection ? EditorSelection.single(0) + : config.selection instanceof EditorSelection ? config.selection + : EditorSelection.single(config.selection.anchor, config.selection.head); + checkSelection(selection, doc.length); + if (!configuration.staticFacet(allowMultipleSelections)) + selection = selection.asSingle(); + return new EditorState(configuration, doc, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null); + } + /** + The size (in columns) of a tab in the document, determined by + the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet. + */ + get tabSize() { return this.facet(EditorState.tabSize); } + /** + Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator) + string for this state. + */ + get lineBreak() { return this.facet(EditorState.lineSeparator) || "\n"; } + /** + Returns true when the editor is + [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only. + */ + get readOnly() { return this.facet(readOnly); } + /** + Look up a translation for the given phrase (via the + [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the + original string if no translation is found. + + If additional arguments are passed, they will be inserted in + place of markers like `$1` (for the first value) and `$2`, etc. + A single `$` is equivalent to `$1`, and `$$` will produce a + literal dollar sign. + */ + phrase(phrase, ...insert) { + for (let map of this.facet(EditorState.phrases)) + if (Object.prototype.hasOwnProperty.call(map, phrase)) { + phrase = map[phrase]; + break; + } + if (insert.length) + phrase = phrase.replace(/\$(\$|\d*)/g, (m, i) => { + if (i == "$") + return "$"; + let n = +(i || 1); + return !n || n > insert.length ? m : insert[n - 1]; + }); + return phrase; + } + /** + Find the values for a given language data field, provided by the + the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet. + + Examples of language data fields are... + + - [`"commentTokens"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying + comment syntax. + - [`"autocomplete"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override) + for providing language-specific completion sources. + - [`"wordChars"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding + characters that should be considered part of words in this + language. + - [`"closeBrackets"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls + bracket closing behavior. + */ + languageDataAt(name, pos, side = -1) { + let values = []; + for (let provider of this.facet(languageData)) { + for (let result of provider(this, pos, side)) { + if (Object.prototype.hasOwnProperty.call(result, name)) + values.push(result[name]); + } + } + return values; + } + /** + Return a function that can categorize strings (expected to + represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak)) + into one of: + + - Word (contains an alphanumeric character or a character + explicitly listed in the local language's `"wordChars"` + language data, which should be a string) + - Space (contains only whitespace) + - Other (anything else) + */ + charCategorizer(at) { + return makeCategorizer(this.languageDataAt("wordChars", at).join("")); + } + /** + Find the word at the given position, meaning the range + containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters + around it. If no word characters are adjacent to the position, + this returns null. + */ + wordAt(pos) { + let { text, from, length } = this.doc.lineAt(pos); + let cat = this.charCategorizer(pos); + let start = pos - from, end = pos - from; + while (start > 0) { + let prev = findClusterBreak(text, start, false); + if (cat(text.slice(prev, start)) != exports.CharCategory.Word) + break; + start = prev; + } + while (end < length) { + let next = findClusterBreak(text, end); + if (cat(text.slice(end, next)) != exports.CharCategory.Word) + break; + end = next; + } + return start == end ? null : EditorSelection.range(start + from, end + from); + } +} +/** +A facet that, when enabled, causes the editor to allow multiple +ranges to be selected. Be careful though, because by default the +editor relies on the native DOM selection, which cannot handle +multiple selections. An extension like +[`drawSelection`](https://codemirror.net/6/docs/ref/#view.drawSelection) can be used to make +secondary selections visible to the user. +*/ +EditorState.allowMultipleSelections = allowMultipleSelections; +/** +Configures the tab size to use in this state. The first +(highest-precedence) value of the facet is used. If no value is +given, this defaults to 4. +*/ +EditorState.tabSize = /*@__PURE__*/Facet.define({ + combine: values => values.length ? values[0] : 4 +}); +/** +The line separator to use. By default, any of `"\n"`, `"\r\n"` +and `"\r"` is treated as a separator when splitting lines, and +lines are joined with `"\n"`. + +When you configure a value here, only that precise separator +will be used, allowing you to round-trip documents through the +editor without normalizing line separators. +*/ +EditorState.lineSeparator = lineSeparator; +/** +This facet controls the value of the +[`readOnly`](https://codemirror.net/6/docs/ref/#state.EditorState.readOnly) getter, which is +consulted by commands and extensions that implement editing +functionality to determine whether they should apply. It +defaults to false, but when its highest-precedence value is +`true`, such functionality disables itself. + +Not to be confused with +[`EditorView.editable`](https://codemirror.net/6/docs/ref/#view.EditorView^editable), which +controls whether the editor's DOM is set to be editable (and +thus focusable). +*/ +EditorState.readOnly = readOnly; +/** +Registers translation phrases. The +[`phrase`](https://codemirror.net/6/docs/ref/#state.EditorState.phrase) method will look through +all objects registered with this facet to find translations for +its argument. +*/ +EditorState.phrases = /*@__PURE__*/Facet.define({ + compare(a, b) { + let kA = Object.keys(a), kB = Object.keys(b); + return kA.length == kB.length && kA.every(k => a[k] == b[k]); + } +}); +/** +A facet used to register [language +data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) providers. +*/ +EditorState.languageData = languageData; +/** +Facet used to register change filters, which are called for each +transaction (unless explicitly +[disabled](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter)), and can suppress +part of the transaction's changes. + +Such a function can return `true` to indicate that it doesn't +want to do anything, `false` to completely stop the changes in +the transaction, or a set of ranges in which changes should be +suppressed. Such ranges are represented as an array of numbers, +with each pair of two numbers indicating the start and end of a +range. So for example `[10, 20, 100, 110]` suppresses changes +between 10 and 20, and between 100 and 110. +*/ +EditorState.changeFilter = changeFilter; +/** +Facet used to register a hook that gets a chance to update or +replace transaction specs before they are applied. This will +only be applied for transactions that don't have +[`filter`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter) set to `false`. You +can either return a single transaction spec (possibly the input +transaction), or an array of specs (which will be combined in +the same way as the arguments to +[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update)). + +When possible, it is recommended to avoid accessing +[`Transaction.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state) in a filter, +since it will force creation of a state that will then be +discarded again, if the transaction is actually filtered. + +(This functionality should be used with care. Indiscriminately +modifying transaction is likely to break something or degrade +the user experience.) +*/ +EditorState.transactionFilter = transactionFilter; +/** +This is a more limited form of +[`transactionFilter`](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter), +which can only add +[annotations](https://codemirror.net/6/docs/ref/#state.TransactionSpec.annotations) and +[effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects). _But_, this type +of filter runs even if the transaction has disabled regular +[filtering](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter), making it suitable +for effects that don't need to touch the changes or selection, +but do want to process every transaction. + +Extenders run _after_ filters, when both are present. +*/ +EditorState.transactionExtender = transactionExtender; +Compartment.reconfigure = /*@__PURE__*/StateEffect.define(); + +/** +Utility function for combining behaviors to fill in a config +object from an array of provided configs. `defaults` should hold +default values for all optional fields in `Config`. + +The function will, by default, error +when a field gets two values that aren't `===`-equal, but you can +provide combine functions per field to do something else. +*/ +function combineConfig(configs, defaults, // Should hold only the optional properties of Config, but I haven't managed to express that +combine = {}) { + let result = {}; + for (let config of configs) + for (let key of Object.keys(config)) { + let value = config[key], current = result[key]; + if (current === undefined) + result[key] = value; + else if (current === value || value === undefined) ; // No conflict + else if (Object.hasOwnProperty.call(combine, key)) + result[key] = combine[key](current, value); + else + throw new Error("Config merge conflict for field " + key); + } + for (let key in defaults) + if (result[key] === undefined) + result[key] = defaults[key]; + return result; +} + +/** +Each range is associated with a value, which must inherit from +this class. +*/ +class RangeValue { + /** + Compare this value with another value. Used when comparing + rangesets. The default implementation compares by identity. + Unless you are only creating a fixed number of unique instances + of your value type, it is a good idea to implement this + properly. + */ + eq(other) { return this == other; } + /** + Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value. + */ + range(from, to = from) { return Range$1.create(from, to, this); } +} +RangeValue.prototype.startSide = RangeValue.prototype.endSide = 0; +RangeValue.prototype.point = false; +RangeValue.prototype.mapMode = exports.MapMode.TrackDel; +/** +A range associates a value with a range of positions. +*/ +let Range$1 = class Range { + constructor( + /** + The range's start position. + */ + from, + /** + Its end position. + */ + to, + /** + The value associated with this range. + */ + value) { + this.from = from; + this.to = to; + this.value = value; + } + /** + @internal + */ + static create(from, to, value) { + return new Range(from, to, value); + } +}; +function cmpRange(a, b) { + return a.from - b.from || a.value.startSide - b.value.startSide; +} +class Chunk { + constructor(from, to, value, + // Chunks are marked with the largest point that occurs + // in them (or -1 for no points), so that scans that are + // only interested in points (such as the + // heightmap-related logic) can skip range-only chunks. + maxPoint) { + this.from = from; + this.to = to; + this.value = value; + this.maxPoint = maxPoint; + } + get length() { return this.to[this.to.length - 1]; } + // Find the index of the given position and side. Use the ranges' + // `from` pos when `end == false`, `to` when `end == true`. + findIndex(pos, side, end, startAt = 0) { + let arr = end ? this.to : this.from; + for (let lo = startAt, hi = arr.length;;) { + if (lo == hi) + return lo; + let mid = (lo + hi) >> 1; + let diff = arr[mid] - pos || (end ? this.value[mid].endSide : this.value[mid].startSide) - side; + if (mid == lo) + return diff >= 0 ? lo : hi; + if (diff >= 0) + hi = mid; + else + lo = mid + 1; + } + } + between(offset, from, to, f) { + for (let i = this.findIndex(from, -1000000000 /* C.Far */, true), e = this.findIndex(to, 1000000000 /* C.Far */, false, i); i < e; i++) + if (f(this.from[i] + offset, this.to[i] + offset, this.value[i]) === false) + return false; + } + map(offset, changes) { + let value = [], from = [], to = [], newPos = -1, maxPoint = -1; + for (let i = 0; i < this.value.length; i++) { + let val = this.value[i], curFrom = this.from[i] + offset, curTo = this.to[i] + offset, newFrom, newTo; + if (curFrom == curTo) { + let mapped = changes.mapPos(curFrom, val.startSide, val.mapMode); + if (mapped == null) + continue; + newFrom = newTo = mapped; + if (val.startSide != val.endSide) { + newTo = changes.mapPos(curFrom, val.endSide); + if (newTo < newFrom) + continue; + } + } + else { + newFrom = changes.mapPos(curFrom, val.startSide); + newTo = changes.mapPos(curTo, val.endSide); + if (newFrom > newTo || newFrom == newTo && val.startSide > 0 && val.endSide <= 0) + continue; + } + if ((newTo - newFrom || val.endSide - val.startSide) < 0) + continue; + if (newPos < 0) + newPos = newFrom; + if (val.point) + maxPoint = Math.max(maxPoint, newTo - newFrom); + value.push(val); + from.push(newFrom - newPos); + to.push(newTo - newPos); + } + return { mapped: value.length ? new Chunk(from, to, value, maxPoint) : null, pos: newPos }; + } +} +/** +A range set stores a collection of [ranges](https://codemirror.net/6/docs/ref/#state.Range) in a +way that makes them efficient to [map](https://codemirror.net/6/docs/ref/#state.RangeSet.map) and +[update](https://codemirror.net/6/docs/ref/#state.RangeSet.update). This is an immutable data +structure. +*/ +class RangeSet { + constructor( + /** + @internal + */ + chunkPos, + /** + @internal + */ + chunk, + /** + @internal + */ + nextLayer, + /** + @internal + */ + maxPoint) { + this.chunkPos = chunkPos; + this.chunk = chunk; + this.nextLayer = nextLayer; + this.maxPoint = maxPoint; + } + /** + @internal + */ + static create(chunkPos, chunk, nextLayer, maxPoint) { + return new RangeSet(chunkPos, chunk, nextLayer, maxPoint); + } + /** + @internal + */ + get length() { + let last = this.chunk.length - 1; + return last < 0 ? 0 : Math.max(this.chunkEnd(last), this.nextLayer.length); + } + /** + The number of ranges in the set. + */ + get size() { + if (this.isEmpty) + return 0; + let size = this.nextLayer.size; + for (let chunk of this.chunk) + size += chunk.value.length; + return size; + } + /** + @internal + */ + chunkEnd(index) { + return this.chunkPos[index] + this.chunk[index].length; + } + /** + Update the range set, optionally adding new ranges or filtering + out existing ones. + + (Note: The type parameter is just there as a kludge to work + around TypeScript variance issues that prevented `RangeSet` + from being a subtype of `RangeSet` when `X` is a subtype of + `Y`.) + */ + update(updateSpec) { + let { add = [], sort = false, filterFrom = 0, filterTo = this.length } = updateSpec; + let filter = updateSpec.filter; + if (add.length == 0 && !filter) + return this; + if (sort) + add = add.slice().sort(cmpRange); + if (this.isEmpty) + return add.length ? RangeSet.of(add) : this; + let cur = new LayerCursor(this, null, -1).goto(0), i = 0, spill = []; + let builder = new RangeSetBuilder(); + while (cur.value || i < add.length) { + if (i < add.length && (cur.from - add[i].from || cur.startSide - add[i].value.startSide) >= 0) { + let range = add[i++]; + if (!builder.addInner(range.from, range.to, range.value)) + spill.push(range); + } + else if (cur.rangeIndex == 1 && cur.chunkIndex < this.chunk.length && + (i == add.length || this.chunkEnd(cur.chunkIndex) < add[i].from) && + (!filter || filterFrom > this.chunkEnd(cur.chunkIndex) || filterTo < this.chunkPos[cur.chunkIndex]) && + builder.addChunk(this.chunkPos[cur.chunkIndex], this.chunk[cur.chunkIndex])) { + cur.nextChunk(); + } + else { + if (!filter || filterFrom > cur.to || filterTo < cur.from || filter(cur.from, cur.to, cur.value)) { + if (!builder.addInner(cur.from, cur.to, cur.value)) + spill.push(Range$1.create(cur.from, cur.to, cur.value)); + } + cur.next(); + } + } + return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? RangeSet.empty + : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo })); + } + /** + Map this range set through a set of changes, return the new set. + */ + map(changes) { + if (changes.empty || this.isEmpty) + return this; + let chunks = [], chunkPos = [], maxPoint = -1; + for (let i = 0; i < this.chunk.length; i++) { + let start = this.chunkPos[i], chunk = this.chunk[i]; + let touch = changes.touchesRange(start, start + chunk.length); + if (touch === false) { + maxPoint = Math.max(maxPoint, chunk.maxPoint); + chunks.push(chunk); + chunkPos.push(changes.mapPos(start)); + } + else if (touch === true) { + let { mapped, pos } = chunk.map(start, changes); + if (mapped) { + maxPoint = Math.max(maxPoint, mapped.maxPoint); + chunks.push(mapped); + chunkPos.push(pos); + } + } + } + let next = this.nextLayer.map(changes); + return chunks.length == 0 ? next : new RangeSet(chunkPos, chunks, next || RangeSet.empty, maxPoint); + } + /** + Iterate over the ranges that touch the region `from` to `to`, + calling `f` for each. There is no guarantee that the ranges will + be reported in any specific order. When the callback returns + `false`, iteration stops. + */ + between(from, to, f) { + if (this.isEmpty) + return; + for (let i = 0; i < this.chunk.length; i++) { + let start = this.chunkPos[i], chunk = this.chunk[i]; + if (to >= start && from <= start + chunk.length && + chunk.between(start, from - start, to - start, f) === false) + return; + } + this.nextLayer.between(from, to, f); + } + /** + Iterate over the ranges in this set, in order, including all + ranges that end at or after `from`. + */ + iter(from = 0) { + return HeapCursor.from([this]).goto(from); + } + /** + @internal + */ + get isEmpty() { return this.nextLayer == this; } + /** + Iterate over the ranges in a collection of sets, in order, + starting from `from`. + */ + static iter(sets, from = 0) { + return HeapCursor.from(sets).goto(from); + } + /** + Iterate over two groups of sets, calling methods on `comparator` + to notify it of possible differences. + */ + static compare(oldSets, newSets, + /** + This indicates how the underlying data changed between these + ranges, and is needed to synchronize the iteration. + */ + textDiff, comparator, + /** + Can be used to ignore all non-point ranges, and points below + the given size. When -1, all ranges are compared. + */ + minPointSize = -1) { + let a = oldSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize); + let b = newSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize); + let sharedChunks = findSharedChunks(a, b, textDiff); + let sideA = new SpanCursor(a, sharedChunks, minPointSize); + let sideB = new SpanCursor(b, sharedChunks, minPointSize); + textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator)); + if (textDiff.empty && textDiff.length == 0) + compare(sideA, 0, sideB, 0, 0, comparator); + } + /** + Compare the contents of two groups of range sets, returning true + if they are equivalent in the given range. + */ + static eq(oldSets, newSets, from = 0, to) { + if (to == null) + to = 1000000000 /* C.Far */ - 1; + let a = oldSets.filter(set => !set.isEmpty && newSets.indexOf(set) < 0); + let b = newSets.filter(set => !set.isEmpty && oldSets.indexOf(set) < 0); + if (a.length != b.length) + return false; + if (!a.length) + return true; + let sharedChunks = findSharedChunks(a, b); + let sideA = new SpanCursor(a, sharedChunks, 0).goto(from), sideB = new SpanCursor(b, sharedChunks, 0).goto(from); + for (;;) { + if (sideA.to != sideB.to || + !sameValues(sideA.active, sideB.active) || + sideA.point && (!sideB.point || !sideA.point.eq(sideB.point))) + return false; + if (sideA.to > to) + return true; + sideA.next(); + sideB.next(); + } + } + /** + Iterate over a group of range sets at the same time, notifying + the iterator about the ranges covering every given piece of + content. Returns the open count (see + [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end + of the iteration. + */ + static spans(sets, from, to, iterator, + /** + When given and greater than -1, only points of at least this + size are taken into account. + */ + minPointSize = -1) { + let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from; + let openRanges = cursor.openStart; + for (;;) { + let curTo = Math.min(cursor.to, to); + if (cursor.point) { + let active = cursor.activeForPoint(cursor.to); + let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges); + iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank); + openRanges = Math.min(cursor.openEnd(curTo), active.length); + } + else if (curTo > pos) { + iterator.span(pos, curTo, cursor.active, openRanges); + openRanges = cursor.openEnd(curTo); + } + if (cursor.to > to) + return openRanges + (cursor.point && cursor.to > to ? 1 : 0); + pos = cursor.to; + cursor.next(); + } + } + /** + Create a range set for the given range or array of ranges. By + default, this expects the ranges to be _sorted_ (by start + position and, if two start at the same position, + `value.startSide`). You can pass `true` as second argument to + cause the method to sort them. + */ + static of(ranges, sort = false) { + let build = new RangeSetBuilder(); + for (let range of ranges instanceof Range$1 ? [ranges] : sort ? lazySort(ranges) : ranges) + build.add(range.from, range.to, range.value); + return build.finish(); + } +} +/** +The empty set of ranges. +*/ +RangeSet.empty = /*@__PURE__*/new RangeSet([], [], null, -1); +function lazySort(ranges) { + if (ranges.length > 1) + for (let prev = ranges[0], i = 1; i < ranges.length; i++) { + let cur = ranges[i]; + if (cmpRange(prev, cur) > 0) + return ranges.slice().sort(cmpRange); + prev = cur; + } + return ranges; +} +RangeSet.empty.nextLayer = RangeSet.empty; +/** +A range set builder is a data structure that helps build up a +[range set](https://codemirror.net/6/docs/ref/#state.RangeSet) directly, without first allocating +an array of [`Range`](https://codemirror.net/6/docs/ref/#state.Range) objects. +*/ +class RangeSetBuilder { + finishChunk(newArrays) { + this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint)); + this.chunkPos.push(this.chunkStart); + this.chunkStart = -1; + this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint); + this.maxPoint = -1; + if (newArrays) { + this.from = []; + this.to = []; + this.value = []; + } + } + /** + Create an empty builder. + */ + constructor() { + this.chunks = []; + this.chunkPos = []; + this.chunkStart = -1; + this.last = null; + this.lastFrom = -1000000000 /* C.Far */; + this.lastTo = -1000000000 /* C.Far */; + this.from = []; + this.to = []; + this.value = []; + this.maxPoint = -1; + this.setMaxPoint = -1; + this.nextLayer = null; + } + /** + Add a range. Ranges should be added in sorted (by `from` and + `value.startSide`) order. + */ + add(from, to, value) { + if (!this.addInner(from, to, value)) + (this.nextLayer || (this.nextLayer = new RangeSetBuilder)).add(from, to, value); + } + /** + @internal + */ + addInner(from, to, value) { + let diff = from - this.lastTo || value.startSide - this.last.endSide; + if (diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0) + throw new Error("Ranges must be added sorted by `from` position and `startSide`"); + if (diff < 0) + return false; + if (this.from.length == 250 /* C.ChunkSize */) + this.finishChunk(true); + if (this.chunkStart < 0) + this.chunkStart = from; + this.from.push(from - this.chunkStart); + this.to.push(to - this.chunkStart); + this.last = value; + this.lastFrom = from; + this.lastTo = to; + this.value.push(value); + if (value.point) + this.maxPoint = Math.max(this.maxPoint, to - from); + return true; + } + /** + @internal + */ + addChunk(from, chunk) { + if ((from - this.lastTo || chunk.value[0].startSide - this.last.endSide) < 0) + return false; + if (this.from.length) + this.finishChunk(true); + this.setMaxPoint = Math.max(this.setMaxPoint, chunk.maxPoint); + this.chunks.push(chunk); + this.chunkPos.push(from); + let last = chunk.value.length - 1; + this.last = chunk.value[last]; + this.lastFrom = chunk.from[last] + from; + this.lastTo = chunk.to[last] + from; + return true; + } + /** + Finish the range set. Returns the new set. The builder can't be + used anymore after this has been called. + */ + finish() { return this.finishInner(RangeSet.empty); } + /** + @internal + */ + finishInner(next) { + if (this.from.length) + this.finishChunk(false); + if (this.chunks.length == 0) + return next; + let result = RangeSet.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(next) : next, this.setMaxPoint); + this.from = null; // Make sure further `add` calls produce errors + return result; + } +} +function findSharedChunks(a, b, textDiff) { + let inA = new Map(); + for (let set of a) + for (let i = 0; i < set.chunk.length; i++) + if (set.chunk[i].maxPoint <= 0) + inA.set(set.chunk[i], set.chunkPos[i]); + let shared = new Set(); + for (let set of b) + for (let i = 0; i < set.chunk.length; i++) { + let known = inA.get(set.chunk[i]); + if (known != null && (textDiff ? textDiff.mapPos(known) : known) == set.chunkPos[i] && + !(textDiff === null || textDiff === void 0 ? void 0 : textDiff.touchesRange(known, known + set.chunk[i].length))) + shared.add(set.chunk[i]); + } + return shared; +} +class LayerCursor { + constructor(layer, skip, minPoint, rank = 0) { + this.layer = layer; + this.skip = skip; + this.minPoint = minPoint; + this.rank = rank; + } + get startSide() { return this.value ? this.value.startSide : 0; } + get endSide() { return this.value ? this.value.endSide : 0; } + goto(pos, side = -1000000000 /* C.Far */) { + this.chunkIndex = this.rangeIndex = 0; + this.gotoInner(pos, side, false); + return this; + } + gotoInner(pos, side, forward) { + while (this.chunkIndex < this.layer.chunk.length) { + let next = this.layer.chunk[this.chunkIndex]; + if (!(this.skip && this.skip.has(next) || + this.layer.chunkEnd(this.chunkIndex) < pos || + next.maxPoint < this.minPoint)) + break; + this.chunkIndex++; + forward = false; + } + if (this.chunkIndex < this.layer.chunk.length) { + let rangeIndex = this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true); + if (!forward || this.rangeIndex < rangeIndex) + this.setRangeIndex(rangeIndex); + } + this.next(); + } + forward(pos, side) { + if ((this.to - pos || this.endSide - side) < 0) + this.gotoInner(pos, side, true); + } + next() { + for (;;) { + if (this.chunkIndex == this.layer.chunk.length) { + this.from = this.to = 1000000000 /* C.Far */; + this.value = null; + break; + } + else { + let chunkPos = this.layer.chunkPos[this.chunkIndex], chunk = this.layer.chunk[this.chunkIndex]; + let from = chunkPos + chunk.from[this.rangeIndex]; + this.from = from; + this.to = chunkPos + chunk.to[this.rangeIndex]; + this.value = chunk.value[this.rangeIndex]; + this.setRangeIndex(this.rangeIndex + 1); + if (this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) + break; + } + } + } + setRangeIndex(index) { + if (index == this.layer.chunk[this.chunkIndex].value.length) { + this.chunkIndex++; + if (this.skip) { + while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex])) + this.chunkIndex++; + } + this.rangeIndex = 0; + } + else { + this.rangeIndex = index; + } + } + nextChunk() { + this.chunkIndex++; + this.rangeIndex = 0; + this.next(); + } + compare(other) { + return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank || + this.to - other.to || this.endSide - other.endSide; + } +} +class HeapCursor { + constructor(heap) { + this.heap = heap; + } + static from(sets, skip = null, minPoint = -1) { + let heap = []; + for (let i = 0; i < sets.length; i++) { + for (let cur = sets[i]; !cur.isEmpty; cur = cur.nextLayer) { + if (cur.maxPoint >= minPoint) + heap.push(new LayerCursor(cur, skip, minPoint, i)); + } + } + return heap.length == 1 ? heap[0] : new HeapCursor(heap); + } + get startSide() { return this.value ? this.value.startSide : 0; } + goto(pos, side = -1000000000 /* C.Far */) { + for (let cur of this.heap) + cur.goto(pos, side); + for (let i = this.heap.length >> 1; i >= 0; i--) + heapBubble(this.heap, i); + this.next(); + return this; + } + forward(pos, side) { + for (let cur of this.heap) + cur.forward(pos, side); + for (let i = this.heap.length >> 1; i >= 0; i--) + heapBubble(this.heap, i); + if ((this.to - pos || this.value.endSide - side) < 0) + this.next(); + } + next() { + if (this.heap.length == 0) { + this.from = this.to = 1000000000 /* C.Far */; + this.value = null; + this.rank = -1; + } + else { + let top = this.heap[0]; + this.from = top.from; + this.to = top.to; + this.value = top.value; + this.rank = top.rank; + if (top.value) + top.next(); + heapBubble(this.heap, 0); + } + } +} +function heapBubble(heap, index) { + for (let cur = heap[index];;) { + let childIndex = (index << 1) + 1; + if (childIndex >= heap.length) + break; + let child = heap[childIndex]; + if (childIndex + 1 < heap.length && child.compare(heap[childIndex + 1]) >= 0) { + child = heap[childIndex + 1]; + childIndex++; + } + if (cur.compare(child) < 0) + break; + heap[childIndex] = cur; + heap[index] = child; + index = childIndex; + } +} +class SpanCursor { + constructor(sets, skip, minPoint) { + this.minPoint = minPoint; + this.active = []; + this.activeTo = []; + this.activeRank = []; + this.minActive = -1; + // A currently active point range, if any + this.point = null; + this.pointFrom = 0; + this.pointRank = 0; + this.to = -1000000000 /* C.Far */; + this.endSide = 0; + // The amount of open active ranges at the start of the iterator. + // Not including points. + this.openStart = -1; + this.cursor = HeapCursor.from(sets, skip, minPoint); + } + goto(pos, side = -1000000000 /* C.Far */) { + this.cursor.goto(pos, side); + this.active.length = this.activeTo.length = this.activeRank.length = 0; + this.minActive = -1; + this.to = pos; + this.endSide = side; + this.openStart = -1; + this.next(); + return this; + } + forward(pos, side) { + while (this.minActive > -1 && (this.activeTo[this.minActive] - pos || this.active[this.minActive].endSide - side) < 0) + this.removeActive(this.minActive); + this.cursor.forward(pos, side); + } + removeActive(index) { + remove(this.active, index); + remove(this.activeTo, index); + remove(this.activeRank, index); + this.minActive = findMinIndex(this.active, this.activeTo); + } + addActive(trackOpen) { + let i = 0, { value, to, rank } = this.cursor; + while (i < this.activeRank.length && this.activeRank[i] <= rank) + i++; + insert(this.active, i, value); + insert(this.activeTo, i, to); + insert(this.activeRank, i, rank); + if (trackOpen) + insert(trackOpen, i, this.cursor.from); + this.minActive = findMinIndex(this.active, this.activeTo); + } + // After calling this, if `this.point` != null, the next range is a + // point. Otherwise, it's a regular range, covered by `this.active`. + next() { + let from = this.to, wasPoint = this.point; + this.point = null; + let trackOpen = this.openStart < 0 ? [] : null; + for (;;) { + let a = this.minActive; + if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0) { + if (this.activeTo[a] > from) { + this.to = this.activeTo[a]; + this.endSide = this.active[a].endSide; + break; + } + this.removeActive(a); + if (trackOpen) + remove(trackOpen, a); + } + else if (!this.cursor.value) { + this.to = this.endSide = 1000000000 /* C.Far */; + break; + } + else if (this.cursor.from > from) { + this.to = this.cursor.from; + this.endSide = this.cursor.startSide; + break; + } + else { + let nextVal = this.cursor.value; + if (!nextVal.point) { // Opening a range + this.addActive(trackOpen); + this.cursor.next(); + } + else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) { + // Ignore any non-empty points that end precisely at the end of the prev point + this.cursor.next(); + } + else { // New point + this.point = nextVal; + this.pointFrom = this.cursor.from; + this.pointRank = this.cursor.rank; + this.to = this.cursor.to; + this.endSide = nextVal.endSide; + this.cursor.next(); + this.forward(this.to, this.endSide); + break; + } + } + } + if (trackOpen) { + this.openStart = 0; + for (let i = trackOpen.length - 1; i >= 0 && trackOpen[i] < from; i--) + this.openStart++; + } + } + activeForPoint(to) { + if (!this.active.length) + return this.active; + let active = []; + for (let i = this.active.length - 1; i >= 0; i--) { + if (this.activeRank[i] < this.pointRank) + break; + if (this.activeTo[i] > to || this.activeTo[i] == to && this.active[i].endSide >= this.point.endSide) + active.push(this.active[i]); + } + return active.reverse(); + } + openEnd(to) { + let open = 0; + for (let i = this.activeTo.length - 1; i >= 0 && this.activeTo[i] > to; i--) + open++; + return open; + } +} +function compare(a, startA, b, startB, length, comparator) { + a.goto(startA); + b.goto(startB); + let endB = startB + length; + let pos = startB, dPos = startB - startA; + for (;;) { + let diff = (a.to + dPos) - b.to || a.endSide - b.endSide; + let end = diff < 0 ? a.to + dPos : b.to, clipEnd = Math.min(end, endB); + if (a.point || b.point) { + if (!(a.point && b.point && (a.point == b.point || a.point.eq(b.point)) && + sameValues(a.activeForPoint(a.to), b.activeForPoint(b.to)))) + comparator.comparePoint(pos, clipEnd, a.point, b.point); + } + else { + if (clipEnd > pos && !sameValues(a.active, b.active)) + comparator.compareRange(pos, clipEnd, a.active, b.active); + } + if (end > endB) + break; + pos = end; + if (diff <= 0) + a.next(); + if (diff >= 0) + b.next(); + } +} +function sameValues(a, b) { + if (a.length != b.length) + return false; + for (let i = 0; i < a.length; i++) + if (a[i] != b[i] && !a[i].eq(b[i])) + return false; + return true; +} +function remove(array, index) { + for (let i = index, e = array.length - 1; i < e; i++) + array[i] = array[i + 1]; + array.pop(); +} +function insert(array, index, value) { + for (let i = array.length - 1; i >= index; i--) + array[i + 1] = array[i]; + array[index] = value; +} +function findMinIndex(value, array) { + let found = -1, foundPos = 1000000000 /* C.Far */; + for (let i = 0; i < array.length; i++) + if ((array[i] - foundPos || value[i].endSide - value[found].endSide) < 0) { + found = i; + foundPos = array[i]; + } + return found; +} + +/** +Count the column position at the given offset into the string, +taking extending characters and tab size into account. +*/ +function countColumn(string, tabSize, to = string.length) { + let n = 0; + for (let i = 0; i < to;) { + if (string.charCodeAt(i) == 9) { + n += tabSize - (n % tabSize); + i++; + } + else { + n++; + i = findClusterBreak(string, i); + } + } + return n; +} +/** +Find the offset that corresponds to the given column position in a +string, taking extending characters and tab size into account. By +default, the string length is returned when it is too short to +reach the column. Pass `strict` true to make it return -1 in that +situation. +*/ +function findColumn(string, col, tabSize, strict) { + for (let i = 0, n = 0;;) { + if (n >= col) + return i; + if (i == string.length) + break; + n += string.charCodeAt(i) == 9 ? tabSize - (n % tabSize) : 1; + i = findClusterBreak(string, i); + } + return strict === true ? -1 : string.length; +} + +const C = "\u037c"; +const COUNT = typeof Symbol == "undefined" ? "__" + C : Symbol.for(C); +const SET = typeof Symbol == "undefined" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet"); +const top = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : {}; + +// :: - Style modules encapsulate a set of CSS rules defined from +// JavaScript. Their definitions are only available in a given DOM +// root after it has been _mounted_ there with `StyleModule.mount`. +// +// Style modules should be created once and stored somewhere, as +// opposed to re-creating them every time you need them. The amount of +// CSS rules generated for a given DOM root is bounded by the amount +// of style modules that were used. So to avoid leaking rules, don't +// create these dynamically, but treat them as one-time allocations. +class StyleModule { + // :: (Object