diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 3cb084c98..000000000 --- a/.babelrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - ["@babel/preset-env", { - "modules": "umd", - "useBuiltIns": "entry", - "corejs": 3 - }] - ], - "plugins": [ - "babel-plugin-add-module-exports", - "babel-plugin-class-display-name", - "@babel/plugin-transform-runtime" - ], - "env": { - "test": { - "plugins": [ "istanbul" ] - } - } -} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 78639a6ca..d7b90d07e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,5 +1,5 @@ # These are supported funding model platforms -github: neSpecc patreon: editorjs open_collective: editorjs +custom: https://codex.so/donate \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f8df3f874..6889bef95 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug report about: Create a report to help us improve Editor.js -title: "[Bug]" +title: "" labels: bug assignees: '' diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 40a9197f0..dbb6ff672 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -3,9 +3,9 @@ contact_links: - name: Team url: mailto:team@codex.so about: Direct team contact. + - name: 💬 Discussions + url: https://github.com/codex-team/editor.js/discussions + about: Use discussions if you have an issue draft, an idea for improvement or for asking questions. - name: Editor.js Telegram chat url: https://t.me/codex_editor - about: Telegram chat for Editor.js users communication. - - name: Editor.js contributors Telegram chat - url: https://t.me/editorjsdev - about: Telegram chat for Editor.js contributors communication. + about: Telegram chat for Editor.js users communication. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 6069bf434..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Feature request -about: Suggest an idea to improve Editor.js -title: "\U0001F4A1" -labels: feature -assignees: '' - ---- - -1. Describe a problem. - -2. Describe the solution you'd like. Mockups are welcome. - -3. Are there any alternatives? - - diff --git a/.github/ISSUE_TEMPLATE/discussion.md b/.github/ISSUE_TEMPLATE/general_issue.md similarity index 65% rename from .github/ISSUE_TEMPLATE/discussion.md rename to .github/ISSUE_TEMPLATE/general_issue.md index f6f6a3ed3..593bfd206 100644 --- a/.github/ISSUE_TEMPLATE/discussion.md +++ b/.github/ISSUE_TEMPLATE/general_issue.md @@ -1,8 +1,8 @@ --- -name: Discussion -about: Any question about the Editor.js to discuss +name: General Issue +about: Well-designed, algorithmized feature/idea/improvement issue for Editor.js title: '' -labels: discussion +labels: '' assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/issue--discussion.md b/.github/ISSUE_TEMPLATE/issue--discussion.md deleted file mode 100644 index 00261395d..000000000 --- a/.github/ISSUE_TEMPLATE/issue--discussion.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: 'Issue: Discussion' -about: Any question about the project to discuss -title: "❓" -labels: discussion -assignees: '' - ---- - -**Question** - -A clear and consistent question about the project. Ex. How can I do smth? Why smth works this way? etc. - -**Context** - -Why and how the question has come up - -**Related issues** - -If there are related issues which describe a bugs or features, put them here - -**Comments** - -Any thoughts about the question diff --git a/.github/workflows/bump-version-on-merge-next.yml b/.github/workflows/bump-version-on-merge-next.yml index d1e94ea01..67d303e7e 100644 --- a/.github/workflows/bump-version-on-merge-next.yml +++ b/.github/workflows/bump-version-on-merge-next.yml @@ -49,8 +49,7 @@ jobs: # Setup node environment - uses: actions/setup-node@v1 with: - node-version: 15 - registry-url: https://registry.npmjs.org/ + node-version: 16 # Bump version to the next prerelease (patch) with rc suffix - name: Suggest the new version diff --git a/.github/workflows/create-a-release-draft.yml b/.github/workflows/create-a-release-draft.yml index 4016b7b80..4d923c3c7 100644 --- a/.github/workflows/create-a-release-draft.yml +++ b/.github/workflows/create-a-release-draft.yml @@ -12,6 +12,9 @@ jobs: if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: + - uses: actions/setup-node@v3 + with: + node-version: 16 # Checkout to target branch - uses: actions/checkout@v2 with: @@ -53,8 +56,7 @@ jobs: # Setup node environment - uses: actions/setup-node@v1 with: - node-version: 14.17.0 - registry-url: https://registry.npmjs.org/ + node-version: 16 # Prepare, build and publish project - name: Install dependencies @@ -87,16 +89,27 @@ jobs: # If version name contains "-rc" suffix than mark a "pre-release" checkbox prerelease: ${{ contains(steps.package.outputs.version, '-rc') }} - # Build and upload target Editor.js build to release as artifact + # Build and upload target Editor.js UMD build to release as artifact - name: Upload Release Asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: dist/editor.js - asset_name: editor.js + asset_path: dist/editorjs.umd.js + asset_name: editorjs.umd.js asset_content_type: application/javascript + + # Build and upload target Editor.js MJS build to release as artifact + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/editorjs.mjs + asset_name: editorjs.mjs + asset_content_type: application/javascript # Send a notification message - name: Send a message diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index ee311b356..2df7d315f 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -1,36 +1,21 @@ -name: Tests +name: Cypress + on: [pull_request] + jobs: - firefox: + run-tests: + strategy: + matrix: + browser: [firefox, chrome, edge] + runs-on: ubuntu-latest - container: - image: cypress/browsers:node14.17.0-chrome88-ff89 - options: --user 1001 steps: - - uses: actions/checkout@v2 - - run: yarn ci:pull_paragraph - - uses: cypress-io/github-action@v2 + - uses: actions/setup-node@v3 with: - config: video=false - browser: firefox - build: yarn build - chrome: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: yarn ci:pull_paragraph - - uses: cypress-io/github-action@v2 - with: - config: video=false - browser: chrome - build: yarn build - edge: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - run: yarn ci:pull_paragraph - - uses: cypress-io/github-action@v2 + node-version: 16 + - uses: actions/checkout@v3 + - uses: cypress-io/github-action@v5 with: config: video=false - browser: edge + browser: ${{ matrix.browser }} build: yarn build diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 052c68355..47d1e3a9d 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -19,6 +19,5 @@ jobs: ${{ runner.OS }}-build- ${{ runner.OS }}- - - run: yarn install - + - run: yarn - run: yarn lint diff --git a/.github/workflows/publish-package-to-npm.yml b/.github/workflows/publish-package-to-npm.yml index a614f700e..ae926224e 100644 --- a/.github/workflows/publish-package-to-npm.yml +++ b/.github/workflows/publish-package-to-npm.yml @@ -22,7 +22,7 @@ jobs: # Setup node environment - uses: actions/setup-node@v1 with: - node-version: 14.17.0 + node-version: 16 registry-url: https://registry.npmjs.org/ # Prepare, build and publish project diff --git a/.gitmodules b/.gitmodules index ad185a9e5..66320775b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,9 +16,6 @@ [submodule "example/tools/simple-image"] path = example/tools/simple-image url = https://github.com/editor-js/simple-image -[submodule "src/tools/paragraph"] - path = src/tools/paragraph - url = https://github.com/editor-js/paragraph [submodule "example/tools/marker"] path = example/tools/marker url = https://github.com/editor-js/marker diff --git a/.npmignore b/.npmignore index 98ed3edfa..c549183e3 100644 --- a/.npmignore +++ b/.npmignore @@ -1,22 +1,6 @@ -.idea -.github -docs -example -src -test -.babelrc -.editorconfig -.eslintignore -.eslintrc -.git -.gitmodules -.jshintrc -.postcssrc.yml -.stylelintrc -CODEOWNERS -cypress.json -tsconfig.json -tslint.json -webpack.config.js -yarn.lock -devserver.js +* +!/dist/**/* +!/types/**/* +!/LICENSE +!/README.md +!/package.json diff --git a/.postcssrc.yml b/.postcssrc.yml index b2a67d586..c52a3b2a8 100644 --- a/.postcssrc.yml +++ b/.postcssrc.yml @@ -1,8 +1,4 @@ plugins: - # Consumes files by @import rule - # https://github.com/postcss/postcss-import - postcss-import: {} - # Apply custom property sets via @apply rule # https://github.com/pascalduez/postcss-apply postcss-apply: {} @@ -26,16 +22,6 @@ plugins: # https://github.com/csstools/postcss-preset-env#preserve preserve: false - # Enable or disable specific polyfills - # https://github.com/csstools/postcss-preset-env#features - # - # List of available plugins - # https://github.com/csstools/postcss-preset-env/blob/master/src/lib/plugins-by-id.js - features: - # Modify colors using the color-mod() function in CSS - # https://github.com/jonathantneal/postcss-color-mod-function - color-mod-function: {} - # Nested rules unwrapper # https://github.com/postcss/postcss-nested # @@ -43,7 +29,3 @@ plugins: # 'postcss-nesting' feature but it does not work with BEM # Report: https://github.com/csstools/postcss-preset-env/issues/40 postcss-nested: {} - - # Compression tool - # https://github.com/cssnano/cssnano - cssnano: {} diff --git a/.vscode/settings.json b/.vscode/settings.json index 8b3ac96d3..5d01b0ef3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,7 @@ "colspan", "contenteditable", "contentless", + "Convertable", "cssnano", "cssnext", "Debouncer", @@ -34,6 +35,7 @@ "textareas", "twitterwidget", "typeof", + "Unmergeable", "viewports" ] } diff --git a/README.md b/README.md index 649c4a352..5be82b456 100644 --- a/README.md +++ b/README.md @@ -1,270 +1,233 @@ -

- -[![](https://flat.badgen.net/npm/v/@editorjs/editorjs?icon=npm)](https://www.npmjs.com/package/@editorjs/editorjs) -[![](https://flat.badgen.net/bundlephobia/min/@editorjs/editorjs?color=cyan)](https://www.npmjs.com/package/@editorjs/editorjs) -[![](https://flat.badgen.net/bundlephobia/minzip/@editorjs/editorjs?color=green)](https://www.npmjs.com/package/@editorjs/editorjs) -[![Backers on Open Collective](https://opencollective.com/editorjs/backers/badge.svg)](#backers) -[![Sponsors on Open Collective](https://opencollective.com/editorjs/sponsors/badge.svg)](#sponsors) -[![](https://img.shields.io/npm/l/@editorjs/editorjs?style=flat-square)](https://www.npmjs.com/package/@editorjs/editorjs) -[![Join the chat at https://gitter.im/codex-team/editor.js](https://badges.gitter.im/codex-team/editor.js.svg)](https://gitter.im/codex-team/editor.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -| | | | | | | -| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| IE / Edge Edge 12+ | Firefox Firefox 18+ | Chrome Chrome 49+ | Safari Safari 10+ | iOS Safari iOS Safari 10+ | Opera Opera 36+ | - -## Roadmap - - - -- Collaborative editing - - - [ ] Implement Inline Tools JSON format `In progress` [#1801](https://github.com/codex-team/editor.js/pull/1801) - - [ ] Implement Operations creation and transformations - - [ ] Implement Tools API changes - - [ ] Implement Server and communication - - [ ] Update basic tools to fit the new API - -- Unified Toolbox - - [x] Block Tunes moved left [#1815](https://github.com/codex-team/editor.js/pull/1815) - - [x] Toolbox become vertical [#2014](https://github.com/codex-team/editor.js/pull/2014) - - [x] Ability to display several Toolbox buttons by the single Tool [#2050](https://github.com/codex-team/editor.js/pull/2050) - - [ ] Conversion Toolbar uses Unified Toolbox `In progress` - - [ ] Block Tunes become vertical - - [ ] Conversion Toolbar added to the Block Tunes -- Ecosystem improvements - - - image - - -## - -## If you like a project 💗💗💗 - -If you like Editor.js you can support project improvements and development of new features with a donation to our collective. - -👉 [https://opencollective.com/editorjs](https://opencollective.com/editorjs) - -### Sponsors - -Support us by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/editorjs/contribute/sir-8679/checkout)] - - - - - -### Backers - -Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/editorjs/contribute/backer-8632/checkout)] - - - -### Contributors - -This project exists thanks to all the people who contribute. - -We really welcome new contributors. If you want to make some code with us, please take a look at the [Good First Tasks](https://github.com/codex-team/editor.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+task%22). You can write to us on `team@codex.so` or via special [Telegram chat](https://t.me/editorjsdev), or any other way. - -## Documentation - -Please visit [https://editorjs.io/](https://editorjs.io) to view all documentation articles. - -- [Base concepts](https://editorjs.io/base-concepts) -- [Getting started](https://editorjs.io/getting-started) -- [Configuration](https://editorjs.io/configuration) -- [How to create a Block Tool Plugin](https://editorjs.io/creating-a-block-tool) -- [How to create an Inline Tool Plugin](https://editorjs.io/creating-an-inline-tool) -- [API for Tools](https://editorjs.io/tools-api) - -You can join a [Gitter-channel](https://gitter.im/codex-team/editor.js) or [Telegram-chat](//t.me/codex_editor) and ask a question. - -## Changelog - -See the whole [Changelog](/docs/CHANGELOG.md) - -If you want to follow Editor.js updates, [subscribe to our Newsletter](http://digest.editorjs.io/). - -## How to use Editor.js - -### Basics - -Editor.js is a Block-Styled editor. Blocks are structural units, of which the Entry is composed. -For example, `Paragraph`, `Heading`, `Image`, `Video`, `List` are Blocks. Each Block is represented by Plugin. -We have [many](http://github.com/editor-js/) ready-to-use Plugins and a [simple API](https://editorjs.io/tools-api) for creating new ones. - -How to use the Editor after [Installation](https://editorjs.io/getting-started). - -- Create new Blocks by pressing Enter or clicking the Plus Button -- Press `TAB` or click on the Plus Button to view the Toolbox -- Press `TAB` again to leaf Toolbox and select a Block you need. Then press Enter. - -![](https://github.com/editor-js/list/raw/master/assets/example.gif) - -- Select a text fragment and apply a style or insert a link from the Inline Toolbar - -![](https://capella.pics/7ccbcfcd-1c49-4674-bea7-71021468a1bd.jpg) - -- Use the «three-dots» button on the right to open Block Settings. From here, you can move and delete a Block - or apply a Tool's settings, if it provided. For example, you can set a Heading level or List style. - -![](https://capella.pics/01a55381-46cd-47c7-b92e-34765434f2ca.jpg) - -### Shortcuts +

+ + + + + Editor.js Logo + + +

+ +

+ editorjs.io | + documentation | + changelog + +

+ +

+ + npm + + + Minzipped size + + + Backers on Open Collective + + + Sponsors on Open Collective + +

+ +## About + +Editor.js is an open-source text editor offering a variety of features to help users create and format content efficiently. It has a modern, block-style interface that allows users to easily add and arrange different types of content, such as text, images, lists, quotes, etc. Each Block is provided via a separate plugin making Editor.js extremely flexible. + +Editor.js outputs a clean JSON data instead of heavy HTML markup. Use it in Web, iOS, Android, AMP, Instant Articles, speech readers, AI chatbots — everywhere. Easy to sanitize, extend and integrate with your logic. + +- 😍  Modern UI out of the box +- 💎  Clean JSON output +- ⚙️  Well-designed API +- 🛍  Various Tools available +- 💌  Free and open source + + + Editor.js Overview + + +## Installation + +It's quite simple: + +1. Install Editor.js +2. Install tools you need +3. Initialize Editor's instance + +Install using NPM, Yarn, or [CDN](https://www.jsdelivr.com/package/npm/@editorjs/editorjs): + +```bash +npm i @editorjs/editorjs +``` -A few shortcuts are preset as available. +Choose and install tools: + +- [Heading](https://github.com/editor-js/header) +- [Quote](https://github.com/editor-js/quote) +- [Image](https://github.com/editor-js/image) +- [Simple Image](https://github.com/editor-js/simple-image) (without backend requirement) +- [Nested List](https://github.com/editor-js/nested-list) +- [Checklist](https://github.com/editor-js/checklist) +- [Link embed](https://github.com/editor-js/link) +- [Embeds](https://github.com/editor-js/embed) (YouTube, Twitch, Vimeo, Gfycat, Instagram, Twitter, etc) +- [Table](https://github.com/editor-js/table) +- [Delimiter](https://github.com/editor-js/delimiter) +- [Warning](https://github.com/editor-js/warning) +- [Code](https://github.com/editor-js/code) +- [Raw HTML](https://github.com/editor-js/raw) +- [Attaches](https://github.com/editor-js/attaches) +- [Marker](https://github.com/editor-js/marker) +- [Inline Code](https://github.com/editor-js/inline-code) + +See the [😎 Awesome Editor.js](https://github.com/editor-js/awesome-editorjs) list for more tools. + +Initialize the Editor: -| Shortcut | Action | Restrictions | -| ----------- | -------------------- | ------------------------------------------------- | -| `TAB` | Show/leaf a Toolbox. | On empty block | -| `SHIFT+TAB` | Leaf back a Toolbox. | While Toolbox is opened | -| `ENTER` | Create a Block | While Toolbox is opened and some Tool is selected | -| `CMD+B` | Bold style | On selection | -| `CMD+I` | Italic style | On selection | -| `CMD+K` | Insert a link | On selection | +```html +
+``` -Each Tool can also have its own shortcuts. These are specified in the configuration of the Tool, for example: +```javascript +import EditorJS from "@editorjs/editorjs"; -```js -var editor = new EditorJS({ - //... +const editor = new EditorJS({ tools: { - header: { - class: Header, - shortcut: "CMD+SHIFT+H", - }, - list: { - class: List, - shortcut: "CMD+SHIFT+L", - }, + // ... your tools }, - //... }); ``` -## Installation Guide - -There are few steps to run Editor.js on your site. - -1. [Load Editor's core](#load-editors-core) -2. [Load Tools](#load-tools) -3. [Initialize Editor's instance](#create-editor-instance) - -### Step 1. Load Editor's core - -Get Editor.js itself. It is a [minified script](dist/editor.js) with Editor's core and some default must-have tools. +See details about [Installation](https://editorjs.io/getting-started/) and [Configuration](https://editorjs.io/configuration/) at the documentation. -Choose the most usable method of getting Editor for you. - -- Node package -- Source from CDN - -##### Option A. NPM install - -Install the package via NPM or Yarn - -```shell -npm i @editorjs/editorjs -``` +### Saving Data -Include module in your application +Call `editor.save()` and handle returned Promise with saved data. ```javascript -import EditorJS from "@editorjs/editorjs"; +const data = await editor.save(); ``` -##### Option B. Use a CDN - -You can load EditorJS directly from from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@editorjs/editorjs). +### Example -`https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest` +Take a look at the [example.html](example/example.html) to view more detailed examples. -For example, place this in your HTML: +## Roadmap -```html - -``` + -Or download the bundle file and use it from your server. +- Unified Toolbox + - [x] Block Tunes moved left + - [x] Toolbox becomes vertical + - [x] Ability to display several Toolbox buttons by the single Tool + - [x] Block Tunes become vertical + - [ ] Block Tunes support nested menus + - [ ] Conversion Toolbar uses Unified Toolbox + - [ ] Conversion Toolbar added to the Block Tunes +- Collaborative editing + - [ ] Implement Inline Tools JSON format + - [ ] Operations Observer, Executor, Manager, Transformer + - [ ] Implement Undo/Redo Manager + - [ ] Implement Tools API changes + - [ ] Implement Server and communication + - [ ] Update basic tools to fit the new API +- Other features + - [ ] Blocks drag'n'drop + - [ ] New cross-block selection + - [ ] New cross-block caret moving +- Ecosystem improvements + - [x] CodeX Icons — the way to unify all tools and core icons + - [x] New Homepage and Docs + - [x] @editorjs/create-tool for Tools bootstrapping + - [ ] Editor.js DevTools — stand for core and tools development + - [ ] Editor.js Design System + - [ ] Editor.js Preset Env + - [ ] Editor.js ToolKit + - [ ] New core bundle system + - [ ] New documentation and guides -```html - -``` + + + + + Support Editor.js + + -### Step 2. Load the Tools that you want to make available +
-Each Block is represented by a [Tool](docs/tools.md). Tools are simple external scripts with their own logic. For example, there is a [Header](https://github.com/editor-js/header) Tool into which you type your heading text. If you want to be able to use this, install the Header Tool the same way as the Editor (Node.js, CDN, local file). +## Like Editor.js? -**Example:** use Header from CDN +You can support project improvement and development of new features with a donation to our team. -```html - -``` +[Donate via OpenCollective](https://opencollective.com/editorjs) +\ +[Donate via Crypto](https://codex.so/donate) +\ +[Donate via Patreon](https://www.patreon.com/editorjs) -Check [Editor.js's community](https://github.com/editor-js/) to see more ready-to-use Tools. +### Why donate -### Step 3. Create Editor instance +Donations to open-source products have several advantages for your business: -Create an instance of Editor.js and pass [Configuration Object](types/configs/editor-config.d.ts) with `holderId` and tools list. +- If your business relies on Editor.js, you'll probably want it to be maintained +- It helps Editor.js to evolve and get the new features +- We can support contributors and the community around the project. You'll receive well organized docs, guides, etc. +- We need to pay for our infrastructure and maintain public resources (domain names, homepages, docs, etc). Supporting it guarantees you to access any resources at the time you need them. +- You can advertise by adding your brand assets and mentions on our public resources -```html -
-``` +### Sponsors -You can create a simple Editor with only default Paragraph Tool by passing a string with element's Id (wrapper for Editor) as a configuration param. Or use the default `editorjs` id for wrapper. +Support us by becoming a sponsor. Your logo will show up here with a link to your website. + +

+ + Mister Auto + + + UPLUCID, K.K. + + + Kane Jamison + + + Content Harmony + +

+ +[Become a Sponsor](https://opencollective.com/editorjs/contribute/sir-8679/checkout) -```javascript -var editor = new EditorJS(); /** Zero-configuration */ +### Backers -// equals +Thank you to all our backers -var editor = new EditorJS("editorjs"); -``` + -Or pass a whole settings object. +[Become a Backer](https://opencollective.com/editorjs/contribute/backer-8632/checkout) -```javascript -var editor = new EditorJS({ - /** - * Create a holder for the Editor and pass its ID - */ - holder: "editorjs", - - /** - * Available Tools list. - * Pass Tool's class or Settings object for each Tool you want to use - */ - tools: { - header: { - class: Header, - inlineToolbar: true, - }, - // ... - }, +### Contributors - /** - * Previously saved data that should be rendered - */ - data: {}, -}); -``` +This project exists thanks to all the people who contribute. -### Saving Data +

-Call `editor.save()` and handle returned Promise with saved data. +### Need something special? -```javascript -editor.save().then((savedData) => { - console.log(savedData); -}); -``` +Hire CodeX experts to resolve technical challenges and match your product requirements. -### Example +- Resolve a problem that has high value for you +- Implement a new feature required by your business +- Help with integration or tool development +- Provide any consultation -Take a look at the [example.html](example/example.html) to view more detailed examples. +Contact us via team@codex.so and share your details -## Credits and references +## Community -- We use [HTMLJanitor](https://github.com/guardian/html-janitor) module in our Sanitizer module. +- [Official Tools](https://github.com/editor-js) +- [Awesome Editor.js](https://github.com/editor-js/awesome-editorjs) +- [Good First Tasks](https://github.com/codex-team/editor.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+task%22) +- [Contributing](https://editorjs.io/contributing/) +- [Telegram Chat](https://t.me/codex_editor) # About CodeX diff --git a/assets/logo_day.png b/assets/logo_day.png new file mode 100644 index 000000000..91e5092d4 Binary files /dev/null and b/assets/logo_day.png differ diff --git a/assets/logo_night.png b/assets/logo_night.png new file mode 100644 index 000000000..832c7556b Binary files /dev/null and b/assets/logo_night.png differ diff --git a/assets/overview.png b/assets/overview.png new file mode 100644 index 000000000..00537b451 Binary files /dev/null and b/assets/overview.png differ diff --git a/assets/roadmap.png b/assets/roadmap.png new file mode 100644 index 000000000..9dc84cb0f Binary files /dev/null and b/assets/roadmap.png differ diff --git a/assets/support_day.png b/assets/support_day.png new file mode 100644 index 000000000..bc0cd03e0 Binary files /dev/null and b/assets/support_day.png differ diff --git a/assets/support_night.png b/assets/support_night.png new file mode 100644 index 000000000..e9883d7ac Binary files /dev/null and b/assets/support_night.png differ diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 000000000..11ac2de20 --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,32 @@ +import { defineConfig } from 'cypress'; + +export default defineConfig({ + env: { + NODE_ENV: 'test', + }, + fixturesFolder: 'test/cypress/fixtures', + screenshotsFolder: 'test/cypress/screenshots', + videosFolder: 'test/cypress/videos', + e2e: { + // We've imported your old cypress plugins here. + // You may want to clean this up later by importing these. + setupNodeEvents(on, config) { + /** + * Plugin for cypress that adds better terminal output for easier debugging. + * Prints cy commands, browser console logs, cy.request and cy.intercept data. Great for your pipelines. + * https://github.com/archfz/cypress-terminal-report + */ + require('cypress-terminal-report/src/installLogsPrinter')(on); + + require('./test/cypress/plugins/index.ts')(on, config); + }, + specPattern: 'test/cypress/tests/**/*.cy.{js,jsx,ts,tsx}', + supportFile: 'test/cypress/support/index.ts', + }, + 'retries': { + // Configure retry attempts for `cypress run` + 'runMode': 2, + // Configure retry attempts for `cypress open` + 'openMode': 0, + }, +}); diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 2bed0b88a..000000000 --- a/cypress.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "env": { - "NODE_ENV": "test" - }, - "fixturesFolder": "test/cypress/fixtures", - "integrationFolder": "test/cypress/tests", - "screenshotsFolder": "test/cypress/screenshots", - "videosFolder": "test/cypress/videos", - "supportFile": "test/cypress/support/index.ts", - "pluginsFile": "test/cypress/plugins/index.ts" -} diff --git a/dist/editor.js b/dist/editor.js deleted file mode 100644 index 424e7ef72..000000000 --- a/dist/editor.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see editor.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.EditorJS=t():e.EditorJS=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=186)}([function(e,t,n){var o=n(10),r=n(16),i=n(27),a=n(23),s=n(31),l=function(e,t,n){var c,u,f,d,p=e&l.F,h=e&l.G,v=e&l.S,y=e&l.P,g=e&l.B,b=h?o:v?o[t]||(o[t]={}):(o[t]||{}).prototype,m=h?r:r[t]||(r[t]={}),k=m.prototype||(m.prototype={});for(c in h&&(n=t),n)f=((u=!p&&b&&void 0!==b[c])?b:n)[c],d=g&&u?s(f,o):y&&"function"==typeof f?s(Function.call,f):f,b&&a(b,c,f,e&l.U),m[c]!=f&&i(m,c,d),y&&k[c]!=f&&(k[c]=f)};o.core=r,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function n(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"log",o=arguments.length>3?arguments[3]:void 0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"color: inherit";if("console"in window&&window.console[n]){var i=["info","log","warn","error"].includes(n),a=[];switch(c.logLevel){case s.ERROR:if("error"!==n)return;break;case s.WARN:if(!["error","warn"].includes(n))return;break;case s.INFO:if(!i||e)return}o&&a.push(o);var l="Editor.js ".concat("2.26.2"),u="line-height: 1em;\n color: #006FEA;\n display: inline-block;\n font-size: 11px;\n line-height: 1em;\n background-color: #fff;\n padding: 4px 9px;\n border-radius: 30px;\n border: 1px solid rgba(56, 138, 229, 0.16);\n margin: 4px 5px 4px 0;";e&&(i?(a.unshift(u,r),t="%c".concat(l,"%c ").concat(t)):t="( ".concat(l," )").concat(t));try{if(i)if(o){var f;(f=console)[n].apply(f,["".concat(t," %o")].concat(a))}else{var d;(d=console)[n].apply(d,[t].concat(a))}else console[n](t)}catch(e){}}}Object.defineProperty(e,"__esModule",{value:!0}),e.LogLevels=void 0,e.array=function(e){return Array.prototype.slice.call(e)},e.beautifyShortcut=function(e){var t=g();return e=e.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi," + "),e=t.mac?e.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):e.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN")},e.cacheable=function(e,t,n){var o=n.value?"value":"get",r=n[o],i="#".concat(t,"Cache");if(n[o]=function(){if(void 0===this[i]){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(e).concat(Math.floor(1e8*Math.random()).toString(16))},e.getFileExtension=function(e){return e.name.split(".").pop()},e.getUserOS=g,e.getValidUrl=function(e){try{return new URL(e).href}catch(e){}return"//"===e.substring(0,2)?window.location.protocol+e:window.location.origin+e},e.isBoolean=function(e){return"boolean"===d(e)},e.isClass=function(e){return p(e)&&/^\s*class\s+/.test(e.toString())},e.isEmpty=function(e){return!e||0===Object.keys(e).length&&e.constructor===Object},e.isFunction=p,e.isIosDevice=void 0,e.isMobileScreen=function(){return window.matchMedia("(max-width: ".concat(200,"px)")).matches},e.isNumber=function(e){return"number"===d(e)},e.isObject=h,e.isPrintableKey=function(e){return e>47&&e<58||32===e||13===e||229===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223},e.isPromise=function(e){return Promise.resolve(e)===e},e.isString=function(e){return"string"===d(e)},e.isTouchSupported=void 0,e.isUndefined=v,e.isValidMimeType=function(e){return/^[-\w]+\/([-+\w]+|\*)$/.test(e)},e.mouseButtons=e.mobileScreenBreakpoint=e.logLabeled=e.log=e.keyCodes=void 0,e.openTab=function(e){window.open(e,"_blank")},e.sequence=function(e){return y.apply(this,arguments)},e.setLogLevel=function(e){c.logLevel=e},e.throttle=function(e,t){var n,o,r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=null,s=0;i||(i={});var l=function(){s=!1===i.leading?0:Date.now(),a=null,r=e.apply(n,o),a||(n=o=null)};return function(){var c=Date.now();s||!1!==i.leading||(s=c);var u=t-(c-s);return n=this,o=arguments,u<=0||u>t?(a&&(clearTimeout(a),a=null),s=c,r=e.apply(n,o),a||(n=o=null)):a||!1===i.trailing||(a=setTimeout(l,u)),r}},e.typeOf=d,t=l(t),o=l(o),r=l(r),a=l(a),e.LogLevels=s,function(e){e.VERBOSE="VERBOSE",e.INFO="INFO",e.WARN="WARN",e.ERROR="ERROR"}(s||(e.LogLevels=s={})),e.keyCodes={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91},e.mouseButtons={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4},c.logLevel=s.VERBOSE;var u=c.bind(window,!1);e.log=u;var f=c.bind(window,!0);function d(e){return Object.prototype.toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function p(e){return"function"===d(e)||"asyncfunction"===d(e)}function h(e){return"object"===d(e)}function v(e){return"undefined"===d(e)}function y(){return(y=(0,r.default)(t.default.mark((function e(n){var o,i,a,s,l=arguments;return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=function(){return(s=(0,r.default)(t.default.mark((function e(n,o,r){return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n.function(n.data);case 3:return e.next=5,o(v(n.data)?{}:n.data);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),r(v(n.data)?{}:n.data);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)},a=function(e,t,n){return s.apply(this,arguments)},o=l.length>1&&void 0!==l[1]?l[1]:function(){},i=l.length>2&&void 0!==l[2]?l[2]:function(){},e.abrupt("return",n.reduce(function(){var e=(0,r.default)(t.default.mark((function e(n,r){return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n;case 2:return e.abrupt("return",a(r,o,i));case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Promise.resolve()));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(){var e={win:!1,mac:!1,x11:!1,linux:!1},t=Object.keys(e).find((function(e){return-1!==window.navigator.appVersion.toLowerCase().indexOf(e)}));return t?(e[t]=!0,e):e}e.logLabeled=f;var b="ontouchstart"in document.documentElement;e.isTouchSupported=b,e.mobileScreenBreakpoint=200;var m="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1);e.isIosDevice=m})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(152)],void 0===(i="function"==typeof(o=function(o,r,i,a){"use strict";var s=n(1);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},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 i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n3&&void 0!==arguments[3]&&arguments[3];n.mutableListenerIds.push(n.listeners.on(e,t,o,r))},clearAll:function(){var e,t=l(n.mutableListenerIds);try{for(t.s();!(e=t.n()).done;){var o=e.value;n.listeners.offById(o)}}catch(e){t.e(e)}finally{t.f()}n.mutableListenerIds=[]}},this.mutableListenerIds=[],(this instanceof e?this.constructor:void 0)===e)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=o,this.eventsDispatcher=i}return(0,i.default)(e,[{key:"state",set:function(e){this.Editor=e}},{key:"removeAllNodes",value:function(){for(var e in this.nodes){var t=this.nodes[e];t instanceof HTMLElement&&t.remove()}}},{key:"isRtl",get:function(){return"rtl"===this.config.i18n.direction}}]),e}();o.default=u,u.displayName="Module",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var o=n(13);e.exports=function(e){if(!o(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var o=n(69)("wks"),r=n(44),i=n(10).Symbol,a="function"==typeof i;(e.exports=function(e){return o[e]||(o[e]=a&&i[e]||(a?i:r)("Symbol."+e))}).store=o},function(e,t,n){var o=n(33),r=Math.min;e.exports=function(e){return e>0?r(o(e),9007199254740991):0}},function(e,t){var n=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},function(e,t,n){e.exports=!n(11)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t,n){var o=n(12),r=n(115),i=n(41),a=Object.defineProperty;t.f=n(17)?Object.defineProperty:function(e,t,n){if(o(e),t=i(t,!0),o(n),r)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(40),n(2),n(3),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,s,l){"use strict";var c=n(1);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=c(r),i=c(i),s=c(s),l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(l);var f=function(){function e(){(0,i.default)(this,e)}return(0,s.default)(e,null,[{key:"isSingleTag",value:function(e){return e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}},{key:"isLineBreakTag",value:function(e){return e&&e.tagName&&["BR","WBR"].includes(e.tagName)}},{key:"make",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(e);for(var a in Array.isArray(n)?(t=i.classList).add.apply(t,(0,r.default)(n)):n&&i.classList.add(n),o)Object.prototype.hasOwnProperty.call(o,a)&&(i[a]=o[a]);return i}},{key:"text",value:function(e){return document.createTextNode(e)}},{key:"append",value:function(e,t){Array.isArray(t)?t.forEach((function(t){return e.appendChild(t)})):e.appendChild(t)}},{key:"prepend",value:function(e,t){Array.isArray(t)?(t=t.reverse()).forEach((function(t){return e.prepend(t)})):e.prepend(t)}},{key:"swap",value:function(e,t){var n=document.createElement("div"),o=e.parentNode;o.insertBefore(n,e),o.insertBefore(e,t),o.insertBefore(t,n),o.removeChild(n)}},{key:"find",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=arguments.length>1?arguments[1]:void 0;return e.querySelector(t)}},{key:"get",value:function(e){return document.getElementById(e)}},{key:"findAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=arguments.length>1?arguments[1]:void 0;return e.querySelectorAll(t)}},{key:"allInputsSelector",get:function(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map((function(e){return'input[type="'.concat(e,'"]')})).join(", ")}},{key:"findAllInputs",value:function(t){return l.array(t.querySelectorAll(e.allInputsSelector)).reduce((function(t,n){return e.isNativeInput(n)||e.containsOnlyInlineElements(n)?[].concat((0,r.default)(t),[n]):[].concat((0,r.default)(t),(0,r.default)(e.getDeepestBlockElements(n)))}),[])}},{key:"getDeepestNode",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=n?"lastChild":"firstChild",r=n?"previousSibling":"nextSibling";if(t&&t.nodeType===Node.ELEMENT_NODE&&t[o]){var i=t[o];if(e.isSingleTag(i)&&!e.isNativeInput(i)&&!e.isLineBreakTag(i))if(i[r])i=i[r];else{if(!i.parentNode[r])return i.parentNode;i=i.parentNode[r]}return this.getDeepestNode(i,n)}return t}},{key:"isElement",value:function(e){return!l.isNumber(e)&&e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE}},{key:"isFragment",value:function(e){return!l.isNumber(e)&&e&&e.nodeType&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}},{key:"isContentEditable",value:function(e){return"true"===e.contentEditable}},{key:"isNativeInput",value:function(e){return!(!e||!e.tagName)&&["INPUT","TEXTAREA"].includes(e.tagName)}},{key:"canSetCaret",value:function(t){var n=!0;if(e.isNativeInput(t))switch(t.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":n=!1}else n=e.isContentEditable(t);return n}},{key:"isNodeEmpty",value:function(e){return!(this.isSingleTag(e)&&!this.isLineBreakTag(e))&&0===(this.isElement(e)&&this.isNativeInput(e)?e.value:e.textContent.replace("​","")).trim().length}},{key:"isLeaf",value:function(e){return!!e&&0===e.childNodes.length}},{key:"isEmpty",value:function(e){e.normalize();for(var t=[e];t.length>0;)if(e=t.shift()){if(this.isLeaf(e)&&!this.isNodeEmpty(e))return!1;e.childNodes&&t.push.apply(t,(0,r.default)(Array.from(e.childNodes)))}return!0}},{key:"isHTMLString",value:function(t){var n=e.make("div");return n.innerHTML=t,n.childElementCount>0}},{key:"getContentLength",value:function(t){return e.isNativeInput(t)?t.value.length:t.nodeType===Node.TEXT_NODE?t.length:t.textContent.length}},{key:"blockElements",get:function(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}},{key:"containsOnlyInlineElements",value:function(t){var n;return l.isString(t)?(n=document.createElement("div")).innerHTML=t:n=t,Array.from(n.children).every((function t(n){return!e.blockElements.includes(n.tagName.toLowerCase())&&Array.from(n.children).every(t)}))}},{key:"getDeepestBlockElements",value:function(t){return e.containsOnlyInlineElements(t)?[t]:Array.from(t.children).reduce((function(t,n){return[].concat((0,r.default)(t),(0,r.default)(e.getDeepestBlockElements(n)))}),[])}},{key:"getHolder",value:function(e){return l.isString(e)?document.getElementById(e):e}},{key:"isExtensionNode",value:function(e){return e&&["GRAMMARLY-EXTENSION"].includes(e.nodeName)}},{key:"isAnchor",value:function(e){return"a"===e.tagName.toLowerCase()}},{key:"offset",value:function(e){var t=e.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,o=window.pageYOffset||document.documentElement.scrollTop,r=t.top+o,i=t.left+n;return{top:r,left:i,bottom:r+t.height,right:i+t.width}}}]),e}();o.default=f,f.displayName="Dom",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o=n(367)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}},function(e,t){function n(e,t,n,o,r,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(o,r)}e.exports=function(e){return function(){var t=this,o=arguments;return new Promise((function(r,i){var a=e.apply(t,o);function s(e){n(a,r,i,s,l,"next",e)}function l(e){n(a,r,i,s,l,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var o=n(38);e.exports=function(e){return Object(o(e))}},function(e,t,n){var o=n(10),r=n(27),i=n(26),a=n(44)("src"),s=n(191),l=(""+s).split("toString");n(16).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,s){var c="function"==typeof n;c&&(i(n,"name")||r(n,"name",t)),e[t]!==n&&(c&&(i(n,a)||r(n,a,e[t]?""+e[t]:l.join(String(t)))),e===o?e[t]=n:s?e[t]?e[t]=n:r(e,t,n):(delete e[t],r(e,t,n)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[a]||s.call(this)}))},function(e,t,n){var o=n(0),r=n(11),i=n(38),a=/"/g,s=function(e,t,n,o){var r=String(i(e)),s="<"+t;return""!==n&&(s+=" "+n+'="'+String(o).replace(a,""")+'"'),s+">"+r+""};e.exports=function(e,t){var n={};n[e]=t(s),o(o.P+o.F*r((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3})),"String",n)}},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(8),n(19)],void 0===(i="function"==typeof(o=function(o,r,i,s,l){"use strict";var c=n(1);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=c(r),i=c(i),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(s),l=c(l);var f=function(){function e(){(0,r.default)(this,e),this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor",this.commandRemoveFormat="removeFormat"}return(0,i.default)(e,[{key:"removeFakeBackground",value:function(){this.isFakeBackgroundEnabled&&(this.isFakeBackgroundEnabled=!1,document.execCommand(this.commandRemoveFormat))}},{key:"setFakeBackground",value:function(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}},{key:"save",value:function(){this.savedSelectionRange=e.range}},{key:"restore",value:function(){if(this.savedSelectionRange){var e=window.getSelection();e.removeAllRanges(),e.addRange(this.savedSelectionRange)}}},{key:"clearSaved",value:function(){this.savedSelectionRange=null}},{key:"collapseToEnd",value:function(){var e=window.getSelection(),t=document.createRange();t.selectNodeContents(e.focusNode),t.collapse(!1),e.removeAllRanges(),e.addRange(t)}},{key:"findParentTag",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o=window.getSelection(),r=null;if(!o||!o.anchorNode||!o.focusNode)return null;var i=[o.anchorNode,o.focusNode];return i.forEach((function(o){for(var i=n;i>0&&o.parentNode&&(o.tagName!==e||(r=o,t&&o.classList&&!o.classList.contains(t)&&(r=null),!r));)o=o.parentNode,i--})),r}},{key:"expandToTag",value:function(e){var t=window.getSelection();t.removeAllRanges();var n=document.createRange();n.selectNodeContents(e),t.addRange(n)}}],[{key:"CSS",get:function(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}},{key:"anchorNode",get:function(){var e=window.getSelection();return e?e.anchorNode:null}},{key:"anchorElement",get:function(){var e=window.getSelection();if(!e)return null;var t=e.anchorNode;return t?l.default.isElement(t)?t:t.parentElement:null}},{key:"anchorOffset",get:function(){var e=window.getSelection();return e?e.anchorOffset:null}},{key:"isCollapsed",get:function(){var e=window.getSelection();return e?e.isCollapsed:null}},{key:"isAtEditor",get:function(){return this.isSelectionAtEditor(e.get())}},{key:"isSelectionAtEditor",value:function(t){if(!t)return!1;var n=t.anchorNode||t.focusNode;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);var o=null;return n&&n instanceof Element&&(o=n.closest(".".concat(e.CSS.editorZone))),!!o&&o.nodeType===Node.ELEMENT_NODE}},{key:"isRangeAtEditor",value:function(t){if(t){var n=t.startContainer;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);var o=null;return n&&n instanceof Element&&(o=n.closest(".".concat(e.CSS.editorZone))),!!o&&o.nodeType===Node.ELEMENT_NODE}}},{key:"isSelectionExists",get:function(){return!!e.get().anchorNode}},{key:"range",get:function(){return this.getRangeFromSelection(this.get())}},{key:"getRangeFromSelection",value:function(e){return e&&e.rangeCount?e.getRangeAt(0):null}},{key:"rect",get:function(){var e,t=document.selection,n={x:0,y:0,width:0,height:0};if(t&&"Control"!==t.type)return e=(t=t).createRange(),n.x=e.boundingLeft,n.y=e.boundingTop,n.width=e.boundingWidth,n.height=e.boundingHeight,n;if(!window.getSelection)return s.log("Method window.getSelection is not supported","warn"),n;if(null===(t=window.getSelection()).rangeCount||isNaN(t.rangeCount))return s.log("Method SelectionUtils.rangeCount is not supported","warn"),n;if(0===t.rangeCount)return n;if((e=t.getRangeAt(0).cloneRange()).getBoundingClientRect&&(n=e.getBoundingClientRect()),0===n.x&&0===n.y){var o=document.createElement("span");if(o.getBoundingClientRect){o.appendChild(document.createTextNode("​")),e.insertNode(o),n=o.getBoundingClientRect();var r=o.parentNode;r.removeChild(o),r.normalize()}}return n}},{key:"text",get:function(){return window.getSelection?window.getSelection().toString():""}},{key:"get",value:function(){return window.getSelection()}},{key:"setCursor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=document.createRange(),o=window.getSelection();if(l.default.isNativeInput(e)){if(!l.default.canSetCaret(e))return;return e.focus(),e.selectionStart=e.selectionEnd=t,e.getBoundingClientRect()}return n.setStart(e,t),n.setEnd(e,t),o.removeAllRanges(),o.addRange(n),n.getBoundingClientRect()}},{key:"addFakeCursor",value:function(t){var n=e.range,o=l.default.make("span","codex-editor__fake-cursor");o.dataset.mutationFree="true",!n||t&&!t.contains(n.startContainer)||(n.collapse(),n.insertNode(o))}},{key:"removeFakeCursor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body,t=l.default.find(e,".codex-editor__fake-cursor");t&&t.remove()}}]),e}();o.default=f,f.displayName="SelectionUtils",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var o=n(18),r=n(43);e.exports=n(17)?function(e,t,n){return o.f(e,t,r(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(61),r=n(38);e.exports=function(e){return o(r(e))}},function(e,t,n){"use strict";var o=n(11);e.exports=function(e,t){return!!e&&o((function(){t?e.call(null,(function(){}),1):e.call(null)}))}},function(e,t,n){var o=n(361),r=n(362),i=n(146),a=n(363);e.exports=function(e,t){return o(e)||r(e,t)||i(e,t)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var o=n(32);e.exports=function(e,t,n){if(o(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,o){return e.call(t,n,o)};case 3:return function(n,o,r){return e.call(t,n,o,r)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n=Math.ceil,o=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?o:n)(e)}},function(e,t,n){var o=n(62),r=n(43),i=n(28),a=n(41),s=n(26),l=n(115),c=Object.getOwnPropertyDescriptor;t.f=n(17)?c:function(e,t){if(e=i(e),t=a(t,!0),l)try{return c(e,t)}catch(e){}if(s(e,t))return r(!o.f.call(e,t),e[t])}},function(e,t,n){var o=n(0),r=n(16),i=n(11);e.exports=function(e,t){var n=(r.Object||{})[e]||Object[e],a={};a[e]=t(n),o(o.S+o.F*i((function(){n(1)})),"Object",a)}},function(e,t,n){var o=n(31),r=n(61),i=n(22),a=n(15),s=n(131);e.exports=function(e,t){var n=1==e,l=2==e,c=3==e,u=4==e,f=6==e,d=5==e||f,p=t||s;return function(t,s,h){for(var v,y,g=i(t),b=r(g),m=o(s,h,3),k=a(b.length),x=0,w=n?p(t,k):l?p(t,0):void 0;k>x;x++)if((d||x in b)&&(y=m(v=b[x],x,g),e))if(n)w[x]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return x;case 2:w.push(v)}else if(u)return!1;return f?-1:c||u?u:w}}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){"use strict";if(n(17)){var o=n(45),r=n(10),i=n(11),a=n(0),s=n(80),l=n(109),c=n(31),u=n(58),f=n(43),d=n(27),p=n(59),h=n(33),v=n(15),y=n(142),g=n(47),b=n(41),m=n(26),k=n(63),x=n(13),w=n(22),S=n(101),C=n(48),T=n(50),E=n(49).f,_=n(103),B=n(44),O=n(14),M=n(36),I=n(70),P=n(64),L=n(105),R=n(56),A=n(73),j=n(57),N=n(104),D=n(133),F=n(18),H=n(34),W=F.f,U=H.f,z=r.RangeError,V=r.TypeError,Y=r.Uint8Array,X=Array.prototype,Z=l.ArrayBuffer,G=l.DataView,K=M(0),q=M(2),J=M(3),$=M(4),Q=M(5),ee=M(6),te=I(!0),ne=I(!1),oe=L.values,re=L.keys,ie=L.entries,ae=X.lastIndexOf,se=X.reduce,le=X.reduceRight,ce=X.join,ue=X.sort,fe=X.slice,de=X.toString,pe=X.toLocaleString,he=O("iterator"),ve=O("toStringTag"),ye=B("typed_constructor"),ge=B("def_constructor"),be=s.CONSTR,me=s.TYPED,ke=s.VIEW,xe=M(1,(function(e,t){return Ee(P(e,e[ge]),t)})),we=i((function(){return 1===new Y(new Uint16Array([1]).buffer)[0]})),Se=!!Y&&!!Y.prototype.set&&i((function(){new Y(1).set({})})),Ce=function(e,t){var n=h(e);if(n<0||n%t)throw z("Wrong offset!");return n},Te=function(e){if(x(e)&&me in e)return e;throw V(e+" is not a typed array!")},Ee=function(e,t){if(!x(e)||!(ye in e))throw V("It is not a typed array constructor!");return new e(t)},_e=function(e,t){return Be(P(e,e[ge]),t)},Be=function(e,t){for(var n=0,o=t.length,r=Ee(e,o);o>n;)r[n]=t[n++];return r},Oe=function(e,t,n){W(e,t,{get:function(){return this._d[n]}})},Me=function(e){var t,n,o,r,i,a,s=w(e),l=arguments.length,u=l>1?arguments[1]:void 0,f=void 0!==u,d=_(s);if(null!=d&&!S(d)){for(a=d.call(s),o=[],t=0;!(i=a.next()).done;t++)o.push(i.value);s=o}for(f&&l>2&&(u=c(u,arguments[2],2)),t=0,n=v(s.length),r=Ee(this,n);n>t;t++)r[t]=f?u(s[t],t):s[t];return r},Ie=function(){for(var e=0,t=arguments.length,n=Ee(this,t);t>e;)n[e]=arguments[e++];return n},Pe=!!Y&&i((function(){pe.call(new Y(1))})),Le=function(){return pe.apply(Pe?fe.call(Te(this)):Te(this),arguments)},Re={copyWithin:function(e,t){return D.call(Te(this),e,t,arguments.length>2?arguments[2]:void 0)},every:function(e){return $(Te(this),e,arguments.length>1?arguments[1]:void 0)},fill:function(e){return N.apply(Te(this),arguments)},filter:function(e){return _e(this,q(Te(this),e,arguments.length>1?arguments[1]:void 0))},find:function(e){return Q(Te(this),e,arguments.length>1?arguments[1]:void 0)},findIndex:function(e){return ee(Te(this),e,arguments.length>1?arguments[1]:void 0)},forEach:function(e){K(Te(this),e,arguments.length>1?arguments[1]:void 0)},indexOf:function(e){return ne(Te(this),e,arguments.length>1?arguments[1]:void 0)},includes:function(e){return te(Te(this),e,arguments.length>1?arguments[1]:void 0)},join:function(e){return ce.apply(Te(this),arguments)},lastIndexOf:function(e){return ae.apply(Te(this),arguments)},map:function(e){return xe(Te(this),e,arguments.length>1?arguments[1]:void 0)},reduce:function(e){return se.apply(Te(this),arguments)},reduceRight:function(e){return le.apply(Te(this),arguments)},reverse:function(){for(var e,t=Te(this).length,n=Math.floor(t/2),o=0;o1?arguments[1]:void 0)},sort:function(e){return ue.call(Te(this),e)},subarray:function(e,t){var n=Te(this),o=n.length,r=g(e,o);return new(P(n,n[ge]))(n.buffer,n.byteOffset+r*n.BYTES_PER_ELEMENT,v((void 0===t?o:g(t,o))-r))}},Ae=function(e,t){return _e(this,fe.call(Te(this),e,t))},je=function(e){Te(this);var t=Ce(arguments[1],1),n=this.length,o=w(e),r=v(o.length),i=0;if(r+t>n)throw z("Wrong length!");for(;i255?255:255&o),r.v[p](n*t+r.o,o,we)}(this,n,e)},enumerable:!0})};m?(h=n((function(e,n,o,r){u(e,h,c,"_d");var i,a,s,l,f=0,p=0;if(x(n)){if(!(n instanceof Z||"ArrayBuffer"==(l=k(n))||"SharedArrayBuffer"==l))return me in n?Be(h,n):Me.call(h,n);i=n,p=Ce(o,t);var g=n.byteLength;if(void 0===r){if(g%t)throw z("Wrong length!");if((a=g-p)<0)throw z("Wrong length!")}else if((a=v(r)*t)+p>g)throw z("Wrong length!");s=a/t}else s=y(n),i=new Z(a=s*t);for(d(e,"_d",{b:i,o:p,l:a,e:s,v:new G(i)});fdocument.F=Object<\/script>"),e.close(),l=e.F;o--;)delete l.prototype[i[o]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=o(e),n=new s,s.prototype=null,n[a]=e):n=l(),void 0===t?n:r(n,t)}},function(e,t,n){var o=n(117),r=n(88).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return o(e,r)}},function(e,t,n){var o=n(26),r=n(22),i=n(87)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=r(e),o(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var o=n(14)("unscopables"),r=Array.prototype;null==r[o]&&n(27)(r,o,{}),e.exports=function(e){r[o][e]=!0}},function(e,t,n){var o=n(13);e.exports=function(e,t){if(!o(e)||e._t!==t)throw TypeError("Incompatible receiver, "+t+" required!");return e}},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(148)],void 0===(i="function"==typeof(o=function(o,r,i,a){"use strict";var s=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=s(r),i=s(i),a=s(a);var l=function(){function e(){(0,r.default)(this,e)}return(0,i.default)(e,null,[{key:"ui",value:function(t,n){return e._t(t,n)}},{key:"t",value:function(t,n){return e._t(t,n)}},{key:"setDictionary",value:function(t){e.currentDictionary=t}},{key:"_t",value:function(t,n){var o=e.getNamespace(t);return o&&o[n]?o[n]:n}},{key:"getNamespace",value:function(t){return t.split(".").reduce((function(e,t){return e&&Object.keys(e).length?e[t]:{}}),e.currentDictionary)}}]),e}();o.default=l,l.displayName="I18n",l.currentDictionary=a.default,e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o=n(18).f,r=n(26),i=n(14)("toStringTag");e.exports=function(e,t,n){e&&!r(e=n?e:e.prototype,i)&&o(e,i,{configurable:!0,value:t})}},function(e,t,n){var o=n(0),r=n(38),i=n(11),a=n(91),s="["+a+"]",l=RegExp("^"+s+s+"*"),c=RegExp(s+s+"*$"),u=function(e,t,n){var r={},s=i((function(){return!!a[e]()||"​…"!="​…"[e]()})),l=r[e]=s?t(f):a[e];n&&(r[n]=l),o(o.P+o.F*s,"String",r)},f=u.trim=function(e,t){return e=String(r(e)),1&t&&(e=e.replace(l,"")),2&t&&(e=e.replace(c,"")),e};e.exports=u},function(e,t){e.exports={}},function(e,t,n){"use strict";var o=n(10),r=n(18),i=n(17),a=n(14)("species");e.exports=function(e){var t=o[e];i&&t&&!t[a]&&r.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t){e.exports=function(e,t,n,o){if(!(e instanceof t)||void 0!==o&&o in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var o=n(23);e.exports=function(e,t,n){for(var r in t)o(e,r,t[r],n);return e}},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(30),n(21),n(40),n(2),n(3),n(150),n(112),n(5),n(6),n(4),n(19),n(8),n(111),n(25),n(81)],void 0===(i="function"==typeof(o=function(e,t,o,r,i,s,l,c,u,f,d,p,h,v,y,g,b){"use strict";var m,k=n(1);function x(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(x=function(e){return e?n:t})(e)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,p.default)(e);if(t){var r=(0,p.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,d.default)(this,n)}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BlockToolAPI=void 0,t=k(t),o=k(o),r=k(r),i=k(i),s=k(s),l=k(l),c=k(c),u=k(u),f=k(f),d=k(d),p=k(p),h=k(h),v=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=x(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(v),y=k(y),g=k(g),b=k(b),e.BlockToolAPI=m,function(e){e.APPEND_CALLBACK="appendCallback",e.RENDERED="rendered",e.MOVED="moved",e.UPDATED="updated",e.REMOVED="removed",e.ON_PASTE="onPaste"}(m||(e.BlockToolAPI=m={}));var S=function(e){(0,f.default)(x,e);var n,a,d,b,k=w(x);function x(e){var t,n=e.id,o=void 0===n?v.generateBlockId():n,r=e.data,a=e.tool,l=e.api,u=e.readOnly,f=e.tunesData;return(0,s.default)(this,x),(t=k.call(this)).cachedInputs=[],t.tunesInstances=new Map,t.defaultTunesInstances=new Map,t.unavailableTunesData={},t.inputIndex=0,t.modificationDebounceTimer=450,t.didMutated=v.debounce((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=e instanceof InputEvent||!e.some((function(e){var t=e.addedNodes,n=void 0===t?[]:t,o=e.removedNodes;return[].concat((0,i.default)(Array.from(n)),(0,i.default)(Array.from(o))).some((function(e){return h.default.isElement(e)&&"true"===e.dataset.mutationFree}))}));n&&(t.cachedInputs=[],t.updateCurrentInput(),t.call(m.UPDATED),t.emit("didMutated",(0,c.default)(t)))}),t.modificationDebounceTimer),t.handleFocus=function(){t.cachedInputs=[],t.updateCurrentInput()},t.name=a.name,t.id=o,t.settings=a.settings,t.config=a.settings.config||{},t.api=l,t.blockAPI=new y.default((0,c.default)(t)),t.mutationObserver=new MutationObserver(t.didMutated),t.tool=a,t.toolInstance=a.create(r,t.blockAPI,u),t.tunes=a.tunes,t.composeTunes(f),t.holder=t.compose(),t}return(0,l.default)(x,[{key:"inputs",get:function(){if(0!==this.cachedInputs.length)return this.cachedInputs;var e=h.default.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}},{key:"currentInput",get:function(){return this.inputs[this.inputIndex]},set:function(e){var t=this.inputs.findIndex((function(t){return t===e||t.contains(e)}));-1!==t&&(this.inputIndex=t)}},{key:"firstInput",get:function(){return this.inputs[0]}},{key:"lastInput",get:function(){var e=this.inputs;return e[e.length-1]}},{key:"nextInput",get:function(){return this.inputs[this.inputIndex+1]}},{key:"previousInput",get:function(){return this.inputs[this.inputIndex-1]}},{key:"data",get:function(){return this.save().then((function(e){return e&&!v.isEmpty(e.data)?e.data:{}}))}},{key:"sanitize",get:function(){return this.tool.sanitizeConfig}},{key:"mergeable",get:function(){return v.isFunction(this.toolInstance.merge)}},{key:"isEmpty",get:function(){var e=h.default.isEmpty(this.pluginsContent),t=!this.hasMedia;return e&&t}},{key:"hasMedia",get:function(){return!!this.holder.querySelector(["img","iframe","video","audio","source","input","textarea","twitterwidget"].join(","))}},{key:"focused",get:function(){return this.holder.classList.contains(x.CSS.focused)},set:function(e){this.holder.classList.toggle(x.CSS.focused,e)}},{key:"selected",get:function(){return this.holder.classList.contains(x.CSS.selected)},set:function(e){e?(this.holder.classList.add(x.CSS.selected),g.default.addFakeCursor(this.holder)):(this.holder.classList.remove(x.CSS.selected),g.default.removeFakeCursor(this.holder))}},{key:"stretched",get:function(){return this.holder.classList.contains(x.CSS.wrapperStretched)},set:function(e){this.holder.classList.toggle(x.CSS.wrapperStretched,e)}},{key:"dropTarget",set:function(e){this.holder.classList.toggle(x.CSS.dropTarget,e)}},{key:"pluginsContent",get:function(){var e=this.holder.querySelector(".".concat(x.CSS.content));if(e&&e.childNodes.length)for(var t=e.childNodes.length-1;t>=0;t--){var n=e.childNodes[t];if(!h.default.isExtensionNode(n))return n}return null}},{key:"call",value:function(e,t){if(v.isFunction(this.toolInstance[e])){e===m.APPEND_CALLBACK&&v.log("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[e].call(this.toolInstance,t)}catch(t){v.log("Error during '".concat(e,"' call: ").concat(t.message),"error")}}}},{key:"mergeWith",value:(b=(0,r.default)(t.default.mark((function e(n){return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.toolInstance.merge(n);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"save",value:(d=(0,r.default)(t.default.mark((function e(){var n,r,a,s,l=this;return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.toolInstance.save(this.pluginsContent);case 2:return n=e.sent,r=this.unavailableTunesData,[].concat((0,i.default)(this.tunesInstances.entries()),(0,i.default)(this.defaultTunesInstances.entries())).forEach((function(e){var t=(0,o.default)(e,2),n=t[0],i=t[1];if(v.isFunction(i.save))try{r[n]=i.save()}catch(e){v.log("Tune ".concat(i.constructor.name," save method throws an Error %o"),"warn",e)}})),a=window.performance.now(),e.abrupt("return",Promise.resolve(n).then((function(e){return s=window.performance.now(),{id:l.id,tool:l.name,data:e,tunes:r,time:s-a}})).catch((function(e){v.log("Saving process for ".concat(l.name," tool failed due to the ").concat(e),"log","red")})));case 7:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"validate",value:(a=(0,r.default)(t.default.mark((function e(n){var o;return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=!0,!(this.toolInstance.validate instanceof Function)){e.next=5;break}return e.next=4,this.toolInstance.validate(n);case 4:o=e.sent;case 5:return e.abrupt("return",o);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getTunes",value:function(){var e=document.createElement("div"),t=[];return["function"==typeof this.toolInstance.renderSettings?this.toolInstance.renderSettings():[],[].concat((0,i.default)(this.tunesInstances.values()),(0,i.default)(this.defaultTunesInstances.values())).map((function(e){return e.render()}))].flat().forEach((function(n){h.default.isElement(n)?e.appendChild(n):Array.isArray(n)?t.push.apply(t,(0,i.default)(n)):t.push(n)})),[t,e]}},{key:"updateCurrentInput",value:function(){this.currentInput=h.default.isNativeInput(document.activeElement)||!g.default.anchorNode?document.activeElement:g.default.anchorNode}},{key:"willSelect",value:function(){this.mutationObserver.observe(this.holder.firstElementChild,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.addInputEvents()}},{key:"willUnselect",value:function(){this.mutationObserver.disconnect(),this.removeInputEvents()}},{key:"dispatchChange",value:function(){this.didMutated()}},{key:"destroy",value:function(){(0,u.default)((0,p.default)(x.prototype),"destroy",this).call(this),v.isFunction(this.toolInstance.destroy)&&this.toolInstance.destroy()}},{key:"getActiveToolboxEntry",value:(n=(0,r.default)(t.default.mark((function e(){var n,r,i;return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(1!==(n=this.tool.toolbox).length){e.next=3;break}return e.abrupt("return",Promise.resolve(this.tool.toolbox[0]));case 3:return e.next=5,this.data;case 5:return r=e.sent,i=n,e.abrupt("return",i.find((function(e){return Object.entries(e.data).some((function(e){var t=(0,o.default)(e,2),n=t[0],i=t[1];return r[n]&&v.equals(r[n],i)}))})));case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"compose",value:function(){var e=h.default.make("div",x.CSS.wrapper),t=h.default.make("div",x.CSS.content),n=this.toolInstance.render();t.appendChild(n);var o=t;return[].concat((0,i.default)(this.tunesInstances.values()),(0,i.default)(this.defaultTunesInstances.values())).forEach((function(e){if(v.isFunction(e.wrap))try{o=e.wrap(o)}catch(t){v.log("Tune ".concat(e.constructor.name," wrap method throws an Error %o"),"warn",t)}})),e.appendChild(o),e}},{key:"composeTunes",value:function(e){var t=this;Array.from(this.tunes.values()).forEach((function(n){(n.isInternal?t.defaultTunesInstances:t.tunesInstances).set(n.name,n.create(e[n.name],t.blockAPI))})),Object.entries(e).forEach((function(e){var n=(0,o.default)(e,2),r=n[0],i=n[1];t.tunesInstances.has(r)||(t.unavailableTunesData[r]=i)}))}},{key:"addInputEvents",value:function(){var e=this;this.inputs.forEach((function(t){t.addEventListener("focus",e.handleFocus),h.default.isNativeInput(t)&&t.addEventListener("input",e.didMutated)}))}},{key:"removeInputEvents",value:function(){var e=this;this.inputs.forEach((function(t){t.removeEventListener("focus",e.handleFocus),h.default.isNativeInput(t)&&t.removeEventListener("input",e.didMutated)}))}}],[{key:"CSS",get:function(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",focused:"ce-block--focused",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}}]),x}(b.default);e.default=S,S.displayName="Block"})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o=n(37);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==o(e)?e.split(""):Object(e)}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var o=n(37),r=n(14)("toStringTag"),i="Arguments"==o(function(){return arguments}());e.exports=function(e){var t,n,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),r))?n:i?o(t):"Object"==(a=o(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t,n){var o=n(12),r=n(32),i=n(14)("species");e.exports=function(e,t){var n,a=o(e).constructor;return void 0===a||null==(n=o(a)[i])?t:r(n)}},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(8),n(379)],void 0===(i="function"==typeof(o=function(e,t,o){"use strict";var r=n(1);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={tags:t},r=new o.default(n);return r.clean(e)}function l(e,n){return Array.isArray(e)?(i=n,e.map((function(e){return l(e,i)}))):t.isObject(e)?function(e,n){var o,r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=e[i],s=(o=n[i],t.isObject(o)||t.isBoolean(o)||t.isFunction(o)?n[i]:n);r[i]=l(a,s)}return r}(e,n):t.isString(e)?(o=e,r=n,t.isObject(r)?s(o,r):!1===r?s(o,{}):o):e;var o,r,i}Object.defineProperty(e,"__esModule",{value:!0}),e.clean=s,e.sanitizeBlocks=function(e,n){return e.map((function(e){var o=t.isFunction(n)?n(e.tool):n;return t.isEmpty(o)||(e.data=l(e.data,o)),e}))},t=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var l=r?Object.getOwnPropertyDescriptor(e,s):null;l&&(l.get||l.set)?Object.defineProperty(o,s,l):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}(t),o=r(o)})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(381),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,s,l){"use strict";var c=n(1);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=c(r),i=c(i),s=c(s),l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(l);var f=function(){function e(t){var n=this;(0,r.default)(this,e),this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=function(t){if(n.isEventReadyForHandling(t))switch(e.usedKeys.includes(t.keyCode)&&t.preventDefault(),t.keyCode){case l.keyCodes.TAB:n.handleTabPress(t);break;case l.keyCodes.LEFT:case l.keyCodes.UP:n.flipLeft();break;case l.keyCodes.RIGHT:case l.keyCodes.DOWN:n.flipRight();break;case l.keyCodes.ENTER:n.handleEnterPress(t)}},this.iterator=new s.default(t.items,t.focusedItemClass),this.activateCallback=t.activateCallback,this.allowedKeys=t.allowedKeys||e.usedKeys}return(0,i.default)(e,[{key:"isActivated",get:function(){return this.activated}},{key:"activate",value:function(e,t){this.activated=!0,e&&this.iterator.setItems(e),void 0!==t&&this.iterator.setCursor(t),document.addEventListener("keydown",this.onKeyDown,!0)}},{key:"deactivate",value:function(){this.activated=!1,this.dropCursor(),document.removeEventListener("keydown",this.onKeyDown)}},{key:"focusFirst",value:function(){this.dropCursor(),this.flipRight()}},{key:"flipLeft",value:function(){this.iterator.previous(),this.flipCallback()}},{key:"flipRight",value:function(){this.iterator.next(),this.flipCallback()}},{key:"hasFocus",value:function(){return!!this.iterator.currentItem}},{key:"onFlip",value:function(e){this.flipCallbacks.push(e)}},{key:"removeOnFlip",value:function(e){this.flipCallbacks=this.flipCallbacks.filter((function(t){return t!==e}))}},{key:"dropCursor",value:function(){this.iterator.dropCursor()}},{key:"isEventReadyForHandling",value:function(e){return this.activated&&this.allowedKeys.includes(e.keyCode)}},{key:"handleTabPress",value:function(e){switch(e.shiftKey?s.default.directions.LEFT:s.default.directions.RIGHT){case s.default.directions.RIGHT:this.flipRight();break;case s.default.directions.LEFT:this.flipLeft()}}},{key:"handleEnterPress",value:function(e){this.activated&&(this.iterator.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),l.isFunction(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}},{key:"flipCallback",value:function(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach((function(e){return e()}))}}],[{key:"usedKeys",get:function(){return[l.keyCodes.TAB,l.keyCodes.LEFT,l.keyCodes.RIGHT,l.keyCodes.ENTER,l.keyCodes.UP,l.keyCodes.DOWN]}}]),e}();o.default=f,f.displayName="Flipper",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(30),n(148),n(8)],void 0===(i="function"==typeof(o=function(e,t,o,r){"use strict";var i=n(1);Object.defineProperty(e,"__esModule",{value:!0}),e.I18nInternalNS=void 0,t=i(t);var a=function e(n,o){var i={};return Object.entries(n).forEach((function(n){var a=(0,t.default)(n,2),s=a[0],l=a[1];if((0,r.isObject)(l)){var c=o?"".concat(o,".").concat(s):s,u=Object.values(l).every((function(e){return(0,r.isString)(e)}));i[s]=u?c:e(l,c)}else i[s]=l})),i}((o=i(o)).default);e.I18nInternalNS=a})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(8)],void 0===(i="function"==typeof(o=function(e,t,o,r){"use strict";var i,s,l,c,u,f,d=n(1);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.UserSettings=e.ToolType=e.InternalTuneSettings=e.InternalInlineToolSettings=e.InternalBlockToolSettings=e.CommonInternalSettings=void 0,t=d(t),o=d(o),r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(r),e.ToolType=i,function(e){e[e.Block=0]="Block",e[e.Inline=1]="Inline",e[e.Tune=2]="Tune"}(i||(e.ToolType=i={})),e.UserSettings=s,function(e){e.Shortcut="shortcut",e.Toolbox="toolbox",e.EnabledInlineTools="inlineToolbar",e.EnabledBlockTunes="tunes",e.Config="config"}(s||(e.UserSettings=s={})),e.CommonInternalSettings=l,function(e){e.Shortcut="shortcut",e.SanitizeConfig="sanitize"}(l||(e.CommonInternalSettings=l={})),e.InternalBlockToolSettings=c,function(e){e.IsEnabledLineBreaks="enableLineBreaks",e.Toolbox="toolbox",e.ConversionConfig="conversionConfig",e.IsReadOnlySupported="isReadOnlySupported",e.PasteConfig="pasteConfig"}(c||(e.InternalBlockToolSettings=c={})),e.InternalInlineToolSettings=u,function(e){e.IsInline="isInline",e.Title="title"}(u||(e.InternalInlineToolSettings=u={})),e.InternalTuneSettings=f,function(e){e.IsTune="isTune"}(f||(e.InternalTuneSettings=f={}));var h=function(){function e(n){var o=n.name,r=n.constructable,i=n.config,a=n.api,s=n.isDefault,l=n.isInternal,c=void 0!==l&&l,u=n.defaultPlaceholder;(0,t.default)(this,e),this.api=a,this.name=o,this.constructable=r,this.config=i,this.isDefault=s,this.isInternal=c,this.defaultPlaceholder=u}return(0,o.default)(e,[{key:"settings",get:function(){var e=this.config[s.Config]||{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}},{key:"reset",value:function(){if(r.isFunction(this.constructable.reset))return this.constructable.reset()}},{key:"prepare",value:function(){if(r.isFunction(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}},{key:"shortcut",get:function(){var e=this.constructable[l.Shortcut];return this.config[s.Shortcut]||e}},{key:"sanitizeConfig",get:function(){return this.constructable[l.SanitizeConfig]||{}}},{key:"isInline",value:function(){return this.type===i.Inline}},{key:"isBlock",value:function(){return this.type===i.Block}},{key:"isTune",value:function(){return this.type===i.Tune}}]),e}();e.default=h,h.displayName="BaseTool"})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o=n(16),r=n(10),i=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:o.version,mode:n(45)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var o=n(28),r=n(15),i=n(47);e.exports=function(e){return function(t,n,a){var s,l=o(t),c=r(l.length),u=i(a,c);if(e&&n!=n){for(;c>u;)if((s=l[u++])!=s)return!0}else for(;c>u;u++)if((e||u in l)&&l[u]===n)return e||u||0;return!e&&-1}}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var o=n(37);e.exports=Array.isArray||function(e){return"Array"==o(e)}},function(e,t,n){var o=n(14)("iterator"),r=!1;try{var i=[7][o]();i.return=function(){r=!0},Array.from(i,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!r)return!1;var n=!1;try{var i=[7],a=i[o]();a.next=function(){return{done:n=!0}},i[o]=function(){return a},e(i)}catch(e){}return n}},function(e,t,n){"use strict";var o=n(12);e.exports=function(){var e=o(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){"use strict";var o=n(63),r=RegExp.prototype.exec;e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw new TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==o(e))throw new TypeError("RegExp#exec called on incompatible receiver");return r.call(e,t)}},function(e,t,n){"use strict";n(135);var o=n(23),r=n(27),i=n(11),a=n(38),s=n(14),l=n(106),c=s("species"),u=!i((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")})),f=function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();e.exports=function(e,t,n){var d=s(e),p=!i((function(){var t={};return t[d]=function(){return 7},7!=""[e](t)})),h=p?!i((function(){var t=!1,n=/a/;return n.exec=function(){return t=!0,null},"split"===e&&(n.constructor={},n.constructor[c]=function(){return n}),n[d](""),!t})):void 0;if(!p||!h||"replace"===e&&!u||"split"===e&&!f){var v=/./[d],y=n(a,d,""[e],(function(e,t,n,o,r){return t.exec===l?p&&!r?{done:!0,value:v.call(t,n,o)}:{done:!0,value:e.call(n,t,o)}:{done:!1}})),g=y[0],b=y[1];o(String.prototype,e,g),r(RegExp.prototype,d,2==t?function(e,t){return b.call(e,this,t)}:function(e){return b.call(e,this)})}}},function(e,t,n){var o=n(31),r=n(130),i=n(101),a=n(12),s=n(15),l=n(103),c={},u={};(t=e.exports=function(e,t,n,f,d){var p,h,v,y,g=d?function(){return e}:l(e),b=o(n,f,t?2:1),m=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(i(g)){for(p=s(e.length);p>m;m++)if((y=t?b(a(h=e[m])[0],h[1]):b(e[m]))===c||y===u)return y}else for(v=g.call(e);!(h=v.next()).done;)if((y=r(v,b,h.value,t))===c||y===u)return y}).BREAK=c,t.RETURN=u},function(e,t,n){var o=n(10).navigator;e.exports=o&&o.userAgent||""},function(e,t,n){"use strict";var o=n(10),r=n(0),i=n(23),a=n(59),s=n(42),l=n(77),c=n(58),u=n(13),f=n(11),d=n(73),p=n(54),h=n(92);e.exports=function(e,t,n,v,y,g){var b=o[e],m=b,k=y?"set":"add",x=m&&m.prototype,w={},S=function(e){var t=x[e];i(x,e,"delete"==e||"has"==e?function(e){return!(g&&!u(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!u(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,n){return t.call(this,0===e?0:e,n),this})};if("function"==typeof m&&(g||x.forEach&&!f((function(){(new m).entries().next()})))){var C=new m,T=C[k](g?{}:-0,1)!=C,E=f((function(){C.has(1)})),_=d((function(e){new m(e)})),B=!g&&f((function(){for(var e=new m,t=5;t--;)e[k](t,t);return!e.has(-0)}));_||((m=t((function(t,n){c(t,m,e);var o=h(new b,t,m);return null!=n&&l(n,y,o[k],o),o}))).prototype=x,x.constructor=m),(E||B)&&(S("delete"),S("has"),y&&S("get")),(B||T)&&S(k),g&&x.clear&&delete x.clear}else m=v.getConstructor(t,e,y,k),a(m.prototype,n),s.NEED=!0;return p(m,e),w[e]=m,r(r.G+r.W+r.F*(m!=b),w),g||v.setStrong(m,e,y),m}},function(e,t,n){for(var o,r=n(10),i=n(27),a=n(44),s=a("typed_array"),l=a("view"),c=!(!r.ArrayBuffer||!r.DataView),u=c,f=0,d="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");f<9;)(o=r[d[f++]])?(i(o.prototype,s,!0),i(o.prototype,l,!0)):u=!1;e.exports={ABV:c,CONSTR:u,TYPED:s,VIEW:l}},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,a){"use strict";var s=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=s(r),i=s(i);var l=function(){function e(){(0,r.default)(this,e),this.subscribers={}}return(0,i.default)(e,[{key:"on",value:function(e,t){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(t)}},{key:"once",value:function(e,t){var n=this;e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push((function o(r){var i=t(r),a=n.subscribers[e].indexOf(o);return-1!==a&&n.subscribers[e].splice(a,1),i}))}},{key:"emit",value:function(e,t){!(0,a.isEmpty)(this.subscribers)&&this.subscribers[e]&&this.subscribers[e].reduce((function(e,t){return t(e)||e}),t)}},{key:"off",value:function(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:this.Editor.BlockManager.currentBlock;if(this.toolboxInstance.close(),this.Editor.BlockSettings.close(),e){this.hoveredBlock=e;var t,n=e.holder,o=this.Editor.UI.isMobile,r=e.pluginsContent,i=window.getComputedStyle(r),a=parseInt(i.paddingTop,10),s=n.offsetHeight;t=o?n.offsetTop+s:n.offsetTop+a,this.nodes.wrapper.style.top="".concat(Math.floor(t),"px"),1===this.Editor.BlockManager.blocks.length&&e.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}}},{key:"close",value:function(){this.Editor.ReadOnly.isEnabled||(this.nodes.wrapper.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),this.toolboxInstance.close(),this.Editor.BlockSettings.close())}},{key:"open",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];d.delay((function(){e.nodes.wrapper.classList.add(e.CSS.toolbarOpened),t?e.blockActions.show():e.blockActions.hide()}),50)()}},{key:"make",value:function(){var e=this;this.nodes.wrapper=f.default.make("div",this.CSS.toolbar),["content","actions"].forEach((function(t){e.nodes[t]=f.default.make("div",e.CSS[t])})),f.default.append(this.nodes.wrapper,this.nodes.content),f.default.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=f.default.make("div",this.CSS.plusButton,{innerHTML:''}),f.default.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",(function(){e.tooltip.hide(!0),e.plusButtonClicked()}),!1);var t=f.default.make("div");t.appendChild(document.createTextNode(p.default.ui(h.I18nInternalNS.ui.toolbar.toolbox,"Add"))),t.appendChild(f.default.make("div",this.CSS.plusButtonShortcut,{textContent:"⇥ Tab"})),this.tooltip.onHover(this.nodes.plusButton,t,{hidingDelay:400}),this.nodes.settingsToggler=f.default.make("span",this.CSS.settingsToggler,{innerHTML:''}),f.default.append(this.nodes.actions,this.nodes.settingsToggler),this.tooltip.onHover(this.nodes.settingsToggler,p.default.ui(h.I18nInternalNS.ui.blockTunes.toggler,"Click to tune"),{hidingDelay:400}),f.default.append(this.nodes.actions,this.makeToolbox()),f.default.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),f.default.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}},{key:"makeToolbox",value:function(){var e=this;return this.toolboxInstance=new y.default({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:p.default.ui(h.I18nInternalNS.ui.popover,"Filter"),nothingFound:p.default.ui(h.I18nInternalNS.ui.popover,"Nothing found")}}),this.toolboxInstance.on(y.ToolboxEvent.Opened,(function(){e.Editor.UI.nodes.wrapper.classList.add(e.CSS.openedToolboxHolderModifier)})),this.toolboxInstance.on(y.ToolboxEvent.Closed,(function(){e.Editor.UI.nodes.wrapper.classList.remove(e.CSS.openedToolboxHolderModifier)})),this.toolboxInstance.on(y.ToolboxEvent.BlockAdded,(function(t){var n=t.block,o=e.Editor,r=o.BlockManager,i=o.Caret,a=r.getBlockById(n.id);0===a.inputs.length&&(a===r.lastBlock?(r.insertAtEnd(),i.setToBlock(r.lastBlock)):i.setToBlock(r.nextBlock))})),this.toolboxInstance.make()}},{key:"plusButtonClicked",value:function(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.toggle()}},{key:"enableModuleBindings",value:function(){var e=this;this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",(function(t){t.stopPropagation(),e.settingsTogglerClicked(),e.toolboxInstance.close(),e.tooltip.hide(!0)}),!0),d.isMobileScreen()||this.eventsDispatcher.on(this.Editor.UI.events.blockHovered,(function(t){e.Editor.BlockSettings.opened||e.toolboxInstance.opened||e.moveAndOpen(t.block)}))}},{key:"disableModuleBindings",value:function(){this.readOnlyMutableListeners.clearAll()}},{key:"settingsTogglerClicked",value:function(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.BlockSettings.open(this.hoveredBlock)}},{key:"drawUI",value:function(){this.Editor.BlockSettings.make(),this.make()}},{key:"destroy",value:function(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy(),this.tooltip.destroy()}}]),n}(u.default);o.default=x,x.displayName="Toolbar",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(40),n(2),n(3),n(5),n(6),n(4),n(7),n(19),n(152),n(66),n(81),n(8),n(386)],void 0===(i="function"==typeof(o=function(e,t,o,r,i,a,s,l,c,u,f,d,p,h){"use strict";var v=n(1);function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,s.default)(e);if(t){var r=(0,s.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,a.default)(this,n)}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.PopoverEvent=void 0,t=v(t),o=v(o),r=v(r),i=v(i),a=v(a),s=v(s),l=v(l),c=v(c),u=v(u),f=v(f),d=v(d),h=v(h);var g,b=function(e,t,n,o){var r,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"===("undefined"==typeof Reflect?"undefined":(0,l.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a};e.PopoverEvent=g,function(e){e.OverlayClicked="overlay-clicked",e.Close="close"}(g||(e.PopoverEvent=g={}));var m=function(e){(0,i.default)(a,e);var n=y(a);function a(e){var t,r=e.items,i=e.className,s=e.searchable,l=e.filterLabel,c=e.nothingFoundLabel,f=e.customContent,d=e.customContentFlippableItems,p=e.scopeElement;return(0,o.default)(this,a),(t=n.call(this)).customContentFlippableItems=[],t.isShown=!1,t.nodes={wrapper:null,popover:null,items:null,nothingFound:null,overlay:null},t.scrollLocker=new h.default,t.itemsRequiringConfirmation={},t.removeSpecialHoverBehavior=function(){var e=t.nodes.items.querySelector(".".concat(a.CSS.itemNoHover));e&&e.classList.remove(a.CSS.itemNoHover)},t.onFlip=function(){t.disableSpecialHoverAndFocusBehavior()},t.items=r,t.customContent=f,t.customContentFlippableItems=d,t.className=i||"",t.searchable=s,t.listeners=new u.default,t.scopeElement=p,t.filterLabel=l,t.nothingFoundLabel=c,t.render(),t.enableFlipper(),t}return(0,r.default)(a,[{key:"getElement",value:function(){return this.nodes.wrapper}},{key:"show",value:function(){this.shouldOpenPopoverBottom||(this.nodes.wrapper.style.setProperty("--popover-height",this.calculateHeight()+"px"),this.nodes.wrapper.classList.add(this.className+"--opened-top")),this.nodes.items.scrollTop=0,this.nodes.popover.classList.add(a.CSS.popoverOpened),this.nodes.overlay.classList.remove(a.CSS.popoverOverlayHidden),this.flipper.activate(this.flippableElements),(0,p.isMobileScreen)()&&this.scrollLocker.lock(),this.isShown=!0}},{key:"hide",value:function(){var e=this;this.isShown&&(this.nodes.popover.classList.remove(a.CSS.popoverOpened),this.nodes.overlay.classList.add(a.CSS.popoverOverlayHidden),this.flipper.deactivate(),(0,p.isMobileScreen)()&&this.scrollLocker.unlock(),this.isShown=!1,this.nodes.wrapper.classList.remove(this.className+"--opened-top"),Array.from(this.nodes.items.querySelectorAll(".".concat(a.CSS.itemConfirmation))).forEach((function(t){return e.cleanUpConfirmationStateForItem(t)})),this.disableSpecialHoverAndFocusBehavior(),this.emit(g.Close))}},{key:"destroy",value:function(){this.flipper.deactivate(),this.listeners.removeAll(),this.disableSpecialHoverAndFocusBehavior(),(0,p.isMobileScreen)()&&this.scrollLocker.unlock()}},{key:"hasFocus",value:function(){return this.flipper.hasFocus()}},{key:"calculateHeight",value:function(){var e,t=this.nodes.popover.cloneNode(!0);return t.style.visibility="hidden",t.style.position="absolute",t.style.top="-1000px",t.classList.add(a.CSS.popoverOpened),document.body.appendChild(t),e=t.offsetHeight,t.remove(),e}},{key:"render",value:function(){var e=this;this.nodes.wrapper=c.default.make("div",this.className),this.nodes.popover=c.default.make("div",a.CSS.popover),this.nodes.wrapper.appendChild(this.nodes.popover),this.nodes.overlay=c.default.make("div",[a.CSS.popoverOverlay,a.CSS.popoverOverlayHidden]),this.nodes.wrapper.appendChild(this.nodes.overlay),this.customContent&&(this.customContent.classList.add(a.CSS.customContent),this.nodes.popover.appendChild(this.customContent)),this.nodes.items=c.default.make("div",a.CSS.itemsWrapper),this.items.forEach((function(t){e.nodes.items.appendChild(e.createItem(t))})),this.nodes.popover.appendChild(this.nodes.items),this.nodes.nothingFound=c.default.make("div",[a.CSS.noFoundMessage],{textContent:this.nothingFoundLabel}),this.nodes.popover.appendChild(this.nodes.nothingFound),this.listeners.on(this.nodes.popover,"click",(function(t){var n=t.target.closest(".".concat(a.CSS.item));n&&e.itemClicked(n,t)})),this.listeners.on(this.nodes.overlay,"click",(function(){e.emit(g.OverlayClicked)}))}},{key:"createItem",value:function(e){var t=c.default.make("div",a.CSS.item);e.name&&(t.dataset.itemName=e.name);var n=c.default.make("div",a.CSS.itemLabel,{innerHTML:e.label});return t.appendChild(c.default.make("div",a.CSS.itemIcon,{innerHTML:e.icon||e.name.substring(0,1).toUpperCase()})),t.appendChild(n),e.secondaryLabel&&t.appendChild(c.default.make("div",a.CSS.itemSecondaryLabel,{textContent:e.secondaryLabel})),e.isActive&&t.classList.add(a.CSS.itemActive),e.isDisabled&&t.classList.add(a.CSS.itemDisabled),t}},{key:"itemClicked",value:function(e,t){var n=this,o=Array.from(this.nodes.items.children),r=o.indexOf(e),i=this.items[r];i.isDisabled||(o.filter((function(t){return t!==e})).forEach((function(e){n.cleanUpConfirmationStateForItem(e)})),i.confirmation?this.enableConfirmationStateForItem(i,e,r):(i.onActivate(i,t),this.toggleIfNeeded(r,o),i.closeOnActivate&&this.hide()))}},{key:"toggleIfNeeded",value:function(e,t){var n=this,o=this.items[e];if(!0===o.toggle)return o.isActive=!o.isActive,void t[e].classList.toggle(a.CSS.itemActive);if("string"==typeof o.toggle){var r=this.items.filter((function(e){return e.toggle===o.toggle}));if(1===r.length)return o.isActive=!o.isActive,void t[e].classList.toggle(a.CSS.itemActive);r.forEach((function(e){var r=n.items.indexOf(e),i=e===o;e.isActive=i,t[r].classList.toggle(a.CSS.itemActive,i)}))}}},{key:"enableConfirmationStateForItem",value:function(e,n,o){var r;void 0===this.itemsRequiringConfirmation[o]&&(this.itemsRequiringConfirmation[o]=e);var i=Object.assign(Object.assign(Object.assign({},e),e.confirmation),{confirmation:e.confirmation.confirmation});this.items[o]=i;var s=this.createItem(i);(r=s.classList).add.apply(r,[a.CSS.itemConfirmation].concat((0,t.default)(Array.from(n.classList)))),n.parentElement.replaceChild(s,n),this.enableSpecialHoverAndFocusBehavior(s),this.reactivateFlipper(this.flippableElements,this.flippableElements.indexOf(s))}},{key:"cleanUpConfirmationStateForItem",value:function(e){var t=Array.from(this.nodes.items.children).indexOf(e),n=this.itemsRequiringConfirmation[t];if(void 0!==n){var o=this.createItem(n);e.parentElement.replaceChild(o,e),this.items[t]=n,delete this.itemsRequiringConfirmation[t],e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior),this.disableSpecialHoverAndFocusBehavior(),this.reactivateFlipper(this.flippableElements,this.flippableElements.indexOf(o))}}},{key:"enableSpecialHoverAndFocusBehavior",value:function(e){e.classList.add(a.CSS.itemNoHover),e.classList.add(a.CSS.itemNoFocus),e.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0}),this.flipper.onFlip(this.onFlip)}},{key:"disableSpecialHoverAndFocusBehavior",value:function(){this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),this.flipper.removeOnFlip(this.onFlip)}},{key:"removeSpecialFocusBehavior",value:function(){var e=this.nodes.items.querySelector(".".concat(a.CSS.itemNoFocus));e&&e.classList.remove(a.CSS.itemNoFocus)}},{key:"reactivateFlipper",value:function(e,t){this.flipper.deactivate(),this.flipper.activate(e,t)}},{key:"enableFlipper",value:function(){this.flipper=new f.default({items:this.flippableElements,focusedItemClass:a.CSS.itemFocused,allowedKeys:[p.keyCodes.TAB,p.keyCodes.UP,p.keyCodes.DOWN,p.keyCodes.ENTER]})}},{key:"flippableElements",get:function(){var e=Array.from(this.nodes.wrapper.querySelectorAll(".".concat(a.CSS.item)));return(this.customContentFlippableItems||[]).concat(e)}},{key:"shouldOpenPopoverBottom",get:function(){var e=this.nodes.wrapper.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),n=this.calculateHeight(),o=e.top+n,r=e.top-n,i=Math.min(window.innerHeight,t.bottom);return r0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t){e.exports=Math.sign||function(e){return 0==(e=+e)||e!=e?e:e<0?-1:1}},function(e,t){var n=Math.expm1;e.exports=!n||n(10)>22025.465794806718||n(10)<22025.465794806718||-2e-17!=n(-2e-17)?function(e){return 0==(e=+e)?e:e>-1e-6&&e<1e-6?e+e*e/2:Math.exp(e)-1}:n},function(e,t,n){var o=n(33),r=n(38);e.exports=function(e){return function(t,n){var i,a,s=String(r(t)),l=o(n),c=s.length;return l<0||l>=c?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===c||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}}},function(e,t,n){"use strict";var o=n(45),r=n(0),i=n(23),a=n(27),s=n(56),l=n(129),c=n(54),u=n(50),f=n(14)("iterator"),d=!([].keys&&"next"in[].keys()),p=function(){return this};e.exports=function(e,t,n,h,v,y,g){l(n,t,h);var b,m,k,x=function(e){if(!d&&e in T)return T[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},w=t+" Iterator",S="values"==v,C=!1,T=e.prototype,E=T[f]||T["@@iterator"]||v&&T[v],_=E||x(v),B=v?S?x("entries"):_:void 0,O="Array"==t&&T.entries||E;if(O&&(k=u(O.call(new e)))!==Object.prototype&&k.next&&(c(k,w,!0),o||"function"==typeof k[f]||a(k,f,p)),S&&E&&"values"!==E.name&&(C=!0,_=function(){return E.call(this)}),o&&!g||!d&&!C&&T[f]||a(T,f,_),s[t]=_,s[w]=p,v)if(b={values:S?_:x("values"),keys:y?_:x("keys"),entries:B},g)for(m in b)m in T||i(T,m,b[m]);else r(r.P+r.F*(d||C),t,b);return b}},function(e,t,n){var o=n(99),r=n(38);e.exports=function(e,t,n){if(o(t))throw TypeError("String#"+n+" doesn't accept regex!");return String(r(e))}},function(e,t,n){var o=n(13),r=n(37),i=n(14)("match");e.exports=function(e){var t;return o(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==r(e))}},function(e,t,n){var o=n(14)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[o]=!1,!"/./"[e](t)}catch(e){}}return!0}},function(e,t,n){var o=n(56),r=n(14)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||i[r]===e)}},function(e,t,n){"use strict";var o=n(18),r=n(43);e.exports=function(e,t,n){t in e?o.f(e,t,r(0,n)):e[t]=n}},function(e,t,n){var o=n(63),r=n(14)("iterator"),i=n(56);e.exports=n(16).getIteratorMethod=function(e){if(null!=e)return e[r]||e["@@iterator"]||i[o(e)]}},function(e,t,n){"use strict";var o=n(22),r=n(47),i=n(15);e.exports=function(e){for(var t=o(this),n=i(t.length),a=arguments.length,s=r(a>1?arguments[1]:void 0,n),l=a>2?arguments[2]:void 0,c=void 0===l?n:r(l,n);c>s;)t[s++]=e;return t}},function(e,t,n){"use strict";var o=n(51),r=n(134),i=n(56),a=n(28);e.exports=n(97)(Array,"Array",(function(e,t){this._t=a(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){"use strict";var o,r,i=n(74),a=RegExp.prototype.exec,s=String.prototype.replace,l=a,c=(o=/a/,r=/b*/g,a.call(o,"a"),a.call(r,"a"),0!==o.lastIndex||0!==r.lastIndex),u=void 0!==/()??/.exec("")[1];(c||u)&&(l=function(e){var t,n,o,r,l=this;return u&&(n=new RegExp("^"+l.source+"$(?!\\s)",i.call(l))),c&&(t=l.lastIndex),o=a.call(l,e),c&&o&&(l.lastIndex=l.global?o.index+o[0].length:t),u&&o&&o.length>1&&s.call(o[0],n,(function(){for(r=1;rn;)t.push(arguments[n++]);return g[++y]=function(){s("function"==typeof e?e:Function(e),t)},o(y),y},p=function(e){delete g[e]},"process"==n(37)(f)?o=function(e){f.nextTick(a(b,e,1))}:v&&v.now?o=function(e){v.now(a(b,e,1))}:h?(i=(r=new h).port2,r.port1.onmessage=m,o=a(i.postMessage,i,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(o=function(e){u.postMessage(e+"","*")},u.addEventListener("message",m,!1)):o="onreadystatechange"in c("script")?function(e){l.appendChild(c("script")).onreadystatechange=function(){l.removeChild(this),b.call(e)}}:function(e){setTimeout(a(b,e,1),0)}),e.exports={set:d,clear:p}},function(e,t,n){"use strict";var o=n(10),r=n(17),i=n(45),a=n(80),s=n(27),l=n(59),c=n(11),u=n(58),f=n(33),d=n(15),p=n(142),h=n(49).f,v=n(18).f,y=n(104),g=n(54),b=o.ArrayBuffer,m=o.DataView,k=o.Math,x=o.RangeError,w=o.Infinity,S=b,C=k.abs,T=k.pow,E=k.floor,_=k.log,B=k.LN2,O=r?"_b":"buffer",M=r?"_l":"byteLength",I=r?"_o":"byteOffset";function P(e,t,n){var o,r,i,a=new Array(n),s=8*n-t-1,l=(1<>1,u=23===t?T(2,-24)-T(2,-77):0,f=0,d=e<0||0===e&&1/e<0?1:0;for((e=C(e))!=e||e===w?(r=e!=e?1:0,o=l):(o=E(_(e)/B),e*(i=T(2,-o))<1&&(o--,i*=2),(e+=o+c>=1?u/i:u*T(2,1-c))*i>=2&&(o++,i/=2),o+c>=l?(r=0,o=l):o+c>=1?(r=(e*i-1)*T(2,t),o+=c):(r=e*T(2,c-1)*T(2,t),o=0));t>=8;a[f++]=255&r,r/=256,t-=8);for(o=o<0;a[f++]=255&o,o/=256,s-=8);return a[--f]|=128*d,a}function L(e,t,n){var o,r=8*n-t-1,i=(1<>1,s=r-7,l=n-1,c=e[l--],u=127&c;for(c>>=7;s>0;u=256*u+e[l],l--,s-=8);for(o=u&(1<<-s)-1,u>>=-s,s+=t;s>0;o=256*o+e[l],l--,s-=8);if(0===u)u=1-a;else{if(u===i)return o?NaN:c?-w:w;o+=T(2,t),u-=a}return(c?-1:1)*o*T(2,u-t)}function R(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]}function A(e){return[255&e]}function j(e){return[255&e,e>>8&255]}function N(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]}function D(e){return P(e,52,8)}function F(e){return P(e,23,4)}function H(e,t,n){v(e.prototype,t,{get:function(){return this[n]}})}function W(e,t,n,o){var r=p(+n);if(r+t>e[M])throw x("Wrong index!");var i=e[O]._b,a=r+e[I],s=i.slice(a,a+t);return o?s:s.reverse()}function U(e,t,n,o,r,i){var a=p(+n);if(a+t>e[M])throw x("Wrong index!");for(var s=e[O]._b,l=a+e[I],c=o(+r),u=0;uX;)(z=Y[X++])in b||s(b,z,S[z]);i||(V.constructor=b)}var Z=new m(new b(2)),G=m.prototype.setInt8;Z.setInt8(0,2147483648),Z.setInt8(1,2147483649),!Z.getInt8(0)&&Z.getInt8(1)||l(m.prototype,{setInt8:function(e,t){G.call(this,e,t<<24>>24)},setUint8:function(e,t){G.call(this,e,t<<24>>24)}},!0)}else b=function(e){u(this,b,"ArrayBuffer");var t=p(e);this._b=y.call(new Array(t),0),this[M]=t},m=function(e,t,n){u(this,m,"DataView"),u(e,b,"DataView");var o=e[M],r=f(t);if(r<0||r>o)throw x("Wrong offset!");if(r+(n=void 0===n?o-r:d(n))>o)throw x("Wrong length!");this[O]=e,this[I]=r,this[M]=n},r&&(H(b,"byteLength","_l"),H(m,"buffer","_b"),H(m,"byteLength","_l"),H(m,"byteOffset","_o")),l(m.prototype,{getInt8:function(e){return W(this,1,e)[0]<<24>>24},getUint8:function(e){return W(this,1,e)[0]},getInt16:function(e){var t=W(this,2,e,arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=W(this,2,e,arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return R(W(this,4,e,arguments[1]))},getUint32:function(e){return R(W(this,4,e,arguments[1]))>>>0},getFloat32:function(e){return L(W(this,4,e,arguments[1]),23,4)},getFloat64:function(e){return L(W(this,8,e,arguments[1]),52,8)},setInt8:function(e,t){U(this,1,e,A,t)},setUint8:function(e,t){U(this,1,e,A,t)},setInt16:function(e,t){U(this,2,e,j,t,arguments[2])},setUint16:function(e,t){U(this,2,e,j,t,arguments[2])},setInt32:function(e,t){U(this,4,e,N,t,arguments[2])},setUint32:function(e,t){U(this,4,e,N,t,arguments[2])},setFloat32:function(e,t){U(this,4,e,F,t,arguments[2])},setFloat64:function(e,t){U(this,8,e,D,t,arguments[2])}});g(b,"ArrayBuffer"),g(m,"DataView"),s(m.prototype,a.VIEW,!0),t.ArrayBuffer=b,t.DataView=m},function(e,t){function n(t,o){return e.exports=n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,n(t,o)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t],void 0===(i="function"==typeof(o=function(n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=function(e){var t={get id(){return e.id},get name(){return e.name},get config(){return e.config},get holder(){return e.holder},get isEmpty(){return e.isEmpty},get selected(){return e.selected},set stretched(t){e.stretched=t},get stretched(){return e.stretched},call:function(t,n){return e.call(t,n)},save:function(){return e.save()},validate:function(t){return e.validate(t)},dispatchChange:function(){e.dispatchChange()}};Object.setPrototypeOf(this,t)};n.default=o,e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o=n(376);function r(){return"undefined"!=typeof Reflect&&Reflect.get?(e.exports=r=Reflect.get.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=r=function(e,t,n){var r=o(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},e.exports.__esModule=!0,e.exports.default=e.exports),r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(380)],void 0===(i="function"==typeof(o=function(o,r,i,a){"use strict";var s=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=s(r),i=s(i),a=s(a);var l=function(){function e(){(0,r.default)(this,e),this.lib=new a.default}return(0,i.default)(e,[{key:"destroy",value:function(){this.lib.destroy()}},{key:"show",value:function(e,t,n){this.lib.show(e,t,n)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.lib.hide(e)}},{key:"onHover",value:function(e,t,n){this.lib.onHover(e,t,n)}}]),e}();o.default=l,l.displayName="Tooltip",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(40),n(2),n(3),n(384)],void 0===(i="function"==typeof(o=function(o,r,i,a,s){"use strict";var l=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=l(r),i=l(i),a=l(a),s=l(s);var c=function(){function e(){(0,i.default)(this,e),this.registeredShortcuts=new Map}return(0,a.default)(e,[{key:"add",value:function(e){if(this.findShortcut(e.on,e.name))throw Error("Shortcut ".concat(e.name," is already registered for ").concat(e.on,". Please remove it before add a new handler."));var t=new s.default({name:e.name,on:e.on,callback:e.handler}),n=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[].concat((0,r.default)(n),[t]))}},{key:"remove",value:function(e,t){var n=this.findShortcut(e,t);if(n){n.remove();var o=this.registeredShortcuts.get(e);this.registeredShortcuts.set(e,o.filter((function(e){return e!==n})))}}},{key:"findShortcut",value:function(e,t){return(this.registeredShortcuts.get(e)||[]).find((function(e){return e.name===t}))}}]),e}();c.displayName="Shortcuts";var u=new c;o.default=u,e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){e.exports=!n(17)&&!n(11)((function(){return 7!=Object.defineProperty(n(85)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var o=n(10),r=n(16),i=n(45),a=n(86),s=n(18).f;e.exports=function(e){var t=r.Symbol||(r.Symbol=i?{}:o.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},function(e,t,n){var o=n(26),r=n(28),i=n(70)(!1),a=n(87)("IE_PROTO");e.exports=function(e,t){var n,s=r(e),l=0,c=[];for(n in s)n!=a&&o(s,n)&&c.push(n);for(;t.length>l;)o(s,n=t[l++])&&(~i(c,n)||c.push(n));return c}},function(e,t,n){var o=n(18),r=n(12),i=n(46);e.exports=n(17)?Object.defineProperties:function(e,t){r(e);for(var n,a=i(t),s=a.length,l=0;s>l;)o.f(e,n=a[l++],t[n]);return e}},function(e,t,n){var o=n(28),r=n(49).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return r(e)}catch(e){return a.slice()}}(e):r(o(e))}},function(e,t,n){"use strict";var o=n(17),r=n(46),i=n(71),a=n(62),s=n(22),l=n(61),c=Object.assign;e.exports=!c||n(11)((function(){var e={},t={},n=Symbol(),o="abcdefghijklmnopqrst";return e[n]=7,o.split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||Object.keys(c({},t)).join("")!=o}))?function(e,t){for(var n=s(e),c=arguments.length,u=1,f=i.f,d=a.f;c>u;)for(var p,h=l(arguments[u++]),v=f?r(h).concat(f(h)):r(h),y=v.length,g=0;y>g;)p=v[g++],o&&!d.call(h,p)||(n[p]=h[p]);return n}:c},function(e,t){e.exports=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}},function(e,t,n){"use strict";var o=n(32),r=n(13),i=n(123),a=[].slice,s={},l=function(e,t,n){if(!(t in s)){for(var o=[],r=0;r>>0||(a.test(n)?16:10))}:o},function(e,t,n){var o=n(10).parseFloat,r=n(55).trim;e.exports=1/o(n(91)+"-0")!=-1/0?function(e){var t=r(String(e),3),n=o(t);return 0===n&&"-"==t.charAt(0)?-0:n}:o},function(e,t,n){var o=n(37);e.exports=function(e,t){if("number"!=typeof e&&"Number"!=o(e))throw TypeError(t);return+e}},function(e,t,n){var o=n(13),r=Math.floor;e.exports=function(e){return!o(e)&&isFinite(e)&&r(e)===e}},function(e,t){e.exports=Math.log1p||function(e){return(e=+e)>-1e-8&&e<1e-8?e-e*e/2:Math.log(1+e)}},function(e,t,n){"use strict";var o=n(48),r=n(43),i=n(54),a={};n(27)(a,n(14)("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=o(a,{next:r(1,n)}),i(e,t+" Iterator")}},function(e,t,n){var o=n(12);e.exports=function(e,t,n,r){try{return r?t(o(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&o(i.call(e)),t}}},function(e,t,n){var o=n(281);e.exports=function(e,t){return new(o(e))(t)}},function(e,t,n){var o=n(32),r=n(22),i=n(61),a=n(15);e.exports=function(e,t,n,s,l){o(t);var c=r(e),u=i(c),f=a(c.length),d=l?f-1:0,p=l?-1:1;if(n<2)for(;;){if(d in u){s=u[d],d+=p;break}if(d+=p,l?d<0:f<=d)throw TypeError("Reduce of empty array with no initial value")}for(;l?d>=0:f>d;d+=p)d in u&&(s=t(s,u[d],d,c));return s}},function(e,t,n){"use strict";var o=n(22),r=n(47),i=n(15);e.exports=[].copyWithin||function(e,t){var n=o(this),a=i(n.length),s=r(e,a),l=r(t,a),c=arguments.length>2?arguments[2]:void 0,u=Math.min((void 0===c?a:r(c,a))-l,a-s),f=1;for(l0;)l in n?n[s]=n[l]:delete n[s],s+=f,l+=f;return n}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){"use strict";var o=n(106);n(0)({target:"RegExp",proto:!0,forced:o!==/./.exec},{exec:o})},function(e,t,n){n(17)&&"g"!=/./g.flags&&n(18).f(RegExp.prototype,"flags",{configurable:!0,get:n(74)})},function(e,t,n){"use strict";var o,r,i,a,s=n(45),l=n(10),c=n(31),u=n(63),f=n(0),d=n(13),p=n(32),h=n(58),v=n(77),y=n(64),g=n(108).set,b=n(301)(),m=n(138),k=n(302),x=n(78),w=n(139),S=l.TypeError,C=l.process,T=C&&C.versions,E=T&&T.v8||"",_=l.Promise,B="process"==u(C),O=function(){},M=r=m.f,I=!!function(){try{var e=_.resolve(1),t=(e.constructor={})[n(14)("species")]=function(e){e(O,O)};return(B||"function"==typeof PromiseRejectionEvent)&&e.then(O)instanceof t&&0!==E.indexOf("6.6")&&-1===x.indexOf("Chrome/66")}catch(e){}}(),P=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},L=function(e,t){if(!e._n){e._n=!0;var n=e._c;b((function(){for(var o=e._v,r=1==e._s,i=0,a=function(t){var n,i,a,s=r?t.ok:t.fail,l=t.resolve,c=t.reject,u=t.domain;try{s?(r||(2==e._h&&j(e),e._h=1),!0===s?n=o:(u&&u.enter(),n=s(o),u&&(u.exit(),a=!0)),n===t.promise?c(S("Promise-chain cycle")):(i=P(n))?i.call(n,l,c):l(n)):c(o)}catch(e){u&&!a&&u.exit(),c(e)}};n.length>i;)a(n[i++]);e._c=[],e._n=!1,t&&!e._h&&R(e)}))}},R=function(e){g.call(l,(function(){var t,n,o,r=e._v,i=A(e);if(i&&(t=k((function(){B?C.emit("unhandledRejection",r,e):(n=l.onunhandledrejection)?n({promise:e,reason:r}):(o=l.console)&&o.error&&o.error("Unhandled promise rejection",r)})),e._h=B||A(e)?2:1),e._a=void 0,i&&t.e)throw t.v}))},A=function(e){return 1!==e._h&&0===(e._a||e._c).length},j=function(e){g.call(l,(function(){var t;B?C.emit("rejectionHandled",e):(t=l.onrejectionhandled)&&t({promise:e,reason:e._v})}))},N=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),L(t,!0))},D=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw S("Promise can't be resolved itself");(t=P(e))?b((function(){var o={_w:n,_d:!1};try{t.call(e,c(D,o,1),c(N,o,1))}catch(e){N.call(o,e)}})):(n._v=e,n._s=1,L(n,!1))}catch(e){N.call({_w:n,_d:!1},e)}}};I||(_=function(e){h(this,_,"Promise","_h"),p(e),o.call(this);try{e(c(D,this,1),c(N,this,1))}catch(e){N.call(this,e)}},(o=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(59)(_.prototype,{then:function(e,t){var n=M(y(this,_));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=B?C.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&L(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),i=function(){var e=new o;this.promise=e,this.resolve=c(D,e,1),this.reject=c(N,e,1)},m.f=M=function(e){return e===_||e===a?new i(e):r(e)}),f(f.G+f.W+f.F*!I,{Promise:_}),n(54)(_,"Promise"),n(57)("Promise"),a=n(16).Promise,f(f.S+f.F*!I,"Promise",{reject:function(e){var t=M(this);return(0,t.reject)(e),t.promise}}),f(f.S+f.F*(s||!I),"Promise",{resolve:function(e){return w(s&&this===a?_:this,e)}}),f(f.S+f.F*!(I&&n(73)((function(e){_.all(e).catch(O)}))),"Promise",{all:function(e){var t=this,n=M(t),o=n.resolve,r=n.reject,i=k((function(){var n=[],i=0,a=1;v(e,!1,(function(e){var s=i++,l=!1;n.push(void 0),a++,t.resolve(e).then((function(e){l||(l=!0,n[s]=e,--a||o(n))}),r)})),--a||o(n)}));return i.e&&r(i.v),n.promise},race:function(e){var t=this,n=M(t),o=n.reject,r=k((function(){v(e,!1,(function(e){t.resolve(e).then(n.resolve,o)}))}));return r.e&&o(r.v),n.promise}})},function(e,t,n){"use strict";var o=n(32);function r(e){var t,n;this.promise=new e((function(e,o){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=o})),this.resolve=o(t),this.reject=o(n)}e.exports.f=function(e){return new r(e)}},function(e,t,n){var o=n(12),r=n(13),i=n(138);e.exports=function(e,t){if(o(e),r(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){"use strict";var o=n(18).f,r=n(48),i=n(59),a=n(31),s=n(58),l=n(77),c=n(97),u=n(134),f=n(57),d=n(17),p=n(42).fastKey,h=n(52),v=d?"_s":"size",y=function(e,t){var n,o=p(t);if("F"!==o)return e._i[o];for(n=e._f;n;n=n.n)if(n.k==t)return n};e.exports={getConstructor:function(e,t,n,c){var u=e((function(e,o){s(e,u,t,"_i"),e._t=t,e._i=r(null),e._f=void 0,e._l=void 0,e[v]=0,null!=o&&l(o,n,e[c],e)}));return i(u.prototype,{clear:function(){for(var e=h(this,t),n=e._i,o=e._f;o;o=o.n)o.r=!0,o.p&&(o.p=o.p.n=void 0),delete n[o.i];e._f=e._l=void 0,e[v]=0},delete:function(e){var n=h(this,t),o=y(n,e);if(o){var r=o.n,i=o.p;delete n._i[o.i],o.r=!0,i&&(i.n=r),r&&(r.p=i),n._f==o&&(n._f=r),n._l==o&&(n._l=i),n[v]--}return!!o},forEach:function(e){h(this,t);for(var n,o=a(e,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(o(n.v,n.k,this);n&&n.r;)n=n.p},has:function(e){return!!y(h(this,t),e)}}),d&&o(u.prototype,"size",{get:function(){return h(this,t)[v]}}),u},def:function(e,t,n){var o,r,i=y(e,t);return i?i.v=n:(e._l=i={i:r=p(t,!0),k:t,v:n,p:o=e._l,n:void 0,r:!1},e._f||(e._f=i),o&&(o.n=i),e[v]++,"F"!==r&&(e._i[r]=i)),e},getEntry:y,setStrong:function(e,t,n){c(e,t,(function(e,n){this._t=h(e,t),this._k=n,this._l=void 0}),(function(){for(var e=this._k,t=this._l;t&&t.r;)t=t.p;return this._t&&(this._l=t=t?t.n:this._t._f)?u(0,"keys"==e?t.k:"values"==e?t.v:[t.k,t.v]):(this._t=void 0,u(1))}),n?"entries":"values",!n,!0),f(t)}}},function(e,t,n){"use strict";var o=n(59),r=n(42).getWeak,i=n(12),a=n(13),s=n(58),l=n(77),c=n(36),u=n(26),f=n(52),d=c(5),p=c(6),h=0,v=function(e){return e._l||(e._l=new y)},y=function(){this.a=[]},g=function(e,t){return d(e.a,(function(e){return e[0]===t}))};y.prototype={get:function(e){var t=g(this,e);if(t)return t[1]},has:function(e){return!!g(this,e)},set:function(e,t){var n=g(this,e);n?n[1]=t:this.a.push([e,t])},delete:function(e){var t=p(this.a,(function(t){return t[0]===e}));return~t&&this.a.splice(t,1),!!~t}},e.exports={getConstructor:function(e,t,n,i){var c=e((function(e,o){s(e,c,t,"_i"),e._t=t,e._i=h++,e._l=void 0,null!=o&&l(o,n,e[i],e)}));return o(c.prototype,{delete:function(e){if(!a(e))return!1;var n=r(e);return!0===n?v(f(this,t)).delete(e):n&&u(n,this._i)&&delete n[this._i]},has:function(e){if(!a(e))return!1;var n=r(e);return!0===n?v(f(this,t)).has(e):n&&u(n,this._i)}}),c},def:function(e,t,n){var o=r(i(t),!0);return!0===o?v(e).set(t,n):o[e._i]=n,e},ufstore:v}},function(e,t,n){var o=n(33),r=n(15);e.exports=function(e){if(void 0===e)return 0;var t=o(e),n=r(t);if(t!==n)throw RangeError("Wrong length!");return n}},function(e,t,n){var o=n(49),r=n(71),i=n(12),a=n(10).Reflect;e.exports=a&&a.ownKeys||function(e){var t=o.f(i(e)),n=r.f;return n?t.concat(n(e)):t}},function(e,t,n){var o=n(15),r=n(93),i=n(38);e.exports=function(e,t,n,a){var s=String(i(e)),l=s.length,c=void 0===n?" ":String(n),u=o(t);if(u<=l||""==c)return s;var f=u-l,d=r.call(c,Math.ceil(f/c.length));return d.length>f&&(d=d.slice(0,f)),a?d+s:s+d}},function(e,t,n){var o=n(17),r=n(46),i=n(28),a=n(62).f;e.exports=function(e){return function(t){for(var n,s=i(t),l=r(s),c=l.length,u=0,f=[];c>u;)n=l[u++],o&&!a.call(s,n)||f.push(e?[n,s[n]]:s[n]);return f}}},function(e,t,n){var o=n(147);e.exports=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n3&&void 0!==arguments[3]&&arguments[3],r=s.generateId("l"),i={id:r,element:e,eventType:t,handler:n,options:o},a=this.findOne(e,t,n);if(!a)return this.allListeners.push(i),e.addEventListener(t,n,o),r}},{key:"off",value:function(e,t,n,o){var r=this,i=this.findAll(e,t,n);i.forEach((function(e,t){var n=r.allListeners.indexOf(i[t]);n>-1&&(r.allListeners.splice(n,1),e.element.removeEventListener(e.eventType,e.handler,e.options))}))}},{key:"offById",value:function(e){var t=this.findById(e);t&&t.element.removeEventListener(t.eventType,t.handler,t.options)}},{key:"findOne",value:function(e,t,n){var o=this.findAll(e,t,n);return o.length>0?o[0]:null}},{key:"findAll",value:function(e,t,n){var o=e?this.findByEventTarget(e):[];return e&&t&&n?o.filter((function(e){return e.eventType===t&&e.handler===n})):e&&t?o.filter((function(e){return e.eventType===t})):o}},{key:"removeAll",value:function(){this.allListeners.map((function(e){e.element.removeEventListener(e.eventType,e.handler,e.options)})),this.allListeners=[]}},{key:"destroy",value:function(){this.removeAll()}},{key:"findByEventTarget",value:function(e){return this.allListeners.filter((function(t){if(t.element===e)return t}))}},{key:"findByType",value:function(e){return this.allListeners.filter((function(t){if(t.eventType===e)return t}))}},{key:"findByHandler",value:function(e){return this.allListeners.filter((function(t){if(t.handler===e)return t}))}},{key:"findById",value:function(e){return this.allListeners.find((function(t){return t.id===e}))}}]),e}();o.default=u,u.displayName="Listeners",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(21),n(2),n(3),n(5),n(6),n(4),n(8),n(111),n(9),n(60)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h,v){"use strict";var y=n(1);function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function b(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,f.default)(e);if(t){var r=(0,f.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,u.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=y(r),i=y(i),s=y(s),l=y(l),c=y(c),u=y(u),f=y(f),d=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=g(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(d),p=y(p),h=y(h),v=y(v);var m=function(e){(0,c.default)(n,e);var t=b(n);function n(){var e;return(0,s.default)(this,n),(e=t.apply(this,arguments)).insert=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.config.defaultBlock,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,i=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,s=e.Editor.BlockManager.insert({id:a,tool:t,data:n,index:o,needToFocus:r,replace:i});return new p.default(s)},e.composeBlockData=function(){var t=(0,i.default)(r.default.mark((function t(n){var o,i;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=e.Editor.Tools.blockTools.get(n),i=new v.default({tool:o,api:e.Editor.API,readOnly:!0,data:{},tunesData:{}}),t.abrupt("return",i.data);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),e.update=function(t,n){var o=e.Editor.BlockManager,r=o.getBlockById(t);if(r){var i=o.getBlockIndex(r);o.insert({id:r.id,tool:r.name,data:n,index:i,replace:!0,tunes:r.tunes})}else d.log("blocks.update(): Block with passed id was not found","warn")},e}return(0,l.default)(n,[{key:"methods",get:function(){var e=this;return{clear:function(){return e.clear()},render:function(t){return e.render(t)},renderFromHTML:function(t){return e.renderFromHTML(t)},delete:function(t){return e.delete(t)},swap:function(t,n){return e.swap(t,n)},move:function(t,n){return e.move(t,n)},getBlockByIndex:function(t){return e.getBlockByIndex(t)},getById:function(t){return e.getById(t)},getCurrentBlockIndex:function(){return e.getCurrentBlockIndex()},getBlockIndex:function(t){return e.getBlockIndex(t)},getBlocksCount:function(){return e.getBlocksCount()},stretchBlock:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.stretchBlock(t,n)},insertNewBlock:function(){return e.insertNewBlock()},insert:this.insert,update:this.update,composeBlockData:this.composeBlockData}}},{key:"getBlocksCount",value:function(){return this.Editor.BlockManager.blocks.length}},{key:"getCurrentBlockIndex",value:function(){return this.Editor.BlockManager.currentBlockIndex}},{key:"getBlockIndex",value:function(e){var t=this.Editor.BlockManager.getBlockById(e);if(t)return this.Editor.BlockManager.getBlockIndex(t);d.logLabeled("There is no block with id `"+e+"`","warn")}},{key:"getBlockByIndex",value:function(e){var t=this.Editor.BlockManager.getBlockByIndex(e);if(void 0!==t)return new p.default(t);d.logLabeled("There is no block at index `"+e+"`","warn")}},{key:"getById",value:function(e){var t=this.Editor.BlockManager.getBlockById(e);return void 0===t?(d.logLabeled("There is no block with id `"+e+"`","warn"),null):new p.default(t)}},{key:"swap",value:function(e,t){d.log("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(e,t)}},{key:"move",value:function(e,t){this.Editor.BlockManager.move(e,t)}},{key:"delete",value:function(e){try{this.Editor.BlockManager.removeBlock(e)}catch(e){return void d.logLabeled(e,"warn")}0===this.Editor.BlockManager.blocks.length&&this.Editor.BlockManager.insert(),this.Editor.BlockManager.currentBlock&&this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END),this.Editor.Toolbar.close()}},{key:"clear",value:function(){this.Editor.BlockManager.clear(!0),this.Editor.InlineToolbar.close()}},{key:"render",value:function(e){return this.Editor.BlockManager.clear(),this.Editor.Renderer.render(e.blocks)}},{key:"renderFromHTML",value:function(e){return this.Editor.BlockManager.clear(),this.Editor.Paste.processText(e,!0)}},{key:"stretchBlock",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];d.deprecationAssert(!0,"blocks.stretchBlock()","BlockAPI");var n=this.Editor.BlockManager.getBlockByIndex(e);n&&(n.stretched=t)}},{key:"insertNewBlock",value:function(){d.log("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}}]),n}(h.default);o.default=m,m.displayName="BlocksAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c){"use strict";var u=n(1);function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),a=u(a),s=u(s),l=u(l);var d=function(e){(0,a.default)(n,e);var t=f(n);function n(){var e;return(0,r.default)(this,n),(e=t.apply(this,arguments)).setToFirstBlock=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.Editor.Caret.positions.DEFAULT,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!!e.Editor.BlockManager.firstBlock&&(e.Editor.Caret.setToBlock(e.Editor.BlockManager.firstBlock,t,n),!0)},e.setToLastBlock=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.Editor.Caret.positions.DEFAULT,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!!e.Editor.BlockManager.lastBlock&&(e.Editor.Caret.setToBlock(e.Editor.BlockManager.lastBlock,t,n),!0)},e.setToPreviousBlock=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.Editor.Caret.positions.DEFAULT,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!!e.Editor.BlockManager.previousBlock&&(e.Editor.Caret.setToBlock(e.Editor.BlockManager.previousBlock,t,n),!0)},e.setToNextBlock=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.Editor.Caret.positions.DEFAULT,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!!e.Editor.BlockManager.nextBlock&&(e.Editor.Caret.setToBlock(e.Editor.BlockManager.nextBlock,t,n),!0)},e.setToBlock=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.Editor.Caret.positions.DEFAULT,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return!!e.Editor.BlockManager.blocks[t]&&(e.Editor.Caret.setToBlock(e.Editor.BlockManager.blocks[t],n,o),!0)},e.focus=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t?e.setToLastBlock(e.Editor.Caret.positions.END):e.setToFirstBlock(e.Editor.Caret.positions.START)},e}return(0,i.default)(n,[{key:"methods",get:function(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}}]),n}((c=u(c)).default);o.default=d,d.displayName="CaretAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c){"use strict";var u=n(1);function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),a=u(a),s=u(s),l=u(l);var d=function(e){(0,a.default)(n,e);var t=f(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){var e=this;return{emit:function(t,n){return e.emit(t,n)},off:function(t,n){return e.off(t,n)},on:function(t,n){return e.on(t,n)}}}},{key:"on",value:function(e,t){this.eventsDispatcher.on(e,t)}},{key:"emit",value:function(e,t){this.eventsDispatcher.emit(e,t)}},{key:"off",value:function(e,t){this.eventsDispatcher.off(e,t)}}]),n}((c=u(c)).default);o.default=d,d.displayName="EventsAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(53),n(8),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c,u,f){"use strict";var d=n(1);function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=d(r),i=d(i),a=d(a),s=d(s),l=d(l),c=d(c);var h=function(e){(0,a.default)(n,e);var t=p(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){return{t:function(){(0,u.logLabeled)("I18n.t() method can be accessed only from Tools","warn")}}}},{key:"getMethodsForTool",value:function(e){return Object.assign(this.methods,{t:function(t){return c.default.t(n.getNamespace(e),t)}})}}],[{key:"getNamespace",value:function(e){return e.isTune()?"blockTunes.".concat(e.name):"tools.".concat(e.name)}}]),n}((f=d(f)).default);o.default=h,h.displayName="I18nAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c){"use strict";var u=n(1);function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),a=u(a),s=u(s),l=u(l);var d=function(e){(0,a.default)(n,e);var t=f(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){var e=this;return{close:function(){return e.close()},open:function(){return e.open()}}}},{key:"open",value:function(){this.Editor.InlineToolbar.tryToShow()}},{key:"close",value:function(){this.Editor.InlineToolbar.close()}}]),n}((c=u(c)).default);o.default=d,d.displayName="InlineToolbarAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c){"use strict";var u=n(1);function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),a=u(a),s=u(s),l=u(l);var d=function(e){(0,a.default)(n,e);var t=f(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){var e=this;return{on:function(t,n,o,r){return e.on(t,n,o,r)},off:function(t,n,o,r){return e.off(t,n,o,r)},offById:function(t){return e.offById(t)}}}},{key:"on",value:function(e,t,n,o){return this.listeners.on(e,t,n,o)}},{key:"off",value:function(e,t,n,o){this.listeners.off(e,t,n,o)}},{key:"offById",value:function(e){this.listeners.offById(e)}}]),n}((c=u(c)).default);o.default=d,d.displayName="ListenersAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(377),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c,u){"use strict";var f=n(1);function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=f(r),i=f(i),a=f(a),s=f(s),l=f(l),c=f(c);var p=function(e){(0,a.default)(n,e);var t=d(n);function n(e){var o,i=e.config,a=e.eventsDispatcher;return(0,r.default)(this,n),(o=t.call(this,{config:i,eventsDispatcher:a})).notifier=new c.default,o}return(0,i.default)(n,[{key:"methods",get:function(){var e=this;return{show:function(t){return e.show(t)}}}},{key:"show",value:function(e){return this.notifier.show(e)}}]),n}((u=f(u)).default);o.default=p,p.displayName="NotifierAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c){"use strict";var u=n(1);function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),a=u(a),s=u(s),l=u(l);var d=function(e){(0,a.default)(n,e);var t=f(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){var e=this;return{toggle:function(t){return e.toggle(t)},get isEnabled(){return e.isEnabled}}}},{key:"toggle",value:function(e){return this.Editor.ReadOnly.toggle(e)}},{key:"isEnabled",get:function(){return this.Editor.ReadOnly.isEnabled}}]),n}((c=u(c)).default);o.default=d,d.displayName="ReadOnlyAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9),n(65)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c,u){"use strict";var f=n(1);function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=f(r),i=f(i),a=f(a),s=f(s),l=f(l);var p=function(e){(0,a.default)(n,e);var t=d(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){var e=this;return{clean:function(t,n){return e.clean(t,n)}}}},{key:"clean",value:function(e,t){return(0,u.clean)(e,t)}}]),n}((c=f(c)).default);o.default=p,p.displayName="SanitizerAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(8),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f){"use strict";var d=n(1);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,l.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=d(r),i=d(i),s=d(s),l=d(l),c=d(c),u=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(u);var v=function(e){(0,s.default)(n,e);var t=h(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){var e=this;return{save:function(){return e.save()}}}},{key:"save",value:function(){var e="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(u.logLabeled(e,"warn"),Promise.reject(new Error(e))):this.Editor.Saver.save()}}]),n}((f=d(f)).default);o.default=v,v.displayName="SaverAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(25),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c,u){"use strict";var f=n(1);function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=f(r),i=f(i),a=f(a),s=f(s),l=f(l),c=f(c);var p=function(e){(0,a.default)(n,e);var t=d(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){var e=this;return{findParentTag:function(t,n){return e.findParentTag(t,n)},expandToTag:function(t){return e.expandToTag(t)}}}},{key:"findParentTag",value:function(e,t){return(new c.default).findParentTag(e,t)}},{key:"expandToTag",value:function(e){(new c.default).expandToTag(e)}}]),n}((u=f(u)).default);o.default=p,p.displayName="SelectionAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c){"use strict";var u=n(1);function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),a=u(a),s=u(s),l=u(l);var d=function(e){(0,a.default)(n,e);var t=f(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"classes",get:function(){return{block:"cdx-block",inlineToolButton:"ce-inline-tool",inlineToolButtonActive:"ce-inline-tool--active",input:"cdx-input",loader:"cdx-loader",button:"cdx-button",settingsButton:"cdx-settings-button",settingsButtonActive:"cdx-settings-button--active"}}}]),n}((c=u(c)).default);o.default=d,d.displayName="StylesAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f){"use strict";var d=n(1);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,l.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=d(r),i=d(i),s=d(s),l=d(l),c=d(c),u=d(u),f=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(f);var v=function(e){(0,s.default)(n,e);var t=h(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){var e=this;return{close:function(){return e.close()},open:function(){return e.open()},toggleBlockSettings:function(t){return e.toggleBlockSettings(t)}}}},{key:"open",value:function(){this.Editor.Toolbar.moveAndOpen()}},{key:"close",value:function(){this.Editor.Toolbar.close()}},{key:"toggleBlockSettings",value:function(e){-1!==this.Editor.BlockManager.currentBlockIndex?(null!=e?e:!this.Editor.BlockSettings.opened)?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close():f.logLabeled("Could't toggle the Toolbar because there is no block selected ","warn")}}]),n}(u.default);o.default=v,v.displayName="ToolbarAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9),n(113)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c,u){"use strict";var f=n(1);function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=f(r),i=f(i),a=f(a),s=f(s),l=f(l),c=f(c),u=f(u);var p=function(e){(0,a.default)(n,e);var t=d(n);function n(e){var o,i=e.config,a=e.eventsDispatcher;return(0,r.default)(this,n),(o=t.call(this,{config:i,eventsDispatcher:a})).tooltip=new u.default,o}return(0,i.default)(n,[{key:"destroy",value:function(){this.tooltip.destroy()}},{key:"methods",get:function(){var e=this;return{show:function(t,n,o){return e.show(t,n,o)},hide:function(){return e.hide()},onHover:function(t,n,o){return e.onHover(t,n,o)}}}},{key:"show",value:function(e,t,n){this.tooltip.show(e,t,n)}},{key:"hide",value:function(){this.tooltip.hide()}},{key:"onHover",value:function(e,t,n){this.tooltip.onHover(e,t,n)}}]),n}(c.default);o.default=p,p.displayName="TooltipAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c){"use strict";var u=n(1);function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,l.default)(e);if(t){var r=(0,l.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,s.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),a=u(a),s=u(s),l=u(l);var d=function(e){(0,a.default)(n,e);var t=f(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"methods",get:function(){return{nodes:this.editorNodes}}},{key:"editorNodes",get:function(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}}]),n}((c=u(c)).default);o.default=d,d.displayName="UiAPI",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9),n(8),n(25),n(66)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p){"use strict";var h=n(1);function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(v=function(e){return e?n:t})(e)}function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,l.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=h(r),i=h(i),s=h(s),l=h(l),c=h(c),u=h(u),f=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=v(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(f),d=h(d),p=h(p);var g=function(e){(0,s.default)(n,e);var t=y(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"keydown",value:function(e){switch(this.beforeKeydownProcessing(e),e.keyCode){case f.keyCodes.BACKSPACE:this.backspace(e);break;case f.keyCodes.ENTER:this.enter(e);break;case f.keyCodes.DOWN:case f.keyCodes.RIGHT:this.arrowRightAndDown(e);break;case f.keyCodes.UP:case f.keyCodes.LEFT:this.arrowLeftAndUp(e);break;case f.keyCodes.TAB:this.tabPressed(e)}}},{key:"beforeKeydownProcessing",value:function(e){this.needToolbarClosing(e)&&f.isPrintableKey(e.keyCode)&&(this.Editor.Toolbar.close(),this.Editor.ConversionToolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||(this.Editor.BlockManager.clearFocused(),this.Editor.BlockSelection.clearSelection(e)))}},{key:"keyup",value:function(e){e.shiftKey||this.Editor.UI.checkEmptiness()}},{key:"tabPressed",value:function(e){this.Editor.BlockSelection.clearSelection(e);var t=this.Editor,n=t.BlockManager,o=t.InlineToolbar,r=t.ConversionToolbar,i=n.currentBlock;if(i){var a=i.isEmpty,s=i.tool.isDefault&&a,l=!a&&r.opened,c=!a&&!d.default.isCollapsed&&o.opened,u=!l&&!c;s?this.activateToolbox():u&&this.activateBlockSettings()}}},{key:"dragOver",value:function(e){this.Editor.BlockManager.getBlockByChildNode(e.target).dropTarget=!0}},{key:"dragLeave",value:function(e){this.Editor.BlockManager.getBlockByChildNode(e.target).dropTarget=!1}},{key:"handleCommandC",value:function(e){var t=this.Editor.BlockSelection;t.anyBlockSelected&&t.copySelectedBlocks(e)}},{key:"handleCommandX",value:function(e){var t=this.Editor,n=t.BlockSelection,o=t.BlockManager,r=t.Caret;n.anyBlockSelected&&n.copySelectedBlocks(e).then((function(){var t=o.removeSelectedBlocks(),i=o.insertDefaultBlockAtIndex(t,!0);r.setToBlock(i,r.positions.START),n.clearSelection(e)}))}},{key:"enter",value:function(e){var t=this.Editor,n=t.BlockManager,o=t.UI;if(!n.currentBlock.tool.isLineBreaksEnabled&&!(o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey)){var r=this.Editor.BlockManager.currentBlock;this.Editor.Caret.isAtStart&&!this.Editor.BlockManager.currentBlock.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):r=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(r),this.Editor.Toolbar.moveAndOpen(r),e.preventDefault()}}},{key:"backspace",value:function(e){var t=this.Editor,n=t.BlockManager,o=t.BlockSelection,r=t.Caret,i=n.currentBlock,a=i.tool;if(i.selected||i.isEmpty&&i.currentInput===i.firstInput){e.preventDefault();var s=n.currentBlockIndex;return n.previousBlock&&0===n.previousBlock.inputs.length?n.removeBlock(s-1):n.removeBlock(),r.setToBlock(n.currentBlock,s?r.positions.END:r.positions.START),this.Editor.Toolbar.close(),void o.clearSelection(e)}if(!a.isLineBreaksEnabled||r.isAtStart){var l=0===n.currentBlockIndex;r.isAtStart&&d.default.isCollapsed&&i.currentInput===i.firstInput&&!l&&(e.preventDefault(),this.mergeBlocks())}}},{key:"mergeBlocks",value:function(){var e=this.Editor,t=e.BlockManager,n=e.Caret,o=e.Toolbar,r=t.previousBlock,i=t.currentBlock;if(i.name!==r.name||!r.mergeable)return 0===r.inputs.length||r.isEmpty?(t.removeBlock(t.currentBlockIndex-1),n.setToBlock(t.currentBlock),void o.close()):void(n.navigatePrevious()&&o.close());n.createShadow(r.pluginsContent),t.mergeBlocks(r,i).then((function(){n.restoreCaret(r.pluginsContent),r.pluginsContent.normalize(),o.close()}))}},{key:"arrowRightAndDown",value:function(e){var t=this,n=p.default.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===f.keyCodes.TAB);if(!this.Editor.UI.someToolbarOpened||!n){this.Editor.BlockManager.clearFocused(),this.Editor.Toolbar.close();var o=this.Editor.Caret.isAtEnd||this.Editor.BlockSelection.anyBlockSelected;e.shiftKey&&e.keyCode===f.keyCodes.DOWN&&o?this.Editor.CrossBlockSelection.toggleBlockSelectedState():((e.keyCode===f.keyCodes.DOWN||e.keyCode===f.keyCodes.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious())?e.preventDefault():f.delay((function(){t.Editor.BlockManager.currentBlock&&t.Editor.BlockManager.currentBlock.updateCurrentInput()}),20)(),this.Editor.BlockSelection.clearSelection(e))}}},{key:"arrowLeftAndUp",value:function(e){var t=this;if(this.Editor.UI.someToolbarOpened){if(p.default.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===f.keyCodes.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.BlockManager.clearFocused(),this.Editor.Toolbar.close();var n=this.Editor.Caret.isAtStart||this.Editor.BlockSelection.anyBlockSelected;e.shiftKey&&e.keyCode===f.keyCodes.UP&&n?this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1):((e.keyCode===f.keyCodes.UP||e.keyCode===f.keyCodes.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext())?e.preventDefault():f.delay((function(){t.Editor.BlockManager.currentBlock&&t.Editor.BlockManager.currentBlock.updateCurrentInput()}),20)(),this.Editor.BlockSelection.clearSelection(e))}},{key:"needToolbarClosing",value:function(e){var t=e.keyCode===f.keyCodes.ENTER&&this.Editor.Toolbar.toolbox.opened,n=e.keyCode===f.keyCodes.ENTER&&this.Editor.BlockSettings.opened,o=e.keyCode===f.keyCodes.ENTER&&this.Editor.InlineToolbar.opened,r=e.keyCode===f.keyCodes.ENTER&&this.Editor.ConversionToolbar.opened,i=e.keyCode===f.keyCodes.TAB;return!(e.shiftKey||i||t||n||o||r)}},{key:"activateToolbox",value:function(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}},{key:"activateBlockSettings",value:function(){this.Editor.Toolbar.opened||(this.Editor.BlockManager.currentBlock.focused=!0,this.Editor.Toolbar.moveAndOpen()),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}}]),n}(u.default);o.default=g,g.displayName="BlockEvents",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(21),n(2),n(3),n(5),n(6),n(4),n(60),n(9),n(19),n(8),n(382),n(111),n(383)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h,v,y,g,b){"use strict";var m=n(1);function k(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(k=function(e){return e?n:t})(e)}function x(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=k(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,f.default)(e);if(t){var r=(0,f.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,u.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=m(r),i=m(i),s=m(s),l=m(l),c=m(c),u=m(u),f=m(f),d=x(d),p=m(p),h=m(h),v=x(v),y=m(y),g=m(g);var S=function(e){(0,c.default)(a,e);var t,n,o=w(a);function a(){var e;return(0,s.default)(this,a),(e=o.apply(this,arguments))._currentBlockIndex=-1,e._blocks=null,e}return(0,l.default)(a,[{key:"currentBlockIndex",get:function(){return this._currentBlockIndex},set:function(e){this._blocks[this._currentBlockIndex]&&this._blocks[this._currentBlockIndex].willUnselect(),this._blocks[e]&&this._blocks[e].willSelect(),this._currentBlockIndex=e}},{key:"firstBlock",get:function(){return this._blocks[0]}},{key:"lastBlock",get:function(){return this._blocks[this._blocks.length-1]}},{key:"currentBlock",get:function(){return this._blocks[this.currentBlockIndex]},set:function(e){this.currentBlockIndex=this.getBlockIndex(e)}},{key:"nextBlock",get:function(){return this.currentBlockIndex===this._blocks.length-1?null:this._blocks[this.currentBlockIndex+1]}},{key:"nextContentfulBlock",get:function(){return this.blocks.slice(this.currentBlockIndex+1).find((function(e){return!!e.inputs.length}))}},{key:"previousContentfulBlock",get:function(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find((function(e){return!!e.inputs.length}))}},{key:"previousBlock",get:function(){return 0===this.currentBlockIndex?null:this._blocks[this.currentBlockIndex-1]}},{key:"blocks",get:function(){return this._blocks.array}},{key:"isEditorEmpty",get:function(){return this.blocks.every((function(e){return e.isEmpty}))}},{key:"prepare",value:function(){var e=this,t=new y.default(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(t,{set:y.default.set,get:y.default.get}),this.listeners.on(document,"copy",(function(t){return e.Editor.BlockEvents.handleCommandC(t)}))}},{key:"toggleReadOnly",value:function(e){e?this.disableModuleBindings():this.enableModuleBindings()}},{key:"composeBlock",value:function(e){var t=e.tool,n=e.data,o=void 0===n?{}:n,r=e.id,i=void 0===r?void 0:r,a=e.tunes,s=void 0===a?{}:a,l=this.Editor.ReadOnly.isEnabled,c=this.Editor.Tools.blockTools.get(t),u=new d.default({id:i,data:o,tool:c,api:this.Editor.API,readOnly:l,tunesData:s});return l||this.bindBlockEvents(u),u}},{key:"insert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.id,n=void 0===t?void 0:t,o=e.tool,r=void 0===o?this.config.defaultBlock:o,i=e.data,a=void 0===i?{}:i,s=e.index,l=e.needToFocus,c=void 0===l||l,u=e.replace,f=void 0!==u&&u,d=e.tunes,p=void 0===d?{}:d,h=s;void 0===h&&(h=this.currentBlockIndex+(f?0:1));var v=this.composeBlock({id:n,tool:r,data:a,tunes:p});return f&&this.blockDidMutated(b.BlockMutationType.Removed,this.getBlockByIndex(h),{index:h}),this._blocks.insert(h,v,f),this.blockDidMutated(b.BlockMutationType.Added,v,{index:h}),c?this.currentBlockIndex=h:h<=this.currentBlockIndex&&this.currentBlockIndex++,v}},{key:"replace",value:function(e){var t=e.tool,n=void 0===t?this.config.defaultBlock:t,o=e.data,r=void 0===o?{}:o;return this.insert({tool:n,data:r,index:this.currentBlockIndex,replace:!0})}},{key:"paste",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this.insert({tool:e,replace:n});try{o.call(d.BlockToolAPI.ON_PASTE,t)}catch(t){v.log("".concat(e,": onPaste callback call is failed"),"error",t)}return o}},{key:"insertDefaultBlockAtIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[e]=n,this.blockDidMutated(b.BlockMutationType.Added,n,{index:e}),t?this.currentBlockIndex=e:e<=this.currentBlockIndex&&this.currentBlockIndex++,n}},{key:"insertAtEnd",value:function(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}},{key:"mergeBlocks",value:(n=(0,i.default)(r.default.mark((function e(t,n){var o,i;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this._blocks.indexOf(n),!n.isEmpty){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,n.data;case 5:if(i=e.sent,v.isEmpty(i)){e.next=9;break}return e.next=9,t.mergeWith(i);case 9:this.removeBlock(o),this.currentBlockIndex=this._blocks.indexOf(t);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"removeBlock",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.currentBlockIndex;if(!this.validateIndex(e))throw new Error("Can't find a Block to remove");var t=this._blocks[e];t.destroy(),this._blocks.remove(e),this.blockDidMutated(b.BlockMutationType.Removed,t,{index:e}),this.currentBlockIndex>=e&&this.currentBlockIndex--,this.blocks.length?0===e&&(this.currentBlockIndex=0):(this.currentBlockIndex=-1,this.insert())}},{key:"removeSelectedBlocks",value:function(){for(var e,t=this.blocks.length-1;t>=0;t--)this.blocks[t].selected&&(this.removeBlock(t),e=t);return e}},{key:"removeAllBlocks",value:function(){for(var e=this.blocks.length-1;e>=0;e--)this._blocks.remove(e);this.currentBlockIndex=-1,this.insert(),this.currentBlock.firstInput.focus()}},{key:"split",value:function(){var e=this.Editor.Caret.extractFragmentFromCaretPosition(),t=h.default.make("div");e&&t.appendChild(e);var n={text:h.default.isEmpty(t)?"":t.innerHTML};return this.insert({data:n})}},{key:"getBlockByIndex",value:function(e){return-1===e&&(e=this._blocks.length-1),this._blocks[e]}},{key:"getBlockIndex",value:function(e){return this._blocks.indexOf(e)}},{key:"getBlockById",value:function(e){return this._blocks.array.find((function(t){return t.id===e}))}},{key:"getBlock",value:function(e){h.default.isElement(e)||(e=e.parentNode);var t=this._blocks.nodes,n=e.closest(".".concat(d.default.CSS.wrapper)),o=t.indexOf(n);if(o>=0)return this._blocks[o]}},{key:"highlightCurrentNode",value:function(){this.clearFocused(),this.currentBlock.focused=!0}},{key:"clearFocused",value:function(){this.blocks.forEach((function(e){e.focused=!1}))}},{key:"setCurrentBlockByChildNode",value:function(e){h.default.isElement(e)||(e=e.parentNode);var t=e.closest(".".concat(d.default.CSS.wrapper));if(t){var n=t.closest(".".concat(this.Editor.UI.CSS.editorWrapper));if(null==n?void 0:n.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(t),this.currentBlock.updateCurrentInput(),this.currentBlock}}},{key:"getBlockByChildNode",value:function(e){h.default.isElement(e)||(e=e.parentNode);var t=e.closest(".".concat(d.default.CSS.wrapper));return this.blocks.find((function(e){return e.holder===t}))}},{key:"swap",value:function(e,t){this._blocks.swap(e,t),this.currentBlockIndex=t}},{key:"move",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.currentBlockIndex;isNaN(e)||isNaN(t)?v.log("Warning during 'move' call: incorrect indices provided.","warn"):this.validateIndex(e)&&this.validateIndex(t)?(this._blocks.move(e,t),this.currentBlockIndex=e,this.blockDidMutated(b.BlockMutationType.Moved,this.currentBlock,{fromIndex:t,toIndex:e})):v.log("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn")}},{key:"dropPointer",value:function(){this.currentBlockIndex=-1,this.clearFocused()}},{key:"clear",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._blocks.removeAll(),this.dropPointer(),e&&this.insert(),this.Editor.UI.checkEmptiness()}},{key:"destroy",value:(t=(0,i.default)(r.default.mark((function e(){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(this.blocks.map((function(e){return e.destroy()})));case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"bindBlockEvents",value:function(e){var t=this,n=this.Editor.BlockEvents;this.readOnlyMutableListeners.on(e.holder,"keydown",(function(e){n.keydown(e)})),this.readOnlyMutableListeners.on(e.holder,"keyup",(function(e){n.keyup(e)})),this.readOnlyMutableListeners.on(e.holder,"dragover",(function(e){n.dragOver(e)})),this.readOnlyMutableListeners.on(e.holder,"dragleave",(function(e){n.dragLeave(e)})),e.on("didMutated",(function(e){return t.blockDidMutated(b.BlockMutationType.Changed,e,{index:t.getBlockIndex(e)})}))}},{key:"disableModuleBindings",value:function(){this.readOnlyMutableListeners.clearAll()}},{key:"enableModuleBindings",value:function(){var e=this;this.readOnlyMutableListeners.on(document,"cut",(function(t){return e.Editor.BlockEvents.handleCommandX(t)})),this.blocks.forEach((function(t){e.bindBlockEvents(t)}))}},{key:"validateIndex",value:function(e){return!(e<0||e>=this._blocks.length)}},{key:"blockDidMutated",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=new CustomEvent(e,{detail:Object.assign({target:new g.default(t)},n)});return this.Editor.ModificationsObserver.onChange(o),t}}]),a}(p.default);o.default=S,S.displayName="BlockManager",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9),n(8),n(19),n(114),n(25),n(65)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h,v){"use strict";var y=n(1);function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function b(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,l.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=y(r),i=y(i),s=y(s),l=y(l),c=y(c),u=y(u),f=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=g(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(f),d=y(d),p=y(p),h=y(h);var m=function(e){(0,s.default)(n,e);var t=b(n);function n(){var e;return(0,r.default)(this,n),(e=t.apply(this,arguments)).anyBlockSelectedCache=null,e.needToSelectAll=!1,e.nativeInputSelected=!1,e.readyToBlockSelection=!1,e}return(0,i.default)(n,[{key:"sanitizerConfig",get:function(){return{p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}}}},{key:"allBlocksSelected",get:function(){return this.Editor.BlockManager.blocks.every((function(e){return!0===e.selected}))},set:function(e){this.Editor.BlockManager.blocks.forEach((function(t){t.selected=e})),this.clearCache()}},{key:"anyBlockSelected",get:function(){var e=this.Editor.BlockManager;return null===this.anyBlockSelectedCache&&(this.anyBlockSelectedCache=e.blocks.some((function(e){return!0===e.selected}))),this.anyBlockSelectedCache}},{key:"selectedBlocks",get:function(){return this.Editor.BlockManager.blocks.filter((function(e){return e.selected}))}},{key:"prepare",value:function(){var e=this;this.selection=new h.default,p.default.add({name:"CMD+A",handler:function(t){var n=e.Editor,o=n.BlockManager;if(n.ReadOnly.isEnabled)return t.preventDefault(),void e.selectAllBlocks();o.currentBlock&&e.handleCommandA(t)},on:this.Editor.UI.nodes.redactor})}},{key:"toggleReadOnly",value:function(){h.default.get().removeAllRanges(),this.allBlocksSelected=!1}},{key:"unSelectBlockByIndex",value:function(e){var t=this.Editor.BlockManager;(isNaN(e)?t.currentBlock:t.getBlockByIndex(e)).selected=!1,this.clearCache()}},{key:"clearSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.Editor,o=n.BlockManager,r=n.Caret,i=n.RectangleSelection;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;var a=e&&e instanceof KeyboardEvent,s=a&&f.isPrintableKey(e.keyCode);if(this.anyBlockSelected&&a&&s&&!h.default.isSelectionExists){var l=o.removeSelectedBlocks();o.insertDefaultBlockAtIndex(l,!0),r.setToBlock(o.currentBlock),f.delay((function(){var t=e.key;r.insertContentAtCaretPosition(t.length>1?"":t)}),20)()}this.Editor.CrossBlockSelection.clear(e),this.anyBlockSelected&&!i.isRectActivated()?(t&&this.selection.restore(),this.allBlocksSelected=!1):this.Editor.RectangleSelection.clearSelection()}},{key:"copySelectedBlocks",value:function(e){var t=this;e.preventDefault();var n=d.default.make("div");this.selectedBlocks.forEach((function(e){var o=(0,v.clean)(e.holder.innerHTML,t.sanitizerConfig),r=d.default.make("p");r.innerHTML=o,n.appendChild(r)}));var o=Array.from(n.childNodes).map((function(e){return e.textContent})).join("\n\n"),r=n.innerHTML;return e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",r),Promise.all(this.selectedBlocks.map((function(e){return e.save()}))).then((function(n){try{e.clipboardData.setData(t.Editor.Paste.MIME_TYPE,JSON.stringify(n))}catch(e){}}))}},{key:"selectBlockByIndex",value:function(e){var t,n=this.Editor.BlockManager;n.clearFocused(),t=isNaN(e)?n.currentBlock:n.getBlockByIndex(e),this.selection.save(),h.default.get().removeAllRanges(),t.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}},{key:"clearCache",value:function(){this.anyBlockSelectedCache=null}},{key:"destroy",value:function(){p.default.remove(this.Editor.UI.nodes.redactor,"CMD+A")}},{key:"handleCommandA",value:function(e){if(this.Editor.RectangleSelection.clearSelection(),!d.default.isNativeInput(e.target)||this.readyToBlockSelection){var t=this.Editor.BlockManager.getBlock(e.target).inputs;t.length>1&&!this.readyToBlockSelection?this.readyToBlockSelection=!0:1!==t.length||this.needToSelectAll?this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1,this.Editor.ConversionToolbar.close()):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlockByIndex(),this.needToSelectAll=!0):this.needToSelectAll=!0}else this.readyToBlockSelection=!0}},{key:"selectAllBlocks",value:function(){this.selection.save(),h.default.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}}]),n}(u.default);o.default=m,m.displayName="BlockSelection",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(25),n(9),n(19),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p){"use strict";var h=n(1);function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(v=function(e){return e?n:t})(e)}function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,l.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=h(r),i=h(i),s=h(s),l=h(l),c=h(c),u=h(u),f=h(f),d=h(d),p=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=v(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(p);var g=function(e){(0,s.default)(n,e);var t=y(n);function n(){return(0,r.default)(this,n),t.apply(this,arguments)}return(0,i.default)(n,[{key:"positions",get:function(){return{START:"start",END:"end",DEFAULT:"default"}}},{key:"isAtStart",get:function(){var e=u.default.get(),t=d.default.getDeepestNode(this.Editor.BlockManager.currentBlock.currentInput),n=e.focusNode;if(d.default.isNativeInput(t))return 0===t.selectionEnd;if(!e.anchorNode)return!1;var o=n.textContent.search(/\S/);-1===o&&(o=0);var r=e.focusOffset;return n.nodeType!==Node.TEXT_NODE&&n.childNodes.length&&(n.childNodes[r]?(n=n.childNodes[r],r=0):r=(n=n.childNodes[r-1]).textContent.length),!(!d.default.isLineBreakTag(t)&&!d.default.isEmpty(t)||!this.getHigherLevelSiblings(n,"left").every((function(e){var t=d.default.isLineBreakTag(e),n=1===e.children.length&&d.default.isLineBreakTag(e.children[0]),o=t||n;return d.default.isEmpty(e)&&!o}))||r!==o)||(null===t||n===t&&r<=o)}},{key:"isAtEnd",get:function(){var e=u.default.get(),t=e.focusNode,n=d.default.getDeepestNode(this.Editor.BlockManager.currentBlock.currentInput,!0);if(d.default.isNativeInput(n))return n.selectionEnd===n.value.length;if(!e.focusNode)return!1;var o=e.focusOffset;if(t.nodeType!==Node.TEXT_NODE&&t.childNodes.length&&(t.childNodes[o-1]?o=(t=t.childNodes[o-1]).textContent.length:(t=t.childNodes[0],o=0)),d.default.isLineBreakTag(n)||d.default.isEmpty(n)){var r=this.getHigherLevelSiblings(t,"right");if(r.every((function(e,t){return t===r.length-1&&d.default.isLineBreakTag(e)||d.default.isEmpty(e)&&!d.default.isLineBreakTag(e)}))&&o===t.textContent.length)return!0}var i=n.textContent.replace(/\s+$/,"");return t===n&&o>=i.length}},{key:"setToBlock",value:function(e){var t,n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.positions.DEFAULT,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=this.Editor.BlockManager;switch(o){case this.positions.START:t=e.firstInput;break;case this.positions.END:t=e.lastInput;break;default:t=e.currentInput}if(t){var a=d.default.getDeepestNode(t,o===this.positions.END),s=d.default.getContentLength(a);switch(!0){case o===this.positions.START:r=0;break;case o===this.positions.END:case r>s:r=s}p.delay((function(){n.set(a,r)}),20)(),i.setCurrentBlockByChildNode(e.holder),i.currentBlock.currentInput=t}}},{key:"setToInput",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.positions.DEFAULT,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=this.Editor.BlockManager.currentBlock,r=d.default.getDeepestNode(e);switch(t){case this.positions.START:this.set(r,0);break;case this.positions.END:this.set(r,d.default.getContentLength(r));break;default:n&&this.set(r,n)}o.currentInput=e}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=u.default.setCursor(e,t),o=n.top,r=n.bottom,i=window,a=i.innerHeight;o<0&&window.scrollBy(0,o),r>a&&window.scrollBy(0,r-a)}},{key:"setToTheLastBlock",value:function(){var e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{var t=this.Editor.BlockManager.insertAtEnd();this.setToBlock(t)}}},{key:"extractFragmentFromCaretPosition",value:function(){var e=u.default.get();if(e.rangeCount){var t=e.getRangeAt(0),n=this.Editor.BlockManager.currentBlock.currentInput;if(t.deleteContents(),n){if(d.default.isNativeInput(n)){var o=n,r=document.createDocumentFragment(),i=o.value.substring(0,o.selectionStart),a=o.value.substring(o.selectionStart);return r.textContent=a,o.value=i,r}var s=t.cloneRange();return s.selectNodeContents(n),s.setStart(t.endContainer,t.endOffset),s.extractContents()}}}},{key:"navigateNext",value:function(){var e=this.Editor.BlockManager,t=e.currentBlock,n=e.nextContentfulBlock,o=t.nextInput,r=this.isAtEnd,i=n;if(!i&&!o){if(t.tool.isDefault||!r)return!1;i=e.insertAtEnd()}return!!r&&(o?this.setToInput(o,this.positions.START):this.setToBlock(i,this.positions.START),!0)}},{key:"navigatePrevious",value:function(){var e=this.Editor.BlockManager,t=e.currentBlock,n=e.previousContentfulBlock;if(!t)return!1;var o=t.previousInput;return!(!n&&!o||!this.isAtStart||(o?this.setToInput(o,this.positions.END):this.setToBlock(n,this.positions.END),0))}},{key:"createShadow",value:function(e){var t=document.createElement("span");t.classList.add(n.CSS.shadowCaret),e.insertAdjacentElement("beforeend",t)}},{key:"restoreCaret",value:function(e){var t=e.querySelector(".".concat(n.CSS.shadowCaret));t&&((new u.default).expandToTag(t),setTimeout((function(){var e=document.createRange();e.selectNode(t),e.extractContents()}),50))}},{key:"insertContentAtCaretPosition",value:function(e){var t=document.createDocumentFragment(),n=document.createElement("div"),o=u.default.get(),r=u.default.range;n.innerHTML=e,Array.from(n.childNodes).forEach((function(e){return t.appendChild(e)})),0===t.childNodes.length&&t.appendChild(new Text);var i=t.lastChild;r.deleteContents(),r.insertNode(t);var a=document.createRange();a.setStart(i,i.textContent.length),o.removeAllRanges(),o.addRange(a)}},{key:"getHigherLevelSiblings",value:function(e,t){for(var n=e,o=[];n.parentNode&&"true"!==n.parentNode.contentEditable;)n=n.parentNode;for(var r="left"===t?"previousSibling":"nextSibling";n[r];)n=n[r],o.push(n);return o}}],[{key:"CSS",get:function(){return{shadowCaret:"cdx-shadow-caret"}}}]),n}(f.default);o.default=g,g.displayName="Caret",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(21),n(2),n(3),n(5),n(6),n(4),n(9),n(25),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h){"use strict";var v=n(1);function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,f.default)(e);if(t){var r=(0,f.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,u.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=v(r),i=v(i),s=v(s),l=v(l),c=v(c),u=v(u),f=v(f),d=v(d),p=v(p),h=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(h);var b=function(e){(0,c.default)(o,e);var t,n=g(o);function o(){var e;return(0,s.default)(this,o),(e=n.apply(this,arguments)).onMouseUp=function(){e.listeners.off(document,"mouseover",e.onMouseOver),e.listeners.off(document,"mouseup",e.onMouseUp)},e.onMouseOver=function(t){var n=e.Editor,o=n.BlockManager,r=n.BlockSelection,i=o.getBlockByChildNode(t.relatedTarget)||e.lastSelectedBlock,a=o.getBlockByChildNode(t.target);if(i&&a&&a!==i){if(i===e.firstSelectedBlock)return p.default.get().removeAllRanges(),i.selected=!0,a.selected=!0,void r.clearCache();if(a===e.firstSelectedBlock)return i.selected=!1,a.selected=!1,void r.clearCache();e.Editor.InlineToolbar.close(),e.toggleBlocksSelectedState(i,a),e.lastSelectedBlock=a}},e}return(0,l.default)(o,[{key:"prepare",value:(t=(0,i.default)(r.default.mark((function e(){var t=this;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.listeners.on(document,"mousedown",(function(e){t.enableCrossBlockSelection(e)}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"watchSelection",value:function(e){if(e.button===h.mouseButtons.LEFT){var t=this.Editor.BlockManager;this.firstSelectedBlock=t.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}}},{key:"isCrossBlockSelectionStarted",get:function(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock}},{key:"toggleBlockSelectedState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.Editor,n=t.BlockManager,o=t.BlockSelection;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=n.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),p.default.get().removeAllRanges());var r=n.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),i=n.blocks[r];i&&(this.lastSelectedBlock.selected!==i.selected?(i.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=i,this.Editor.InlineToolbar.close(),i.holder.scrollIntoView({block:"nearest"}))}},{key:"clear",value:function(e){var t=this.Editor,n=t.BlockManager,o=t.BlockSelection,r=t.Caret,i=n.blocks.indexOf(this.firstSelectedBlock),a=n.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&i>-1&&a>-1)if(e&&e instanceof KeyboardEvent)switch(e.keyCode){case h.keyCodes.DOWN:case h.keyCodes.RIGHT:r.setToBlock(n.blocks[Math.max(i,a)],r.positions.END);break;case h.keyCodes.UP:case h.keyCodes.LEFT:r.setToBlock(n.blocks[Math.min(i,a)],r.positions.START);break;default:r.setToBlock(n.blocks[Math.max(i,a)],r.positions.END)}else r.setToBlock(n.blocks[Math.max(i,a)],r.positions.END);this.firstSelectedBlock=this.lastSelectedBlock=null}},{key:"enableCrossBlockSelection",value:function(e){var t=this.Editor.UI;p.default.isCollapsed||this.Editor.BlockSelection.clearSelection(e),t.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}},{key:"toggleBlocksSelectedState",value:function(e,t){for(var n=this.Editor,o=n.BlockManager,r=n.BlockSelection,i=o.blocks.indexOf(e),a=o.blocks.indexOf(t),s=e.selected!==t.selected,l=Math.min(i,a);l<=Math.max(i,a);l++){var c=o.blocks[l];c!==this.firstSelectedBlock&&c!==(s?e:t)&&(o.blocks[l].selected=!o.blocks[l].selected,r.clearCache())}}}]),o}(d.default);o.default=b,b.displayName="CrossBlockSelection",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(21),n(2),n(3),n(5),n(6),n(4),n(25),n(9)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c,u,f,d){"use strict";var p=n(1);function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,u.default)(e);if(t){var r=(0,u.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,c.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=p(r),i=p(i),a=p(a),s=p(s),l=p(l),c=p(c),u=p(u),f=p(f);var v=function(e){(0,l.default)(o,e);var t,n=h(o);function o(){var e;return(0,a.default)(this,o),(e=n.apply(this,arguments)).isStartedAtEditor=!1,e}return(0,s.default)(o,[{key:"toggleReadOnly",value:function(e){e?this.disableModuleBindings():this.enableModuleBindings()}},{key:"enableModuleBindings",value:function(){var e=this,t=this.Editor.UI;this.readOnlyMutableListeners.on(t.nodes.holder,"drop",function(){var t=(0,i.default)(r.default.mark((function t(n){return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.processDrop(n);case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),!0),this.readOnlyMutableListeners.on(t.nodes.holder,"dragstart",(function(){e.processDragStart()})),this.readOnlyMutableListeners.on(t.nodes.holder,"dragover",(function(t){e.processDragOver(t)}),!0)}},{key:"disableModuleBindings",value:function(){this.readOnlyMutableListeners.clearAll()}},{key:"processDrop",value:(t=(0,i.default)(r.default.mark((function e(t){var n,o,i,a,s,l;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.Editor,o=n.BlockManager,i=n.Caret,a=n.Paste,t.preventDefault(),o.blocks.forEach((function(e){e.dropTarget=!1})),f.default.isAtEditor&&!f.default.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1,(s=o.setCurrentBlockByChildNode(t.target))?this.Editor.Caret.setToBlock(s,i.positions.END):(l=o.setCurrentBlockByChildNode(o.lastBlock.holder),this.Editor.Caret.setToBlock(l,i.positions.END)),e.next=9,a.processDataTransfer(t.dataTransfer,!0);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"processDragStart",value:function(){f.default.isAtEditor&&!f.default.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}},{key:"processDragOver",value:function(e){e.preventDefault()}}]),o}((d=p(d)).default);o.default=v,v.displayName="DragNDrop",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f){"use strict";var d=n(1);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,l.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=d(r),i=d(i),s=d(s),l=d(l),c=d(c),u=d(u),f=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(f);var v=function(e){(0,s.default)(n,e);var t=h(n);function n(){var e;return(0,r.default)(this,n),(e=t.apply(this,arguments)).disabled=!1,e}return(0,i.default)(n,[{key:"enable",value:function(){this.disabled=!1}},{key:"disable",value:function(){this.disabled=!0}},{key:"onChange",value:function(e){!this.disabled&&f.isFunction(this.config.onChange)&&this.config.onChange(this.Editor.API.methods,e)}}]),n}(u.default);o.default=v,v.displayName="ModificationsObserver",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(30),n(40),n(21),n(2),n(3),n(5),n(6),n(4),n(9),n(19),n(8),n(65)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h,v,y,g){"use strict";var b=n(1);function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,p.default)(e);if(t){var r=(0,p.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,d.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=b(r),i=b(i),s=b(s),l=b(l),c=b(c),u=b(u),f=b(f),d=b(d),p=b(p),h=b(h),v=b(v),y=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(y);var x=function(e){(0,f.default)(x,e);var t,n,o,a,d,p,h,b,m=k(x);function x(){var e;return(0,c.default)(this,x),(e=m.apply(this,arguments)).MIME_TYPE="application/x-editor-js",e.toolsTags={},e.tagsByTool={},e.toolsPatterns=[],e.toolsFiles={},e.exceptionList=[],e.processTool=function(t){try{var n=t.create({},{},!1);if(!1===t.pasteConfig)return void e.exceptionList.push(t.name);if(!y.isFunction(n.onPaste))return;e.getTagsConfig(t),e.getFilesConfig(t),e.getPatternsConfig(t)}catch(e){y.log("Paste handling for «".concat(t.name,"» Tool hasn't been set up because of the error"),"warn",e)}},e.handlePasteEvent=function(){var t=(0,l.default)(r.default.mark((function t(n){var o,i,a;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=e.Editor,i=o.BlockManager,a=o.Toolbar,i.currentBlock&&(!e.isNativeBehaviour(n.target)||n.clipboardData.types.includes("Files"))){t.next=3;break}return t.abrupt("return");case 3:if(!i.currentBlock||!e.exceptionList.includes(i.currentBlock.name)){t.next=5;break}return t.abrupt("return");case 5:n.preventDefault(),e.processDataTransfer(n.clipboardData),i.clearFocused(),a.close();case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),e}return(0,u.default)(x,[{key:"prepare",value:(b=(0,l.default)(r.default.mark((function e(){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.processTools();case 1:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"toggleReadOnly",value:function(e){e?this.unsetCallback():this.setCallback()}},{key:"processDataTransfer",value:(h=(0,l.default)(r.default.mark((function e(t){var n,o,i,a,s,l,c,u,f,d,p,h=this,b=arguments;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=b.length>1&&void 0!==b[1]&&b[1],o=this.Editor.Tools,!((i=t.types).includes?i.includes("Files"):i.contains("Files"))||y.isEmpty(this.toolsFiles)){e.next=8;break}return e.next=7,this.processFiles(t.files);case 7:return e.abrupt("return");case 8:if(a=t.getData(this.MIME_TYPE),s=t.getData("text/plain"),l=t.getData("text/html"),(c=document.createElement("div")).innerHTML=l,c.querySelectorAll("*").forEach((function(e){e instanceof HTMLElement&&(e.style.fontFamily="inherit",e.style.color="inherit",e.style.fontSize="inherit",e.style.backgroundColor="initial")})),u=c.innerHTML,l=u,!a){e.next=24;break}return e.prev=17,this.insertEditorJSData(JSON.parse(a)),e.abrupt("return");case 22:e.prev=22,e.t0=e.catch(17);case 24:if(n&&s.trim()&&l.trim()&&(l="

"+(l.trim()?l:s)+"

"),f=Object.keys(this.toolsTags).reduce((function(e,t){var n;return e[t.toLowerCase()]=null!==(n=h.toolsTags[t].sanitizationConfig)&&void 0!==n?n:{},e}),{}),d=Object.assign({},f,o.getAllInlineToolsSanitizeConfig(),{br:{}}),(p=(0,g.clean)(l,d)).trim()&&p.trim()!==s&&v.default.isHTMLString(p)){e.next=33;break}return e.next=31,this.processText(s);case 31:e.next=35;break;case 33:return e.next=35,this.processText(p,!0);case 35:case"end":return e.stop()}}),e,this,[[17,22]])}))),function(e){return h.apply(this,arguments)})},{key:"processText",value:(p=(0,l.default)(r.default.mark((function e(t){var n,o,i,a,s,c,u,f=this,d=arguments;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=d.length>1&&void 0!==d[1]&&d[1],o=this.Editor,i=o.Caret,a=o.BlockManager,(s=n?this.processHTML(t):this.processPlain(t)).length){e.next=5;break}return e.abrupt("return");case 5:if(1!==s.length){e.next=8;break}return s[0].isBlock?this.processSingleBlock(s.pop()):this.processInlinePaste(s.pop()),e.abrupt("return");case 8:c=a.currentBlock&&a.currentBlock.tool.isDefault,u=c&&a.currentBlock.isEmpty,s.map(function(){var e=(0,l.default)(r.default.mark((function e(t,n){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",f.insertBlock(t,0===n&&u));case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),a.currentBlock&&i.setToBlock(a.currentBlock,i.positions.END);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"setCallback",value:function(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}},{key:"unsetCallback",value:function(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}},{key:"processTools",value:function(){var e=this.Editor.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}},{key:"collectTagNames",value:function(e){return y.isString(e)?[e]:y.isObject(e)?Object.keys(e):[]}},{key:"getTagsConfig",value:function(e){var t=this,n=e.pasteConfig.tags||[],o=[];n.forEach((function(n){var r=t.collectTagNames(n);o.push.apply(o,(0,s.default)(r)),r.forEach((function(o){if(Object.prototype.hasOwnProperty.call(t.toolsTags,o))y.log("Paste handler for «".concat(e.name,"» Tool on «").concat(o,"» tag is skipped ")+"because it is already used by «".concat(t.toolsTags[o].tool.name,"» Tool."),"warn");else{var r=y.isObject(n)?n[o]:null;t.toolsTags[o.toUpperCase()]={tool:e,sanitizationConfig:r}}}))})),this.tagsByTool[e.name]=o.map((function(e){return e.toUpperCase()}))}},{key:"getFilesConfig",value:function(e){var t=e.pasteConfig.files,n=void 0===t?{}:t,o=n.extensions,r=n.mimeTypes;(o||r)&&(o&&!Array.isArray(o)&&(y.log("«extensions» property of the onDrop config for «".concat(e.name,"» Tool should be an array")),o=[]),r&&!Array.isArray(r)&&(y.log("«mimeTypes» property of the onDrop config for «".concat(e.name,"» Tool should be an array")),r=[]),r&&(r=r.filter((function(t){return!!y.isValidMimeType(t)||(y.log("MIME type value «".concat(t,"» for the «").concat(e.name,"» Tool is not a valid MIME type"),"warn"),!1)}))),this.toolsFiles[e.name]={extensions:o||[],mimeTypes:r||[]})}},{key:"getPatternsConfig",value:function(e){var t=this;e.pasteConfig.patterns&&!y.isEmpty(e.pasteConfig.patterns)&&Object.entries(e.pasteConfig.patterns).forEach((function(n){var o=(0,i.default)(n,2),r=o[0],a=o[1];a instanceof RegExp||y.log("Pattern ".concat(a," for «").concat(e.name,"» Tool is skipped because it should be a Regexp instance."),"warn"),t.toolsPatterns.push({key:r,pattern:a,tool:e})}))}},{key:"isNativeBehaviour",value:function(e){return v.default.isNativeInput(e)}},{key:"processFiles",value:(d=(0,l.default)(r.default.mark((function e(t){var n,o,i,a,s=this;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.Editor.BlockManager,e.next=3,Promise.all(Array.from(t).map((function(e){return s.processFile(e)})));case 3:o=(o=e.sent).filter((function(e){return!!e})),i=n.currentBlock.tool.isDefault,a=i&&n.currentBlock.isEmpty,o.forEach((function(e,t){n.paste(e.type,e.event,0===t&&a)}));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"processFile",value:(a=(0,l.default)(r.default.mark((function e(t){var n,o,a,s,l;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=y.getFileExtension(t),o=Object.entries(this.toolsFiles).find((function(e){var o=(0,i.default)(e,2),r=(o[0],o[1]),a=r.mimeTypes,s=r.extensions,l=t.type.split("/"),c=(0,i.default)(l,2),u=c[0],f=c[1],d=s.find((function(e){return e.toLowerCase()===n.toLowerCase()})),p=a.find((function(e){var t=e.split("/"),n=(0,i.default)(t,2),o=n[0],r=n[1];return o===u&&(r===f||"*"===r)}));return!!d||!!p}))){e.next=4;break}return e.abrupt("return");case 4:return a=(0,i.default)(o,1),s=a[0],l=this.composePasteEvent("file",{file:t}),e.abrupt("return",{event:l,type:s});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"processHTML",value:function(e){var t=this,n=this.Editor.Tools,o=v.default.make("DIV");return o.innerHTML=e,this.getNodes(o).map((function(e){var o,r=n.defaultTool,i=!1;switch(e.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:(o=v.default.make("div")).appendChild(e);break;case Node.ELEMENT_NODE:o=e,i=!0,t.toolsTags[o.tagName]&&(r=t.toolsTags[o.tagName].tool)}var a=r.pasteConfig.tags.reduce((function(e,n){return t.collectTagNames(n).forEach((function(t){var o=y.isObject(n)?n[t]:null;e[t]=o||{}})),e}),{}),s=Object.assign({},a,r.baseSanitizeConfig);if("table"===o.tagName.toLowerCase()){var l=(0,g.clean)(o.outerHTML,s);o=v.default.make("div",void 0,{innerHTML:l}).firstChild}else o.innerHTML=(0,g.clean)(o.innerHTML,s);var c=t.composePasteEvent("tag",{data:o});return{content:o,isBlock:i,tool:r.name,event:c}})).filter((function(e){var t=v.default.isEmpty(e.content),n=v.default.isSingleTag(e.content);return!t||n}))}},{key:"processPlain",value:function(e){var t=this,n=this.config.defaultBlock;if(!e)return[];var o=n;return e.split(/\r?\n/).filter((function(e){return e.trim()})).map((function(e){var n=v.default.make("div");n.textContent=e;var r=t.composePasteEvent("tag",{data:n});return{content:n,tool:o,isBlock:!1,event:r}}))}},{key:"processSingleBlock",value:(o=(0,l.default)(r.default.mark((function e(t){var n,o,i,a;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.Editor,o=n.Caret,i=n.BlockManager,(a=i.currentBlock)&&t.tool===a.name&&v.default.containsOnlyInlineElements(t.content.innerHTML)){e.next=5;break}return this.insertBlock(t,(null==a?void 0:a.tool.isDefault)&&a.isEmpty),e.abrupt("return");case 5:o.insertContentAtCaretPosition(t.content.innerHTML);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"processInlinePaste",value:(n=(0,l.default)(r.default.mark((function e(t){var n,o,i,a,s,l,c,u;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.Editor,o=n.BlockManager,i=n.Caret,a=t.content,!(o.currentBlock&&o.currentBlock.tool.isDefault&&a.textContent.length1&&void 0!==arguments[1]&&arguments[1],o=this.Editor,r=o.BlockManager,i=o.Caret,a=r.currentBlock;if(n&&a&&a.isEmpty)return t=r.paste(e.tool,e.event,!0),void i.setToBlock(t,i.positions.END);t=r.paste(e.tool,e.event),i.setToBlock(t,i.positions.END)}},{key:"insertEditorJSData",value:function(e){var t=this.Editor,n=t.BlockManager,o=t.Caret,r=t.Tools;(0,g.sanitizeBlocks)(e,(function(e){return r.blockTools.get(e).sanitizeConfig})).forEach((function(e,t){var r=e.tool,i=e.data,a=!1;0===t&&(a=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty);var s=n.insert({tool:r,data:i,replace:a});o.setToBlock(s,o.positions.END)}))}},{key:"processElementNode",value:function(e,t,n){var o=Object.keys(this.toolsTags),r=e,i=(this.toolsTags[r.tagName]||{}).tool,a=this.tagsByTool[null==i?void 0:i.name]||[],l=o.includes(r.tagName),c=v.default.blockElements.includes(r.tagName.toLowerCase()),u=Array.from(r.children).some((function(e){var t=e.tagName;return o.includes(t)&&!a.includes(t)})),f=Array.from(r.children).some((function(e){var t=e.tagName;return v.default.blockElements.includes(t.toLowerCase())}));return c||l||u?l&&!u||c&&!f&&!u?[].concat((0,s.default)(t),[n,r]):void 0:(n.appendChild(r),[].concat((0,s.default)(t),[n]))}},{key:"getNodes",value:function(e){var t,n=this;return Array.from(e.childNodes).reduce((function e(o,r){if(v.default.isEmpty(r)&&!v.default.isSingleTag(r))return o;var i=o[o.length-1],a=new DocumentFragment;switch(i&&v.default.isFragment(i)&&(a=o.pop()),r.nodeType){case Node.ELEMENT_NODE:if(t=n.processElementNode(r,o,a))return t;break;case Node.TEXT_NODE:return a.appendChild(r),[].concat((0,s.default)(o),[a]);default:return[].concat((0,s.default)(o),[a])}return[].concat((0,s.default)(o),(0,s.default)(Array.from(r.childNodes).reduce(e,[])))}),[])}},{key:"composePasteEvent",value:function(e,t){return new CustomEvent(e,{detail:t})}}]),x}(h.default);o.default=x,x.displayName="Paste",x.PATTERN_PROCESSING_MAX_LENGTH=450,e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(30),n(21),n(2),n(3),n(5),n(6),n(4),n(9),n(149)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c,u,f,d,p){"use strict";var h=n(1);function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,f.default)(e);if(t){var r=(0,f.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,u.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=h(r),i=h(i),a=h(a),s=h(s),l=h(l),c=h(c),u=h(u),f=h(f);var y=function(e){(0,c.default)(u,e);var t,n,o=v(u);function u(){var e;return(0,s.default)(this,u),(e=o.apply(this,arguments)).toolsDontSupportReadOnly=[],e.readOnlyEnabled=!1,e}return(0,l.default)(u,[{key:"isEnabled",get:function(){return this.readOnlyEnabled}},{key:"prepare",value:(n=(0,a.default)(r.default.mark((function e(){var t,n,o;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.Editor.Tools,n=t.blockTools,o=[],Array.from(n.entries()).forEach((function(e){var t=(0,i.default)(e,2),n=t[0];t[1].isReadOnlySupported||o.push(n)})),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly);case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"toggle",value:(t=(0,a.default)(r.default.mark((function e(){var t,n,o,i,a=arguments;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(t=a.length>0&&void 0!==a[0]?a[0]:!this.readOnlyEnabled)&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError(),n=this.readOnlyEnabled,this.readOnlyEnabled=t,e.t0=r.default.keys(this.Editor);case 5:if((e.t1=e.t0()).done){e.next=12;break}if(o=e.t1.value,this.Editor[o].toggleReadOnly){e.next=9;break}return e.abrupt("continue",5);case 9:this.Editor[o].toggleReadOnly(t),e.next=5;break;case 12:if(n!==t){e.next=14;break}return e.abrupt("return",this.readOnlyEnabled);case 14:return e.next=16,this.Editor.Saver.save();case 16:return i=e.sent,e.next=19,this.Editor.BlockManager.clear();case 19:return e.next=21,this.Editor.Renderer.render(i.blocks);case 21:return e.abrupt("return",this.readOnlyEnabled);case 22:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"throwCriticalError",value:function(){throw new p.CriticalError("To enable read-only mode all connected tools should support it. Tools ".concat(this.toolsDontSupportReadOnly.join(", ")," don't support read-only mode."))}}]),u}((d=h(d)).default);o.default=y,y.displayName="ReadOnly",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(5),n(6),n(4),n(9),n(19),n(25),n(60),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h){"use strict";var v=n(1);function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},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 i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);nn&&this.mouseX>n,a=this.startX=this.startY?(this.overlayRectangle.style.top="".concat(this.startY-window.pageYOffset,"px"),this.overlayRectangle.style.bottom="calc(100% - ".concat(this.mouseY-window.pageYOffset,"px")):(this.overlayRectangle.style.bottom="calc(100% - ".concat(this.startY-window.pageYOffset,"px"),this.overlayRectangle.style.top="".concat(this.mouseY-window.pageYOffset,"px")),this.mouseX>=this.startX?(this.overlayRectangle.style.left="".concat(this.startX-window.pageXOffset,"px"),this.overlayRectangle.style.right="calc(100% - ".concat(this.mouseX-window.pageXOffset,"px")):(this.overlayRectangle.style.right="calc(100% - ".concat(this.startX-window.pageXOffset,"px"),this.overlayRectangle.style.left="".concat(this.mouseX-window.pageXOffset,"px"))}},{key:"genInfoForMouseSelection",value:function(){var e,t=document.body.offsetWidth/2,n=this.mouseY-window.pageYOffset,o=document.elementFromPoint(t,n),r=this.Editor.BlockManager.getBlockByChildNode(o);void 0!==r&&(e=this.Editor.BlockManager.blocks.findIndex((function(e){return e.holder===r.holder})));var i=this.Editor.BlockManager.lastBlock.holder.querySelector("."+p.default.CSS.content),a=Number.parseInt(window.getComputedStyle(i).width,10)/2;return{index:e,leftPos:t-a,rightPos:t+a}}},{key:"addBlockInSelection",value:function(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}},{key:"trySelectNextBlock",value:function(e){var t=this,n=this.stackOfSelected[this.stackOfSelected.length-1]===e,o=this.stackOfSelected.length;if(!n){var r=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0,i=0;o>1&&(i=r?1:-1);var a=e>this.stackOfSelected[o-1]&&1===i,s=ethis.stackOfSelected[o-1]||void 0===this.stackOfSelected[o-1])){if(!l&&e=e;c--)this.addBlockInSelection(c);else if(l){var u,f=o-1;for(u=e>this.stackOfSelected[o-1]?function(){return e>t.stackOfSelected[f]}:function(){return e0&&void 0!==arguments[0]?arguments[0]:this.Editor.BlockManager.currentBlock;this.opened=!0,this.selection.save(),t.selected=!0,this.Editor.BlockSelection.clearCache();var n=t.getTunes(),o=(0,r.default)(n,2),i=o[0],a=o[1];this.eventsDispatcher.emit(this.events.opened),this.popover=new h.default({className:this.CSS.settings,searchable:!0,filterLabel:v.default.ui(y.I18nInternalNS.ui.popover,"Filter"),nothingFoundLabel:v.default.ui(y.I18nInternalNS.ui.popover,"Nothing found"),items:i,customContent:a,customContentFlippableItems:this.getControls(a),scopeElement:this.Editor.API.methods.ui.nodes.redactor}),this.popover.on(h.PopoverEvent.OverlayClicked,this.onOverlayClicked),this.popover.on(h.PopoverEvent.Close,(function(){return e.close()})),this.nodes.wrapper.append(this.popover.getElement()),this.popover.show()}},{key:"getElement",value:function(){return this.nodes.wrapper}},{key:"close",value:function(){this.opened=!1,p.default.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&(this.Editor.BlockManager.currentBlock.selected=!1),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(h.PopoverEvent.OverlayClicked,this.onOverlayClicked),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null)}},{key:"getControls",value:function(e){var t=this.Editor.StylesAPI,n=e.querySelectorAll(".".concat(t.classes.settingsButton,", ").concat(d.default.allInputsSelector));return Array.from(n)}}]),n}(f.default);o.default=k,k.displayName="BlockSettings",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(30),n(21),n(40),n(2),n(3),n(5),n(6),n(4),n(9),n(19),n(8),n(66),n(53),n(67),n(65)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h,v,y,g,b,m,k){"use strict";var x=n(1);function w(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(w=function(e){return e?n:t})(e)}function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,p.default)(e);if(t){var r=(0,p.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,d.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=x(r),i=x(i),s=x(s),l=x(l),c=x(c),u=x(u),f=x(f),d=x(d),p=x(p),h=x(h),v=x(v),y=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=w(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(y),g=x(g),b=x(b);var C=function(e){(0,f.default)(a,e);var t,n,o=S(a);function a(){var e;return(0,c.default)(this,a),(e=o.apply(this,arguments)).opened=!1,e.tools=[],e.flipper=null,e.togglingCallback=null,e}return(0,u.default)(a,[{key:"make",value:function(){this.nodes.wrapper=v.default.make("div",[a.CSS.conversionToolbarWrapper].concat((0,l.default)(this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]))),this.nodes.tools=v.default.make("div",a.CSS.conversionToolbarTools);var e=v.default.make("div",a.CSS.conversionToolbarLabel,{textContent:b.default.ui(m.I18nInternalNS.ui.inlineToolbar.converter,"Convert to")});return this.addTools(),this.enableFlipper(),v.default.append(this.nodes.wrapper,e),v.default.append(this.nodes.wrapper,this.nodes.tools),this.nodes.wrapper}},{key:"destroy",value:function(){this.flipper&&(this.flipper.deactivate(),this.flipper=null),this.removeAllNodes()}},{key:"toggle",value:function(e){this.opened?this.close():this.open(),y.isFunction(e)&&(this.togglingCallback=e)}},{key:"open",value:function(){var e=this;this.filterTools(),this.opened=!0,this.nodes.wrapper.classList.add(a.CSS.conversionToolbarShowed),window.requestAnimationFrame((function(){e.flipper.activate(e.tools.map((function(e){return e.button})).filter((function(e){return!e.classList.contains(a.CSS.conversionToolHidden)}))),e.flipper.focusFirst(),y.isFunction(e.togglingCallback)&&e.togglingCallback(!0)}))}},{key:"close",value:function(){this.opened=!1,this.flipper.deactivate(),this.nodes.wrapper.classList.remove(a.CSS.conversionToolbarShowed),y.isFunction(this.togglingCallback)&&this.togglingCallback(!1)}},{key:"hasTools",value:function(){return 1!==this.tools.length||this.tools[0].name!==this.config.defaultBlock}},{key:"replaceWithBlock",value:(n=(0,s.default)(r.default.mark((function e(t,n){var o,i,a,s,l,c,u,f,d,p=this;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.Editor.BlockManager.currentBlock.tool,e.next=3,this.Editor.BlockManager.currentBlock.save();case 3:if(i=e.sent,a=i.data,s=this.Editor.Tools.blockTools.get(t),l="",c=o.conversionConfig.export,!y.isFunction(c)){e.next=12;break}l=c(a),e.next=18;break;case 12:if(!y.isString(c)){e.next=16;break}l=a[c],e.next=18;break;case 16:return y.log("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),e.abrupt("return");case 18:if(u=(0,k.clean)(l,s.sanitizeConfig),f={},d=s.conversionConfig.import,!y.isFunction(d)){e.next=25;break}f=d(u),e.next=31;break;case 25:if(!y.isString(d)){e.next=29;break}f[d]=u,e.next=31;break;case 29:return y.log("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),e.abrupt("return");case 31:n&&(f=Object.assign(f,n)),this.Editor.BlockManager.replace({tool:t,data:f}),this.Editor.BlockSelection.clearSelection(),this.close(),this.Editor.InlineToolbar.close(),y.delay((function(){p.Editor.Caret.setToBlock(p.Editor.BlockManager.currentBlock)}),10)();case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"addTools",value:function(){var e=this,t=this.Editor.Tools.blockTools;Array.from(t.entries()).forEach((function(t){var n=(0,i.default)(t,2),o=n[0],r=n[1],a=r.conversionConfig;a&&a.import&&r.toolbox.forEach((function(t){return e.addToolIfValid(o,t)}))}))}},{key:"addToolIfValid",value:function(e,t){!y.isEmpty(t)&&t.icon&&this.addTool(e,t)}},{key:"addTool",value:function(e,t){var n=this,o=v.default.make("div",[a.CSS.conversionTool]),i=v.default.make("div",[a.CSS.conversionToolIcon]),l=v.default.make("div",[a.CSS.conversionToolCheckIcon]);switch(o.dataset.tool=e,e){case"paragraph":i.innerHTML='\n \n ';break;case"header1":i.innerHTML='';break;case"header2":i.innerHTML='';break;case"header3":i.innerHTML='';break;case"unorderedList":i.innerHTML='';break;case"orderedList":i.innerHTML='';break;case"blockChecklist":i.innerHTML='';break;default:i.innerHTML=t.icon}l.innerHTML='',v.default.append(o,i),v.default.append(o,v.default.text(b.default.t(m.I18nInternalNS.toolNames,t.title||y.capitalize(e)))),v.default.append(o,l),v.default.append(this.nodes.tools,o),this.tools.push({name:e,button:o,toolboxItem:t}),this.listeners.on(o,"click",(0,s.default)(r.default.mark((function o(){return r.default.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,n.replaceWithBlock(e,t.data);case 2:case"end":return o.stop()}}),o)}))))}},{key:"filterTools",value:(t=(0,s.default)(r.default.mark((function e(){var t,n,o;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(e,t){return e.icon===t.icon&&e.title===t.title},t=this.Editor.BlockManager.currentBlock,e.next=4,t.getActiveToolboxEntry();case 4:n=e.sent,this.tools.forEach((function(e){var r=!1;if(n){var i=o(n,e.toolboxItem);r=e.button.dataset.tool===t.name&&i}e.button.classList.toggle(a.CSS.conversionToolCurrent,r)}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"enableFlipper",value:function(){this.flipper=new g.default({focusedItemClass:a.CSS.conversionToolFocused})}}],[{key:"CSS",get:function(){return{conversionToolbarWrapper:"ce-conversion-toolbar",conversionToolbarShowed:"ce-conversion-toolbar--showed",conversionToolbarTools:"ce-conversion-toolbar__tools",conversionToolbarLabel:"ce-conversion-toolbar__label",conversionTool:"ce-conversion-tool",conversionToolCurrent:"ce-conversion-tool--current",conversionToolIcon:"ce-conversion-tool__icon",conversionToolCheckIcon:"ce-conversion-tool__check-icon",conversionToolFocused:"ce-conversion-tool--focused",conversionToolActive:"ce-conversion-tool--active"}}}]),a}(h.default);o.default=C,C.displayName="ConversionToolbar",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(21),n(40),n(30),n(2),n(3),n(5),n(6),n(4),n(9),n(19),n(25),n(8),n(66),n(53),n(67),n(114),n(113),n(68)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h,v,y,g,b,m,k,x,w,S){"use strict";var C=n(1);function T(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(T=function(e){return e?n:t})(e)}function E(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,p.default)(e);if(t){var r=(0,p.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,d.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=C(r),i=C(i),s=C(s),l=C(l),c=C(c),u=C(u),f=C(f),d=C(d),p=C(p),h=C(h),v=C(v),y=C(y),g=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=T(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(g),b=C(b),m=C(m),x=C(x),w=C(w);var _=function(e){(0,f.default)(o,e);var t,n=E(o);function o(e){var t,r=e.config,i=e.eventsDispatcher;return(0,c.default)(this,o),(t=n.call(this,{config:r,eventsDispatcher:i})).CSS={inlineToolbar:"ce-inline-toolbar",inlineToolbarShowed:"ce-inline-toolbar--showed",inlineToolbarLeftOriented:"ce-inline-toolbar--left-oriented",inlineToolbarRightOriented:"ce-inline-toolbar--right-oriented",inlineToolbarShortcut:"ce-inline-toolbar__shortcut",buttonsWrapper:"ce-inline-toolbar__buttons",actionsWrapper:"ce-inline-toolbar__actions",inlineToolButton:"ce-inline-tool",inputField:"cdx-input",focusedButton:"ce-inline-tool--focused",conversionToggler:"ce-inline-toolbar__dropdown",conversionTogglerArrow:"ce-inline-toolbar__dropdown-arrow",conversionTogglerHidden:"ce-inline-toolbar__dropdown--hidden",conversionTogglerContent:"ce-inline-toolbar__dropdown-content",togglerAndButtonsWrapper:"ce-inline-toolbar__toggler-and-button-wrapper"},t.opened=!1,t.toolbarVerticalMargin=g.isMobileScreen()?20:6,t.buttonsList=null,t.width=0,t.flipper=null,t.tooltip=new w.default,t}return(0,u.default)(o,[{key:"toggleReadOnly",value:function(e){e?(this.destroy(),this.Editor.ConversionToolbar.destroy()):this.make()}},{key:"tryToShow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.allowedToShow()?(this.move(),this.open(t),this.Editor.Toolbar.close()):e&&this.close()}},{key:"move",value:function(){var e=y.default.rect,t=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),n={x:e.x-t.left+145,y:e.y-t.top-40},o=document.getElementsByClassName("ce-inline-toolbar")[0].clientWidth,r=document.getElementsByClassName("ce-block__content")[0].getBoundingClientRect();r.width<650&&t.right-e.x=650&&r.right-e.x0&&void 0!==arguments[0])||arguments[0];if(!this.opened){this.addToolsFiltered(),this.nodes.wrapper.classList.add(this.CSS.inlineToolbarShowed),this.buttonsList=this.nodes.buttons.querySelectorAll(".".concat(this.CSS.inlineToolButton)),this.opened=!0,e&&this.Editor.ConversionToolbar.hasTools()?this.setConversionTogglerContent():this.nodes.conversionToggler.hidden=!0;var t=Array.from(this.buttonsList);t.unshift(this.nodes.conversionToggler),t=t.filter((function(e){return!e.hidden})),this.flipper.activate(t)}}},{key:"containsNode",value:function(e){return this.nodes.wrapper.contains(e)}},{key:"destroy",value:function(){this.flipper&&(this.flipper.deactivate(),this.flipper=null),this.removeAllNodes(),this.tooltip.destroy()}},{key:"make",value:function(){var e=this;this.nodes.wrapper=v.default.make("div",[this.CSS.inlineToolbar].concat((0,s.default)(this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]))),this.nodes.togglerAndButtonsWrapper=v.default.make("div",this.CSS.togglerAndButtonsWrapper),this.nodes.buttons=v.default.make("div",this.CSS.buttonsWrapper),this.nodes.actions=v.default.make("div",this.CSS.actionsWrapper),this.listeners.on(this.nodes.wrapper,"mousedown",(function(t){t.target.closest(".".concat(e.CSS.actionsWrapper))||t.preventDefault()})),v.default.append(this.nodes.wrapper,[this.nodes.togglerAndButtonsWrapper,this.nodes.actions]),v.default.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper),this.addConversionToggler(),v.default.append(this.nodes.togglerAndButtonsWrapper,this.nodes.buttons),this.prepareConversionToolbar(),this.recalculateWidth(),this.enableFlipper()}},{key:"allowedToShow",value:function(){var e=y.default.get(),t=y.default.text;if(!e||!e.anchorNode)return!1;if(e.isCollapsed||t.length<1)return!1;var n=v.default.isElement(e.anchorNode)?e.anchorNode:e.anchorNode.parentElement;if(e&&["IMG","INPUT"].includes(n.tagName))return!1;if(null===n.closest('[contenteditable="true"]'))return!1;var o=this.Editor.BlockManager.getBlock(e.anchorNode);return!!o&&0!==o.tool.inlineTools.size}},{key:"recalculateWidth",value:function(){this.width=this.nodes.wrapper.offsetWidth}},{key:"addConversionToggler",value:function(){var e=this;this.nodes.conversionToggler=v.default.make("div",this.CSS.conversionToggler),this.nodes.conversionTogglerContent=v.default.make("div",this.CSS.conversionTogglerContent);var t=v.default.make("div",this.CSS.conversionTogglerArrow,{innerHTML:'\n\n'});this.nodes.conversionToggler.appendChild(this.nodes.conversionTogglerContent),this.nodes.conversionToggler.appendChild(t),this.nodes.togglerAndButtonsWrapper.appendChild(this.nodes.conversionToggler),this.listeners.on(this.nodes.conversionToggler,"click",(function(){e.Editor.ConversionToolbar.toggle((function(t){!t&&e.opened?e.flipper.activate():e.opened&&e.flipper.deactivate()}))})),!1===g.isMobileScreen()&&this.tooltip.onHover(this.nodes.conversionToggler,m.default.ui(k.I18nInternalNS.ui.inlineToolbar.converter,"Convert to"),{placement:"top",hidingDelay:100})}},{key:"setConversionTogglerContent",value:(t=(0,i.default)(r.default.mark((function e(){var t,n,o,i,a,s;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.Editor.BlockManager,n=t.currentBlock,o=n.name,i=n.tool.conversionConfig,a=i&&i.export,this.nodes.conversionToggler.hidden=!a,this.nodes.conversionToggler.classList.toggle(this.CSS.conversionTogglerHidden,!a),e.next=9,n.getActiveToolboxEntry();case 9:if(e.t0=e.sent,e.t0){e.next=12;break}e.t0={};case 12:s=e.t0,this.nodes.conversionTogglerContent.innerHTML=s.icon||s.title||g.capitalize(o);case 14:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"prepareConversionToolbar",value:function(){var e=this.Editor.ConversionToolbar.make();v.default.append(this.nodes.wrapper,e)}},{key:"addToolsFiltered",value:function(){var e=this,t=y.default.get(),n=this.Editor.BlockManager.getBlock(t.anchorNode);this.nodes.buttons.innerHTML="",this.nodes.actions.innerHTML="",this.toolsInstances=new Map,Array.from(n.tool.inlineTools.values()).forEach((function(t){e.addTool(t)})),this.recalculateWidth()}},{key:"addTool",value:function(e){var t=this,n=e.create(),o=n.render();if(o){if(o.dataset.tool=e.name,this.nodes.buttons.appendChild(o),this.toolsInstances.set(e.name,n),g.isFunction(n.renderActions)){var r=n.renderActions();this.nodes.actions.appendChild(r)}this.listeners.on(o,"click",(function(e){t.toolClicked(n),e.preventDefault()}));var i=this.getToolShortcut(e.name);if(i)try{this.enableShortcuts(n,i)}catch(e){}var a=v.default.make("div"),s=m.default.t(k.I18nInternalNS.toolNames,e.title||g.capitalize(e.name));a.appendChild(v.default.text(s)),i&&a.appendChild(v.default.make("div",this.CSS.inlineToolbarShortcut,{textContent:g.beautifyShortcut(i)})),!1===g.isMobileScreen()&&this.tooltip.onHover(o,a,{placement:"top",hidingDelay:100}),n.checkState(y.default.get())}else g.log("Render method must return an instance of Node","warn",e.name)}},{key:"getToolShortcut",value:function(e){var t=this.Editor.Tools,n=t.inlineTools.get(e),o=t.internal.inlineTools;return Array.from(o.keys()).includes(e)?this.inlineTools[e][S.CommonInternalSettings.Shortcut]:n.shortcut}},{key:"enableShortcuts",value:function(e,t){var n=this;x.default.add({name:t,handler:function(t){var o=n.Editor.BlockManager.currentBlock;o&&o.tool.enabledInlineTools&&(t.preventDefault(),n.toolClicked(e))},on:this.Editor.UI.nodes.redactor})}},{key:"toolClicked",value:function(e){var t=y.default.range;e.surround(t),this.checkToolsState(),void 0!==e.renderActions&&this.flipper.deactivate()}},{key:"checkToolsState",value:function(){this.toolsInstances.forEach((function(e){e.checkState(y.default.get())}))}},{key:"inlineTools",get:function(){var e={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach((function(t){var n=(0,l.default)(t,2),o=n[0],r=n[1];e[o]=r.create()})),e}},{key:"enableFlipper",value:function(){this.flipper=new b.default({focusedItemClass:this.CSS.focusedButton,allowedKeys:[g.keyCodes.ENTER,g.keyCodes.TAB]})}}]),o}(h.default);o.default=_,_.displayName="InlineToolbar",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(40),n(30),n(21),n(2),n(3),n(5),n(6),n(4),n(7),n(387),n(9),n(8),n(388),n(389),n(390),n(391),n(392),n(396),n(397),n(398),n(184)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h,v,y,g,b,m,k,x,w,S,C,T,E){"use strict";var _=n(1);function B(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(B=function(e){return e?n:t})(e)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,p.default)(e);if(t){var r=(0,p.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,d.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=_(r),i=_(i),s=_(s),l=_(l),c=_(c),u=_(u),f=_(f),d=_(d),p=_(p),h=_(h),v=_(v),y=_(y),g=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=B(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(g),b=_(b),m=_(m),k=_(k),x=_(x),w=_(w),S=_(S),C=_(C),T=_(T),E=_(E);var M=function(e,t,n,o){var r,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"===("undefined"==typeof Reflect?"undefined":(0,h.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},I=function(e){(0,f.default)(o,e);var t,n=O(o);function o(){var e;return(0,c.default)(this,o),(e=n.apply(this,arguments)).stubTool="stub",e.toolsAvailable=new E.default,e.toolsUnavailable=new E.default,e}return(0,u.default)(o,[{key:"available",get:function(){return this.toolsAvailable}},{key:"unavailable",get:function(){return this.toolsUnavailable}},{key:"inlineTools",get:function(){return this.available.inlineTools}},{key:"blockTools",get:function(){return this.available.blockTools}},{key:"blockTunes",get:function(){return this.available.blockTunes}},{key:"defaultTool",get:function(){return this.blockTools.get(this.config.defaultBlock)}},{key:"internal",get:function(){return this.available.internalTools}},{key:"prepare",value:(t=(0,l.default)(r.default.mark((function e(){var t,n,o=this;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.validateTools(),this.config.tools=g.deepMerge({},this.internalTools,this.config.tools),Object.prototype.hasOwnProperty.call(this.config,"tools")&&0!==Object.keys(this.config.tools).length){e.next=4;break}throw Error("Can't start without tools");case 4:if(t=this.prepareConfig(),this.factory=new w.default(t,this.config,this.Editor.API),0!==(n=this.getListOfPrepareFunctions(t)).length){e.next=9;break}return e.abrupt("return",Promise.resolve());case 9:return e.next=11,g.sequence(n,(function(e){o.toolPrepareMethodSuccess(e)}),(function(e){o.toolPrepareMethodFallback(e)}));case 11:this.prepareBlockTools();case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getAllInlineToolsSanitizeConfig",value:function(){var e={};return Array.from(this.inlineTools.values()).forEach((function(t){Object.assign(e,t.sanitizeConfig)})),e}},{key:"destroy",value:function(){Object.values(this.available).forEach(function(){var e=(0,l.default)(r.default.mark((function e(t){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!g.isFunction(t.reset)){e.next=3;break}return e.next=3,t.reset();case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}},{key:"internalTools",get:function(){return{bold:{class:b.default,isInternal:!0},italic:{class:m.default,isInternal:!0},link:{class:k.default,isInternal:!0},paragraph:{class:v.default,inlineToolbar:!0,isInternal:!0},stub:{class:x.default,isInternal:!0},moveUp:{class:T.default,isInternal:!0},moveDown:{class:S.default,isInternal:!0},delete:{class:C.default,isInternal:!0}}}},{key:"toolPrepareMethodSuccess",value:function(e){var t=this.factory.get(e.toolName);if(t.isInline()){var n=["render","surround","checkState"].filter((function(e){return!t.create()[e]}));if(n.length)return g.log("Incorrect Inline Tool: ".concat(t.name,". Some of required methods is not implemented %o"),"warn",n),void this.toolsUnavailable.set(t.name,t)}this.toolsAvailable.set(t.name,t)}},{key:"toolPrepareMethodFallback",value:function(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}},{key:"getListOfPrepareFunctions",value:function(e){var t=[];return Object.entries(e).forEach((function(e){var n=(0,s.default)(e,2),o=n[0],r=n[1];t.push({function:g.isFunction(r.class.prepare)?r.class.prepare:function(){},data:{toolName:o,config:r.config}})})),t}},{key:"prepareBlockTools",value:function(){var e=this;Array.from(this.blockTools.values()).forEach((function(t){e.assignInlineToolsToBlockTool(t),e.assignBlockTunesToBlockTool(t)}))}},{key:"assignInlineToolsToBlockTool",value:function(e){var t=this;!1!==this.config.inlineToolbar&&(!0!==e.enabledInlineTools?Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new E.default(e.enabledInlineTools.map((function(e){return[e,t.inlineTools.get(e)]})))):e.inlineTools=new E.default(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map((function(e){return[e,t.inlineTools.get(e)]})):Array.from(this.inlineTools.entries())))}},{key:"assignBlockTunesToBlockTool",value:function(e){var t=this;if(!1!==e.enabledBlockTunes)if(Array.isArray(e.enabledBlockTunes)){var n=new E.default(e.enabledBlockTunes.map((function(e){return[e,t.blockTunes.get(e)]})));e.tunes=new E.default([].concat((0,i.default)(n),(0,i.default)(this.blockTunes.internalTools)))}else if(Array.isArray(this.config.tunes)){var o=new E.default(this.config.tunes.map((function(e){return[e,t.blockTunes.get(e)]})));e.tunes=new E.default([].concat((0,i.default)(o),(0,i.default)(this.blockTunes.internalTools)))}else e.tunes=this.blockTunes.internalTools}},{key:"validateTools",value:function(){for(var e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;var t=this.config.tools[e];if(!g.isFunction(t)&&!g.isFunction(t.class))throw Error("Tool «".concat(e,"» must be a constructor function or an object with function in the «class» property"))}}},{key:"prepareConfig",value:function(){var e={};for(var t in this.config.tools)g.isObject(this.config.tools[t])?e[t]=this.config.tools[t]:e[t]={class:this.config.tools[t]};return e}}]),o}(y.default);o.default=I,I.displayName="Tools",M([g.cacheable],I.prototype,"getAllInlineToolsSanitizeConfig",null),e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(30),n(2),n(3),n(5),n(6),n(4),n(151)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c,u){"use strict";var f=n(1);function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,l.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=f(r),i=f(i),a=f(a),s=f(s),l=f(l),c=f(c);var p=function(e){(0,s.default)(n,e);var t=d(n);function n(){return(0,i.default)(this,n),t.apply(this,arguments)}return(0,a.default)(n,[{key:"blockTools",get:function(){return new n(Array.from(this.entries()).filter((function(e){return(0,r.default)(e,2)[1].isBlock()})))}},{key:"inlineTools",get:function(){return new n(Array.from(this.entries()).filter((function(e){return(0,r.default)(e,2)[1].isInline()})))}},{key:"blockTunes",get:function(){return new n(Array.from(this.entries()).filter((function(e){return(0,r.default)(e,2)[1].isTune()})))}},{key:"internalTools",get:function(){return new n(Array.from(this.entries()).filter((function(e){return(0,r.default)(e,2)[1].isInternal})))}},{key:"externalTools",get:function(){return new n(Array.from(this.entries()).filter((function(e){return!(0,r.default)(e,2)[1].isInternal})))}}]),n}((0,(u=f(u)).default)(Map));o.default=p,p.displayName="ToolsCollection",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(40),n(30),n(21),n(2),n(3),n(5),n(6),n(4),n(9),n(19),n(8),n(25),n(60),n(66)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p,h,v,y,g,b,m){"use strict";var k=n(1);function x(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(x=function(e){return e?n:t})(e)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=(0,p.default)(e);if(t){var r=(0,p.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,d.default)(this,n)}}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=k(r),i=k(i),s=k(s),l=k(l),c=k(c),u=k(u),f=k(f),d=k(d),p=k(p),h=k(h),v=k(v),y=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=x(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(y),g=k(g),b=k(b),m=k(m);var S=function(e){(0,f.default)(a,e);var t,o=w(a);function a(){var e;return(0,c.default)(this,a),(e=o.apply(this,arguments)).isMobile=!1,e.contentRectCache=void 0,e.resizeDebouncer=y.debounce((function(){e.windowResize()}),200),e}return(0,u.default)(a,[{key:"events",get:function(){return{blockHovered:"block-hovered"}}},{key:"CSS",get:function(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorLoader:"codex-editor__loader",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}},{key:"contentRect",get:function(){if(this.contentRectCache)return this.contentRectCache;var e=this.nodes.wrapper.querySelector(".".concat(b.default.CSS.content));return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}},{key:"addLoader",value:function(){this.nodes.loader=v.default.make("div",this.CSS.editorLoader),this.nodes.wrapper.prepend(this.nodes.loader),this.nodes.redactor.classList.add(this.CSS.editorZoneHidden)}},{key:"removeLoader",value:function(){this.nodes.loader.remove(),this.nodes.redactor.classList.remove(this.CSS.editorZoneHidden)}},{key:"prepare",value:(t=(0,l.default)(r.default.mark((function e(){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.checkIsMobile(),this.make(),this.addLoader(),this.loadStyles();case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"toggleReadOnly",value:function(e){e?this.disableModuleBindings():this.enableModuleBindings()}},{key:"checkEmptiness",value:function(){var e=this.Editor.BlockManager;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}},{key:"someToolbarOpened",get:function(){var e=this.Editor,t=e.Toolbar,n=e.BlockSettings,o=e.InlineToolbar,r=e.ConversionToolbar;return n.opened||o.opened||r.opened||t.toolbox.opened}},{key:"someFlipperButtonFocused",get:function(){return!!this.Editor.Toolbar.toolbox.hasFocus()||Object.entries(this.Editor).filter((function(e){var t=(0,s.default)(e,2);return t[0],t[1].flipper instanceof m.default})).some((function(e){var t=(0,s.default)(e,2);return t[0],t[1].flipper.hasFocus()}))}},{key:"destroy",value:function(){this.nodes.holder.innerHTML=""}},{key:"closeAllToolbars",value:function(){var e=this.Editor,t=e.Toolbar,n=e.BlockSettings,o=e.InlineToolbar,r=e.ConversionToolbar;n.close(),o.close(),r.close(),t.toolbox.close()}},{key:"checkIsMobile",value:function(){this.isMobile=window.innerWidth=0;if(o.anyBlockSelected&&!g.default.isSelectionExists)return o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),void e.stopPropagation();if(!this.someToolbarOpened&&r&&"BODY"===e.target.tagName){var i=this.Editor.BlockManager.insert();this.Editor.Caret.setToBlock(i),this.Editor.BlockManager.highlightCurrentNode(),this.Editor.Toolbar.moveAndOpen(i)}this.Editor.BlockSelection.clearSelection(e)}},{key:"documentClicked",value:function(e){if(e.isTrusted){var t=e.target;this.nodes.holder.contains(t)||g.default.isAtEditor||(this.Editor.BlockManager.dropPointer(),this.Editor.Toolbar.close());var n=this.Editor.BlockSettings.nodes.wrapper.contains(t),o=this.Editor.Toolbar.nodes.settingsToggler.contains(t),r=n||o;if(this.Editor.BlockSettings.opened&&!r){this.Editor.BlockSettings.close();var i=this.Editor.BlockManager.getBlockByChildNode(t);this.Editor.Toolbar.moveAndOpen(i)}this.Editor.BlockSelection.clearSelection(e)}}},{key:"documentTouched",value:function(e){var t=e.target;if(t===this.nodes.redactor){var n=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,o=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;t=document.elementFromPoint(n,o)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(t),this.Editor.BlockManager.highlightCurrentNode()}catch(e){this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.Toolbar.moveAndOpen()}},{key:"redactorClicked",value:function(e){var t=this.Editor.BlockSelection;if(g.default.isCollapsed){var n=function(){e.stopImmediatePropagation(),e.stopPropagation()},o=e.target,r=e.metaKey||e.ctrlKey;if(v.default.isAnchor(o)&&r){n();var i=o.getAttribute("href"),a=y.getValidUrl(i);y.openTab(a)}else{var s=this.Editor.BlockManager.getBlockByIndex(-1),l=v.default.offset(s.holder).bottom,c=e.pageY;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!t.anyBlockSelected&&lr;)K(e,n=o[r++],t[n]);return e},J=function(e){var t=D.call(this,e=w(e,!0));return!(this===U&&r(H,e)&&!r(W,e))&&(!(t||!r(this,e)||!r(H,e)||r(this,j)&&this[j][e])||t)},$=function(e,t){if(e=x(e),t=w(t,!0),e!==U||!r(H,t)||r(W,t)){var n=M(e,t);return!n||!r(H,t)||r(e,j)&&e[j][t]||(n.enumerable=!0),n}},Q=function(e){for(var t,n=P(x(e)),o=[],i=0;n.length>i;)r(H,t=n[i++])||t==j||t==l||o.push(t);return o},ee=function(e){for(var t,n=e===U,o=P(n?W:x(e)),i=[],a=0;o.length>a;)!r(H,t=o[a++])||n&&!r(U,t)||i.push(H[t]);return i};z||(s((L=function(){if(this instanceof L)throw TypeError("Symbol is not a constructor!");var e=d(arguments.length>0?arguments[0]:void 0),t=function(n){this===U&&t.call(W,n),r(this,j)&&r(this[j],e)&&(this[j][e]=!1),X(this,e,S(1,n))};return i&&Y&&X(U,e,{configurable:!0,set:t}),Z(e)}).prototype,"toString",(function(){return this._k})),E.f=$,B.f=K,n(49).f=T.f=Q,n(62).f=J,_.f=ee,i&&!n(45)&&s(U,"propertyIsEnumerable",J,!0),h.f=function(e){return Z(p(e))}),a(a.G+a.W+a.F*!z,{Symbol:L});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)p(te[ne++]);for(var oe=O(p.store),re=0;oe.length>re;)v(oe[re++]);a(a.S+a.F*!z,"Symbol",{for:function(e){return r(F,e+="")?F[e]:F[e]=L(e)},keyFor:function(e){if(!G(e))throw TypeError(e+" is not a symbol!");for(var t in F)if(F[t]===e)return t},useSetter:function(){Y=!0},useSimple:function(){Y=!1}}),a(a.S+a.F*!z,"Object",{create:function(e,t){return void 0===t?C(e):q(C(e),t)},defineProperty:K,defineProperties:q,getOwnPropertyDescriptor:$,getOwnPropertyNames:Q,getOwnPropertySymbols:ee});var ie=c((function(){_.f(1)}));a(a.S+a.F*ie,"Object",{getOwnPropertySymbols:function(e){return _.f(k(e))}}),R&&a(a.S+a.F*(!z||c((function(){var e=L();return"[null]"!=A([e])||"{}"!=A({a:e})||"{}"!=A(Object(e))}))),"JSON",{stringify:function(e){for(var t,n,o=[e],r=1;arguments.length>r;)o.push(arguments[r++]);if(n=t=o[1],(m(t)||void 0!==e)&&!G(e))return g(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!G(t))return t}),o[1]=t,A.apply(R,o)}}),L.prototype[N]||n(27)(L.prototype,N,L.prototype.valueOf),f(L,"Symbol"),f(Math,"Math",!0),f(o.JSON,"JSON",!0)},function(e,t,n){e.exports=n(69)("native-function-to-string",Function.toString)},function(e,t,n){var o=n(46),r=n(71),i=n(62);e.exports=function(e){var t=o(e),n=r.f;if(n)for(var a,s=n(e),l=i.f,c=0;s.length>c;)l.call(e,a=s[c++])&&t.push(a);return t}},function(e,t,n){var o=n(0);o(o.S,"Object",{create:n(48)})},function(e,t,n){var o=n(0);o(o.S+o.F*!n(17),"Object",{defineProperty:n(18).f})},function(e,t,n){var o=n(0);o(o.S+o.F*!n(17),"Object",{defineProperties:n(118)})},function(e,t,n){var o=n(28),r=n(34).f;n(35)("getOwnPropertyDescriptor",(function(){return function(e,t){return r(o(e),t)}}))},function(e,t,n){var o=n(22),r=n(50);n(35)("getPrototypeOf",(function(){return function(e){return r(o(e))}}))},function(e,t,n){var o=n(22),r=n(46);n(35)("keys",(function(){return function(e){return r(o(e))}}))},function(e,t,n){n(35)("getOwnPropertyNames",(function(){return n(119).f}))},function(e,t,n){var o=n(13),r=n(42).onFreeze;n(35)("freeze",(function(e){return function(t){return e&&o(t)?e(r(t)):t}}))},function(e,t,n){var o=n(13),r=n(42).onFreeze;n(35)("seal",(function(e){return function(t){return e&&o(t)?e(r(t)):t}}))},function(e,t,n){var o=n(13),r=n(42).onFreeze;n(35)("preventExtensions",(function(e){return function(t){return e&&o(t)?e(r(t)):t}}))},function(e,t,n){var o=n(13);n(35)("isFrozen",(function(e){return function(t){return!o(t)||!!e&&e(t)}}))},function(e,t,n){var o=n(13);n(35)("isSealed",(function(e){return function(t){return!o(t)||!!e&&e(t)}}))},function(e,t,n){var o=n(13);n(35)("isExtensible",(function(e){return function(t){return!!o(t)&&(!e||e(t))}}))},function(e,t,n){var o=n(0);o(o.S+o.F,"Object",{assign:n(120)})},function(e,t,n){var o=n(0);o(o.S,"Object",{is:n(121)})},function(e,t,n){var o=n(0);o(o.S,"Object",{setPrototypeOf:n(90).set})},function(e,t,n){"use strict";var o=n(63),r={};r[n(14)("toStringTag")]="z",r+""!="[object z]"&&n(23)(Object.prototype,"toString",(function(){return"[object "+o(this)+"]"}),!0)},function(e,t,n){var o=n(0);o(o.P,"Function",{bind:n(122)})},function(e,t,n){var o=n(18).f,r=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in r||n(17)&&o(r,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var o=n(13),r=n(50),i=n(14)("hasInstance"),a=Function.prototype;i in a||n(18).f(a,i,{value:function(e){if("function"!=typeof this||!o(e))return!1;if(!o(this.prototype))return e instanceof this;for(;e=r(e);)if(this.prototype===e)return!0;return!1}})},function(e,t,n){var o=n(0),r=n(124);o(o.G+o.F*(parseInt!=r),{parseInt:r})},function(e,t,n){var o=n(0),r=n(125);o(o.G+o.F*(parseFloat!=r),{parseFloat:r})},function(e,t,n){"use strict";var o=n(10),r=n(26),i=n(37),a=n(92),s=n(41),l=n(11),c=n(49).f,u=n(34).f,f=n(18).f,d=n(55).trim,p=o.Number,h=p,v=p.prototype,y="Number"==i(n(48)(v)),g="trim"in String.prototype,b=function(e){var t=s(e,!1);if("string"==typeof t&&t.length>2){var n,o,r,i=(t=g?t.trim():d(t,3)).charCodeAt(0);if(43===i||45===i){if(88===(n=t.charCodeAt(2))||120===n)return NaN}else if(48===i){switch(t.charCodeAt(1)){case 66:case 98:o=2,r=49;break;case 79:case 111:o=8,r=55;break;default:return+t}for(var a,l=t.slice(2),c=0,u=l.length;cr)return NaN;return parseInt(l,o)}}return+t};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof p&&(y?l((function(){v.valueOf.call(n)})):"Number"!=i(n))?a(new h(b(t)),n,p):b(t)};for(var m,k=n(17)?c(h):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;k.length>x;x++)r(h,m=k[x])&&!r(p,m)&&f(p,m,u(h,m));p.prototype=v,v.constructor=p,n(23)(o,"Number",p)}},function(e,t,n){"use strict";var o=n(0),r=n(33),i=n(126),a=n(93),s=1..toFixed,l=Math.floor,c=[0,0,0,0,0,0],u="Number.toFixed: incorrect invocation!",f=function(e,t){for(var n=-1,o=t;++n<6;)o+=e*c[n],c[n]=o%1e7,o=l(o/1e7)},d=function(e){for(var t=6,n=0;--t>=0;)n+=c[t],c[t]=l(n/e),n=n%e*1e7},p=function(){for(var e=6,t="";--e>=0;)if(""!==t||0===e||0!==c[e]){var n=String(c[e]);t=""===t?n:t+a.call("0",7-n.length)+n}return t},h=function(e,t,n){return 0===t?n:t%2==1?h(e,t-1,n*e):h(e*e,t/2,n)};o(o.P+o.F*(!!s&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!n(11)((function(){s.call({})}))),"Number",{toFixed:function(e){var t,n,o,s,l=i(this,u),c=r(e),v="",y="0";if(c<0||c>20)throw RangeError(u);if(l!=l)return"NaN";if(l<=-1e21||l>=1e21)return String(l);if(l<0&&(v="-",l=-l),l>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(l*h(2,69,1))-69)<0?l*h(2,-t,1):l/h(2,t,1),n*=4503599627370496,(t=52-t)>0){for(f(0,n),o=c;o>=7;)f(1e7,0),o-=7;for(f(h(10,o,1),0),o=t-1;o>=23;)d(1<<23),o-=23;d(1<0?v+((s=y.length)<=c?"0."+a.call("0",c-s)+y:y.slice(0,s-c)+"."+y.slice(s-c)):v+y}})},function(e,t,n){"use strict";var o=n(0),r=n(11),i=n(126),a=1..toPrecision;o(o.P+o.F*(r((function(){return"1"!==a.call(1,void 0)}))||!r((function(){a.call({})}))),"Number",{toPrecision:function(e){var t=i(this,"Number#toPrecision: incorrect invocation!");return void 0===e?a.call(t):a.call(t,e)}})},function(e,t,n){var o=n(0);o(o.S,"Number",{EPSILON:Math.pow(2,-52)})},function(e,t,n){var o=n(0),r=n(10).isFinite;o(o.S,"Number",{isFinite:function(e){return"number"==typeof e&&r(e)}})},function(e,t,n){var o=n(0);o(o.S,"Number",{isInteger:n(127)})},function(e,t,n){var o=n(0);o(o.S,"Number",{isNaN:function(e){return e!=e}})},function(e,t,n){var o=n(0),r=n(127),i=Math.abs;o(o.S,"Number",{isSafeInteger:function(e){return r(e)&&i(e)<=9007199254740991}})},function(e,t,n){var o=n(0);o(o.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(e,t,n){var o=n(0);o(o.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(e,t,n){var o=n(0),r=n(125);o(o.S+o.F*(Number.parseFloat!=r),"Number",{parseFloat:r})},function(e,t,n){var o=n(0),r=n(124);o(o.S+o.F*(Number.parseInt!=r),"Number",{parseInt:r})},function(e,t,n){var o=n(0),r=n(128),i=Math.sqrt,a=Math.acosh;o(o.S+o.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(e){return(e=+e)<1?NaN:e>94906265.62425156?Math.log(e)+Math.LN2:r(e-1+i(e-1)*i(e+1))}})},function(e,t,n){var o=n(0),r=Math.asinh;o(o.S+o.F*!(r&&1/r(0)>0),"Math",{asinh:function e(t){return isFinite(t=+t)&&0!=t?t<0?-e(-t):Math.log(t+Math.sqrt(t*t+1)):t}})},function(e,t,n){var o=n(0),r=Math.atanh;o(o.S+o.F*!(r&&1/r(-0)<0),"Math",{atanh:function(e){return 0==(e=+e)?e:Math.log((1+e)/(1-e))/2}})},function(e,t,n){var o=n(0),r=n(94);o(o.S,"Math",{cbrt:function(e){return r(e=+e)*Math.pow(Math.abs(e),1/3)}})},function(e,t,n){var o=n(0);o(o.S,"Math",{clz32:function(e){return(e>>>=0)?31-Math.floor(Math.log(e+.5)*Math.LOG2E):32}})},function(e,t,n){var o=n(0),r=Math.exp;o(o.S,"Math",{cosh:function(e){return(r(e=+e)+r(-e))/2}})},function(e,t,n){var o=n(0),r=n(95);o(o.S+o.F*(r!=Math.expm1),"Math",{expm1:r})},function(e,t,n){var o=n(0);o(o.S,"Math",{fround:n(235)})},function(e,t,n){var o=n(94),r=Math.pow,i=r(2,-52),a=r(2,-23),s=r(2,127)*(2-a),l=r(2,-126);e.exports=Math.fround||function(e){var t,n,r=Math.abs(e),c=o(e);return rs||n!=n?c*(1/0):c*n}},function(e,t,n){var o=n(0),r=Math.abs;o(o.S,"Math",{hypot:function(e,t){for(var n,o,i=0,a=0,s=arguments.length,l=0;a0?(o=n/l)*o:n;return l===1/0?1/0:l*Math.sqrt(i)}})},function(e,t,n){var o=n(0),r=Math.imul;o(o.S+o.F*n(11)((function(){return-5!=r(4294967295,5)||2!=r.length})),"Math",{imul:function(e,t){var n=+e,o=+t,r=65535&n,i=65535&o;return 0|r*i+((65535&n>>>16)*i+r*(65535&o>>>16)<<16>>>0)}})},function(e,t,n){var o=n(0);o(o.S,"Math",{log10:function(e){return Math.log(e)*Math.LOG10E}})},function(e,t,n){var o=n(0);o(o.S,"Math",{log1p:n(128)})},function(e,t,n){var o=n(0);o(o.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},function(e,t,n){var o=n(0);o(o.S,"Math",{sign:n(94)})},function(e,t,n){var o=n(0),r=n(95),i=Math.exp;o(o.S+o.F*n(11)((function(){return-2e-17!=!Math.sinh(-2e-17)})),"Math",{sinh:function(e){return Math.abs(e=+e)<1?(r(e)-r(-e))/2:(i(e-1)-i(-e-1))*(Math.E/2)}})},function(e,t,n){var o=n(0),r=n(95),i=Math.exp;o(o.S,"Math",{tanh:function(e){var t=r(e=+e),n=r(-e);return t==1/0?1:n==1/0?-1:(t-n)/(i(e)+i(-e))}})},function(e,t,n){var o=n(0);o(o.S,"Math",{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}})},function(e,t,n){var o=n(0),r=n(47),i=String.fromCharCode,a=String.fromCodePoint;o(o.S+o.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(e){for(var t,n=[],o=arguments.length,a=0;o>a;){if(t=+arguments[a++],r(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){var o=n(0),r=n(28),i=n(15);o(o.S,"String",{raw:function(e){for(var t=r(e.raw),n=i(t.length),o=arguments.length,a=[],s=0;n>s;)a.push(String(t[s++])),s=t.length?{value:void 0,done:!0}:(e=o(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t,n){"use strict";var o=n(0),r=n(96)(!1);o(o.P,"String",{codePointAt:function(e){return r(this,e)}})},function(e,t,n){"use strict";var o=n(0),r=n(15),i=n(98),a="".endsWith;o(o.P+o.F*n(100)("endsWith"),"String",{endsWith:function(e){var t=i(this,e,"endsWith"),n=arguments.length>1?arguments[1]:void 0,o=r(t.length),s=void 0===n?o:Math.min(r(n),o),l=String(e);return a?a.call(t,l,s):t.slice(s-l.length,s)===l}})},function(e,t,n){"use strict";var o=n(0),r=n(98);o(o.P+o.F*n(100)("includes"),"String",{includes:function(e){return!!~r(this,e,"includes").indexOf(e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var o=n(0);o(o.P,"String",{repeat:n(93)})},function(e,t,n){"use strict";var o=n(0),r=n(15),i=n(98),a="".startsWith;o(o.P+o.F*n(100)("startsWith"),"String",{startsWith:function(e){var t=i(this,e,"startsWith"),n=r(Math.min(arguments.length>1?arguments[1]:void 0,t.length)),o=String(e);return a?a.call(t,o,n):t.slice(n,n+o.length)===o}})},function(e,t,n){"use strict";n(24)("anchor",(function(e){return function(t){return e(this,"a","name",t)}}))},function(e,t,n){"use strict";n(24)("big",(function(e){return function(){return e(this,"big","","")}}))},function(e,t,n){"use strict";n(24)("blink",(function(e){return function(){return e(this,"blink","","")}}))},function(e,t,n){"use strict";n(24)("bold",(function(e){return function(){return e(this,"b","","")}}))},function(e,t,n){"use strict";n(24)("fixed",(function(e){return function(){return e(this,"tt","","")}}))},function(e,t,n){"use strict";n(24)("fontcolor",(function(e){return function(t){return e(this,"font","color",t)}}))},function(e,t,n){"use strict";n(24)("fontsize",(function(e){return function(t){return e(this,"font","size",t)}}))},function(e,t,n){"use strict";n(24)("italics",(function(e){return function(){return e(this,"i","","")}}))},function(e,t,n){"use strict";n(24)("link",(function(e){return function(t){return e(this,"a","href",t)}}))},function(e,t,n){"use strict";n(24)("small",(function(e){return function(){return e(this,"small","","")}}))},function(e,t,n){"use strict";n(24)("strike",(function(e){return function(){return e(this,"strike","","")}}))},function(e,t,n){"use strict";n(24)("sub",(function(e){return function(){return e(this,"sub","","")}}))},function(e,t,n){"use strict";n(24)("sup",(function(e){return function(){return e(this,"sup","","")}}))},function(e,t,n){var o=n(0);o(o.S,"Date",{now:function(){return(new Date).getTime()}})},function(e,t,n){"use strict";var o=n(0),r=n(22),i=n(41);o(o.P+o.F*n(11)((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})),"Date",{toJSON:function(e){var t=r(this),n=i(t);return"number"!=typeof n||isFinite(n)?t.toISOString():null}})},function(e,t,n){var o=n(0),r=n(270);o(o.P+o.F*(Date.prototype.toISOString!==r),"Date",{toISOString:r})},function(e,t,n){"use strict";var o=n(11),r=Date.prototype.getTime,i=Date.prototype.toISOString,a=function(e){return e>9?e:"0"+e};e.exports=o((function(){return"0385-07-25T07:06:39.999Z"!=i.call(new Date(-50000000000001))}))||!o((function(){i.call(new Date(NaN))}))?function(){if(!isFinite(r.call(this)))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),n=e.getUTCMilliseconds(),o=t<0?"-":t>9999?"+":"";return o+("00000"+Math.abs(t)).slice(o?-6:-4)+"-"+a(e.getUTCMonth()+1)+"-"+a(e.getUTCDate())+"T"+a(e.getUTCHours())+":"+a(e.getUTCMinutes())+":"+a(e.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}:i},function(e,t,n){var o=Date.prototype,r=o.toString,i=o.getTime;new Date(NaN)+""!="Invalid Date"&&n(23)(o,"toString",(function(){var e=i.call(this);return e==e?r.call(this):"Invalid Date"}))},function(e,t,n){var o=n(14)("toPrimitive"),r=Date.prototype;o in r||n(27)(r,o,n(273))},function(e,t,n){"use strict";var o=n(12),r=n(41);e.exports=function(e){if("string"!==e&&"number"!==e&&"default"!==e)throw TypeError("Incorrect hint");return r(o(this),"number"!=e)}},function(e,t,n){var o=n(0);o(o.S,"Array",{isArray:n(72)})},function(e,t,n){"use strict";var o=n(31),r=n(0),i=n(22),a=n(130),s=n(101),l=n(15),c=n(102),u=n(103);r(r.S+r.F*!n(73)((function(e){Array.from(e)})),"Array",{from:function(e){var t,n,r,f,d=i(e),p="function"==typeof this?this:Array,h=arguments.length,v=h>1?arguments[1]:void 0,y=void 0!==v,g=0,b=u(d);if(y&&(v=o(v,h>2?arguments[2]:void 0,2)),null==b||p==Array&&s(b))for(n=new p(t=l(d.length));t>g;g++)c(n,g,y?v(d[g],g):d[g]);else for(f=b.call(d),n=new p;!(r=f.next()).done;g++)c(n,g,y?a(f,v,[r.value,g],!0):r.value);return n.length=g,n}})},function(e,t,n){"use strict";var o=n(0),r=n(102);o(o.S+o.F*n(11)((function(){function e(){}return!(Array.of.call(e)instanceof e)})),"Array",{of:function(){for(var e=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>e;)r(n,e,arguments[e++]);return n.length=t,n}})},function(e,t,n){"use strict";var o=n(0),r=n(28),i=[].join;o(o.P+o.F*(n(61)!=Object||!n(29)(i)),"Array",{join:function(e){return i.call(r(this),void 0===e?",":e)}})},function(e,t,n){"use strict";var o=n(0),r=n(89),i=n(37),a=n(47),s=n(15),l=[].slice;o(o.P+o.F*n(11)((function(){r&&l.call(r)})),"Array",{slice:function(e,t){var n=s(this.length),o=i(this);if(t=void 0===t?n:t,"Array"==o)return l.call(this,e,t);for(var r=a(e,n),c=a(t,n),u=s(c-r),f=new Array(u),d=0;d1&&(o=Math.min(o,i(arguments[1]))),o<0&&(o=n+o);o>=0;o--)if(o in t&&t[o]===e)return o||0;return-1}})},function(e,t,n){var o=n(0);o(o.P,"Array",{copyWithin:n(133)}),n(51)("copyWithin")},function(e,t,n){var o=n(0);o(o.P,"Array",{fill:n(104)}),n(51)("fill")},function(e,t,n){"use strict";var o=n(0),r=n(36)(5),i=!0;"find"in[]&&Array(1).find((function(){i=!1})),o(o.P+o.F*i,"Array",{find:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}}),n(51)("find")},function(e,t,n){"use strict";var o=n(0),r=n(36)(6),i="findIndex",a=!0;i in[]&&Array(1)[i]((function(){a=!1})),o(o.P+o.F*a,"Array",{findIndex:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}}),n(51)(i)},function(e,t,n){n(57)("Array")},function(e,t,n){var o=n(10),r=n(92),i=n(18).f,a=n(49).f,s=n(99),l=n(74),c=o.RegExp,u=c,f=c.prototype,d=/a/g,p=/a/g,h=new c(d)!==d;if(n(17)&&(!h||n(11)((function(){return p[n(14)("match")]=!1,c(d)!=d||c(p)==p||"/a/i"!=c(d,"i")})))){c=function(e,t){var n=this instanceof c,o=s(e),i=void 0===t;return!n&&o&&e.constructor===c&&i?e:r(h?new u(o&&!i?e.source:e,t):u((o=e instanceof c)?e.source:e,o&&i?l.call(e):t),n?this:f,c)};for(var v=function(e){e in c||i(c,e,{configurable:!0,get:function(){return u[e]},set:function(t){u[e]=t}})},y=a(u),g=0;y.length>g;)v(y[g++]);f.constructor=c,c.prototype=f,n(23)(o,"RegExp",c)}n(57)("RegExp")},function(e,t,n){"use strict";n(136);var o=n(12),r=n(74),i=n(17),a=/./.toString,s=function(e){n(23)(RegExp.prototype,"toString",e,!0)};n(11)((function(){return"/a/b"!=a.call({source:"a",flags:"b"})}))?s((function(){var e=o(this);return"/".concat(e.source,"/","flags"in e?e.flags:!i&&e instanceof RegExp?r.call(e):void 0)})):"toString"!=a.name&&s((function(){return a.call(this)}))},function(e,t,n){"use strict";var o=n(12),r=n(15),i=n(107),a=n(75);n(76)("match",1,(function(e,t,n,s){return[function(n){var o=e(this),r=null==n?void 0:n[t];return void 0!==r?r.call(n,o):new RegExp(n)[t](String(o))},function(e){var t=s(n,e,this);if(t.done)return t.value;var l=o(e),c=String(this);if(!l.global)return a(l,c);var u=l.unicode;l.lastIndex=0;for(var f,d=[],p=0;null!==(f=a(l,c));){var h=String(f[0]);d[p]=h,""===h&&(l.lastIndex=i(c,r(l.lastIndex),u)),p++}return 0===p?null:d}]}))},function(e,t,n){"use strict";var o=n(12),r=n(22),i=n(15),a=n(33),s=n(107),l=n(75),c=Math.max,u=Math.min,f=Math.floor,d=/\$([$&`']|\d\d?|<[^>]*>)/g,p=/\$([$&`']|\d\d?)/g;n(76)("replace",2,(function(e,t,n,h){return[function(o,r){var i=e(this),a=null==o?void 0:o[t];return void 0!==a?a.call(o,i,r):n.call(String(i),o,r)},function(e,t){var r=h(n,e,this,t);if(r.done)return r.value;var f=o(e),d=String(this),p="function"==typeof t;p||(t=String(t));var y=f.global;if(y){var g=f.unicode;f.lastIndex=0}for(var b=[];;){var m=l(f,d);if(null===m)break;if(b.push(m),!y)break;""===String(m[0])&&(f.lastIndex=s(d,i(f.lastIndex),g))}for(var k,x="",w=0,S=0;S=w&&(x+=d.slice(w,T)+M,w=T+C.length)}return x+d.slice(w)}];function v(e,t,o,i,a,s){var l=o+e.length,c=i.length,u=p;return void 0!==a&&(a=r(a),u=d),n.call(s,u,(function(n,r){var s;switch(r.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,o);case"'":return t.slice(l);case"<":s=a[r.slice(1,-1)];break;default:var u=+r;if(0===u)return n;if(u>c){var d=f(u/10);return 0===d?n:d<=c?void 0===i[d-1]?r.charAt(1):i[d-1]+r.charAt(1):n}s=i[u-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";var o=n(12),r=n(121),i=n(75);n(76)("search",1,(function(e,t,n,a){return[function(n){var o=e(this),r=null==n?void 0:n[t];return void 0!==r?r.call(n,o):new RegExp(n)[t](String(o))},function(e){var t=a(n,e,this);if(t.done)return t.value;var s=o(e),l=String(this),c=s.lastIndex;r(c,0)||(s.lastIndex=0);var u=i(s,l);return r(s.lastIndex,c)||(s.lastIndex=c),null===u?-1:u.index}]}))},function(e,t,n){"use strict";var o=n(99),r=n(12),i=n(64),a=n(107),s=n(15),l=n(75),c=n(106),u=n(11),f=Math.min,d=[].push,p="length",h=!u((function(){RegExp(4294967295,"y")}));n(76)("split",2,(function(e,t,n,u){var v;return v="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1)[p]||2!="ab".split(/(?:ab)*/)[p]||4!=".".split(/(.?)(.?)/)[p]||".".split(/()()/)[p]>1||"".split(/.?/)[p]?function(e,t){var r=String(this);if(void 0===e&&0===t)return[];if(!o(e))return n.call(r,e,t);for(var i,a,s,l=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),f=0,h=void 0===t?4294967295:t>>>0,v=new RegExp(e.source,u+"g");(i=c.call(v,r))&&!((a=v.lastIndex)>f&&(l.push(r.slice(f,i.index)),i[p]>1&&i.index=h));)v.lastIndex===i.index&&v.lastIndex++;return f===r[p]?!s&&v.test("")||l.push(""):l.push(r.slice(f)),l[p]>h?l.slice(0,h):l}:"0".split(void 0,0)[p]?function(e,t){return void 0===e&&0===t?[]:n.call(this,e,t)}:n,[function(n,o){var r=e(this),i=null==n?void 0:n[t];return void 0!==i?i.call(n,r,o):v.call(String(r),n,o)},function(e,t){var o=u(v,e,this,t,v!==n);if(o.done)return o.value;var c=r(e),d=String(this),p=i(c,RegExp),y=c.unicode,g=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(h?"y":"g"),b=new p(h?c:"^(?:"+c.source+")",g),m=void 0===t?4294967295:t>>>0;if(0===m)return[];if(0===d.length)return null===l(b,d)?[d]:[];for(var k=0,x=0,w=[];x0?arguments[0]:void 0)}}),{get:function(e){var t=o.getEntry(r(this,"Map"),e);return t&&t.v},set:function(e,t){return o.def(r(this,"Map"),0===e?0:e,t)}},o,!0)},function(e,t,n){"use strict";var o=n(140),r=n(52);e.exports=n(79)("Set",(function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(e){return o.def(r(this,"Set"),e=0===e?0:e,e)}},o)},function(e,t,n){"use strict";var o,r=n(10),i=n(36)(0),a=n(23),s=n(42),l=n(120),c=n(141),u=n(13),f=n(52),d=n(52),p=!r.ActiveXObject&&"ActiveXObject"in r,h=s.getWeak,v=Object.isExtensible,y=c.ufstore,g=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},b={get:function(e){if(u(e)){var t=h(e);return!0===t?y(f(this,"WeakMap")).get(e):t?t[this._i]:void 0}},set:function(e,t){return c.def(f(this,"WeakMap"),e,t)}},m=e.exports=n(79)("WeakMap",g,b,c,!0,!0);d&&p&&(l((o=c.getConstructor(g,"WeakMap")).prototype,b),s.NEED=!0,i(["delete","has","get","set"],(function(e){var t=m.prototype,n=t[e];a(t,e,(function(t,r){if(u(t)&&!v(t)){this._f||(this._f=new o);var i=this._f[e](t,r);return"set"==e?this:i}return n.call(this,t,r)}))})))},function(e,t,n){"use strict";var o=n(141),r=n(52);n(79)("WeakSet",(function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(e){return o.def(r(this,"WeakSet"),e,!0)}},o,!1,!0)},function(e,t,n){"use strict";var o=n(0),r=n(80),i=n(109),a=n(12),s=n(47),l=n(15),c=n(13),u=n(10).ArrayBuffer,f=n(64),d=i.ArrayBuffer,p=i.DataView,h=r.ABV&&u.isView,v=d.prototype.slice,y=r.VIEW;o(o.G+o.W+o.F*(u!==d),{ArrayBuffer:d}),o(o.S+o.F*!r.CONSTR,"ArrayBuffer",{isView:function(e){return h&&h(e)||c(e)&&y in e}}),o(o.P+o.U+o.F*n(11)((function(){return!new d(2).slice(1,void 0).byteLength})),"ArrayBuffer",{slice:function(e,t){if(void 0!==v&&void 0===t)return v.call(a(this),e);for(var n=a(this).byteLength,o=s(e,n),r=s(void 0===t?n:t,n),i=new(f(this,d))(l(r-o)),c=new p(this),u=new p(i),h=0;o=t.length)return{value:void 0,done:!0}}while(!((e=t[this._i++])in this._t));return{value:e,done:!1}})),o(o.S,"Reflect",{enumerate:function(e){return new i(e)}})},function(e,t,n){var o=n(34),r=n(50),i=n(26),a=n(0),s=n(13),l=n(12);a(a.S,"Reflect",{get:function e(t,n){var a,c,u=arguments.length<3?t:arguments[2];return l(t)===u?t[n]:(a=o.f(t,n))?i(a,"value")?a.value:void 0!==a.get?a.get.call(u):void 0:s(c=r(t))?e(c,n,u):void 0}})},function(e,t,n){var o=n(34),r=n(0),i=n(12);r(r.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return o.f(i(e),t)}})},function(e,t,n){var o=n(0),r=n(50),i=n(12);o(o.S,"Reflect",{getPrototypeOf:function(e){return r(i(e))}})},function(e,t,n){var o=n(0);o(o.S,"Reflect",{has:function(e,t){return t in e}})},function(e,t,n){var o=n(0),r=n(12),i=Object.isExtensible;o(o.S,"Reflect",{isExtensible:function(e){return r(e),!i||i(e)}})},function(e,t,n){var o=n(0);o(o.S,"Reflect",{ownKeys:n(143)})},function(e,t,n){var o=n(0),r=n(12),i=Object.preventExtensions;o(o.S,"Reflect",{preventExtensions:function(e){r(e);try{return i&&i(e),!0}catch(e){return!1}}})},function(e,t,n){var o=n(18),r=n(34),i=n(50),a=n(26),s=n(0),l=n(43),c=n(12),u=n(13);s(s.S,"Reflect",{set:function e(t,n,s){var f,d,p=arguments.length<4?t:arguments[3],h=r.f(c(t),n);if(!h){if(u(d=i(t)))return e(d,n,s,p);h=l(0)}if(a(h,"value")){if(!1===h.writable||!u(p))return!1;if(f=r.f(p,n)){if(f.get||f.set||!1===f.writable)return!1;f.value=s,o.f(p,n,f)}else o.f(p,n,l(0,s));return!0}return void 0!==h.set&&(h.set.call(p,s),!0)}})},function(e,t,n){var o=n(0),r=n(90);r&&o(o.S,"Reflect",{setPrototypeOf:function(e,t){r.check(e,t);try{return r.set(e,t),!0}catch(e){return!1}}})},function(e,t,n){n(333),e.exports=n(16).Array.includes},function(e,t,n){"use strict";var o=n(0),r=n(70)(!0);o(o.P,"Array",{includes:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}}),n(51)("includes")},function(e,t,n){n(335),e.exports=n(16).Array.flatMap},function(e,t,n){"use strict";var o=n(0),r=n(336),i=n(22),a=n(15),s=n(32),l=n(131);o(o.P,"Array",{flatMap:function(e){var t,n,o=i(this);return s(e),t=a(o.length),n=l(o,0),r(n,o,o,t,0,1,e,arguments[1]),n}}),n(51)("flatMap")},function(e,t,n){"use strict";var o=n(72),r=n(13),i=n(15),a=n(31),s=n(14)("isConcatSpreadable");e.exports=function e(t,n,l,c,u,f,d,p){for(var h,v,y=u,g=0,b=!!d&&a(d,p,3);g0)y=e(t,n,h,i(h.length),y,f-1)-1;else{if(y>=9007199254740991)throw TypeError();t[y]=h}y++}g++}return y}},function(e,t,n){n(338),e.exports=n(16).String.padStart},function(e,t,n){"use strict";var o=n(0),r=n(144),i=n(78),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);o(o.P+o.F*a,"String",{padStart:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0,!0)}})},function(e,t,n){n(340),e.exports=n(16).String.padEnd},function(e,t,n){"use strict";var o=n(0),r=n(144),i=n(78),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);o(o.P+o.F*a,"String",{padEnd:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0,!1)}})},function(e,t,n){n(342),e.exports=n(16).String.trimLeft},function(e,t,n){"use strict";n(55)("trimLeft",(function(e){return function(){return e(this,1)}}),"trimStart")},function(e,t,n){n(344),e.exports=n(16).String.trimRight},function(e,t,n){"use strict";n(55)("trimRight",(function(e){return function(){return e(this,2)}}),"trimEnd")},function(e,t,n){n(346),e.exports=n(86).f("asyncIterator")},function(e,t,n){n(116)("asyncIterator")},function(e,t,n){n(348),e.exports=n(16).Object.getOwnPropertyDescriptors},function(e,t,n){var o=n(0),r=n(143),i=n(28),a=n(34),s=n(102);o(o.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,n,o=i(e),l=a.f,c=r(o),u={},f=0;c.length>f;)void 0!==(n=l(o,t=c[f++]))&&s(u,t,n);return u}})},function(e,t,n){n(350),e.exports=n(16).Object.values},function(e,t,n){var o=n(0),r=n(145)(!1);o(o.S,"Object",{values:function(e){return r(e)}})},function(e,t,n){n(352),e.exports=n(16).Object.entries},function(e,t,n){var o=n(0),r=n(145)(!0);o(o.S,"Object",{entries:function(e){return r(e)}})},function(e,t,n){"use strict";n(137),n(354),e.exports=n(16).Promise.finally},function(e,t,n){"use strict";var o=n(0),r=n(16),i=n(10),a=n(64),s=n(139);o(o.P+o.R,"Promise",{finally:function(e){var t=a(this,r.Promise||i.Promise),n="function"==typeof e;return this.then(n?function(n){return s(t,e()).then((function(){return n}))}:e,n?function(n){return s(t,e()).then((function(){throw n}))}:e)}})},function(e,t,n){n(356),n(357),n(358),e.exports=n(16)},function(e,t,n){var o=n(10),r=n(0),i=n(78),a=[].slice,s=/MSIE .\./.test(i),l=function(e){return function(t,n){var o=arguments.length>2,r=!!o&&a.call(arguments,2);return e(o?function(){("function"==typeof t?t:Function(t)).apply(this,r)}:t,n)}};r(r.G+r.B+r.F*s,{setTimeout:l(o.setTimeout),setInterval:l(o.setInterval)})},function(e,t,n){var o=n(0),r=n(108);o(o.G+o.B,{setImmediate:r.set,clearImmediate:r.clear})},function(e,t,n){for(var o=n(105),r=n(46),i=n(23),a=n(10),s=n(27),l=n(56),c=n(14),u=c("iterator"),f=c("toStringTag"),d=l.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=r(p),v=0;v=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),l=n.call(i,"finallyLoc");if(s&&l){if(this.prev=0;--o){var r=this.tryEntries[o];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var r=o.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}(e.exports);try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(30),n(2),n(3),n(364),n(365),n(366),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f){"use strict";var d=n(1);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=d(r),i=d(i),s=d(s),u=d(u),f=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(f);var h=function(){function e(t){var n=this;(0,i.default)(this,e);var o=function(){};f.isObject(t)&&f.isFunction(t.onReady)&&(o=t.onReady);var r=new u.default(t);this.isReady=r.isReady.then((function(){n.exportAPI(r),o()}))}return(0,s.default)(e,[{key:"exportAPI",value:function(e){var t=this;["configuration"].forEach((function(n){t[n]=e[n]})),this.destroy=function(){for(var n in Object.values(e.moduleInstances).forEach((function(e){f.isFunction(e.destroy)&&e.destroy(),e.listeners.removeAll()})),e=null,t)Object.prototype.hasOwnProperty.call(t,n)&&delete t[n];Object.setPrototypeOf(t,null)},Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach((function(n){var o=(0,r.default)(n,2),i=o[0],a=o[1];Object.entries(a).forEach((function(n){var o=(0,r.default)(n,2),a=o[0],s=o[1];t[s]=e.moduleInstances.API.methods[i][a]}))}))}}],[{key:"version",get:function(){return"2.26.2"}}]),e}();o.default=h,h.displayName="EditorJS",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return i}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function n(){}e.exports=Object.assign(n,{default:n,register:n,revert:function(){},__esModule:!0})},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[],void 0===(i="function"==typeof(o=function(){"use strict";Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;--n>=0&&t.item(n)!==this;);return n>-1}),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t);return null}),Element.prototype.prepend||(Element.prototype.prepend=function(e){var t=document.createDocumentFragment();Array.isArray(e)||(e=[e]),e.forEach((function(e){var n=e instanceof Node;t.appendChild(n?e:document.createTextNode(e))})),this.insertBefore(t,this.firstChild)}),Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(e){e=0===arguments.length||!!e;var t=this.parentNode,n=window.getComputedStyle(t,null),o=parseInt(n.getPropertyValue("border-top-width")),r=parseInt(n.getPropertyValue("border-left-width")),i=this.offsetTop-t.offsetTopt.scrollTop+t.clientHeight,s=this.offsetLeft-t.offsetLeftt.scrollLeft+t.clientWidth,c=i&&!a;(i||a)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-o+this.clientHeight/2),(s||l)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-r+this.clientWidth/2),(i||a||s||l)&&!e&&this.scrollIntoView(c)})})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(20),n(21),n(2),n(3),n(19),n(8),n(53),n(149),n(81)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c,u,f,d,p){"use strict";var h=n(1);function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(v=function(e){return e?n:t})(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=h(r),i=h(i),s=h(s),l=h(l),c=h(c),u=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=v(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(u),f=h(f),p=h(p);var y=n(375),g=[];y.keys().forEach((function(e){e.match(/^\.\/[^_][\w/]*\.([tj])s$/)&&g.push(y(e))}));var b=function(){function e(t){var n,o,a=this;(0,s.default)(this,e),this.moduleInstances={},this.eventsDispatcher=new p.default,this.isReady=new Promise((function(e,t){n=e,o=t})),Promise.resolve().then((0,i.default)(r.default.mark((function e(){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a.configuration=t,e.next=3,a.validate();case 3:return e.next=5,a.init();case 5:return e.next=7,a.start();case 7:u.logLabeled("I'm ready! (ノ◕ヮ◕)ノ*:・゚✧","log","","color: #E24A75"),setTimeout((0,i.default)(r.default.mark((function e(){var t,o,i;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.render();case 2:a.configuration.autofocus&&(t=a.moduleInstances,o=t.BlockManager,(i=t.Caret).setToBlock(o.blocks[0],i.positions.START),o.highlightCurrentNode()),a.moduleInstances.UI.removeLoader(),n();case 5:case"end":return e.stop()}}),e)}))),500);case 9:case"end":return e.stop()}}),e)})))).catch((function(e){u.log("Editor.js is not ready because of ".concat(e),"error"),o(e)}))}var t,n;return(0,l.default)(e,[{key:"configuration",get:function(){return this.config},set:function(e){var t,n;u.isObject(e)?this.config=Object.assign({},e):this.config={holder:e},u.deprecationAssert(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),null==this.config.holder&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=u.LogLevels.VERBOSE),u.setLogLevel(this.config.logLevel),u.deprecationAssert(Boolean(this.config.initialBlock),"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=void 0!==this.config.minHeight?this.config.minHeight:300;var o={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=!!this.config.hideToolbar&&this.config.hideToolbar,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||function(){},this.config.onChange=this.config.onChange||function(){},this.config.inlineToolbar=void 0===this.config.inlineToolbar||this.config.inlineToolbar,!u.isEmpty(this.config.data)&&this.config.data.blocks&&0!==this.config.data.blocks.length||(this.config.data={blocks:[o]}),this.config.readOnly=this.config.readOnly||!1,(null===(t=this.config.i18n)||void 0===t?void 0:t.messages)&&f.default.setDictionary(this.config.i18n.messages),this.config.i18n.direction=(null===(n=this.config.i18n)||void 0===n?void 0:n.direction)||"ltr"}},{key:"validate",value:(n=(0,i.default)(r.default.mark((function e(){var t,n,o;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.config,n=t.holderId,o=t.holder,!n||!o){e.next=3;break}throw Error("«holderId» and «holder» param can't assign at the same time.");case 3:if(!u.isString(o)||c.default.get(o)){e.next=5;break}throw Error("element with ID «".concat(o,"» is missing. Pass correct holder's ID."));case 5:if(!o||!u.isObject(o)||c.default.isElement(o)){e.next=7;break}throw Error("«holder» value must be an Element node");case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"init",value:function(){this.constructModules(),this.configureModules()}},{key:"start",value:(t=(0,i.default)(r.default.mark((function e(){var t,n=this;return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"],e.next=3,t.reduce((function(e,t){return e.then((0,i.default)(r.default.mark((function e(){return r.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n.moduleInstances[t].prepare();case 3:e.next=10;break;case 5:if(e.prev=5,e.t0=e.catch(0),!(e.t0 instanceof d.CriticalError)){e.next=9;break}throw new Error(e.t0.message);case 9:u.log("Module ".concat(t," was skipped because of %o"),"warn",e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,5]])}))))}),Promise.resolve());case 3:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"render",value:function(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}},{key:"constructModules",value:function(){var e=this;g.forEach((function(t){var n=u.isFunction(t)?t:t.default;try{e.moduleInstances[n.displayName]=new n({config:e.configuration,eventsDispatcher:e.eventsDispatcher})}catch(e){u.log("Module ".concat(n.displayName," skipped because"),"error",e)}}))}},{key:"configureModules",value:function(){for(var e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}},{key:"getModulesDiff",value:function(e){var t={};for(var n in this.moduleInstances)n!==e&&(t[n]=this.moduleInstances[n]);return t}}]),e}();o.default=b,b.displayName="Core",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o=n(7).default;function r(){"use strict";e.exports=r=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,i=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,n){return e[t]=n}}function d(e,t,n,o){var r=t&&t.prototype instanceof v?t:v,i=Object.create(r.prototype),s=new B(o||[]);return a(i,"_invoke",{value:C(e,n,s)}),i}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var h={};function v(){}function y(){}function g(){}var b={};f(b,l,(function(){return this}));var m=Object.getPrototypeOf,k=m&&m(m(O([])));k&&k!==n&&i.call(k,l)&&(b=k);var x=g.prototype=v.prototype=Object.create(b);function w(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){var n;a(this,"_invoke",{value:function(r,a){function s(){return new t((function(n,s){!function n(r,a,s,l){var c=p(e[r],e,a);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==o(f)&&i.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(f).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}(r,a,n,s)}))}return n=n?n.then(s,s):s()}})}function C(e,t,n){var o="suspendedStart";return function(r,i){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===r)throw i;return M()}for(n.method=r,n.arg=i;;){var a=n.delegate;if(a){var s=T(a,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var l=p(e,t,n);if("normal"===l.type){if(o=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o="completed",n.method="throw",n.arg=l.arg)}}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var o=p(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,h;var r=o.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function B(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function O(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n=0;--o){var r=this.tryEntries[o],a=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var s=i.call(r,"catchLoc"),l=i.call(r,"finallyLoc");if(s&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var r=o.arg;_(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var o=n(147);e.exports=function(e){if(Array.isArray(e))return o(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var o=n(110),r=n(374);function i(t,n,a){return r()?(e.exports=i=Reflect.construct.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=i=function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&o(i,n.prototype),i},e.exports.__esModule=!0,e.exports.default=e.exports),i.apply(null,arguments)}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var o={"./api":82,"./api/":82,"./api/blocks":153,"./api/blocks.ts":153,"./api/caret":154,"./api/caret.ts":154,"./api/events":155,"./api/events.ts":155,"./api/i18n":156,"./api/i18n.ts":156,"./api/index":82,"./api/index.ts":82,"./api/inlineToolbar":157,"./api/inlineToolbar.ts":157,"./api/listeners":158,"./api/listeners.ts":158,"./api/notifier":159,"./api/notifier.ts":159,"./api/readonly":160,"./api/readonly.ts":160,"./api/sanitizer":161,"./api/sanitizer.ts":161,"./api/saver":162,"./api/saver.ts":162,"./api/selection":163,"./api/selection.ts":163,"./api/styles":164,"./api/styles.ts":164,"./api/toolbar":165,"./api/toolbar.ts":165,"./api/tooltip":166,"./api/tooltip.ts":166,"./api/ui":167,"./api/ui.ts":167,"./blockEvents":168,"./blockEvents.ts":168,"./blockManager":169,"./blockManager.ts":169,"./blockSelection":170,"./blockSelection.ts":170,"./caret":171,"./caret.ts":171,"./crossBlockSelection":172,"./crossBlockSelection.ts":172,"./dragNDrop":173,"./dragNDrop.ts":173,"./modificationsObserver":174,"./modificationsObserver.ts":174,"./paste":175,"./paste.ts":175,"./readonly":176,"./readonly.ts":176,"./rectangleSelection":177,"./rectangleSelection.ts":177,"./renderer":178,"./renderer.ts":178,"./saver":179,"./saver.ts":179,"./toolbar":83,"./toolbar/":83,"./toolbar/blockSettings":180,"./toolbar/blockSettings.ts":180,"./toolbar/conversion":181,"./toolbar/conversion.ts":181,"./toolbar/index":83,"./toolbar/index.ts":83,"./toolbar/inline":182,"./toolbar/inline.ts":182,"./tools":183,"./tools.ts":183,"./ui":185,"./ui.ts":185};function r(e){var t=i(e);return n(t)}function i(e){if(!n.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return o[e]}r.keys=function(){return Object.keys(o)},r.resolve=i,e.exports=r,r.id=375},function(e,t,n){var o=n(4);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=o(e)););return e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(378)],void 0===(i="function"==typeof(o=function(o,r,i,a){"use strict";var s=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=s(r),i=s(i),a=s(a);var l=function(){function e(){(0,r.default)(this,e)}return(0,i.default)(e,[{key:"show",value:function(e){a.default.show(e)}}]),e}();o.default=l,l.displayName="Notifier",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){window,e.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}([function(e,t,n){"use strict";n(1),e.exports=function(){var e=n(6),t=null;return{show:function(n){if(n.message){!function(){if(t)return!0;t=e.getWrapper(),document.body.appendChild(t)}();var o=null,r=n.time||8e3;switch(n.type){case"confirm":o=e.confirm(n);break;case"prompt":o=e.prompt(n);break;default:o=e.alert(n),window.setTimeout((function(){o.remove()}),r)}t.appendChild(o),o.classList.add("cdx-notify--bounce-in")}}}}()},function(e,t,n){var o=n(2);"string"==typeof o&&(o=[[e.i,o,""]]),n(4)(o,{hmr:!0,transform:void 0,insertInto:void 0}),o.locals&&(e.exports=o.locals)},function(e,t,n){(e.exports=n(3)(!1)).push([e.i,'.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:\'\';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:\'\';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}',""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,o=e[1]||"",r=e[3];if(!r)return o;if(t&&"function"==typeof btoa){var i=(n=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),a=r.sources.map((function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"}));return[o].concat(a).concat([i]).join("\n")}return[o].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},r=0;r=0&&u.splice(t,1)}function y(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),g(t,e.attrs),h(e,t),t}function g(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,o,r,i;if(t.transform&&e.css){if(!(i=t.transform(e.css)))return function(){};e.css=i}if(t.singleton){var a=c++;n=l||(l=y(t)),o=x.bind(null,n,a,!1),r=x.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",g(t,e.attrs),h(e,t),t}(t),o=function(e,t,n){var o=n.css,r=n.sourceMap,i=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||i)&&(o=f(o)),r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([o],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,t),r=function(){v(n),n.href&&URL.revokeObjectURL(n.href)}):(n=y(t),o=function(e,t){var n=t.css,o=t.media;if(o&&e.setAttribute("media",o),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){v(n)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return d(n,t),function(e){for(var o=[],r=0;r0;)t.insertBefore(l.childNodes[0],l);t.removeChild(l),this._sanitize(e,t);break}for(var v=0;v{this.showed&&this.hide(!0)},this.loadStyles(),this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:"ct",tooltipContent:"ct__content",tooltipShown:"ct--shown",placement:{left:"ct--left",bottom:"ct--bottom",right:"ct--right",top:"ct--top"}}}show(e,t,n){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);const o=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},n);if(o.hidingDelay&&(this.hidingDelay=o.hidingDelay),this.nodes.content.innerHTML="","string"==typeof t)this.nodes.content.appendChild(document.createTextNode(t));else{if(!(t instanceof Node))throw Error("[CodeX Tooltip] Wrong type of «content» passed. It should be an instance of Node or String. But "+typeof t+" given.");this.nodes.content.appendChild(t)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),o.placement){case"top":this.placeTop(e,o);break;case"left":this.placeLeft(e,o);break;case"right":this.placeRight(e,o);break;case"bottom":default:this.placeBottom(e,o)}o&&o.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},o.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(e=!1){if(this.hidingDelay&&!e)return this.hidingTimeout&&clearTimeout(this.hidingTimeout),void(this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay));this.nodes.wrapper.classList.remove(this.CSS.tooltipShown),this.showed=!1,this.showingTimeout&&clearTimeout(this.showingTimeout)}onHover(e,t,n){e.addEventListener("mouseenter",()=>{this.show(e,t,n)}),e.addEventListener("mouseleave",()=>{this.hide()})}destroy(){this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll)}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper)}loadStyles(){const e="codex-tooltips-style";if(document.getElementById(e))return;const t=n(2),o=this.make("style",null,{textContent:t.toString(),id:e});this.prepend(document.head,o)}placeBottom(e,t){const n=e.getBoundingClientRect(),o=n.left+e.clientWidth/2-this.nodes.wrapper.offsetWidth/2,r=n.bottom+window.pageYOffset+this.offsetTop+t.marginTop;this.applyPlacement("bottom",o,r)}placeTop(e,t){const n=e.getBoundingClientRect(),o=n.left+e.clientWidth/2-this.nodes.wrapper.offsetWidth/2,r=n.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",o,r)}placeLeft(e,t){const n=e.getBoundingClientRect(),o=n.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-t.marginLeft,r=n.top+window.pageYOffset+e.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",o,r)}placeRight(e,t){const n=e.getBoundingClientRect(),o=n.right+this.offsetRight+t.marginRight,r=n.top+window.pageYOffset+e.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",o,r)}applyPlacement(e,t,n){this.nodes.wrapper.classList.add(this.CSS.placement[e]),this.nodes.wrapper.style.left=t+"px",this.nodes.wrapper.style.top=n+"px"}make(e,t=null,n={}){const o=document.createElement(e);Array.isArray(t)?o.classList.add(...t):t&&o.classList.add(t);for(const e in n)n.hasOwnProperty(e)&&(o[e]=n[e]);return o}append(e,t){Array.isArray(t)?t.forEach(t=>e.appendChild(t)):e.appendChild(t)}prepend(e,t){Array.isArray(t)?(t=t.reverse()).forEach(t=>e.prepend(t)):e.prepend(t)}}},function(e,t){e.exports='.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url(\'data:image/svg+xml;charset=utf-8,\') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}'}]).default},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(19),n(8),n(25)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c){"use strict";var u=n(1);function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),s=u(s),l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(l),c=u(c);var d=function(){function e(t,n){(0,r.default)(this,e),this.cursor=-1,this.items=[],this.items=t||[],this.focusedCssClass=n}return(0,i.default)(e,[{key:"currentItem",get:function(){return-1===this.cursor?null:this.items[this.cursor]}},{key:"setCursor",value:function(e){e=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass))}},{key:"setItems",value:function(e){this.items=e}},{key:"next",value:function(){this.cursor=this.leafNodesAndReturnIndex(e.directions.RIGHT)}},{key:"previous",value:function(){this.cursor=this.leafNodesAndReturnIndex(e.directions.LEFT)}},{key:"dropCursor",value:function(){-1!==this.cursor&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}},{key:"leafNodesAndReturnIndex",value:function(t){var n=this;if(0===this.items.length)return this.cursor;var o=this.cursor;return-1===o?o=t===e.directions.RIGHT?-1:0:this.items[o].classList.remove(this.focusedCssClass),o=t===e.directions.RIGHT?(o+1)%this.items.length:(this.items.length+o-1)%this.items.length,s.default.canSetCaret(this.items[o])&&l.delay((function(){return c.default.setCursor(n.items[o])}),50)(),this.items[o].classList.add(this.focusedCssClass),o}}]),e}();o.default=d,d.displayName="DomIterator",d.directions={RIGHT:"right",LEFT:"left"},e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(8),n(19),n(60)],void 0===(i="function"==typeof(o=function(o,r,i,s,l,c){"use strict";var u=n(1);function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(s),l=u(l);var d=function(){function e(t){(0,r.default)(this,e),this.blocks=[],this.workingArea=t}return(0,i.default)(e,[{key:"length",get:function(){return this.blocks.length}},{key:"array",get:function(){return this.blocks}},{key:"nodes",get:function(){return s.array(this.workingArea.children)}},{key:"push",value:function(e){this.blocks.push(e),this.insertToDOM(e)}},{key:"swap",value:function(e,t){var n=this.blocks[t];l.default.swap(this.blocks[e].holder,n.holder),this.blocks[t]=this.blocks[e],this.blocks[e]=n}},{key:"move",value:function(e,t){var n=this.blocks.splice(t,1)[0],o=e-1,r=Math.max(0,o),i=this.blocks[r];e>0?this.insertToDOM(n,"afterend",i):this.insertToDOM(n,"beforebegin",i),this.blocks.splice(e,0,n);var a=this.composeBlockEvent("move",{fromIndex:t,toIndex:e});n.call(c.BlockToolAPI.MOVED,a)}},{key:"insert",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.length){e>this.length&&(e=this.length),n&&(this.blocks[e].holder.remove(),this.blocks[e].call(c.BlockToolAPI.REMOVED));var o=n?1:0;if(this.blocks.splice(e,o,t),e>0){var r=this.blocks[e-1];this.insertToDOM(t,"afterend",r)}else{var i=this.blocks[e+1];i?this.insertToDOM(t,"beforebegin",i):this.insertToDOM(t)}}else this.push(t)}},{key:"remove",value:function(e){isNaN(e)&&(e=this.length-1),this.blocks[e].holder.remove(),this.blocks[e].call(c.BlockToolAPI.REMOVED),this.blocks.splice(e,1)}},{key:"removeAll",value:function(){this.workingArea.innerHTML="",this.blocks.forEach((function(e){return e.call(c.BlockToolAPI.REMOVED)})),this.blocks.length=0}},{key:"insertAfter",value:function(e,t){var n=this.blocks.indexOf(e);this.insert(n+1,t)}},{key:"get",value:function(e){return this.blocks[e]}},{key:"indexOf",value:function(e){return this.blocks.indexOf(e)}},{key:"insertToDOM",value:function(e,t,n){t?n.holder.insertAdjacentElement(t,e.holder):this.workingArea.appendChild(e.holder),e.call(c.BlockToolAPI.RENDERED)}},{key:"composeBlockEvent",value:function(e,t){return new CustomEvent(e,{detail:t})}}],[{key:"set",value:function(e,t,n){return isNaN(Number(t))?(Reflect.set(e,t,n),!0):(e.insert(+t,n),!0)}},{key:"get",value:function(e,t){return isNaN(Number(t))?Reflect.get(e,t):e.get(+t)}}]),e}();o.default=d,d.displayName="Blocks",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t],void 0===(i="function"==typeof(o=function(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.BlockMutationType=void 0,e.BlockMutationType=t,function(e){e.Added="block-added",e.Removed="block-removed",e.Moved="block-moved",e.Changed="block-changed"}(t||(e.BlockMutationType=t={}))})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){window,e.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function o(e,t){for(var n=0;n=0;s--)(r=e[s])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a};e.ToolboxEvent=S,function(e){e.Opened="toolbox-opened",e.Closed="toolbox-closed",e.BlockAdded="toolbox-block-added"}(S||(e.ToolboxEvent=S={}));var T=function(e){(0,l.default)(c,e);var n,a=w(c);function c(e){var t,n=e.api,o=e.tools,i=e.i18nLabels;return(0,r.default)(this,c),(t=a.call(this)).opened=!1,t.nodes={toolbox:null},t.onOverlayClicked=function(){t.close()},t.api=n,t.tools=o,t.i18nLabels=i,t}return(0,i.default)(c,[{key:"isEmpty",get:function(){return 0===this.toolsToBeDisplayed.length}},{key:"make",value:function(){return this.popover=new y.default({scopeElement:this.api.ui.nodes.redactor,className:c.CSS.toolbox,searchable:!0,filterLabel:this.i18nLabels.filter,nothingFoundLabel:this.i18nLabels.nothingFound,items:this.toolboxItemsToBeDisplayed}),this.popover.on(y.PopoverEvent.OverlayClicked,this.onOverlayClicked),this.enableShortcuts(),this.nodes.toolbox=this.popover.getElement(),this.nodes.toolbox}},{key:"hasFocus",value:function(){var e;return null===(e=this.popover)||void 0===e?void 0:e.hasFocus()}},{key:"destroy",value:function(){var e;(0,s.default)((0,u.default)(c.prototype),"destroy",this).call(this),this.nodes&&this.nodes.toolbox&&(this.nodes.toolbox.remove(),this.nodes.toolbox=null),this.removeAllShortcuts(),null===(e=this.popover)||void 0===e||e.off(y.PopoverEvent.OverlayClicked,this.onOverlayClicked)}},{key:"toolButtonActivated",value:function(e,t){this.insertNewBlock(e,t)}},{key:"open",value:function(){var e;this.isEmpty||(null===(e=this.popover)||void 0===e||e.show(),this.opened=!0,this.emit(S.Opened))}},{key:"close",value:function(){var e;null===(e=this.popover)||void 0===e||e.hide(),this.opened=!1,this.emit(S.Closed)}},{key:"toggle",value:function(){this.opened?this.close():this.open()}},{key:"toolsToBeDisplayed",get:function(){var e=[];return this.tools.forEach((function(t){t.toolbox&&e.push(t)})),e}},{key:"toolboxItemsToBeDisplayed",get:function(){var e=this,t=function(t,n){return{icon:t.icon,label:g.default.t(b.I18nInternalNS.toolNames,t.title||d.capitalize(n.name)),name:n.name,onActivate:function(){e.toolButtonActivated(n.name,t.data)},secondaryLabel:n.shortcut?d.beautifyShortcut(n.shortcut):""}};return this.toolsToBeDisplayed.reduce((function(e,n){return Array.isArray(n.toolbox)?n.toolbox.forEach((function(o){e.push(t(o,n))})):void 0!==n.toolbox&&e.push(t(n.toolbox,n)),e}),[])}},{key:"enableShortcuts",value:function(){var e=this;this.toolsToBeDisplayed.forEach((function(t){var n=t.shortcut;n&&e.enableShortcutForTool(t.name,n)}))}},{key:"enableShortcutForTool",value:function(e,t){var n=this;h.default.add({name:t,on:this.api.ui.nodes.redactor,handler:function(t){t.preventDefault(),n.insertNewBlock(e)}})}},{key:"removeAllShortcuts",value:function(){var e=this;this.toolsToBeDisplayed.forEach((function(t){var n=t.shortcut;n&&h.default.remove(e.api.ui.nodes.redactor,n)}))}},{key:"insertNewBlock",value:(n=(0,o.default)(t.default.mark((function e(n,o){var r,i,a,s,l,c;return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(r)){e.next=4;break}return e.abrupt("return");case 4:if(a=i.isEmpty?r:r+1,!o){e.next=10;break}return e.next=8,this.api.blocks.composeBlockData(n);case 8:l=e.sent,s=Object.assign(l,o);case 10:(c=this.api.blocks.insert(n,s,void 0,a,void 0,i.isEmpty)).call(p.BlockToolAPI.APPEND_CALLBACK),this.api.caret.setToBlock(a),this.emit(S.BlockAdded,{block:c}),this.api.toolbar.close();case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})}],[{key:"CSS",get:function(){return{toolbox:"ce-toolbox"}}}]),c}(v.default);e.default=T,T.displayName="Toolbox",C([d.cacheable],T.prototype,"toolsToBeDisplayed",null),C([d.cacheable],T.prototype,"toolboxItemsToBeDisplayed",null)})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,a){"use strict";var s=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=s(r),i=s(i);var l=function(){function e(){(0,r.default)(this,e)}return(0,i.default)(e,[{key:"lock",value:function(){a.isIosDevice?this.lockHard():document.body.classList.add(e.CSS.scrollLocked)}},{key:"unlock",value:function(){a.isIosDevice?this.unlockHard():document.body.classList.remove(e.CSS.scrollLocked)}},{key:"lockHard",value:function(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset","".concat(this.scrollPosition,"px")),document.body.classList.add(e.CSS.scrollLockedHard)}},{key:"unlockHard",value:function(){document.body.classList.remove(e.CSS.scrollLockedHard),null!==this.scrollPosition&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}}]),e}();o.default=l,l.displayName="ScrollLocker",l.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"},e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){window,e.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=4)}([function(e,t,n){var o=n(1),r=n(2);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]),o(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},function(e,t,n){"use strict";var o,r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),i=[];function a(e){for(var t=-1,n=0;n',title:"Text"}}}]),e}()}]).default},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3)],void 0===(i="function"==typeof(o=function(o,r,i){"use strict";var a=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=a(r),i=a(i);var s=function(){function e(){(0,r.default)(this,e),this.commandName="bold",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--bold"},this.nodes={button:void 0}}return(0,i.default)(e,[{key:"render",value:function(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML='\n\n',this.nodes.button}},{key:"surround",value:function(){document.execCommand(this.commandName)}},{key:"checkState",value:function(){var e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}},{key:"shortcut",get:function(){return"CMD+B"}}],[{key:"sanitize",get:function(){return{b:{}}}}]),e}();o.default=s,s.displayName="BoldInlineTool",s.isInline=!0,s.title="Bold",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3)],void 0===(i="function"==typeof(o=function(o,r,i){"use strict";var a=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=a(r),i=a(i);var s=function(){function e(){(0,r.default)(this,e),this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}return(0,i.default)(e,[{key:"render",value:function(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML='\n\n',this.nodes.button}},{key:"surround",value:function(){document.execCommand(this.commandName)}},{key:"checkState",value:function(){var e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}},{key:"shortcut",get:function(){return"CMD+I"}}],[{key:"sanitize",get:function(){return{i:{}}}}]),e}();o.default=s,s.displayName="ItalicInlineTool",s.isInline=!0,s.title="Italic",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i,a=n(7);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(25),n(8)],void 0===(i="function"==typeof(o=function(o,r,i,s,l){"use strict";var c=n(1);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=c(r),i=c(i),s=c(s),l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}(l);var f='\n\n',d=function(){function e(t){var n=t.api;(0,r.default)(this,e),this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=n.toolbar,this.inlineToolbar=n.inlineToolbar,this.notifier=n.notifier,this.i18n=n.i18n,this.selection=new s.default}return(0,i.default)(e,[{key:"render",value:function(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=f,this.nodes.button}},{key:"renderActions",value:function(){var e=this;return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",(function(t){t.keyCode===e.ENTER_KEY&&e.enterPressed(t)})),this.nodes.input}},{key:"surround",value:function(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());var t=this.selection.findParentTag("A");if(t){var n=document.getElementsByClassName("unlink-button")[0];return this.selection.expandToTag(t),this.unlink(),this.nodes.input.value="",this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive),n.remove(),void this.inlineToolbar.close()}}this.toggleActions()}},{key:"checkState",value:function(){var e=this,t=this.selection.findParentTag("A"),n=document.createElement("button");if(t){this.nodes.button.innerHTML='\n\n',this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions(),n.classList.add("unlink-button"),n.textContent=this.i18n.t("Remove"),n.addEventListener("click",(function(){e.selection.expandToTag(t),e.unlink(),e.nodes.input.value="",e.nodes.button.classList.remove(e.CSS.buttonUnlink),e.nodes.button.classList.remove(e.CSS.buttonActive),n.remove(),e.inlineToolbar.close()}));var o=t.getAttribute("href");this.nodes.input.value="null"!==o?o:"",""===this.nodes.input.value||document.querySelector(".unlink-button")||document.querySelector(".ce-inline-toolbar__actions").appendChild(n),this.selection.save()}else this.nodes.button.innerHTML=f,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!t}},{key:"clear",value:function(){this.closeActions()}},{key:"shortcut",get:function(){return"CMD+K"}},{key:"toggleActions",value:function(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}},{key:"openActions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=document.getElementsByClassName("ce-inline-toolbar")[0];this.nodes.input.classList.add(this.CSS.inputShowed),t.style.transform="translate(-50%, -33px)",e&&this.nodes.input.focus(),this.inputOpened=!0}},{key:"closeActions",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=document.getElementsByClassName("ce-inline-toolbar")[0];if(this.selection.isFakeBackgroundEnabled){var n=new s.default;n.save(),this.selection.restore(),this.selection.removeFakeBackground(),n.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),t.style.transform="",this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}},{key:"enterPressed",value:function(e){var t=this.nodes.input.value||"";return t.trim()?this.validateURL(t)?(t=this.prepareLink(t),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(t),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),void this.inlineToolbar.close()):(this.notifier.show({message:"Pasted link is not valid.",style:"error"}),void l.log("Incorrect Link pasted","warn",t)):(this.selection.restore(),this.unlink(),e.preventDefault(),void this.closeActions())}},{key:"validateURL",value:function(e){return!/\s/.test(e)}},{key:"prepareLink",value:function(e){return e=e.trim(),e=this.addProtocol(e)}},{key:"addProtocol",value:function(e){if(/^(\w+):(\/\/)?/.test(e))return e;var t=/^\/[^/\s]/.test(e),n="#"===e.substring(0,1),o=/^\/\/[^/\s]/.test(e);return t||n||o||(e="http://"+e),e}},{key:"insertLink",value:function(e){var t=this.selection.findParentTag("A");t&&this.selection.expandToTag(t),document.execCommand(this.commandLink,!1,e),this.selection.findParentTag("A").setAttribute("target","_blank")}},{key:"unlink",value:function(){document.execCommand(this.commandUnlink)}}],[{key:"sanitize",get:function(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}}]),e}();o.default=d,d.displayName="LinkInlineTool",d.isInline=!0,d.title="Link",e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(19)],void 0===(i="function"==typeof(o=function(o,r,i,a){"use strict";var s=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=s(r),i=s(i),a=s(a);var l=function(){function e(t){var n=t.data,o=t.api;(0,r.default)(this,e),this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=o,this.title=n.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=n.savedData,this.wrapper=this.make()}return(0,i.default)(e,[{key:"render",value:function(){return this.wrapper}},{key:"save",value:function(){return this.savedData}},{key:"make",value:function(){var e=a.default.make("div",this.CSS.wrapper),t=a.default.make("div",this.CSS.info),n=a.default.make("div",this.CSS.title,{textContent:this.title}),o=a.default.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML='',t.appendChild(n),t.appendChild(o),e.appendChild(t),e}}]),e}();o.default=l,l.displayName="Stub",l.isReadOnlySupported=!0,e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(68),n(393),n(394),n(395)],void 0===(i="function"==typeof(o=function(o,r,i,a,s,l,c){"use strict";var u=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=u(r),i=u(i),s=u(s),l=u(l),c=u(c);var f=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r=0;s--)(r=e[s])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},k=function(e){(0,l.default)(n,e);var t=b(n);function n(){var e;return(0,r.default)(this,n),(e=t.apply(this,arguments)).type=d.ToolType.Block,e.inlineTools=new h.default,e.tunes=new h.default,e}return(0,i.default)(n,[{key:"create",value:function(e,t,n){return new this.constructable({data:e,block:t,readOnly:n,api:this.api.getMethodsForTool(this),config:this.settings})}},{key:"isReadOnlySupported",get:function(){return!0===this.constructable[d.InternalBlockToolSettings.IsReadOnlySupported]}},{key:"isLineBreaksEnabled",get:function(){return this.constructable[d.InternalBlockToolSettings.IsEnabledLineBreaks]}},{key:"toolbox",get:function(){var e=this.constructable[d.InternalBlockToolSettings.Toolbox],t=this.config[d.UserSettings.Toolbox];if(!p.isEmpty(e)&&!1!==t)return t?Array.isArray(e)?Array.isArray(t)?t.map((function(t,n){var o=e[n];return o?Object.assign(Object.assign({},o),t):t})):[t]:Array.isArray(t)?t:[Object.assign(Object.assign({},e),t)]:Array.isArray(e)?e:[e]}},{key:"conversionConfig",get:function(){return this.constructable[d.InternalBlockToolSettings.ConversionConfig]}},{key:"enabledInlineTools",get:function(){return this.config[d.UserSettings.EnabledInlineTools]||!1}},{key:"enabledBlockTunes",get:function(){return this.config[d.UserSettings.EnabledBlockTunes]}},{key:"pasteConfig",get:function(){return this.constructable[d.InternalBlockToolSettings.PasteConfig]||{}}},{key:"sanitizeConfig",get:function(){var e=(0,s.default)((0,u.default)(n.prototype),"sanitizeConfig",this),t=this.baseSanitizeConfig;if(p.isEmpty(e))return t;var o={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=e[r];p.isObject(i)?o[r]=Object.assign({},t,i):o[r]=i}return o}},{key:"baseSanitizeConfig",get:function(){var e={};return Array.from(this.inlineTools.values()).forEach((function(t){return Object.assign(e,t.sanitizeConfig)})),Array.from(this.tunes.values()).forEach((function(t){return Object.assign(e,t.sanitizeConfig)})),e}}]),n}(d.default);o.default=k,k.displayName="BlockTool",m([p.cacheable],k.prototype,"sanitizeConfig",null),m([p.cacheable],k.prototype,"baseSanitizeConfig",null),e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(84)],void 0===(i="function"==typeof(o=function(o,r,i,a){"use strict";var s=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=s(r),i=s(i),a=s(a);var l=function(){function e(t){var n=t.api;(0,r.default)(this,e),this.CSS={animation:"wobble"},this.api=n}return(0,i.default)(e,[{key:"render",value:function(){var e=this;return{icon:'\n\n',label:this.api.i18n.t("Move down"),onActivate:function(t,n){return e.handleClick(n)},name:"move-down"}}},{key:"handleClick",value:function(e){var t=this,n=this.api.blocks.getCurrentBlockIndex(),o=this.api.blocks.getBlockByIndex(n+1);if(!o){var r=e.target.closest("."+a.default.CSS.item).querySelector("."+a.default.CSS.itemIcon);return r.classList.add(this.CSS.animation),void window.setTimeout((function(){r.classList.remove(t.CSS.animation)}),500)}var i=o.holder,s=i.getBoundingClientRect(),l=Math.abs(window.innerHeight-i.offsetHeight);s.top\n\n',label:this.api.i18n.t("Delete"),name:"delete",onActivate:function(){return e.handleClick()}}}},{key:"handleClick",value:function(){this.api.blocks.delete()}}]),e}();o.default=s,s.displayName="DeleteTune",s.isTune=!0,e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t,n){var o,r,i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t,n(2),n(3),n(84)],void 0===(i="function"==typeof(o=function(o,r,i,a){"use strict";var s=n(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0,r=s(r),i=s(i),a=s(a);var l=function(){function e(t){var n=t.api;(0,r.default)(this,e),this.CSS={animation:"wobble"},this.api=n}return(0,i.default)(e,[{key:"render",value:function(){var e=this;return{icon:'\n\n',label:this.api.i18n.t("Move up"),onActivate:function(t,n){return e.handleClick(n)},name:"move-up"}}},{key:"handleClick",value:function(e){var t=this,n=this.api.blocks.getCurrentBlockIndex(),o=this.api.blocks.getBlockByIndex(n),r=this.api.blocks.getBlockByIndex(n-1);if(0===n||!o||!r){var i=e.target.closest("."+a.default.CSS.item).querySelector("."+a.default.CSS.itemIcon);return i.classList.add(this.CSS.animation),void window.setTimeout((function(){i.classList.remove(t.CSS.animation)}),500)}var s,l=o.holder,c=r.holder,u=l.getBoundingClientRect(),f=c.getBoundingClientRect();s=f.top>0?Math.abs(u.top)-Math.abs(f.top):window.innerHeight-Math.abs(u.top)+Math.abs(f.top),window.scrollBy(0,-1*s),this.api.blocks.move(n-1),this.api.toolbar.toggleBlockSettings(!0)}}]),e}();o.default=l,l.displayName="MoveUpTune",l.isTune=!0,e.exports=t.default})?o.apply(t,r):o)||(e.exports=i)},function(e,t){e.exports='.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide,.codex-editor__redactor--hidden{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff "}@media (min-width:201px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width:201px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width:201px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor__loader{position:relative;height:30vh}.codex-editor__loader:before{content:"";position:absolute;left:50%;top:50%;width:30px;height:30px;margin-top:-15px;margin-left:-15px;border-radius:50%;border:2px solid rgba(201,201,204,.48);border-top-color:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-animation:editor-loader-spin .8s linear infinite;animation:editor-loader-spin .8s linear infinite;will-change:transform}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:rgba(46,170,220,.2);border:1px solid transparent}.codex-editor svg{max-height:100%;fill:currentColor}::-moz-selection{background-color:#d4ecff}::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}@-webkit-keyframes editor-loader-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes editor-loader-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(var(--window-scroll-offset)*-1);position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}@media (max-width:200px){.ce-toolbar--opened{display:-webkit-box;display:-ms-flexbox;display:flex}}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}@media (max-width:200px){.ce-toolbar__content{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-line-pack:center;align-content:center;margin:0;max-width:100%}}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media (max-width:200px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover:hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus{-ms-flex-negative:0;flex-shrink:0;height:100%}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}.ce-toolbar__plus--hidden{visibility:hidden}@media (max-width:200px){.ce-toolbar__plus{position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1);border-radius:8px;z-index:2}}@media (max-width:200px) and (max-width:200px){.ce-toolbar__plus{-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1)}}@media (max-width:200px){.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-toolbar__plus{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important;position:static}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;height:26px}@media (max-width:200px){.ce-toolbar__actions{position:absolute;right:auto;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}}.ce-toolbar__actions--opened{opacity:1}@media (max-width:200px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}@media (max-width:200px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover:hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__settings-btn{width:18px;height:100%;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media (min-width:201px){.ce-toolbar__settings-btn{width:18px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width:200px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1);border-radius:8px;z-index:2}}@media (max-width:200px) and (max-width:200px){.ce-toolbar__settings-btn{-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1)}}@media (max-width:200px){.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-toolbar__settings-btn{position:static}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:16px;height:16px}@media (min-width:201px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}.ce-toolbox{--gap:8px}@media (max-width:200px){.ce-toolbox{position:static;-webkit-transform:none!important;transform:none!important;-webkit-box-align:center;-ms-flex-align:center;align-items:center;overflow-x:auto}}@media (min-width:201px){.ce-toolbox{position:absolute;top:calc(26px + var(--gap));left:44px}.ce-toolbox--opened-top{top:calc(var(--gap)*-1 + var(--popover-height)*-1)}}.ce-toolbox__block-button{list-style:none;margin:0;padding:8px 16px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;cursor:pointer}.ce-toolbox__block-button:hover{background-color:#e9ecef}.ce-toolbox__block-button:active{background-color:#f1f3f5}.ce-toolbox__block-button-icon{width:20px;height:20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-toolbox__block-button-icon svg{fill:#868e96}.ce-toolbox__block-button-text{margin-left:4px;font-size:13px!important;line-height:18px;color:var(--gary8)}@media (min-width:201px){.codex-editor--narrow .ce-toolbox{left:auto;right:0}.codex-editor--narrow .ce-toolbox .ce-popover{right:0}}.ce-inline-toolbar{--y-offset:8px;position:absolute;background-color:#fff;border-radius:8px;z-index:2}@media (max-width:200px){.ce-inline-toolbar{-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1)}}.ce-inline-toolbar--left-oriented:before{left:15px;margin-left:0}.ce-inline-toolbar--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-inline-toolbar{border-radius:4px!important;border:none;-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1);-webkit-transform:translateX(-50%) translateY(8px) scale(.9);transform:translateX(-50%) translateY(8px) scale(.9);opacity:0;visibility:hidden;-webkit-transition:opacity .25s ease,-webkit-transform .15s ease;transition:opacity .25s ease,-webkit-transform .15s ease;transition:transform .15s ease,opacity .25s ease;transition:transform .15s ease,opacity .25s ease,-webkit-transform .15s ease;will-change:transform,opacity;top:0;left:0;z-index:3}.ce-inline-toolbar--showed{opacity:1;visibility:visible;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.ce-inline-toolbar--left-oriented{-webkit-transform:translateX(-23px) translateY(8px) scale(.94);transform:translateX(-23px) translateY(8px) scale(.94)}.ce-inline-toolbar--left-oriented.ce-inline-toolbar--showed{-webkit-transform:translateX(-23px);transform:translateX(-23px)}.ce-inline-toolbar--right-oriented{-webkit-transform:translateX(-100%) translateY(8px) scale(.94);transform:translateX(-100%) translateY(8px) scale(.94);margin-left:23px}.ce-inline-toolbar--right-oriented.ce-inline-toolbar--showed{-webkit-transform:translateX(-100%);transform:translateX(-100%)}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{width:100%}.ce-inline-toolbar__actions,.ce-inline-toolbar__buttons,.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__actions .unlink-button{background:inherit;border:none;-webkit-box-shadow:none;box-shadow:none;-webkit-tap-highlight-color:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;outline-style:none}.ce-inline-toolbar__actions .unlink-button:focus{outline:0}.ce-inline-toolbar__actions .unlink-button{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:end;font-weight:400;font-size:11px!important;line-height:16px;color:#868e96;padding:8px 10px 8px 0;cursor:pointer;white-space:nowrap;min-width:60px}.ce-inline-toolbar__actions .unlink-button,.ce-inline-toolbar__actions input{border-top:1px solid #dee2e6}.ce-inline-toolbar__dropdown{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;padding:0 10px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid #dee2e6;border-radius:4px 0 0 4px}@media (hover:hover){.ce-inline-toolbar__dropdown:hover{background:#e9ecef}}.ce-inline-toolbar__dropdown:active{background:#f1f3f5}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content{display:-webkit-box;display:-ms-flexbox;display:flex;font-weight:500;font-size:14px!important}.ce-inline-toolbar__dropdown-arrow,.ce-inline-toolbar__dropdown-content{display:-webkit-box;display:-ms-flexbox;display:flex;margin-left:4px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:32px;height:32px;line-height:32px;padding:0!important;text-align:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0}.ce-inline-tool svg{width:12px;height:12px}@media (max-width:200px){.ce-inline-tool svg{width:12px;height:12px}}@media (hover:hover){.ce-inline-tool:hover{background-color:#eff2f5}}.ce-inline-tool--active{color:#4593fc}.ce-inline-tool--focused{-webkit-box-shadow:inset 0 0 0 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px rgba(7,161,227,.08);background:rgba(34,186,255,.08)!important}.ce-inline-tool--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.ce-inline-tool{border-radius:0;line-height:normal;width:auto;padding:0 10px!important;min-width:24px}.ce-inline-tool .icon{height:12px}.ce-inline-tool:last-child{border-radius:0 4px 4px 0}.ce-inline-tool:hover{background:#e9ecef}.ce-inline-tool:active{background:#f1f3f5}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{outline:none;border:0;border-radius:0 0 4px 4px;margin:0;font-size:11px!important;line-height:16px;padding:8px 5px 8px 10px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;color:#212529}.ce-inline-tool-input::-webkit-input-placeholder{color:#adb5bd}.ce-inline-tool-input::-moz-placeholder{color:#adb5bd}.ce-inline-tool-input:-ms-input-placeholder{color:#adb5bd}.ce-inline-tool-input::-ms-input-placeholder{color:#adb5bd}.ce-inline-tool-input::placeholder{color:#adb5bd}.ce-inline-tool-input--showed{display:block}.ce-conversion-toolbar{position:absolute;background-color:#fff;border-radius:8px;z-index:2}@media (max-width:200px){.ce-conversion-toolbar{-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1)}}.ce-conversion-toolbar--left-oriented:before{left:15px;margin-left:0}.ce-conversion-toolbar--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-conversion-toolbar{opacity:0;visibility:hidden;will-change:transform,opacity;-webkit-transition:opacity .1s ease,-webkit-transform .1s ease;transition:opacity .1s ease,-webkit-transform .1s ease;transition:transform .1s ease,opacity .1s ease;transition:transform .1s ease,opacity .1s ease,-webkit-transform .1s ease;-webkit-transform:translateY(-8px);transform:translateY(-8px);left:-1px;width:160px;margin-top:5px;-webkit-box-sizing:content-box;box-sizing:content-box;padding-bottom:8px;border-radius:4px;border:none;-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1)}.ce-conversion-toolbar--showed{opacity:1;visibility:visible;-webkit-transform:none;transform:none}.ce-conversion-toolbar [hidden]{display:none!important}.ce-conversion-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-conversion-toolbar__label{color:#868e96;font-size:11px;line-height:16px;padding:12px 12px 4px}.ce-conversion-tool{display:-webkit-box;display:-ms-flexbox;display:flex;padding:4px 14.5px 4px 12px;font-size:13px;line-height:18px;color:#343a40;cursor:pointer;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-conversion-tool--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.ce-conversion-tool:hover{background:#e9ecef}.ce-conversion-tool:active{background:#f1f3f5}.ce-conversion-tool__icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:20px;height:20px;border:.5px solid #dee2e6;border-radius:2px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:4px;background:#fff}.ce-conversion-tool__icon svg{fill:#343a40}.ce-conversion-tool__check-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-left:auto;opacity:0;width:12px;height:8px}.ce-conversion-tool--current .ce-conversion-tool__check-icon{opacity:1}.ce-conversion-tool--current .ce-conversion-tool__check-icon svg{fill:#343a40}.ce-conversion-tool--last{margin-right:0!important}.ce-conversion-tool--active{color:#4593fc!important;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-settings{border:none;top:34px;left:51px;width:220px;-webkit-box-sizing:content-box;box-sizing:content-box}@media (max-width:200px){.ce-settings{bottom:40px;right:auto;top:auto}}.ce-settings{position:absolute;z-index:2;--gap:8px}@media (min-width:201px){.ce-settings{position:absolute;top:calc(26px + var(--gap));left:44px}.ce-settings--opened-top{top:calc(var(--gap)*-1 + var(--popover-height)*-1)}}.ce-settings__button{padding:8px 16px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;cursor:pointer}.ce-settings__button:hover{background-color:#e9ecef}.ce-settings__button:active{background-color:#f1f3f5}.ce-settings__button-icon-container{width:20px;height:20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-settings__button-icon-container svg{fill:#868e96}.ce-settings__button-text{font-size:13px!important;line-height:18px;color:#343a40;margin-left:4px;white-space:nowrap}.ce-settings__button-shortcut-text{font-size:11px!important;line-height:16px;color:#adb5bd;margin-left:auto}.ce-settings__button--disabled{cursor:not-allowed!important;opacity:.3}.ce-settings__button--selected{color:#4593fc}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:none}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content .ce-stub,.ce-block--selected .ce-block__content img{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #4593fc;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#4593fc;background:repeating-linear-gradient(90deg,#4593fc,#4593fc 1px,#fff 0,#fff 6px)}.ce-block a{cursor:pointer;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@media (min-width:201px){.codex-editor--narrow .ce-block--focused{margin-right:-50px;padding-right:50px}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translateZ(0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-5%,0,0) rotate(-5deg);transform:translate3d(-5%,0,0) rotate(-5deg)}30%{-webkit-transform:translate3d(2%,0,0) rotate(3deg);transform:translate3d(2%,0,0) rotate(3deg)}45%{-webkit-transform:translate3d(-3%,0,0) rotate(-3deg);transform:translate3d(-3%,0,0) rotate(-3deg)}60%{-webkit-transform:translate3d(2%,0,0) rotate(2deg);transform:translate3d(2%,0,0) rotate(2deg)}75%{-webkit-transform:translate3d(-1%,0,0) rotate(-1deg);transform:translate3d(-1%,0,0) rotate(-1deg)}to{-webkit-transform:translateZ(0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translateZ(0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-5%,0,0) rotate(-5deg);transform:translate3d(-5%,0,0) rotate(-5deg)}30%{-webkit-transform:translate3d(2%,0,0) rotate(3deg);transform:translate3d(2%,0,0) rotate(3deg)}45%{-webkit-transform:translate3d(-3%,0,0) rotate(-3deg);transform:translate3d(-3%,0,0) rotate(-3deg)}60%{-webkit-transform:translate3d(2%,0,0) rotate(2deg);transform:translate3d(2%,0,0) rotate(2deg)}75%{-webkit-transform:translate3d(-1%,0,0) rotate(-1deg);transform:translate3d(-1%,0,0) rotate(-1deg)}to{-webkit-transform:translateZ(0);transform:translateZ(0)}}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scaleX(1);transform:scaleX(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scaleX(1);transform:scaleX(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scaleX(1);transform:scaleX(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scaleX(1);transform:scaleX(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scaleX(1);transform:scaleX(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scaleX(1);transform:scaleX(1)}}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important;display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:32px;height:32px;line-height:32px;padding:0!important;text-align:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0}.cdx-settings-button svg{width:12px;height:12px}@media (max-width:200px){.cdx-settings-button svg{width:12px;height:12px}}@media (hover:hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-settings-button--active{color:#4593fc}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px rgba(7,161,227,.08);background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button:not(:nth-child(3n+3)){margin-right:3px}.cdx-settings-button:nth-child(n+4){margin-top:3px}.cdx-settings-button--active svg{fill:#4593fc}.cdx-settings-button svg{width:auto;height:auto}@media (max-width:200px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#4593fc;border-radius:50%;-webkit-animation:cdxRotation 1.2s linear infinite;animation:cdxRotation 1.2s linear infinite}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px 0 rgba(18,30,57,.04);color:#707684;text-align:center;cursor:pointer}@media (hover:hover){.cdx-button:hover{background:#fbfcfe;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px 0 rgba(18,30,57,.08)}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:100%;padding:3.5em 0;margin:17px 0;border-radius:3px;background:#fcf7f7;color:#b46262}.ce-stub__info{margin-left:20px}.ce-stub__title{margin-bottom:3px;font-weight:600;font-size:18px;text-transform:capitalize}.ce-stub__subtitle{font-size:16px}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width:200px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n+3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0 solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width:201px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0;right:5px}}@media (min-width:201px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.ce-popover{opacity:0;will-change:opacity,transform;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:8px 0;min-width:220px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0;pointer-events:none;position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1);border-radius:8px;z-index:2}@media (max-width:200px){.ce-popover{-webkit-box-shadow:0 8px 24px rgba(0,0,0,.1);box-shadow:0 8px 24px rgba(0,0,0,.1)}}.ce-popover--left-oriented:before{left:15px;margin-left:0}.ce-popover--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-popover{z-index:4;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.ce-popover--opened{opacity:1;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease}@media (max-width:200px){.ce-popover--opened{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}@media (max-width:200px){.ce-popover{--offset:5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset)*2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}}.ce-popover__item{padding:8px 16px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;cursor:pointer}.ce-popover__item:hover{background-color:#e9ecef}.ce-popover__item:active{background-color:#f1f3f5}@media (hover:hover){.ce-popover__item:hover:not(.ce-popover__item--no-visible-hover){background-color:#eff2f5}.ce-popover__item:hover .ce-popover__item-icon{-webkit-box-shadow:none;box-shadow:none}}.ce-popover__item--disabled{color:#707684;cursor:default;pointer-events:none}.ce-popover__item--disabled .ce-popover__item-icon{-webkit-box-shadow:0 0 0 1px #eff0f1;box-shadow:0 0 0 1px #eff0f1}.ce-popover__item--focused:not(.ce-popover__item--no-visible-focus){-webkit-box-shadow:inset 0 0 0 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px rgba(7,161,227,.08);background:rgba(34,186,255,.08)!important}.ce-popover__item--hidden{display:none}.ce-popover__item--active{background:rgba(56,138,229,.1);color:#388ae5}.ce-popover__item--confirmation{background:#e24a4a}.ce-popover__item--confirmation .ce-popover__item-icon{color:#e24a4a}.ce-popover__item--confirmation .ce-popover__item-label{color:#fff}@media (hover:hover){.ce-popover__item--confirmation:not(.ce-popover__item--no-visible-hover):hover{background:#ce4343}}.ce-popover__item--confirmation:not(.ce-popover__item--no-visible-focus).ce-popover__item--focused{background:#ce4343!important}.ce-popover__item-icon{width:20px;height:20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-popover__item-icon svg{fill:#868e96}.ce-popover__item-label{margin-left:4px;font-size:13px!important;line-height:18px;color:var(--gary8);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ce-popover__item-label:after{content:"";width:25px;display:inline-block}.ce-popover__item-secondary-label{color:#707684;font-size:12px!important;margin-left:auto;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;margin-bottom:-2px;opacity:.6}@media (max-width:200px){.ce-popover__item-secondary-label{display:none}}.ce-popover__item--active .ce-popover__item-icon,.ce-popover__item--confirmation .ce-popover__item-icon,.ce-popover__item--focused .ce-popover__item-icon{-webkit-box-shadow:none;box-shadow:none}.ce-popover__no-found{display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:start;white-space:nowrap;padding:3px;font-size:14px!important;line-height:20px;font-weight:500;cursor:pointer;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:6px}.ce-popover__no-found:not(:last-of-type){margin-bottom:1px}@media (max-width:200px){.ce-popover__no-found{font-size:16px!important;padding:4px}}.ce-popover__no-found{color:#707684;display:none;cursor:default}.ce-popover__no-found--shown{display:block}@media (max-width:200px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1d202b;opacity:.5;z-index:3;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}.ce-popover .cdx-search-field{display:none}}.ce-popover__overlay--hidden{z-index:0;opacity:0;visibility:hidden}.ce-popover__custom-content:not(:empty){padding:4px}@media (min-width:201px){.ce-popover__custom-content:not(:empty){margin-top:5px;padding:0}}.ce-popover__custom-content--hidden{display:none}.cdx-search-field{--icon-margin-right:10px;background:rgba(232,232,235,.49);border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{width:12px;height:12px;color:#707684}.cdx-search-field__input{font-size:14px!important;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}'},function(e,t,n){"use strict";n.r(t),n.d(t,"nanoid",(function(){return s})),n.d(t,"customAlphabet",(function(){return a})),n.d(t,"customRandom",(function(){return i})),n.d(t,"urlAlphabet",(function(){return o})),n.d(t,"random",(function(){return r}));let o="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let r=e=>crypto.getRandomValues(new Uint8Array(e)),i=(e,t,n)=>{let o=(2<{let i="";for(;;){let a=n(r),s=r;for(;s--;)if(i+=e[a[s]&o]||"",i.length===t)return i}}},a=(e,t)=>i(e,t,r),s=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;){let o=63&n[e];t+=o<36?o.toString(36):o<62?(o-26).toString(36).toUpperCase():o<63?"_":"-"}return t}}])})); \ No newline at end of file diff --git a/dist/editor.js.LICENSE.txt b/dist/editor.js.LICENSE.txt deleted file mode 100644 index 7ea6368b9..000000000 --- a/dist/editor.js.LICENSE.txt +++ /dev/null @@ -1,56 +0,0 @@ -/*! - * CodeX.Tooltips - * - * @version 1.0.5 - * - * @licence MIT - * @author CodeX - * - * - */ - -/*! - * Codex JavaScript Notification module - * https://github.com/codex-team/js-notifier - */ - -/*! - * Editor.js - * - * @version 2.26.2 - * - * @licence Apache-2.0 - * @author CodeX - * - * @uses html-janitor - * @licence Apache-2.0 (https://github.com/guardian/html-janitor/blob/master/LICENSE) - */ - -/*! - * Library for handling keyboard shortcuts - * @copyright CodeX (https://codex.so) - * @license MIT - * @author CodeX (https://codex.so) - * @version 1.2.0 - */ - -/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ - -/** - * Editor.js - * - * Short Description (눈_눈;) - * - * @version 2.18.0 - * @license Apache-2.0 - * @author CodeX-Team - */ - -/** - * Base Paragraph Block for the Editor.js. - * Represents simple paragraph - * - * @author CodeX (team@codex.so) - * @copyright CodeX 2018 - * @license The MIT License (MIT) - */ diff --git a/dist/editorjs.mjs b/dist/editorjs.mjs new file mode 100644 index 000000000..525f6050a --- /dev/null +++ b/dist/editorjs.mjs @@ -0,0 +1,9868 @@ +var Mt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function ve(s) { + return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; +} +function ye() { +} +Object.assign(ye, { + default: ye, + register: ye, + revert: function() { + }, + __esModule: !0 +}); +Element.prototype.matches || (Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) { + const e = (this.document || this.ownerDocument).querySelectorAll(s); + let t = e.length; + for (; --t >= 0 && e.item(t) !== this; ) + ; + return t > -1; +}); +Element.prototype.closest || (Element.prototype.closest = function(s) { + let e = this; + if (!document.documentElement.contains(e)) + return null; + do { + if (e.matches(s)) + return e; + e = e.parentElement || e.parentNode; + } while (e !== null); + return null; +}); +Element.prototype.prepend || (Element.prototype.prepend = function(e) { + const t = document.createDocumentFragment(); + Array.isArray(e) || (e = [e]), e.forEach((o) => { + const n = o instanceof Node; + t.appendChild(n ? o : document.createTextNode(o)); + }), this.insertBefore(t, this.firstChild); +}); +Element.prototype.scrollIntoViewIfNeeded || (Element.prototype.scrollIntoViewIfNeeded = function(s) { + s = arguments.length === 0 ? !0 : !!s; + const e = this.parentNode, t = window.getComputedStyle(e, null), o = parseInt(t.getPropertyValue("border-top-width")), n = parseInt(t.getPropertyValue("border-left-width")), i = this.offsetTop - e.offsetTop < e.scrollTop, r = this.offsetTop - e.offsetTop + this.clientHeight - o > e.scrollTop + e.clientHeight, a = this.offsetLeft - e.offsetLeft < e.scrollLeft, l = this.offsetLeft - e.offsetLeft + this.clientWidth - n > e.scrollLeft + e.clientWidth, c = i && !r; + (i || r) && s && (e.scrollTop = this.offsetTop - e.offsetTop - e.clientHeight / 2 - o + this.clientHeight / 2), (a || l) && s && (e.scrollLeft = this.offsetLeft - e.offsetLeft - e.clientWidth / 2 - n + this.clientWidth / 2), (i || r || a || l) && !s && this.scrollIntoView(c); +}); +window.requestIdleCallback = window.requestIdleCallback || function(s) { + const e = Date.now(); + return setTimeout(function() { + s({ + didTimeout: !1, + timeRemaining: function() { + return Math.max(0, 50 - (Date.now() - e)); + } + }); + }, 1); +}; +window.cancelIdleCallback = window.cancelIdleCallback || function(s) { + clearTimeout(s); +}; +let Lt = (s = 21) => crypto.getRandomValues(new Uint8Array(s)).reduce((e, t) => (t &= 63, t < 36 ? e += t.toString(36) : t < 62 ? e += (t - 26).toString(36).toUpperCase() : t > 62 ? e += "-" : e += "_", e), ""); +var tt = /* @__PURE__ */ ((s) => (s.VERBOSE = "VERBOSE", s.INFO = "INFO", s.WARN = "WARN", s.ERROR = "ERROR", s))(tt || {}); +const B = { + BACKSPACE: 8, + TAB: 9, + ENTER: 13, + SHIFT: 16, + CTRL: 17, + ALT: 18, + ESC: 27, + SPACE: 32, + LEFT: 37, + UP: 38, + DOWN: 40, + RIGHT: 39, + DELETE: 46, + META: 91 +}, _t = { + LEFT: 0, + WHEEL: 1, + RIGHT: 2, + BACKWARD: 3, + FORWARD: 4 +}; +function ge(s, e, t = "log", o, n = "color: inherit") { + if (!("console" in window) || !window.console[t]) + return; + const i = ["info", "log", "warn", "error"].includes(t), r = []; + switch (ge.logLevel) { + case "ERROR": + if (t !== "error") + return; + break; + case "WARN": + if (!["error", "warn"].includes(t)) + return; + break; + case "INFO": + if (!i || s) + return; + break; + } + o && r.push(o); + const a = "Editor.js 2.28.0-rc.3", l = `line-height: 1em; + color: #006FEA; + display: inline-block; + font-size: 11px; + line-height: 1em; + background-color: #fff; + padding: 4px 9px; + border-radius: 30px; + border: 1px solid rgba(56, 138, 229, 0.16); + margin: 4px 5px 4px 0;`; + s && (i ? (r.unshift(l, n), e = `%c${a}%c ${e}`) : e = `( ${a} )${e}`); + try { + i ? o ? console[t](`${e} %o`, ...r) : console[t](e, ...r) : console[t](e); + } catch { + } +} +ge.logLevel = "VERBOSE"; +function Ot(s) { + ge.logLevel = s; +} +const L = ge.bind(window, !1), Y = ge.bind(window, !0); +function oe(s) { + return Object.prototype.toString.call(s).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); +} +function D(s) { + return oe(s) === "function" || oe(s) === "asyncfunction"; +} +function j(s) { + return oe(s) === "object"; +} +function J(s) { + return oe(s) === "string"; +} +function At(s) { + return oe(s) === "boolean"; +} +function Ze(s) { + return oe(s) === "number"; +} +function Ke(s) { + return oe(s) === "undefined"; +} +function K(s) { + return s ? Object.keys(s).length === 0 && s.constructor === Object : !0; +} +function ot(s) { + return s > 47 && s < 58 || // number keys + s === 32 || s === 13 || // Space bar & return key(s) + s === 229 || // processing key input for certain languages — Chinese, Japanese, etc. + s > 64 && s < 91 || // letter keys + s > 95 && s < 112 || // Numpad keys + s > 185 && s < 193 || // ;=,-./` (in order) + s > 218 && s < 223; +} +async function Nt(s, e = () => { +}, t = () => { +}) { + async function o(n, i, r) { + try { + await n.function(n.data), await i(Ke(n.data) ? {} : n.data); + } catch { + r(Ke(n.data) ? {} : n.data); + } + } + return s.reduce(async (n, i) => (await n, o(i, e, t)), Promise.resolve()); +} +function nt(s) { + return Array.prototype.slice.call(s); +} +function re(s, e) { + return function() { + const t = this, o = arguments; + window.setTimeout(() => s.apply(t, o), e); + }; +} +function Rt(s) { + return s.name.split(".").pop(); +} +function Dt(s) { + return /^[-\w]+\/([-+\w]+|\*)$/.test(s); +} +function Pt(s, e, t) { + let o; + return (...n) => { + const i = this, r = () => { + o = null, t || s.apply(i, n); + }, a = t && !o; + window.clearTimeout(o), o = window.setTimeout(r, e), a && s.apply(i, n); + }; +} +function Ee(s, e, t = void 0) { + let o, n, i, r = null, a = 0; + t || (t = {}); + const l = function() { + a = t.leading === !1 ? 0 : Date.now(), r = null, i = s.apply(o, n), r || (o = n = null); + }; + return function() { + const c = Date.now(); + !a && t.leading === !1 && (a = c); + const u = e - (c - a); + return o = this, n = arguments, u <= 0 || u > e ? (r && (clearTimeout(r), r = null), a = c, i = s.apply(o, n), r || (o = n = null)) : !r && t.trailing !== !1 && (r = setTimeout(l, u)), i; + }; +} +function Ht() { + const s = { + win: !1, + mac: !1, + x11: !1, + linux: !1 + }, e = Object.keys(s).find((t) => window.navigator.appVersion.toLowerCase().indexOf(t) !== -1); + return e && (s[e] = !0), s; +} +function ae(s) { + return s[0].toUpperCase() + s.slice(1); +} +function Te(s, ...e) { + if (!e.length) + return s; + const t = e.shift(); + if (j(s) && j(t)) + for (const o in t) + j(t[o]) ? (s[o] || Object.assign(s, { [o]: {} }), Te(s[o], t[o])) : Object.assign(s, { [o]: t[o] }); + return Te(s, ...e); +} +function Ne(s) { + const e = Ht(); + return s = s.replace(/shift/gi, "⇧").replace(/backspace/gi, "⌫").replace(/enter/gi, "⏎").replace(/up/gi, "↑").replace(/left/gi, "→").replace(/down/gi, "↓").replace(/right/gi, "←").replace(/escape/gi, "⎋").replace(/insert/gi, "Ins").replace(/delete/gi, "␡").replace(/\+/gi, " + "), e.mac ? s = s.replace(/ctrl|cmd/gi, "⌘").replace(/alt/gi, "⌥") : s = s.replace(/cmd/gi, "Ctrl").replace(/windows/gi, "WIN"), s; +} +function Ft(s) { + try { + return new URL(s).href; + } catch { + } + return s.substring(0, 2) === "//" ? window.location.protocol + s : window.location.origin + s; +} +function jt() { + return Lt(10); +} +function zt(s) { + window.open(s, "_blank"); +} +function Ut(s = "") { + return `${s}${Math.floor(Math.random() * 1e8).toString(16)}`; +} +function Se(s, e, t) { + const o = `«${e}» is deprecated and will be removed in the next major release. Please use the «${t}» instead.`; + s && Y(o, "warn"); +} +function ce(s, e, t) { + const o = t.value ? "value" : "get", n = t[o], i = `#${e}Cache`; + if (t[o] = function(...r) { + return this[i] === void 0 && (this[i] = n.apply(this, ...r)), this[i]; + }, o === "get" && t.set) { + const r = t.set; + t.set = function(a) { + delete s[i], r.apply(this, a); + }; + } + return t; +} +const it = 200; +function te() { + return window.matchMedia(`(max-width: ${it}px)`).matches; +} +const Xe = typeof window < "u" && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1); +function $t(s, e) { + const t = Array.isArray(s) || j(s), o = Array.isArray(e) || j(e); + return t || o ? JSON.stringify(s) === JSON.stringify(e) : s === e; +} +class d { + /** + * Check if passed tag has no closed tag + * + * @param {HTMLElement} tag - element to check + * @returns {boolean} + */ + static isSingleTag(e) { + return e.tagName && [ + "AREA", + "BASE", + "BR", + "COL", + "COMMAND", + "EMBED", + "HR", + "IMG", + "INPUT", + "KEYGEN", + "LINK", + "META", + "PARAM", + "SOURCE", + "TRACK", + "WBR" + ].includes(e.tagName); + } + /** + * Check if element is BR or WBR + * + * @param {HTMLElement} element - element to check + * @returns {boolean} + */ + static isLineBreakTag(e) { + return e && e.tagName && [ + "BR", + "WBR" + ].includes(e.tagName); + } + /** + * Helper for making Elements with class name and attributes + * + * @param {string} tagName - new Element tag name + * @param {string[]|string} [classNames] - list or name of CSS class name(s) + * @param {object} [attributes] - any attributes + * @returns {HTMLElement} + */ + static make(e, t = null, o = {}) { + const n = document.createElement(e); + Array.isArray(t) ? n.classList.add(...t) : t && n.classList.add(t); + for (const i in o) + Object.prototype.hasOwnProperty.call(o, i) && (n[i] = o[i]); + return n; + } + /** + * Creates Text Node with the passed content + * + * @param {string} content - text content + * @returns {Text} + */ + static text(e) { + return document.createTextNode(e); + } + /** + * Append one or several elements to the parent + * + * @param {Element|DocumentFragment} parent - where to append + * @param {Element|Element[]|DocumentFragment|Text|Text[]} elements - element or elements list + */ + static append(e, t) { + Array.isArray(t) ? t.forEach((o) => e.appendChild(o)) : e.appendChild(t); + } + /** + * Append element or a couple to the beginning of the parent elements + * + * @param {Element} parent - where to append + * @param {Element|Element[]} elements - element or elements list + */ + static prepend(e, t) { + Array.isArray(t) ? (t = t.reverse(), t.forEach((o) => e.prepend(o))) : e.prepend(t); + } + /** + * Swap two elements in parent + * + * @param {HTMLElement} el1 - from + * @param {HTMLElement} el2 - to + * @deprecated + */ + static swap(e, t) { + const o = document.createElement("div"), n = e.parentNode; + n.insertBefore(o, e), n.insertBefore(e, t), n.insertBefore(t, o), n.removeChild(o); + } + /** + * Selector Decorator + * + * Returns first match + * + * @param {Element} el - element we searching inside. Default - DOM Document + * @param {string} selector - searching string + * @returns {Element} + */ + static find(e = document, t) { + return e.querySelector(t); + } + /** + * Get Element by Id + * + * @param {string} id - id to find + * @returns {HTMLElement | null} + */ + static get(e) { + return document.getElementById(e); + } + /** + * Selector Decorator. + * + * Returns all matches + * + * @param {Element|Document} el - element we searching inside. Default - DOM Document + * @param {string} selector - searching string + * @returns {NodeList} + */ + static findAll(e = document, t) { + return e.querySelectorAll(t); + } + /** + * Returns CSS selector for all text inputs + */ + static get allInputsSelector() { + return "[contenteditable=true], textarea, input:not([type]), " + ["text", "password", "email", "number", "search", "tel", "url"].map((t) => `input[type="${t}"]`).join(", "); + } + /** + * Find all contenteditable, textarea and editable input elements passed holder contains + * + * @param holder - element where to find inputs + */ + static findAllInputs(e) { + return nt(e.querySelectorAll(d.allInputsSelector)).reduce((t, o) => d.isNativeInput(o) || d.containsOnlyInlineElements(o) ? [...t, o] : [...t, ...d.getDeepestBlockElements(o)], []); + } + /** + * Search for deepest node which is Leaf. + * Leaf is the vertex that doesn't have any child nodes + * + * @description Method recursively goes throw the all Node until it finds the Leaf + * @param {Node} node - root Node. From this vertex we start Deep-first search + * {@link https://en.wikipedia.org/wiki/Depth-first_search} + * @param {boolean} [atLast] - find last text node + * @returns {Node} - it can be text Node or Element Node, so that caret will able to work with it + */ + static getDeepestNode(e, t = !1) { + const o = t ? "lastChild" : "firstChild", n = t ? "previousSibling" : "nextSibling"; + if (e && e.nodeType === Node.ELEMENT_NODE && e[o]) { + let i = e[o]; + if (d.isSingleTag(i) && !d.isNativeInput(i) && !d.isLineBreakTag(i)) + if (i[n]) + i = i[n]; + else if (i.parentNode[n]) + i = i.parentNode[n]; + else + return i.parentNode; + return this.getDeepestNode(i, t); + } + return e; + } + /** + * Check if object is DOM node + * + * @param {*} node - object to check + * @returns {boolean} + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + static isElement(e) { + return Ze(e) ? !1 : e && e.nodeType && e.nodeType === Node.ELEMENT_NODE; + } + /** + * Check if object is DocumentFragment node + * + * @param {object} node - object to check + * @returns {boolean} + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + static isFragment(e) { + return Ze(e) ? !1 : e && e.nodeType && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE; + } + /** + * Check if passed element is contenteditable + * + * @param {HTMLElement} element - html element to check + * @returns {boolean} + */ + static isContentEditable(e) { + return e.contentEditable === "true"; + } + /** + * Checks target if it is native input + * + * @param {*} target - HTML element or string + * @returns {boolean} + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + static isNativeInput(e) { + const t = [ + "INPUT", + "TEXTAREA" + ]; + return e && e.tagName ? t.includes(e.tagName) : !1; + } + /** + * Checks if we can set caret + * + * @param {HTMLElement} target - target to check + * @returns {boolean} + */ + static canSetCaret(e) { + let t = !0; + if (d.isNativeInput(e)) + switch (e.type) { + case "file": + case "checkbox": + case "radio": + case "hidden": + case "submit": + case "button": + case "image": + case "reset": + t = !1; + break; + } + else + t = d.isContentEditable(e); + return t; + } + /** + * Checks node if it is empty + * + * @description Method checks simple Node without any childs for emptiness + * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method + * @param {Node} node - node to check + * @returns {boolean} true if it is empty + */ + static isNodeEmpty(e) { + let t; + return this.isSingleTag(e) && !this.isLineBreakTag(e) ? !1 : (this.isElement(e) && this.isNativeInput(e) ? t = e.value : t = e.textContent.replace("​", ""), t.trim().length === 0); + } + /** + * checks node if it is doesn't have any child nodes + * + * @param {Node} node - node to check + * @returns {boolean} + */ + static isLeaf(e) { + return e ? e.childNodes.length === 0 : !1; + } + /** + * breadth-first search (BFS) + * {@link https://en.wikipedia.org/wiki/Breadth-first_search} + * + * @description Pushes to stack all DOM leafs and checks for emptiness + * @param {Node} node - node to check + * @returns {boolean} + */ + static isEmpty(e) { + e.normalize(); + const t = [e]; + for (; t.length > 0; ) + if (e = t.shift(), !!e) { + if (this.isLeaf(e) && !this.isNodeEmpty(e)) + return !1; + e.childNodes && t.push(...Array.from(e.childNodes)); + } + return !0; + } + /** + * Check if string contains html elements + * + * @param {string} str - string to check + * @returns {boolean} + */ + static isHTMLString(e) { + const t = d.make("div"); + return t.innerHTML = e, t.childElementCount > 0; + } + /** + * Return length of node`s text content + * + * @param {Node} node - node with content + * @returns {number} + */ + static getContentLength(e) { + return d.isNativeInput(e) ? e.value.length : e.nodeType === Node.TEXT_NODE ? e.length : e.textContent.length; + } + /** + * Return array of names of block html elements + * + * @returns {string[]} + */ + static get blockElements() { + return [ + "address", + "article", + "aside", + "blockquote", + "canvas", + "div", + "dl", + "dt", + "fieldset", + "figcaption", + "figure", + "footer", + "form", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "header", + "hgroup", + "hr", + "li", + "main", + "nav", + "noscript", + "ol", + "output", + "p", + "pre", + "ruby", + "section", + "table", + "tbody", + "thead", + "tr", + "tfoot", + "ul", + "video" + ]; + } + /** + * Check if passed content includes only inline elements + * + * @param {string|HTMLElement} data - element or html string + * @returns {boolean} + */ + static containsOnlyInlineElements(e) { + let t; + J(e) ? (t = document.createElement("div"), t.innerHTML = e) : t = e; + const o = (n) => !d.blockElements.includes(n.tagName.toLowerCase()) && Array.from(n.children).every(o); + return Array.from(t.children).every(o); + } + /** + * Find and return all block elements in the passed parent (including subtree) + * + * @param {HTMLElement} parent - root element + * @returns {HTMLElement[]} + */ + static getDeepestBlockElements(e) { + return d.containsOnlyInlineElements(e) ? [e] : Array.from(e.children).reduce((t, o) => [...t, ...d.getDeepestBlockElements(o)], []); + } + /** + * Helper for get holder from {string} or return HTMLElement + * + * @param {string | HTMLElement} element - holder's id or holder's HTML Element + * @returns {HTMLElement} + */ + static getHolder(e) { + return J(e) ? document.getElementById(e) : e; + } + /** + * Returns true if element is anchor (is A tag) + * + * @param {Element} element - element to check + * @returns {boolean} + */ + static isAnchor(e) { + return e.tagName.toLowerCase() === "a"; + } + /** + * Return element's offset related to the document + * + * @todo handle case when editor initialized in scrollable popup + * @param el - element to compute offset + */ + static offset(e) { + const t = e.getBoundingClientRect(), o = window.pageXOffset || document.documentElement.scrollLeft, n = window.pageYOffset || document.documentElement.scrollTop, i = t.top + n, r = t.left + o; + return { + top: i, + left: r, + bottom: i + t.height, + right: r + t.width + }; + } +} +const Wt = { + blockTunes: { + toggler: { + "Click to tune": "", + "or drag to move": "" + } + }, + inlineToolbar: { + converter: { + "Convert to": "" + } + }, + toolbar: { + toolbox: { + Add: "" + } + }, + popover: { + Filter: "", + "Nothing found": "" + } +}, Vt = { + Text: "", + Link: "", + Bold: "", + Italic: "" +}, Yt = { + link: { + "Add a link": "Add a link", + Remove: "Remove" + }, + stub: { + "The block can not be displayed correctly.": "" + } +}, Zt = { + delete: { + Delete: "", + "Click to delete": "" + }, + moveUp: { + "Move up": "" + }, + moveDown: { + "Move down": "" + } +}, st = { + ui: Wt, + toolNames: Vt, + tools: Yt, + blockTunes: Zt +}, ne = class { + /** + * Type-safe translation for internal UI texts: + * Perform translation of the string by namespace and a key + * + * @example I18n.ui(I18nInternalNS.ui.blockTunes.toggler, 'Click to tune') + * @param internalNamespace - path to translated string in dictionary + * @param dictKey - dictionary key. Better to use default locale original text + */ + static ui(s, e) { + return ne._t(s, e); + } + /** + * Translate for external strings that is not presented in default dictionary. + * For example, for user-specified tool names + * + * @param namespace - path to translated string in dictionary + * @param dictKey - dictionary key. Better to use default locale original text + */ + static t(s, e) { + return ne._t(s, e); + } + /** + * Adjust module for using external dictionary + * + * @param dictionary - new messages list to override default + */ + static setDictionary(s) { + ne.currentDictionary = s; + } + /** + * Perform translation both for internal and external namespaces + * If there is no translation found, returns passed key as a translated message + * + * @param namespace - path to translated string in dictionary + * @param dictKey - dictionary key. Better to use default locale original text + */ + static _t(s, e) { + const t = ne.getNamespace(s); + return !t || !t[e] ? e : t[e]; + } + /** + * Find messages section by namespace path + * + * @param namespace - path to section + */ + static getNamespace(s) { + return s.split(".").reduce((t, o) => !t || !Object.keys(t).length ? {} : t[o], ne.currentDictionary); + } +}; +let W = ne; +W.currentDictionary = st; +class rt extends Error { +} +class xe { + constructor() { + this.subscribers = {}; + } + /** + * Subscribe any event on callback + * + * @param eventName - event name + * @param callback - subscriber + */ + on(e, t) { + e in this.subscribers || (this.subscribers[e] = []), this.subscribers[e].push(t); + } + /** + * Subscribe any event on callback. Callback will be called once and be removed from subscribers array after call. + * + * @param eventName - event name + * @param callback - subscriber + */ + once(e, t) { + e in this.subscribers || (this.subscribers[e] = []); + const o = (n) => { + const i = t(n), r = this.subscribers[e].indexOf(o); + return r !== -1 && this.subscribers[e].splice(r, 1), i; + }; + this.subscribers[e].push(o); + } + /** + * Emit callbacks with passed data + * + * @param eventName - event name + * @param data - subscribers get this data when they were fired + */ + emit(e, t) { + K(this.subscribers) || !this.subscribers[e] || this.subscribers[e].reduce((o, n) => { + const i = n(o); + return i !== void 0 ? i : o; + }, t); + } + /** + * Unsubscribe callback from event + * + * @param eventName - event name + * @param callback - event handler + */ + off(e, t) { + if (this.subscribers[e] === void 0) { + console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`); + return; + } + for (let o = 0; o < this.subscribers[e].length; o++) + if (this.subscribers[e][o] === t) { + delete this.subscribers[e][o]; + break; + } + } + /** + * Destroyer + * clears subscribers list + */ + destroy() { + this.subscribers = {}; + } +} +function ee(s) { + Object.setPrototypeOf(this, { + /** + * Block id + * + * @returns {string} + */ + get id() { + return s.id; + }, + /** + * Tool name + * + * @returns {string} + */ + get name() { + return s.name; + }, + /** + * Tool config passed on Editor's initialization + * + * @returns {ToolConfig} + */ + get config() { + return s.config; + }, + /** + * .ce-block element, that wraps plugin contents + * + * @returns {HTMLElement} + */ + get holder() { + return s.holder; + }, + /** + * True if Block content is empty + * + * @returns {boolean} + */ + get isEmpty() { + return s.isEmpty; + }, + /** + * True if Block is selected with Cross-Block selection + * + * @returns {boolean} + */ + get selected() { + return s.selected; + }, + /** + * Set Block's stretch state + * + * @param {boolean} state — state to set + */ + set stretched(t) { + s.stretched = t; + }, + /** + * True if Block is stretched + * + * @returns {boolean} + */ + get stretched() { + return s.stretched; + }, + /** + * Call Tool method with errors handler under-the-hood + * + * @param {string} methodName - method to call + * @param {object} param - object with parameters + * @returns {unknown} + */ + call(t, o) { + return s.call(t, o); + }, + /** + * Save Block content + * + * @returns {Promise} + */ + save() { + return s.save(); + }, + /** + * Validate Block data + * + * @param {BlockToolData} data - data to validate + * @returns {Promise} + */ + validate(t) { + return s.validate(t); + }, + /** + * Allows to say Editor that Block was changed. Used to manually trigger Editor's 'onChange' callback + * Can be useful for block changes invisible for editor core. + */ + dispatchChange() { + s.dispatchChange(); + } + }); +} +class at { + constructor() { + this.allListeners = []; + } + /** + * Assigns event listener on element and returns unique identifier + * + * @param {EventTarget} element - DOM element that needs to be listened + * @param {string} eventType - event type + * @param {Function} handler - method that will be fired on event + * @param {boolean|AddEventListenerOptions} options - useCapture or {capture, passive, once} + */ + on(e, t, o, n = !1) { + const i = Ut("l"), r = { + id: i, + element: e, + eventType: t, + handler: o, + options: n + }; + if (!this.findOne(e, t, o)) + return this.allListeners.push(r), e.addEventListener(t, o, n), i; + } + /** + * Removes event listener from element + * + * @param {EventTarget} element - DOM element that we removing listener + * @param {string} eventType - event type + * @param {Function} handler - remove handler, if element listens several handlers on the same event type + * @param {boolean|AddEventListenerOptions} options - useCapture or {capture, passive, once} + */ + off(e, t, o, n) { + const i = this.findAll(e, t, o); + i.forEach((r, a) => { + const l = this.allListeners.indexOf(i[a]); + l > -1 && (this.allListeners.splice(l, 1), r.element.removeEventListener(r.eventType, r.handler, r.options)); + }); + } + /** + * Removes listener by id + * + * @param {string} id - listener identifier + */ + offById(e) { + const t = this.findById(e); + t && t.element.removeEventListener(t.eventType, t.handler, t.options); + } + /** + * Finds and returns first listener by passed params + * + * @param {EventTarget} element - event target + * @param {string} [eventType] - event type + * @param {Function} [handler] - event handler + * @returns {ListenerData|null} + */ + findOne(e, t, o) { + const n = this.findAll(e, t, o); + return n.length > 0 ? n[0] : null; + } + /** + * Return all stored listeners by passed params + * + * @param {EventTarget} element - event target + * @param {string} eventType - event type + * @param {Function} handler - event handler + * @returns {ListenerData[]} + */ + findAll(e, t, o) { + let n; + const i = e ? this.findByEventTarget(e) : []; + return e && t && o ? n = i.filter((r) => r.eventType === t && r.handler === o) : e && t ? n = i.filter((r) => r.eventType === t) : n = i, n; + } + /** + * Removes all listeners + */ + removeAll() { + this.allListeners.map((e) => { + e.element.removeEventListener(e.eventType, e.handler, e.options); + }), this.allListeners = []; + } + /** + * Module cleanup on destruction + */ + destroy() { + this.removeAll(); + } + /** + * Search method: looks for listener by passed element + * + * @param {EventTarget} element - searching element + * @returns {Array} listeners that found on element + */ + findByEventTarget(e) { + return this.allListeners.filter((t) => { + if (t.element === e) + return t; + }); + } + /** + * Search method: looks for listener by passed event type + * + * @param {string} eventType - event type + * @returns {ListenerData[]} listeners that found on element + */ + findByType(e) { + return this.allListeners.filter((t) => { + if (t.eventType === e) + return t; + }); + } + /** + * Search method: looks for listener by passed handler + * + * @param {Function} handler - event handler + * @returns {ListenerData[]} listeners that found on element + */ + findByHandler(e) { + return this.allListeners.filter((t) => { + if (t.handler === e) + return t; + }); + } + /** + * Returns listener data found by id + * + * @param {string} id - listener identifier + * @returns {ListenerData} + */ + findById(e) { + return this.allListeners.find((t) => t.id === e); + } +} +class T { + /** + * @class + * @param options - Module options + * @param options.config - Module config + * @param options.eventsDispatcher - Common event bus + */ + constructor({ config: e, eventsDispatcher: t }) { + if (this.nodes = {}, this.listeners = new at(), this.readOnlyMutableListeners = { + /** + * Assigns event listener on DOM element and pushes into special array that might be removed + * + * @param {EventTarget} element - DOM Element + * @param {string} eventType - Event name + * @param {Function} handler - Event handler + * @param {boolean|AddEventListenerOptions} options - Listening options + */ + on: (o, n, i, r = !1) => { + this.mutableListenerIds.push( + this.listeners.on(o, n, i, r) + ); + }, + /** + * Clears all mutable listeners + */ + clearAll: () => { + for (const o of this.mutableListenerIds) + this.listeners.offById(o); + this.mutableListenerIds = []; + } + }, this.mutableListenerIds = [], new.target === T) + throw new TypeError("Constructors for abstract class Module are not allowed."); + this.config = e, this.eventsDispatcher = t; + } + /** + * Editor modules setter + * + * @param {EditorModules} Editor - Editor's Modules + */ + set state(e) { + this.Editor = e; + } + /** + * Remove memorized nodes + */ + removeAllNodes() { + for (const e in this.nodes) { + const t = this.nodes[e]; + t instanceof HTMLElement && t.remove(); + } + } + /** + * Returns true if current direction is RTL (Right-To-Left) + */ + get isRtl() { + return this.config.i18n.direction === "rtl"; + } +} +class k { + constructor() { + this.instance = null, this.selection = null, this.savedSelectionRange = null, this.isFakeBackgroundEnabled = !1, this.commandBackground = "backColor", this.commandRemoveFormat = "removeFormat"; + } + /** + * Editor styles + * + * @returns {{editorWrapper: string, editorZone: string}} + */ + static get CSS() { + return { + editorWrapper: "codex-editor", + editorZone: "codex-editor__redactor" + }; + } + /** + * Returns selected anchor + * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode} + * + * @returns {Node|null} + */ + static get anchorNode() { + const e = window.getSelection(); + return e ? e.anchorNode : null; + } + /** + * Returns selected anchor element + * + * @returns {Element|null} + */ + static get anchorElement() { + const e = window.getSelection(); + if (!e) + return null; + const t = e.anchorNode; + return t ? d.isElement(t) ? t : t.parentElement : null; + } + /** + * Returns selection offset according to the anchor node + * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset} + * + * @returns {number|null} + */ + static get anchorOffset() { + const e = window.getSelection(); + return e ? e.anchorOffset : null; + } + /** + * Is current selection range collapsed + * + * @returns {boolean|null} + */ + static get isCollapsed() { + const e = window.getSelection(); + return e ? e.isCollapsed : null; + } + /** + * Check current selection if it is at Editor's zone + * + * @returns {boolean} + */ + static get isAtEditor() { + return this.isSelectionAtEditor(k.get()); + } + /** + * Check if passed selection is at Editor's zone + * + * @param selection - Selection object to check + */ + static isSelectionAtEditor(e) { + if (!e) + return !1; + let t = e.anchorNode || e.focusNode; + t && t.nodeType === Node.TEXT_NODE && (t = t.parentNode); + let o = null; + return t && t instanceof Element && (o = t.closest(`.${k.CSS.editorZone}`)), o ? o.nodeType === Node.ELEMENT_NODE : !1; + } + /** + * Check if passed range at Editor zone + * + * @param range - range to check + */ + static isRangeAtEditor(e) { + if (!e) + return; + let t = e.startContainer; + t && t.nodeType === Node.TEXT_NODE && (t = t.parentNode); + let o = null; + return t && t instanceof Element && (o = t.closest(`.${k.CSS.editorZone}`)), o ? o.nodeType === Node.ELEMENT_NODE : !1; + } + /** + * Methods return boolean that true if selection exists on the page + */ + static get isSelectionExists() { + return !!k.get().anchorNode; + } + /** + * Return first range + * + * @returns {Range|null} + */ + static get range() { + return this.getRangeFromSelection(this.get()); + } + /** + * Returns range from passed Selection object + * + * @param selection - Selection object to get Range from + */ + static getRangeFromSelection(e) { + return e && e.rangeCount ? e.getRangeAt(0) : null; + } + /** + * Calculates position and size of selected text + * + * @returns {DOMRect | ClientRect} + */ + static get rect() { + let e = document.selection, t, o = { + x: 0, + y: 0, + width: 0, + height: 0 + }; + if (e && e.type !== "Control") + return e = e, t = e.createRange(), o.x = t.boundingLeft, o.y = t.boundingTop, o.width = t.boundingWidth, o.height = t.boundingHeight, o; + if (!window.getSelection) + return L("Method window.getSelection is not supported", "warn"), o; + if (e = window.getSelection(), e.rangeCount === null || isNaN(e.rangeCount)) + return L("Method SelectionUtils.rangeCount is not supported", "warn"), o; + if (e.rangeCount === 0) + return o; + if (t = e.getRangeAt(0).cloneRange(), t.getBoundingClientRect && (o = t.getBoundingClientRect()), o.x === 0 && o.y === 0) { + const n = document.createElement("span"); + if (n.getBoundingClientRect) { + n.appendChild(document.createTextNode("​")), t.insertNode(n), o = n.getBoundingClientRect(); + const i = n.parentNode; + i.removeChild(n), i.normalize(); + } + } + return o; + } + /** + * Returns selected text as String + * + * @returns {string} + */ + static get text() { + return window.getSelection ? window.getSelection().toString() : ""; + } + /** + * Returns window SelectionUtils + * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection} + * + * @returns {Selection} + */ + static get() { + return window.getSelection(); + } + /** + * Set focus to contenteditable or native input element + * + * @param element - element where to set focus + * @param offset - offset of cursor + */ + static setCursor(e, t = 0) { + const o = document.createRange(), n = window.getSelection(); + return d.isNativeInput(e) ? d.canSetCaret(e) ? (e.focus(), e.selectionStart = e.selectionEnd = t, e.getBoundingClientRect()) : void 0 : (o.setStart(e, t), o.setEnd(e, t), n.removeAllRanges(), n.addRange(o), o.getBoundingClientRect()); + } + /** + * Check if current range exists and belongs to container + * + * @param container - where range should be + */ + static isRangeInsideContainer(e) { + const t = k.range; + return t === null ? !1 : e.contains(t.startContainer); + } + /** + * Adds fake cursor to the current range + */ + static addFakeCursor() { + const e = k.range; + if (e === null) + return; + const t = d.make("span", "codex-editor__fake-cursor"); + t.dataset.mutationFree = "true", e.collapse(), e.insertNode(t); + } + /** + * Check if passed element contains a fake cursor + * + * @param el - where to check + */ + static isFakeCursorInsideContainer(e) { + return d.find(e, ".codex-editor__fake-cursor") !== null; + } + /** + * Removes fake cursor from a container + * + * @param container - container to look for + */ + static removeFakeCursor(e = document.body) { + const t = d.find(e, ".codex-editor__fake-cursor"); + t && t.remove(); + } + /** + * Removes fake background + */ + removeFakeBackground() { + this.isFakeBackgroundEnabled && (this.isFakeBackgroundEnabled = !1, document.execCommand(this.commandRemoveFormat)); + } + /** + * Sets fake background + */ + setFakeBackground() { + document.execCommand(this.commandBackground, !1, "#a8d6ff"), this.isFakeBackgroundEnabled = !0; + } + /** + * Save SelectionUtils's range + */ + save() { + this.savedSelectionRange = k.range; + } + /** + * Restore saved SelectionUtils's range + */ + restore() { + if (!this.savedSelectionRange) + return; + const e = window.getSelection(); + e.removeAllRanges(), e.addRange(this.savedSelectionRange); + } + /** + * Clears saved selection + */ + clearSaved() { + this.savedSelectionRange = null; + } + /** + * Collapse current selection + */ + collapseToEnd() { + const e = window.getSelection(), t = document.createRange(); + t.selectNodeContents(e.focusNode), t.collapse(!1), e.removeAllRanges(), e.addRange(t); + } + /** + * Looks ahead to find passed tag from current selection + * + * @param {string} tagName - tag to found + * @param {string} [className] - tag's class name + * @param {number} [searchDepth] - count of tags that can be included. For better performance. + * @returns {HTMLElement|null} + */ + findParentTag(e, t, o = 10) { + const n = window.getSelection(); + let i = null; + return !n || !n.anchorNode || !n.focusNode ? null : ([ + /** the Node in which the selection begins */ + n.anchorNode, + /** the Node in which the selection ends */ + n.focusNode + ].forEach((a) => { + let l = o; + for (; l > 0 && a.parentNode && !(a.tagName === e && (i = a, t && a.classList && !a.classList.contains(t) && (i = null), i)); ) + a = a.parentNode, l--; + }), i); + } + /** + * Expands selection range to the passed parent node + * + * @param {HTMLElement} element - element which contents should be selected + */ + expandToTag(e) { + const t = window.getSelection(); + t.removeAllRanges(); + const o = document.createRange(); + o.selectNodeContents(e), t.addRange(o); + } +} +function Kt(s, e) { + const { type: t, target: o, addedNodes: n, removedNodes: i } = s; + if (o === e) + return !0; + if (["characterData", "attributes"].includes(t)) { + const l = o.nodeType === Node.TEXT_NODE ? o.parentNode : o; + return e.contains(l); + } + const r = Array.from(n).some((l) => e.contains(l)), a = Array.from(i).some((l) => e.contains(l)); + return r || a; +} +const Ie = "redactor dom changed", lt = "block changed", ct = "fake cursor is about to be toggled", dt = "fake cursor have been set"; +function qe(s, e) { + return s.mergeable && s.name === e.name; +} +function Xt(s, e) { + const t = e == null ? void 0 : e.export; + return D(t) ? t(s) : J(t) ? s[t] : (t !== void 0 && L("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."), ""); +} +function qt(s, e) { + const t = e == null ? void 0 : e.import; + return D(t) ? t(s) : J(t) ? { + [t]: s + } : (t !== void 0 && L("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."), {}); +} +var X = /* @__PURE__ */ ((s) => (s.APPEND_CALLBACK = "appendCallback", s.RENDERED = "rendered", s.MOVED = "moved", s.UPDATED = "updated", s.REMOVED = "removed", s.ON_PASTE = "onPaste", s))(X || {}); +class H extends xe { + /** + * @param options - block constructor options + * @param [options.id] - block's id. Will be generated if omitted. + * @param options.data - Tool's initial data + * @param options.tool — block's tool + * @param options.api - Editor API module for pass it to the Block Tunes + * @param options.readOnly - Read-Only flag + * @param [eventBus] - Editor common event bus. Allows to subscribe on some Editor events. Could be omitted when "virtual" Block is created. See BlocksAPI@composeBlockData. + */ + constructor({ + id: e = jt(), + data: t, + tool: o, + api: n, + readOnly: i, + tunesData: r + }, a) { + super(), this.cachedInputs = [], this.toolRenderedElement = null, this.tunesInstances = /* @__PURE__ */ new Map(), this.defaultTunesInstances = /* @__PURE__ */ new Map(), this.unavailableTunesData = {}, this.inputIndex = 0, this.editorEventBus = null, this.handleFocus = () => { + this.dropInputsCache(), this.updateCurrentInput(); + }, this.didMutated = (l = void 0) => { + const c = l === void 0, u = l instanceof InputEvent; + !c && !u && this.detectToolRootChange(l); + let h; + c || u ? h = !0 : h = !(l.length > 0 && l.every((m) => { + const { addedNodes: p, removedNodes: v, target: O } = m; + return [ + ...Array.from(p), + ...Array.from(v), + O + ].some((A) => d.isElement(A) ? A.dataset.mutationFree === "true" : !1); + })), h && (this.dropInputsCache(), this.updateCurrentInput(), this.call( + "updated" + /* UPDATED */ + ), this.emit("didMutated", this)); + }, this.name = o.name, this.id = e, this.settings = o.settings, this.config = o.settings.config || {}, this.api = n, this.editorEventBus = a || null, this.blockAPI = new ee(this), this.tool = o, this.toolInstance = o.create(t, this.blockAPI, i), this.tunes = o.tunes, this.composeTunes(r), this.holder = this.compose(), window.requestIdleCallback(() => { + this.watchBlockMutations(), this.addInputEvents(); + }); + } + /** + * CSS classes for the Block + * + * @returns {{wrapper: string, content: string}} + */ + static get CSS() { + return { + wrapper: "ce-block", + wrapperStretched: "ce-block--stretched", + content: "ce-block__content", + focused: "ce-block--focused", + selected: "ce-block--selected", + dropTarget: "ce-block--drop-target" + }; + } + /** + * Find and return all editable elements (contenteditable and native inputs) in the Tool HTML + * + * @returns {HTMLElement[]} + */ + get inputs() { + if (this.cachedInputs.length !== 0) + return this.cachedInputs; + const e = d.findAllInputs(this.holder); + return this.inputIndex > e.length - 1 && (this.inputIndex = e.length - 1), this.cachedInputs = e, e; + } + /** + * Return current Tool`s input + * + * @returns {HTMLElement} + */ + get currentInput() { + return this.inputs[this.inputIndex]; + } + /** + * Set input index to the passed element + * + * @param {HTMLElement | Node} element - HTML Element to set as current input + */ + set currentInput(e) { + const t = this.inputs.findIndex((o) => o === e || o.contains(e)); + t !== -1 && (this.inputIndex = t); + } + /** + * Return first Tool`s input + * + * @returns {HTMLElement} + */ + get firstInput() { + return this.inputs[0]; + } + /** + * Return first Tool`s input + * + * @returns {HTMLElement} + */ + get lastInput() { + const e = this.inputs; + return e[e.length - 1]; + } + /** + * Return next Tool`s input or undefined if it doesn't exist + * + * @returns {HTMLElement} + */ + get nextInput() { + return this.inputs[this.inputIndex + 1]; + } + /** + * Return previous Tool`s input or undefined if it doesn't exist + * + * @returns {HTMLElement} + */ + get previousInput() { + return this.inputs[this.inputIndex - 1]; + } + /** + * Get Block's JSON data + * + * @returns {object} + */ + get data() { + return this.save().then((e) => e && !K(e.data) ? e.data : {}); + } + /** + * Returns tool's sanitizer config + * + * @returns {object} + */ + get sanitize() { + return this.tool.sanitizeConfig; + } + /** + * is block mergeable + * We plugin have merge function then we call it mergeable + * + * @returns {boolean} + */ + get mergeable() { + return D(this.toolInstance.merge); + } + /** + * Check block for emptiness + * + * @returns {boolean} + */ + get isEmpty() { + const e = d.isEmpty(this.pluginsContent), t = !this.hasMedia; + return e && t; + } + /** + * Check if block has a media content such as images, iframe and other + * + * @returns {boolean} + */ + get hasMedia() { + const e = [ + "img", + "iframe", + "video", + "audio", + "source", + "input", + "textarea", + "twitterwidget" + ]; + return !!this.holder.querySelector(e.join(",")); + } + /** + * Set focused state + * + * @param {boolean} state - 'true' to select, 'false' to remove selection + */ + set focused(e) { + this.holder.classList.toggle(H.CSS.focused, e); + } + /** + * Get Block's focused state + */ + get focused() { + return this.holder.classList.contains(H.CSS.focused); + } + /** + * Set selected state + * We don't need to mark Block as Selected when it is empty + * + * @param {boolean} state - 'true' to select, 'false' to remove selection + */ + set selected(e) { + var n, i; + this.holder.classList.toggle(H.CSS.selected, e); + const t = e === !0 && k.isRangeInsideContainer(this.holder), o = e === !1 && k.isFakeCursorInsideContainer(this.holder); + (t || o) && ((n = this.editorEventBus) == null || n.emit(ct, { state: e }), t ? k.addFakeCursor() : k.removeFakeCursor(this.holder), (i = this.editorEventBus) == null || i.emit(dt, { state: e })); + } + /** + * Returns True if it is Selected + * + * @returns {boolean} + */ + get selected() { + return this.holder.classList.contains(H.CSS.selected); + } + /** + * Set stretched state + * + * @param {boolean} state - 'true' to enable, 'false' to disable stretched state + */ + set stretched(e) { + this.holder.classList.toggle(H.CSS.wrapperStretched, e); + } + /** + * Return Block's stretched state + * + * @returns {boolean} + */ + get stretched() { + return this.holder.classList.contains(H.CSS.wrapperStretched); + } + /** + * Toggle drop target state + * + * @param {boolean} state - 'true' if block is drop target, false otherwise + */ + set dropTarget(e) { + this.holder.classList.toggle(H.CSS.dropTarget, e); + } + /** + * Returns Plugins content + * + * @returns {HTMLElement} + */ + get pluginsContent() { + return this.toolRenderedElement; + } + /** + * Calls Tool's method + * + * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function + * + * @param {string} methodName - method to call + * @param {object} params - method argument + */ + call(e, t) { + if (D(this.toolInstance[e])) { + e === "appendCallback" && L( + "`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead", + "warn" + ); + try { + this.toolInstance[e].call(this.toolInstance, t); + } catch (o) { + L(`Error during '${e}' call: ${o.message}`, "error"); + } + } + } + /** + * Call plugins merge method + * + * @param {BlockToolData} data - data to merge + */ + async mergeWith(e) { + await this.toolInstance.merge(e); + } + /** + * Extracts data from Block + * Groups Tool's save processing time + * + * @returns {object} + */ + async save() { + const e = await this.toolInstance.save(this.pluginsContent), t = this.unavailableTunesData; + [ + ...this.tunesInstances.entries(), + ...this.defaultTunesInstances.entries() + ].forEach(([i, r]) => { + if (D(r.save)) + try { + t[i] = r.save(); + } catch (a) { + L(`Tune ${r.constructor.name} save method throws an Error %o`, "warn", a); + } + }); + const o = window.performance.now(); + let n; + return Promise.resolve(e).then((i) => (n = window.performance.now(), { + id: this.id, + tool: this.name, + data: i, + tunes: t, + time: n - o + })).catch((i) => { + L(`Saving process for ${this.name} tool failed due to the ${i}`, "log", "red"); + }); + } + /** + * Uses Tool's validation method to check the correctness of output data + * Tool's validation method is optional + * + * @description Method returns true|false whether data passed the validation or not + * @param {BlockToolData} data - data to validate + * @returns {Promise} valid + */ + async validate(e) { + let t = !0; + return this.toolInstance.validate instanceof Function && (t = await this.toolInstance.validate(e)), t; + } + /** + * Returns data to render in tunes menu. + * Splits block tunes settings into 2 groups: popover items and custom html. + */ + getTunes() { + const e = document.createElement("div"), t = [], o = typeof this.toolInstance.renderSettings == "function" ? this.toolInstance.renderSettings() : [], n = [ + ...this.tunesInstances.values(), + ...this.defaultTunesInstances.values() + ].map((i) => i.render()); + return [o, n].flat().forEach((i) => { + d.isElement(i) ? e.appendChild(i) : Array.isArray(i) ? t.push(...i) : t.push(i); + }), [t, e]; + } + /** + * Update current input index with selection anchor node + */ + updateCurrentInput() { + this.currentInput = d.isNativeInput(document.activeElement) || !k.anchorNode ? document.activeElement : k.anchorNode; + } + /** + * Allows to say Editor that Block was changed. Used to manually trigger Editor's 'onChange' callback + * Can be useful for block changes invisible for editor core. + */ + dispatchChange() { + this.didMutated(); + } + /** + * Call Tool instance destroy method + */ + destroy() { + this.unwatchBlockMutations(), this.removeInputEvents(), super.destroy(), D(this.toolInstance.destroy) && this.toolInstance.destroy(); + } + /** + * Tool could specify several entries to be displayed at the Toolbox (for example, "Heading 1", "Heading 2", "Heading 3") + * This method returns the entry that is related to the Block (depended on the Block data) + */ + async getActiveToolboxEntry() { + const e = this.tool.toolbox; + if (e.length === 1) + return Promise.resolve(this.tool.toolbox[0]); + const t = await this.data; + return e.find((n) => Object.entries(n.data).some(([i, r]) => t[i] && $t(t[i], r))); + } + /** + * Exports Block data as string using conversion config + */ + async exportDataAsString() { + const e = await this.data; + return Xt(e, this.tool.conversionConfig); + } + /** + * Make default Block wrappers and put Tool`s content there + * + * @returns {HTMLDivElement} + */ + compose() { + const e = d.make("div", H.CSS.wrapper), t = d.make("div", H.CSS.content), o = this.toolInstance.render(); + e.dataset.id = this.id, this.toolRenderedElement = o, t.appendChild(this.toolRenderedElement); + let n = t; + return [...this.tunesInstances.values(), ...this.defaultTunesInstances.values()].forEach((i) => { + if (D(i.wrap)) + try { + n = i.wrap(n); + } catch (r) { + L(`Tune ${i.constructor.name} wrap method throws an Error %o`, "warn", r); + } + }), e.appendChild(n), e; + } + /** + * Instantiate Block Tunes + * + * @param tunesData - current Block tunes data + * @private + */ + composeTunes(e) { + Array.from(this.tunes.values()).forEach((t) => { + (t.isInternal ? this.defaultTunesInstances : this.tunesInstances).set(t.name, t.create(e[t.name], this.blockAPI)); + }), Object.entries(e).forEach(([t, o]) => { + this.tunesInstances.has(t) || (this.unavailableTunesData[t] = o); + }); + } + /** + * Adds focus event listeners to all inputs and contenteditable + */ + addInputEvents() { + this.inputs.forEach((e) => { + e.addEventListener("focus", this.handleFocus), d.isNativeInput(e) && e.addEventListener("input", this.didMutated); + }); + } + /** + * removes focus event listeners from all inputs and contenteditable + */ + removeInputEvents() { + this.inputs.forEach((e) => { + e.removeEventListener("focus", this.handleFocus), d.isNativeInput(e) && e.removeEventListener("input", this.didMutated); + }); + } + /** + * Listen common editor Dom Changed event and detect mutations related to the Block + */ + watchBlockMutations() { + var e; + this.redactorDomChangedCallback = (t) => { + const { mutations: o } = t; + o.some((i) => Kt(i, this.toolRenderedElement)) && this.didMutated(o); + }, (e = this.editorEventBus) == null || e.on(Ie, this.redactorDomChangedCallback); + } + /** + * Remove redactor dom change event listener + */ + unwatchBlockMutations() { + var e; + (e = this.editorEventBus) == null || e.off(Ie, this.redactorDomChangedCallback); + } + /** + * Sometimes Tool can replace own main element, for example H2 -> H4 or UL -> OL + * We need to detect such changes and update a link to tools main element with the new one + * + * @param mutations - records of block content mutations + */ + detectToolRootChange(e) { + e.forEach((t) => { + if (Array.from(t.removedNodes).includes(this.toolRenderedElement)) { + const n = t.addedNodes[t.addedNodes.length - 1]; + this.toolRenderedElement = n; + } + }); + } + /** + * Clears inputs cached value + */ + dropInputsCache() { + this.cachedInputs = []; + } +} +class Gt extends T { + constructor() { + super(...arguments), this.insert = (e = this.config.defaultBlock, t = {}, o = {}, n, i, r, a) => { + const l = this.Editor.BlockManager.insert({ + id: a, + tool: e, + data: t, + index: n, + needToFocus: i, + replace: r + }); + return new ee(l); + }, this.composeBlockData = async (e) => { + const t = this.Editor.Tools.blockTools.get(e); + return new H({ + tool: t, + api: this.Editor.API, + readOnly: !0, + data: {}, + tunesData: {} + }).data; + }, this.update = async (e, t) => { + const { BlockManager: o } = this.Editor, n = o.getBlockById(e); + if (n === void 0) + throw new Error(`Block with id "${e}" not found`); + const i = await o.update(n, t); + return new ee(i); + }, this.convert = (e, t, o) => { + var h, f; + const { BlockManager: n, Tools: i } = this.Editor, r = n.getBlockById(e); + if (!r) + throw new Error(`Block with id "${e}" not found`); + const a = i.blockTools.get(r.name), l = i.blockTools.get(t); + if (!l) + throw new Error(`Block Tool with type "${t}" not found`); + const c = ((h = a == null ? void 0 : a.conversionConfig) == null ? void 0 : h.export) !== void 0, u = ((f = l.conversionConfig) == null ? void 0 : f.import) !== void 0; + if (c && u) + n.convert(r, t, o); + else { + const m = [ + c ? !1 : ae(r.name), + u ? !1 : ae(t) + ].filter(Boolean).join(" and "); + throw new Error(`Conversion from "${r.name}" to "${t}" is not possible. ${m} tool(s) should provide a "conversionConfig"`); + } + }, this.insertMany = (e, t = this.Editor.BlockManager.blocks.length - 1) => { + this.validateIndex(t); + const o = e.map(({ id: n, type: i, data: r }) => this.Editor.BlockManager.composeBlock({ + id: n, + tool: i || this.config.defaultBlock, + data: r + })); + return this.Editor.BlockManager.insertMany(o, t), o.map((n) => new ee(n)); + }; + } + /** + * Available methods + * + * @returns {Blocks} + */ + get methods() { + return { + clear: () => this.clear(), + render: (e) => this.render(e), + renderFromHTML: (e) => this.renderFromHTML(e), + delete: (e) => this.delete(e), + swap: (e, t) => this.swap(e, t), + move: (e, t) => this.move(e, t), + getBlockByIndex: (e) => this.getBlockByIndex(e), + getById: (e) => this.getById(e), + getCurrentBlockIndex: () => this.getCurrentBlockIndex(), + getBlockIndex: (e) => this.getBlockIndex(e), + getBlocksCount: () => this.getBlocksCount(), + stretchBlock: (e, t = !0) => this.stretchBlock(e, t), + insertNewBlock: () => this.insertNewBlock(), + insert: this.insert, + insertMany: this.insertMany, + update: this.update, + composeBlockData: this.composeBlockData, + convert: this.convert + }; + } + /** + * Returns Blocks count + * + * @returns {number} + */ + getBlocksCount() { + return this.Editor.BlockManager.blocks.length; + } + /** + * Returns current block index + * + * @returns {number} + */ + getCurrentBlockIndex() { + return this.Editor.BlockManager.currentBlockIndex; + } + /** + * Returns the index of Block by id; + * + * @param id - block id + */ + getBlockIndex(e) { + const t = this.Editor.BlockManager.getBlockById(e); + if (!t) { + Y("There is no block with id `" + e + "`", "warn"); + return; + } + return this.Editor.BlockManager.getBlockIndex(t); + } + /** + * Returns BlockAPI object by Block index + * + * @param {number} index - index to get + */ + getBlockByIndex(e) { + const t = this.Editor.BlockManager.getBlockByIndex(e); + if (t === void 0) { + Y("There is no block at index `" + e + "`", "warn"); + return; + } + return new ee(t); + } + /** + * Returns BlockAPI object by Block id + * + * @param id - id of block to get + */ + getById(e) { + const t = this.Editor.BlockManager.getBlockById(e); + return t === void 0 ? (Y("There is no block with id `" + e + "`", "warn"), null) : new ee(t); + } + /** + * Call Block Manager method that swap Blocks + * + * @param {number} fromIndex - position of first Block + * @param {number} toIndex - position of second Block + * @deprecated — use 'move' instead + */ + swap(e, t) { + L( + "`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead", + "info" + ), this.Editor.BlockManager.swap(e, t); + } + /** + * Move block from one index to another + * + * @param {number} toIndex - index to move to + * @param {number} fromIndex - index to move from + */ + move(e, t) { + this.Editor.BlockManager.move(e, t); + } + /** + * Deletes Block + * + * @param {number} blockIndex - index of Block to delete + */ + delete(e = this.Editor.BlockManager.currentBlockIndex) { + try { + const t = this.Editor.BlockManager.getBlockByIndex(e); + this.Editor.BlockManager.removeBlock(t); + } catch (t) { + Y(t, "warn"); + return; + } + this.Editor.BlockManager.blocks.length === 0 && this.Editor.BlockManager.insert(), this.Editor.BlockManager.currentBlock && this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, this.Editor.Caret.positions.END), this.Editor.Toolbar.close(); + } + /** + * Clear Editor's area + */ + clear() { + this.Editor.BlockManager.clear(!0), this.Editor.InlineToolbar.close(); + } + /** + * Fills Editor with Blocks data + * + * @param {OutputData} data — Saved Editor data + */ + async render(e) { + if (e === void 0 || e.blocks === void 0) + throw new Error("Incorrect data passed to the render() method"); + return await this.Editor.BlockManager.clear(), this.Editor.Renderer.render(e.blocks); + } + /** + * Render passed HTML string + * + * @param {string} data - HTML string to render + * @returns {Promise} + */ + renderFromHTML(e) { + return this.Editor.BlockManager.clear(), this.Editor.Paste.processText(e, !0); + } + /** + * Stretch Block's content + * + * @param {number} index - index of Block to stretch + * @param {boolean} status - true to enable, false to disable + * @deprecated Use BlockAPI interface to stretch Blocks + */ + stretchBlock(e, t = !0) { + Se( + !0, + "blocks.stretchBlock()", + "BlockAPI" + ); + const o = this.Editor.BlockManager.getBlockByIndex(e); + o && (o.stretched = t); + } + /** + * Insert new Block + * After set caret to this Block + * + * @todo remove in 3.0.0 + * @deprecated with insert() method + */ + insertNewBlock() { + L("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.", "warn"), this.insert(); + } + /** + * Validated block index and throws an error if it's invalid + * + * @param index - index to validate + */ + validateIndex(e) { + if (typeof e != "number") + throw new Error("Index should be a number"); + if (e < 0) + throw new Error("Index should be greater than or equal to 0"); + if (e === null) + throw new Error("Index should be greater than or equal to 0"); + } +} +class Jt extends T { + constructor() { + super(...arguments), this.setToFirstBlock = (e = this.Editor.Caret.positions.DEFAULT, t = 0) => this.Editor.BlockManager.firstBlock ? (this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock, e, t), !0) : !1, this.setToLastBlock = (e = this.Editor.Caret.positions.DEFAULT, t = 0) => this.Editor.BlockManager.lastBlock ? (this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock, e, t), !0) : !1, this.setToPreviousBlock = (e = this.Editor.Caret.positions.DEFAULT, t = 0) => this.Editor.BlockManager.previousBlock ? (this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock, e, t), !0) : !1, this.setToNextBlock = (e = this.Editor.Caret.positions.DEFAULT, t = 0) => this.Editor.BlockManager.nextBlock ? (this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock, e, t), !0) : !1, this.setToBlock = (e, t = this.Editor.Caret.positions.DEFAULT, o = 0) => this.Editor.BlockManager.blocks[e] ? (this.Editor.Caret.setToBlock(this.Editor.BlockManager.blocks[e], t, o), !0) : !1, this.focus = (e = !1) => e ? this.setToLastBlock(this.Editor.Caret.positions.END) : this.setToFirstBlock(this.Editor.Caret.positions.START); + } + /** + * Available methods + * + * @returns {Caret} + */ + get methods() { + return { + setToFirstBlock: this.setToFirstBlock, + setToLastBlock: this.setToLastBlock, + setToPreviousBlock: this.setToPreviousBlock, + setToNextBlock: this.setToNextBlock, + setToBlock: this.setToBlock, + focus: this.focus + }; + } +} +class Qt extends T { + /** + * Available methods + * + * @returns {Events} + */ + get methods() { + return { + emit: (e, t) => this.emit(e, t), + off: (e, t) => this.off(e, t), + on: (e, t) => this.on(e, t) + }; + } + /** + * Subscribe on Events + * + * @param {string} eventName - event name to subscribe + * @param {Function} callback - event handler + */ + on(e, t) { + this.eventsDispatcher.on(e, t); + } + /** + * Emit event with data + * + * @param {string} eventName - event to emit + * @param {object} data - event's data + */ + emit(e, t) { + this.eventsDispatcher.emit(e, t); + } + /** + * Unsubscribe from Event + * + * @param {string} eventName - event to unsubscribe + * @param {Function} callback - event handler + */ + off(e, t) { + this.eventsDispatcher.off(e, t); + } +} +class Re extends T { + /** + * Return namespace section for tool or block tune + * + * @param tool - tool object + */ + static getNamespace(e) { + return e.isTune() ? `blockTunes.${e.name}` : `tools.${e.name}`; + } + /** + * Return I18n API methods with global dictionary access + */ + get methods() { + return { + t: () => { + Y("I18n.t() method can be accessed only from Tools", "warn"); + } + }; + } + /** + * Return I18n API methods with tool namespaced dictionary + * + * @param tool - Tool object + */ + getMethodsForTool(e) { + return Object.assign( + this.methods, + { + t: (t) => W.t(Re.getNamespace(e), t) + } + ); + } +} +class eo extends T { + /** + * Editor.js Core API modules + */ + get methods() { + return { + blocks: this.Editor.BlocksAPI.methods, + caret: this.Editor.CaretAPI.methods, + events: this.Editor.EventsAPI.methods, + listeners: this.Editor.ListenersAPI.methods, + notifier: this.Editor.NotifierAPI.methods, + sanitizer: this.Editor.SanitizerAPI.methods, + saver: this.Editor.SaverAPI.methods, + selection: this.Editor.SelectionAPI.methods, + styles: this.Editor.StylesAPI.classes, + toolbar: this.Editor.ToolbarAPI.methods, + inlineToolbar: this.Editor.InlineToolbarAPI.methods, + tooltip: this.Editor.TooltipAPI.methods, + i18n: this.Editor.I18nAPI.methods, + readOnly: this.Editor.ReadOnlyAPI.methods, + ui: this.Editor.UiAPI.methods + }; + } + /** + * Returns Editor.js Core API methods for passed tool + * + * @param tool - tool object + */ + getMethodsForTool(e) { + return Object.assign( + this.methods, + { + i18n: this.Editor.I18nAPI.getMethodsForTool(e) + } + ); + } +} +class to extends T { + /** + * Available methods + * + * @returns {InlineToolbar} + */ + get methods() { + return { + close: () => this.close(), + open: () => this.open() + }; + } + /** + * Open Inline Toolbar + */ + open() { + this.Editor.InlineToolbar.tryToShow(); + } + /** + * Close Inline Toolbar + */ + close() { + this.Editor.InlineToolbar.close(); + } +} +class oo extends T { + /** + * Available methods + * + * @returns {Listeners} + */ + get methods() { + return { + on: (e, t, o, n) => this.on(e, t, o, n), + off: (e, t, o, n) => this.off(e, t, o, n), + offById: (e) => this.offById(e) + }; + } + /** + * Ads a DOM event listener. Return it's id. + * + * @param {HTMLElement} element - Element to set handler to + * @param {string} eventType - event type + * @param {() => void} handler - event handler + * @param {boolean} useCapture - capture event or not + */ + on(e, t, o, n) { + return this.listeners.on(e, t, o, n); + } + /** + * Removes DOM listener from element + * + * @param {Element} element - Element to remove handler from + * @param eventType - event type + * @param handler - event handler + * @param {boolean} useCapture - capture event or not + */ + off(e, t, o, n) { + this.listeners.off(e, t, o, n); + } + /** + * Removes DOM listener by the listener id + * + * @param id - id of the listener to remove + */ + offById(e) { + this.listeners.offById(e); + } +} +var Me = {}, no = { + get exports() { + return Me; + }, + set exports(s) { + Me = s; + } +}; +(function(s, e) { + (function(t, o) { + s.exports = o(); + })(window, function() { + return function(t) { + var o = {}; + function n(i) { + if (o[i]) + return o[i].exports; + var r = o[i] = { i, l: !1, exports: {} }; + return t[i].call(r.exports, r, r.exports, n), r.l = !0, r.exports; + } + return n.m = t, n.c = o, n.d = function(i, r, a) { + n.o(i, r) || Object.defineProperty(i, r, { enumerable: !0, get: a }); + }, n.r = function(i) { + typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 }); + }, n.t = function(i, r) { + if (1 & r && (i = n(i)), 8 & r || 4 & r && typeof i == "object" && i && i.__esModule) + return i; + var a = /* @__PURE__ */ Object.create(null); + if (n.r(a), Object.defineProperty(a, "default", { enumerable: !0, value: i }), 2 & r && typeof i != "string") + for (var l in i) + n.d(a, l, function(c) { + return i[c]; + }.bind(null, l)); + return a; + }, n.n = function(i) { + var r = i && i.__esModule ? function() { + return i.default; + } : function() { + return i; + }; + return n.d(r, "a", r), r; + }, n.o = function(i, r) { + return Object.prototype.hasOwnProperty.call(i, r); + }, n.p = "/", n(n.s = 0); + }([function(t, o, n) { + n(1), /*! + * Codex JavaScript Notification module + * https://github.com/codex-team/js-notifier + */ + t.exports = function() { + var i = n(6), r = "cdx-notify--bounce-in", a = null; + return { show: function(l) { + if (l.message) { + (function() { + if (a) + return !0; + a = i.getWrapper(), document.body.appendChild(a); + })(); + var c = null, u = l.time || 8e3; + switch (l.type) { + case "confirm": + c = i.confirm(l); + break; + case "prompt": + c = i.prompt(l); + break; + default: + c = i.alert(l), window.setTimeout(function() { + c.remove(); + }, u); + } + a.appendChild(c), c.classList.add(r); + } + } }; + }(); + }, function(t, o, n) { + var i = n(2); + typeof i == "string" && (i = [[t.i, i, ""]]); + var r = { hmr: !0, transform: void 0, insertInto: void 0 }; + n(4)(i, r), i.locals && (t.exports = i.locals); + }, function(t, o, n) { + (t.exports = n(3)(!1)).push([t.i, `.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:'';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:'';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}`, ""]); + }, function(t, o) { + t.exports = function(n) { + var i = []; + return i.toString = function() { + return this.map(function(r) { + var a = function(l, c) { + var u = l[1] || "", h = l[3]; + if (!h) + return u; + if (c && typeof btoa == "function") { + var f = (p = h, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(p)))) + " */"), m = h.sources.map(function(v) { + return "/*# sourceURL=" + h.sourceRoot + v + " */"; + }); + return [u].concat(m).concat([f]).join(` +`); + } + var p; + return [u].join(` +`); + }(r, n); + return r[2] ? "@media " + r[2] + "{" + a + "}" : a; + }).join(""); + }, i.i = function(r, a) { + typeof r == "string" && (r = [[null, r, ""]]); + for (var l = {}, c = 0; c < this.length; c++) { + var u = this[c][0]; + typeof u == "number" && (l[u] = !0); + } + for (c = 0; c < r.length; c++) { + var h = r[c]; + typeof h[0] == "number" && l[h[0]] || (a && !h[2] ? h[2] = a : a && (h[2] = "(" + h[2] + ") and (" + a + ")"), i.push(h)); + } + }, i; + }; + }, function(t, o, n) { + var i, r, a = {}, l = (i = function() { + return window && document && document.all && !window.atob; + }, function() { + return r === void 0 && (r = i.apply(this, arguments)), r; + }), c = function(b) { + var g = {}; + return function(y) { + if (typeof y == "function") + return y(); + if (g[y] === void 0) { + var E = function(_) { + return document.querySelector(_); + }.call(this, y); + if (window.HTMLIFrameElement && E instanceof window.HTMLIFrameElement) + try { + E = E.contentDocument.head; + } catch { + E = null; + } + g[y] = E; + } + return g[y]; + }; + }(), u = null, h = 0, f = [], m = n(5); + function p(b, g) { + for (var y = 0; y < b.length; y++) { + var E = b[y], _ = a[E.id]; + if (_) { + _.refs++; + for (var S = 0; S < _.parts.length; S++) + _.parts[S](E.parts[S]); + for (; S < E.parts.length; S++) + _.parts.push(x(E.parts[S], g)); + } else { + var F = []; + for (S = 0; S < E.parts.length; S++) + F.push(x(E.parts[S], g)); + a[E.id] = { id: E.id, refs: 1, parts: F }; + } + } + } + function v(b, g) { + for (var y = [], E = {}, _ = 0; _ < b.length; _++) { + var S = b[_], F = g.base ? S[0] + g.base : S[0], M = { css: S[1], media: S[2], sourceMap: S[3] }; + E[F] ? E[F].parts.push(M) : y.push(E[F] = { id: F, parts: [M] }); + } + return y; + } + function O(b, g) { + var y = c(b.insertInto); + if (!y) + throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); + var E = f[f.length - 1]; + if (b.insertAt === "top") + E ? E.nextSibling ? y.insertBefore(g, E.nextSibling) : y.appendChild(g) : y.insertBefore(g, y.firstChild), f.push(g); + else if (b.insertAt === "bottom") + y.appendChild(g); + else { + if (typeof b.insertAt != "object" || !b.insertAt.before) + throw new Error(`[Style Loader] + + Invalid value for parameter 'insertAt' ('options.insertAt') found. + Must be 'top', 'bottom', or Object. + (https://github.com/webpack-contrib/style-loader#insertat) +`); + var _ = c(b.insertInto + " " + b.insertAt.before); + y.insertBefore(g, _); + } + } + function N(b) { + if (b.parentNode === null) + return !1; + b.parentNode.removeChild(b); + var g = f.indexOf(b); + g >= 0 && f.splice(g, 1); + } + function A(b) { + var g = document.createElement("style"); + return b.attrs.type === void 0 && (b.attrs.type = "text/css"), C(g, b.attrs), O(b, g), g; + } + function C(b, g) { + Object.keys(g).forEach(function(y) { + b.setAttribute(y, g[y]); + }); + } + function x(b, g) { + var y, E, _, S; + if (g.transform && b.css) { + if (!(S = g.transform(b.css))) + return function() { + }; + b.css = S; + } + if (g.singleton) { + var F = h++; + y = u || (u = A(g)), E = R.bind(null, y, F, !1), _ = R.bind(null, y, F, !0); + } else + b.sourceMap && typeof URL == "function" && typeof URL.createObjectURL == "function" && typeof URL.revokeObjectURL == "function" && typeof Blob == "function" && typeof btoa == "function" ? (y = function(M) { + var V = document.createElement("link"); + return M.attrs.type === void 0 && (M.attrs.type = "text/css"), M.attrs.rel = "stylesheet", C(V, M.attrs), O(M, V), V; + }(g), E = function(M, V, de) { + var Q = de.css, Ce = de.sourceMap, St = V.convertToAbsoluteUrls === void 0 && Ce; + (V.convertToAbsoluteUrls || St) && (Q = m(Q)), Ce && (Q += ` +/*# sourceMappingURL=data:application/json;base64,` + btoa(unescape(encodeURIComponent(JSON.stringify(Ce)))) + " */"); + var It = new Blob([Q], { type: "text/css" }), Ye = M.href; + M.href = URL.createObjectURL(It), Ye && URL.revokeObjectURL(Ye); + }.bind(null, y, g), _ = function() { + N(y), y.href && URL.revokeObjectURL(y.href); + }) : (y = A(g), E = function(M, V) { + var de = V.css, Q = V.media; + if (Q && M.setAttribute("media", Q), M.styleSheet) + M.styleSheet.cssText = de; + else { + for (; M.firstChild; ) + M.removeChild(M.firstChild); + M.appendChild(document.createTextNode(de)); + } + }.bind(null, y), _ = function() { + N(y); + }); + return E(b), function(M) { + if (M) { + if (M.css === b.css && M.media === b.media && M.sourceMap === b.sourceMap) + return; + E(b = M); + } else + _(); + }; + } + t.exports = function(b, g) { + if (typeof DEBUG < "u" && DEBUG && typeof document != "object") + throw new Error("The style-loader cannot be used in a non-browser environment"); + (g = g || {}).attrs = typeof g.attrs == "object" ? g.attrs : {}, g.singleton || typeof g.singleton == "boolean" || (g.singleton = l()), g.insertInto || (g.insertInto = "head"), g.insertAt || (g.insertAt = "bottom"); + var y = v(b, g); + return p(y, g), function(E) { + for (var _ = [], S = 0; S < y.length; S++) { + var F = y[S]; + (M = a[F.id]).refs--, _.push(M); + } + for (E && p(v(E, g), g), S = 0; S < _.length; S++) { + var M; + if ((M = _[S]).refs === 0) { + for (var V = 0; V < M.parts.length; V++) + M.parts[V](); + delete a[M.id]; + } + } + }; + }; + var w, I = (w = [], function(b, g) { + return w[b] = g, w.filter(Boolean).join(` +`); + }); + function R(b, g, y, E) { + var _ = y ? "" : E.css; + if (b.styleSheet) + b.styleSheet.cssText = I(g, _); + else { + var S = document.createTextNode(_), F = b.childNodes; + F[g] && b.removeChild(F[g]), F.length ? b.insertBefore(S, F[g]) : b.appendChild(S); + } + } + }, function(t, o) { + t.exports = function(n) { + var i = typeof window < "u" && window.location; + if (!i) + throw new Error("fixUrls requires window.location"); + if (!n || typeof n != "string") + return n; + var r = i.protocol + "//" + i.host, a = r + i.pathname.replace(/\/[^\/]*$/, "/"); + return n.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(l, c) { + var u, h = c.trim().replace(/^"(.*)"$/, function(f, m) { + return m; + }).replace(/^'(.*)'$/, function(f, m) { + return m; + }); + return /^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(h) ? l : (u = h.indexOf("//") === 0 ? h : h.indexOf("/") === 0 ? r + h : a + h.replace(/^\.\//, ""), "url(" + JSON.stringify(u) + ")"); + }); + }; + }, function(t, o, n) { + var i, r, a, l, c, u, h, f, m; + t.exports = (i = "cdx-notifies", r = "cdx-notify", a = "cdx-notify__cross", l = "cdx-notify__button--confirm", c = "cdx-notify__button--cancel", u = "cdx-notify__input", h = "cdx-notify__button", f = "cdx-notify__btns-wrapper", { alert: m = function(p) { + var v = document.createElement("DIV"), O = document.createElement("DIV"), N = p.message, A = p.style; + return v.classList.add(r), A && v.classList.add(r + "--" + A), v.innerHTML = N, O.classList.add(a), O.addEventListener("click", v.remove.bind(v)), v.appendChild(O), v; + }, confirm: function(p) { + var v = m(p), O = document.createElement("div"), N = document.createElement("button"), A = document.createElement("button"), C = v.querySelector("." + a), x = p.cancelHandler, w = p.okHandler; + return O.classList.add(f), N.innerHTML = p.okText || "Confirm", A.innerHTML = p.cancelText || "Cancel", N.classList.add(h), A.classList.add(h), N.classList.add(l), A.classList.add(c), x && typeof x == "function" && (A.addEventListener("click", x), C.addEventListener("click", x)), w && typeof w == "function" && N.addEventListener("click", w), N.addEventListener("click", v.remove.bind(v)), A.addEventListener("click", v.remove.bind(v)), O.appendChild(N), O.appendChild(A), v.appendChild(O), v; + }, prompt: function(p) { + var v = m(p), O = document.createElement("div"), N = document.createElement("button"), A = document.createElement("input"), C = v.querySelector("." + a), x = p.cancelHandler, w = p.okHandler; + return O.classList.add(f), N.innerHTML = p.okText || "Ok", N.classList.add(h), N.classList.add(l), A.classList.add(u), p.placeholder && A.setAttribute("placeholder", p.placeholder), p.default && (A.value = p.default), p.inputType && (A.type = p.inputType), x && typeof x == "function" && C.addEventListener("click", x), w && typeof w == "function" && N.addEventListener("click", function() { + w(A.value); + }), N.addEventListener("click", v.remove.bind(v)), O.appendChild(A), O.appendChild(N), v.appendChild(O), v; + }, getWrapper: function() { + var p = document.createElement("DIV"); + return p.classList.add(i), p; + } }); + }]); + }); +})(no); +const io = /* @__PURE__ */ ve(Me); +class so { + /** + * Show web notification + * + * @param {NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions} options - notification options + */ + show(e) { + io.show(e); + } +} +class ro extends T { + /** + * @param moduleConfiguration - Module Configuration + * @param moduleConfiguration.config - Editor's config + * @param moduleConfiguration.eventsDispatcher - Editor's event dispatcher + */ + constructor({ config: e, eventsDispatcher: t }) { + super({ + config: e, + eventsDispatcher: t + }), this.notifier = new so(); + } + /** + * Available methods + */ + get methods() { + return { + show: (e) => this.show(e) + }; + } + /** + * Show notification + * + * @param {NotifierOptions} options - message option + */ + show(e) { + return this.notifier.show(e); + } +} +class ao extends T { + /** + * Available methods + */ + get methods() { + const e = () => this.isEnabled; + return { + toggle: (t) => this.toggle(t), + get isEnabled() { + return e(); + } + }; + } + /** + * Set or toggle read-only state + * + * @param {boolean|undefined} state - set or toggle state + * @returns {boolean} current value + */ + toggle(e) { + return this.Editor.ReadOnly.toggle(e); + } + /** + * Returns current read-only state + */ + get isEnabled() { + return this.Editor.ReadOnly.isEnabled; + } +} +var Le = {}, lo = { + get exports() { + return Le; + }, + set exports(s) { + Le = s; + } +}; +(function(s, e) { + (function(t, o) { + s.exports = o(); + })(Mt, function() { + function t(h) { + var f = h.tags, m = Object.keys(f), p = m.map(function(v) { + return typeof f[v]; + }).every(function(v) { + return v === "object" || v === "boolean" || v === "function"; + }); + if (!p) + throw new Error("The configuration was invalid"); + this.config = h; + } + var o = ["P", "LI", "TD", "TH", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "PRE"]; + function n(h) { + return o.indexOf(h.nodeName) !== -1; + } + var i = ["A", "B", "STRONG", "I", "EM", "SUB", "SUP", "U", "STRIKE"]; + function r(h) { + return i.indexOf(h.nodeName) !== -1; + } + t.prototype.clean = function(h) { + const f = document.implementation.createHTMLDocument(), m = f.createElement("div"); + return m.innerHTML = h, this._sanitize(f, m), m.innerHTML; + }, t.prototype._sanitize = function(h, f) { + var m = a(h, f), p = m.firstChild(); + if (p) + do { + if (p.nodeType === Node.TEXT_NODE) + if (p.data.trim() === "" && (p.previousElementSibling && n(p.previousElementSibling) || p.nextElementSibling && n(p.nextElementSibling))) { + f.removeChild(p), this._sanitize(h, f); + break; + } else + continue; + if (p.nodeType === Node.COMMENT_NODE) { + f.removeChild(p), this._sanitize(h, f); + break; + } + var v = r(p), O; + v && (O = Array.prototype.some.call(p.childNodes, n)); + var N = !!f.parentNode, A = n(f) && n(p) && N, C = p.nodeName.toLowerCase(), x = l(this.config, C, p), w = v && O; + if (w || c(p, x) || !this.config.keepNestedBlockElements && A) { + if (!(p.nodeName === "SCRIPT" || p.nodeName === "STYLE")) + for (; p.childNodes.length > 0; ) + f.insertBefore(p.childNodes[0], p); + f.removeChild(p), this._sanitize(h, f); + break; + } + for (var I = 0; I < p.attributes.length; I += 1) { + var R = p.attributes[I]; + u(R, x, p) && (p.removeAttribute(R.name), I = I - 1); + } + this._sanitize(h, p); + } while (p = m.nextSibling()); + }; + function a(h, f) { + return h.createTreeWalker( + f, + NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT, + null, + !1 + ); + } + function l(h, f, m) { + return typeof h.tags[f] == "function" ? h.tags[f](m) : h.tags[f]; + } + function c(h, f) { + return typeof f > "u" ? !0 : typeof f == "boolean" ? !f : !1; + } + function u(h, f, m) { + var p = h.name.toLowerCase(); + return f === !0 ? !1 : typeof f[p] == "function" ? !f[p](h.value, m) : typeof f[p] > "u" || f[p] === !1 ? !0 : typeof f[p] == "string" ? f[p] !== h.value : !1; + } + return t; + }); +})(lo); +const co = Le; +function ht(s, e) { + return s.map((t) => { + const o = D(e) ? e(t.tool) : e; + return K(o) || (t.data = De(t.data, o)), t; + }); +} +function q(s, e = {}) { + const t = { + tags: e + }; + return new co(t).clean(s); +} +function De(s, e) { + return Array.isArray(s) ? ho(s, e) : j(s) ? uo(s, e) : J(s) ? po(s, e) : s; +} +function ho(s, e) { + return s.map((t) => De(t, e)); +} +function uo(s, e) { + const t = {}; + for (const o in s) { + if (!Object.prototype.hasOwnProperty.call(s, o)) + continue; + const n = s[o], i = fo(e[o]) ? e[o] : e; + t[o] = De(n, i); + } + return t; +} +function po(s, e) { + return j(e) ? q(s, e) : e === !1 ? q(s, {}) : s; +} +function fo(s) { + return j(s) || At(s) || D(s); +} +class go extends T { + /** + * Available methods + * + * @returns {SanitizerConfig} + */ + get methods() { + return { + clean: (e, t) => this.clean(e, t) + }; + } + /** + * Perform sanitizing of a string + * + * @param {string} taintString - what to sanitize + * @param {SanitizerConfig} config - sanitizer config + * @returns {string} + */ + clean(e, t) { + return q(e, t); + } +} +class bo extends T { + /** + * Available methods + * + * @returns {Saver} + */ + get methods() { + return { + save: () => this.save() + }; + } + /** + * Return Editor's data + * + * @returns {OutputData} + */ + save() { + const e = "Editor's content can not be saved in read-only mode"; + return this.Editor.ReadOnly.isEnabled ? (Y(e, "warn"), Promise.reject(new Error(e))) : this.Editor.Saver.save(); + } +} +class mo extends T { + /** + * Available methods + * + * @returns {SelectionAPIInterface} + */ + get methods() { + return { + findParentTag: (e, t) => this.findParentTag(e, t), + expandToTag: (e) => this.expandToTag(e) + }; + } + /** + * Looks ahead from selection and find passed tag with class name + * + * @param {string} tagName - tag to find + * @param {string} className - tag's class name + * @returns {HTMLElement|null} + */ + findParentTag(e, t) { + return new k().findParentTag(e, t); + } + /** + * Expand selection to passed tag + * + * @param {HTMLElement} node - tag that should contain selection + */ + expandToTag(e) { + new k().expandToTag(e); + } +} +class ko extends T { + /** + * Exported classes + */ + get classes() { + return { + /** + * Base Block styles + */ + block: "cdx-block", + /** + * Inline Tools styles + */ + inlineToolButton: "ce-inline-tool", + inlineToolButtonActive: "ce-inline-tool--active", + /** + * UI elements + */ + input: "cdx-input", + loader: "cdx-loader", + button: "cdx-button", + /** + * Settings styles + */ + settingsButton: "cdx-settings-button", + settingsButtonActive: "cdx-settings-button--active" + }; + } +} +class vo extends T { + /** + * Available methods + * + * @returns {Toolbar} + */ + get methods() { + return { + close: () => this.close(), + open: () => this.open(), + toggleBlockSettings: (e) => this.toggleBlockSettings(e), + toggleToolbox: (e) => this.toggleToolbox(e) + }; + } + /** + * Open toolbar + */ + open() { + this.Editor.Toolbar.moveAndOpen(); + } + /** + * Close toolbar and all included elements + */ + close() { + this.Editor.Toolbar.close(); + } + /** + * Toggles Block Setting of the current block + * + * @param {boolean} openingState — opening state of Block Setting + */ + toggleBlockSettings(e) { + if (this.Editor.BlockManager.currentBlockIndex === -1) { + Y("Could't toggle the Toolbar because there is no block selected ", "warn"); + return; + } + e ?? !this.Editor.BlockSettings.opened ? (this.Editor.Toolbar.moveAndOpen(), this.Editor.BlockSettings.open()) : this.Editor.BlockSettings.close(); + } + /** + * Open toolbox + * + * @param {boolean} openingState - Opening state of toolbox + */ + toggleToolbox(e) { + if (this.Editor.BlockManager.currentBlockIndex === -1) { + Y("Could't toggle the Toolbox because there is no block selected ", "warn"); + return; + } + e ?? !this.Editor.Toolbar.toolbox.opened ? (this.Editor.Toolbar.moveAndOpen(), this.Editor.Toolbar.toolbox.open()) : this.Editor.Toolbar.toolbox.close(); + } +} +var _e = {}, xo = { + get exports() { + return _e; + }, + set exports(s) { + _e = s; + } +}; +/*! + * CodeX.Tooltips + * + * @version 1.0.5 + * + * @licence MIT + * @author CodeX + * + * + */ +(function(s, e) { + (function(t, o) { + s.exports = o(); + })(window, function() { + return function(t) { + var o = {}; + function n(i) { + if (o[i]) + return o[i].exports; + var r = o[i] = { i, l: !1, exports: {} }; + return t[i].call(r.exports, r, r.exports, n), r.l = !0, r.exports; + } + return n.m = t, n.c = o, n.d = function(i, r, a) { + n.o(i, r) || Object.defineProperty(i, r, { enumerable: !0, get: a }); + }, n.r = function(i) { + typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 }); + }, n.t = function(i, r) { + if (1 & r && (i = n(i)), 8 & r || 4 & r && typeof i == "object" && i && i.__esModule) + return i; + var a = /* @__PURE__ */ Object.create(null); + if (n.r(a), Object.defineProperty(a, "default", { enumerable: !0, value: i }), 2 & r && typeof i != "string") + for (var l in i) + n.d(a, l, function(c) { + return i[c]; + }.bind(null, l)); + return a; + }, n.n = function(i) { + var r = i && i.__esModule ? function() { + return i.default; + } : function() { + return i; + }; + return n.d(r, "a", r), r; + }, n.o = function(i, r) { + return Object.prototype.hasOwnProperty.call(i, r); + }, n.p = "", n(n.s = 0); + }([function(t, o, n) { + t.exports = n(1); + }, function(t, o, n) { + n.r(o), n.d(o, "default", function() { + return i; + }); + class i { + constructor() { + this.nodes = { wrapper: null, content: null }, this.showed = !1, this.offsetTop = 10, this.offsetLeft = 10, this.offsetRight = 10, this.hidingDelay = 0, this.handleWindowScroll = () => { + this.showed && this.hide(!0); + }, this.loadStyles(), this.prepare(), window.addEventListener("scroll", this.handleWindowScroll, { passive: !0 }); + } + get CSS() { + return { tooltip: "ct", tooltipContent: "ct__content", tooltipShown: "ct--shown", placement: { left: "ct--left", bottom: "ct--bottom", right: "ct--right", top: "ct--top" } }; + } + show(a, l, c) { + this.nodes.wrapper || this.prepare(), this.hidingTimeout && clearTimeout(this.hidingTimeout); + const u = Object.assign({ placement: "bottom", marginTop: 0, marginLeft: 0, marginRight: 0, marginBottom: 0, delay: 70, hidingDelay: 0 }, c); + if (u.hidingDelay && (this.hidingDelay = u.hidingDelay), this.nodes.content.innerHTML = "", typeof l == "string") + this.nodes.content.appendChild(document.createTextNode(l)); + else { + if (!(l instanceof Node)) + throw Error("[CodeX Tooltip] Wrong type of «content» passed. It should be an instance of Node or String. But " + typeof l + " given."); + this.nodes.content.appendChild(l); + } + switch (this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)), u.placement) { + case "top": + this.placeTop(a, u); + break; + case "left": + this.placeLeft(a, u); + break; + case "right": + this.placeRight(a, u); + break; + case "bottom": + default: + this.placeBottom(a, u); + } + u && u.delay ? this.showingTimeout = setTimeout(() => { + this.nodes.wrapper.classList.add(this.CSS.tooltipShown), this.showed = !0; + }, u.delay) : (this.nodes.wrapper.classList.add(this.CSS.tooltipShown), this.showed = !0); + } + hide(a = !1) { + if (this.hidingDelay && !a) + return this.hidingTimeout && clearTimeout(this.hidingTimeout), void (this.hidingTimeout = setTimeout(() => { + this.hide(!0); + }, this.hidingDelay)); + this.nodes.wrapper.classList.remove(this.CSS.tooltipShown), this.showed = !1, this.showingTimeout && clearTimeout(this.showingTimeout); + } + onHover(a, l, c) { + a.addEventListener("mouseenter", () => { + this.show(a, l, c); + }), a.addEventListener("mouseleave", () => { + this.hide(); + }); + } + destroy() { + this.nodes.wrapper.remove(), window.removeEventListener("scroll", this.handleWindowScroll); + } + prepare() { + this.nodes.wrapper = this.make("div", this.CSS.tooltip), this.nodes.content = this.make("div", this.CSS.tooltipContent), this.append(this.nodes.wrapper, this.nodes.content), this.append(document.body, this.nodes.wrapper); + } + loadStyles() { + const a = "codex-tooltips-style"; + if (document.getElementById(a)) + return; + const l = n(2), c = this.make("style", null, { textContent: l.toString(), id: a }); + this.prepend(document.head, c); + } + placeBottom(a, l) { + const c = a.getBoundingClientRect(), u = c.left + a.clientWidth / 2 - this.nodes.wrapper.offsetWidth / 2, h = c.bottom + window.pageYOffset + this.offsetTop + l.marginTop; + this.applyPlacement("bottom", u, h); + } + placeTop(a, l) { + const c = a.getBoundingClientRect(), u = c.left + a.clientWidth / 2 - this.nodes.wrapper.offsetWidth / 2, h = c.top + window.pageYOffset - this.nodes.wrapper.clientHeight - this.offsetTop; + this.applyPlacement("top", u, h); + } + placeLeft(a, l) { + const c = a.getBoundingClientRect(), u = c.left - this.nodes.wrapper.offsetWidth - this.offsetLeft - l.marginLeft, h = c.top + window.pageYOffset + a.clientHeight / 2 - this.nodes.wrapper.offsetHeight / 2; + this.applyPlacement("left", u, h); + } + placeRight(a, l) { + const c = a.getBoundingClientRect(), u = c.right + this.offsetRight + l.marginRight, h = c.top + window.pageYOffset + a.clientHeight / 2 - this.nodes.wrapper.offsetHeight / 2; + this.applyPlacement("right", u, h); + } + applyPlacement(a, l, c) { + this.nodes.wrapper.classList.add(this.CSS.placement[a]), this.nodes.wrapper.style.left = l + "px", this.nodes.wrapper.style.top = c + "px"; + } + make(a, l = null, c = {}) { + const u = document.createElement(a); + Array.isArray(l) ? u.classList.add(...l) : l && u.classList.add(l); + for (const h in c) + c.hasOwnProperty(h) && (u[h] = c[h]); + return u; + } + append(a, l) { + Array.isArray(l) ? l.forEach((c) => a.appendChild(c)) : a.appendChild(l); + } + prepend(a, l) { + Array.isArray(l) ? (l = l.reverse()).forEach((c) => a.prepend(c)) : a.prepend(l); + } + } + }, function(t, o) { + t.exports = `.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url('data:image/svg+xml;charset=utf-8,') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}`; + }]).default; + }); +})(xo); +const wo = /* @__PURE__ */ ve(_e); +class Pe { + constructor() { + this.lib = new wo(); + } + /** + * Release the library + */ + destroy() { + this.lib.destroy(); + } + /** + * Shows tooltip on element with passed HTML content + * + * @param {HTMLElement} element - any HTML element in DOM + * @param content - tooltip's content + * @param options - showing settings + */ + show(e, t, o) { + this.lib.show(e, t, o); + } + /** + * Hides tooltip + * + * @param skipHidingDelay — pass true to immediately hide the tooltip + */ + hide(e = !1) { + this.lib.hide(e); + } + /** + * Binds 'mouseenter' and 'mouseleave' events that shows/hides the Tooltip + * + * @param {HTMLElement} element - any HTML element in DOM + * @param content - tooltip's content + * @param options - showing settings + */ + onHover(e, t, o) { + this.lib.onHover(e, t, o); + } +} +class Co extends T { + /** + * @class + * @param moduleConfiguration - Module Configuration + * @param moduleConfiguration.config - Editor's config + * @param moduleConfiguration.eventsDispatcher - Editor's event dispatcher + */ + constructor({ config: e, eventsDispatcher: t }) { + super({ + config: e, + eventsDispatcher: t + }), this.tooltip = new Pe(); + } + /** + * Destroy Module + */ + destroy() { + this.tooltip.destroy(); + } + /** + * Available methods + */ + get methods() { + return { + show: (e, t, o) => this.show(e, t, o), + hide: () => this.hide(), + onHover: (e, t, o) => this.onHover(e, t, o) + }; + } + /** + * Method show tooltip on element with passed HTML content + * + * @param {HTMLElement} element - element on which tooltip should be shown + * @param {TooltipContent} content - tooltip content + * @param {TooltipOptions} options - tooltip options + */ + show(e, t, o) { + this.tooltip.show(e, t, o); + } + /** + * Method hides tooltip on HTML page + */ + hide() { + this.tooltip.hide(); + } + /** + * Decorator for showing Tooltip by mouseenter/mouseleave + * + * @param {HTMLElement} element - element on which tooltip should be shown + * @param {TooltipContent} content - tooltip content + * @param {TooltipOptions} options - tooltip options + */ + onHover(e, t, o) { + this.tooltip.onHover(e, t, o); + } +} +class yo extends T { + /** + * Available methods / getters + */ + get methods() { + return { + nodes: this.editorNodes + /** + * There can be added some UI methods, like toggleThinMode() etc + */ + }; + } + /** + * Exported classes + */ + get editorNodes() { + return { + /** + * Top-level editor instance wrapper + */ + wrapper: this.Editor.UI.nodes.wrapper, + /** + * Element that holds all the Blocks + */ + redactor: this.Editor.UI.nodes.redactor + }; + } +} +function ut(s, e) { + const t = {}; + return Object.entries(s).forEach(([o, n]) => { + if (j(n)) { + const i = e ? `${e}.${o}` : o; + Object.values(n).every((a) => J(a)) ? t[o] = i : t[o] = ut(n, i); + return; + } + t[o] = n; + }), t; +} +const Z = ut(st); +function Bo(s, e) { + const t = {}; + return Object.keys(s).forEach((o) => { + const n = e[o]; + n !== void 0 ? t[n] = s[o] : t[o] = s[o]; + }), t; +} +const Eo = '', To = ''; +class P { + /** + * Constructs popover item instance + * + * @param params - popover item construction params + */ + constructor(e) { + this.nodes = { + root: null, + icon: null + }, this.confirmationState = null, this.removeSpecialFocusBehavior = () => { + this.nodes.root.classList.remove(P.CSS.noFocus); + }, this.removeSpecialHoverBehavior = () => { + this.nodes.root.classList.remove(P.CSS.noHover); + }, this.onErrorAnimationEnd = () => { + this.nodes.icon.classList.remove(P.CSS.wobbleAnimation), this.nodes.icon.removeEventListener("animationend", this.onErrorAnimationEnd); + }, this.params = e, this.nodes.root = this.make(e); + } + /** + * True if item is disabled and hence not clickable + */ + get isDisabled() { + return this.params.isDisabled; + } + /** + * Exposes popover item toggle parameter + */ + get toggle() { + return this.params.toggle; + } + /** + * Item title + */ + get title() { + return this.params.title; + } + /** + * True if popover should close once item is activated + */ + get closeOnActivate() { + return this.params.closeOnActivate; + } + /** + * True if confirmation state is enabled for popover item + */ + get isConfirmationStateEnabled() { + return this.confirmationState !== null; + } + /** + * True if item is focused in keyboard navigation process + */ + get isFocused() { + return this.nodes.root.classList.contains(P.CSS.focused); + } + /** + * Popover item CSS classes + */ + static get CSS() { + return { + container: "ce-popover-item", + title: "ce-popover-item__title", + secondaryTitle: "ce-popover-item__secondary-title", + icon: "ce-popover-item__icon", + active: "ce-popover-item--active", + disabled: "ce-popover-item--disabled", + focused: "ce-popover-item--focused", + hidden: "ce-popover-item--hidden", + confirmationState: "ce-popover-item--confirmation", + noHover: "ce-popover-item--no-hover", + noFocus: "ce-popover-item--no-focus", + wobbleAnimation: "wobble" + }; + } + /** + * Returns popover item root element + */ + getElement() { + return this.nodes.root; + } + /** + * Called on popover item click + */ + handleClick() { + if (this.isConfirmationStateEnabled) { + this.activateOrEnableConfirmationMode(this.confirmationState); + return; + } + this.activateOrEnableConfirmationMode(this.params); + } + /** + * Toggles item active state + * + * @param isActive - true if item should strictly should become active + */ + toggleActive(e) { + this.nodes.root.classList.toggle(P.CSS.active, e); + } + /** + * Toggles item hidden state + * + * @param isHidden - true if item should be hidden + */ + toggleHidden(e) { + this.nodes.root.classList.toggle(P.CSS.hidden, e); + } + /** + * Resets popover item to its original state + */ + reset() { + this.isConfirmationStateEnabled && this.disableConfirmationMode(); + } + /** + * Method called once item becomes focused during keyboard navigation + */ + onFocus() { + this.disableSpecialHoverAndFocusBehavior(); + } + /** + * Constructs HTML element corresponding to popover item params + * + * @param params - item construction params + */ + make(e) { + const t = d.make("div", P.CSS.container); + return e.name && (t.dataset.itemName = e.name), this.nodes.icon = d.make("div", P.CSS.icon, { + innerHTML: e.icon || Eo + }), t.appendChild(this.nodes.icon), t.appendChild(d.make("div", P.CSS.title, { + innerHTML: e.title || "" + })), e.secondaryLabel && t.appendChild(d.make("div", P.CSS.secondaryTitle, { + textContent: e.secondaryLabel + })), e.isActive && t.classList.add(P.CSS.active), e.isDisabled && t.classList.add(P.CSS.disabled), t; + } + /** + * Activates confirmation mode for the item. + * + * @param newState - new popover item params that should be applied + */ + enableConfirmationMode(e) { + const t = { + ...this.params, + ...e, + confirmation: e.confirmation + }, o = this.make(t); + this.nodes.root.innerHTML = o.innerHTML, this.nodes.root.classList.add(P.CSS.confirmationState), this.confirmationState = e, this.enableSpecialHoverAndFocusBehavior(); + } + /** + * Returns item to its original state + */ + disableConfirmationMode() { + const e = this.make(this.params); + this.nodes.root.innerHTML = e.innerHTML, this.nodes.root.classList.remove(P.CSS.confirmationState), this.confirmationState = null, this.disableSpecialHoverAndFocusBehavior(); + } + /** + * Enables special focus and hover behavior for item in confirmation state. + * This is needed to prevent item from being highlighted as hovered/focused just after click. + */ + enableSpecialHoverAndFocusBehavior() { + this.nodes.root.classList.add(P.CSS.noHover), this.nodes.root.classList.add(P.CSS.noFocus), this.nodes.root.addEventListener("mouseleave", this.removeSpecialHoverBehavior, { once: !0 }); + } + /** + * Disables special focus and hover behavior + */ + disableSpecialHoverAndFocusBehavior() { + this.removeSpecialFocusBehavior(), this.removeSpecialHoverBehavior(), this.nodes.root.removeEventListener("mouseleave", this.removeSpecialHoverBehavior); + } + /** + * Executes item's onActivate callback if the item has no confirmation configured + * + * @param item - item to activate or bring to confirmation mode + */ + activateOrEnableConfirmationMode(e) { + if (e.confirmation === void 0) + try { + e.onActivate(e), this.disableConfirmationMode(); + } catch { + this.animateError(); + } + else + this.enableConfirmationMode(e.confirmation); + } + /** + * Animates item which symbolizes that error occured while executing 'onActivate()' callback + */ + animateError() { + this.nodes.icon.classList.contains(P.CSS.wobbleAnimation) || (this.nodes.icon.classList.add(P.CSS.wobbleAnimation), this.nodes.icon.addEventListener("animationend", this.onErrorAnimationEnd)); + } +} +const he = class { + /** + * @param {HTMLElement[]} nodeList — the list of iterable HTML-items + * @param {string} focusedCssClass - user-provided CSS-class that will be set in flipping process + */ + constructor(s, e) { + this.cursor = -1, this.items = [], this.items = s || [], this.focusedCssClass = e; + } + /** + * Returns Focused button Node + * + * @returns {HTMLElement} + */ + get currentItem() { + return this.cursor === -1 ? null : this.items[this.cursor]; + } + /** + * Sets cursor to specified position + * + * @param cursorPosition - new cursor position + */ + setCursor(s) { + s < this.items.length && s >= -1 && (this.dropCursor(), this.cursor = s, this.items[this.cursor].classList.add(this.focusedCssClass)); + } + /** + * Sets items. Can be used when iterable items changed dynamically + * + * @param {HTMLElement[]} nodeList - nodes to iterate + */ + setItems(s) { + this.items = s; + } + /** + * Sets cursor next to the current + */ + next() { + this.cursor = this.leafNodesAndReturnIndex(he.directions.RIGHT); + } + /** + * Sets cursor before current + */ + previous() { + this.cursor = this.leafNodesAndReturnIndex(he.directions.LEFT); + } + /** + * Sets cursor to the default position and removes CSS-class from previously focused item + */ + dropCursor() { + this.cursor !== -1 && (this.items[this.cursor].classList.remove(this.focusedCssClass), this.cursor = -1); + } + /** + * Leafs nodes inside the target list from active element + * + * @param {string} direction - leaf direction. Can be 'left' or 'right' + * @returns {number} index of focused node + */ + leafNodesAndReturnIndex(s) { + if (this.items.length === 0) + return this.cursor; + let e = this.cursor; + return e === -1 ? e = s === he.directions.RIGHT ? -1 : 0 : this.items[e].classList.remove(this.focusedCssClass), s === he.directions.RIGHT ? e = (e + 1) % this.items.length : e = (this.items.length + e - 1) % this.items.length, d.canSetCaret(this.items[e]) && re(() => k.setCursor(this.items[e]), 50)(), this.items[e].classList.add(this.focusedCssClass), e; + } +}; +let ie = he; +ie.directions = { + RIGHT: "right", + LEFT: "left" +}; +class G { + /** + * @param {FlipperOptions} options - different constructing settings + */ + constructor(e) { + this.iterator = null, this.activated = !1, this.flipCallbacks = [], this.onKeyDown = (t) => { + if (this.isEventReadyForHandling(t)) + switch (G.usedKeys.includes(t.keyCode) && t.preventDefault(), t.keyCode) { + case B.TAB: + this.handleTabPress(t); + break; + case B.LEFT: + case B.UP: + this.flipLeft(); + break; + case B.RIGHT: + case B.DOWN: + this.flipRight(); + break; + case B.ENTER: + this.handleEnterPress(t); + break; + } + }, this.iterator = new ie(e.items, e.focusedItemClass), this.activateCallback = e.activateCallback, this.allowedKeys = e.allowedKeys || G.usedKeys; + } + /** + * True if flipper is currently activated + */ + get isActivated() { + return this.activated; + } + /** + * Array of keys (codes) that is handled by Flipper + * Used to: + * - preventDefault only for this keys, not all keydowns (@see constructor) + * - to skip external behaviours only for these keys, when filler is activated (@see BlockEvents@arrowRightAndDown) + */ + static get usedKeys() { + return [ + B.TAB, + B.LEFT, + B.RIGHT, + B.ENTER, + B.UP, + B.DOWN + ]; + } + /** + * Active tab/arrows handling by flipper + * + * @param items - Some modules (like, InlineToolbar, BlockSettings) might refresh buttons dynamically + * @param cursorPosition - index of the item that should be focused once flipper is activated + */ + activate(e, t) { + this.activated = !0, e && this.iterator.setItems(e), t !== void 0 && this.iterator.setCursor(t), document.addEventListener("keydown", this.onKeyDown, !0); + } + /** + * Disable tab/arrows handling by flipper + */ + deactivate() { + this.activated = !1, this.dropCursor(), document.removeEventListener("keydown", this.onKeyDown); + } + /** + * Focus first item + */ + focusFirst() { + this.dropCursor(), this.flipRight(); + } + /** + * Focuses previous flipper iterator item + */ + flipLeft() { + this.iterator.previous(), this.flipCallback(); + } + /** + * Focuses next flipper iterator item + */ + flipRight() { + this.iterator.next(), this.flipCallback(); + } + /** + * Return true if some button is focused + */ + hasFocus() { + return !!this.iterator.currentItem; + } + /** + * Registeres function that should be executed on each navigation action + * + * @param cb - function to execute + */ + onFlip(e) { + this.flipCallbacks.push(e); + } + /** + * Unregisteres function that is executed on each navigation action + * + * @param cb - function to stop executing + */ + removeOnFlip(e) { + this.flipCallbacks = this.flipCallbacks.filter((t) => t !== e); + } + /** + * Drops flipper's iterator cursor + * + * @see DomIterator#dropCursor + */ + dropCursor() { + this.iterator.dropCursor(); + } + /** + * This function is fired before handling flipper keycodes + * The result of this function defines if it is need to be handled or not + * + * @param {KeyboardEvent} event - keydown keyboard event + * @returns {boolean} + */ + isEventReadyForHandling(e) { + return this.activated && this.allowedKeys.includes(e.keyCode); + } + /** + * When flipper is activated tab press will leaf the items + * + * @param {KeyboardEvent} event - tab keydown event + */ + handleTabPress(e) { + switch (e.shiftKey ? ie.directions.LEFT : ie.directions.RIGHT) { + case ie.directions.RIGHT: + this.flipRight(); + break; + case ie.directions.LEFT: + this.flipLeft(); + break; + } + } + /** + * Enter press will click current item if flipper is activated + * + * @param {KeyboardEvent} event - enter keydown event + */ + handleEnterPress(e) { + this.activated && (this.iterator.currentItem && (e.stopPropagation(), e.preventDefault(), this.iterator.currentItem.click()), D(this.activateCallback) && this.activateCallback(this.iterator.currentItem)); + } + /** + * Fired after flipping in any direction + */ + flipCallback() { + this.iterator.currentItem && this.iterator.currentItem.scrollIntoViewIfNeeded(), this.flipCallbacks.forEach((e) => e()); + } +} +const ue = class { + /** + * Locks body element scroll + */ + lock() { + Xe ? this.lockHard() : document.body.classList.add(ue.CSS.scrollLocked); + } + /** + * Unlocks body element scroll + */ + unlock() { + Xe ? this.unlockHard() : document.body.classList.remove(ue.CSS.scrollLocked); + } + /** + * Locks scroll in a hard way (via setting fixed position to body element) + */ + lockHard() { + this.scrollPosition = window.pageYOffset, document.documentElement.style.setProperty( + "--window-scroll-offset", + `${this.scrollPosition}px` + ), document.body.classList.add(ue.CSS.scrollLockedHard); + } + /** + * Unlocks hard scroll lock + */ + unlockHard() { + document.body.classList.remove(ue.CSS.scrollLockedHard), this.scrollPosition !== null && window.scrollTo(0, this.scrollPosition), this.scrollPosition = null; + } +}; +let pt = ue; +pt.CSS = { + scrollLocked: "ce-scroll-locked", + scrollLockedHard: "ce-scroll-locked--hard" +}; +var So = Object.defineProperty, Io = Object.getOwnPropertyDescriptor, Mo = (s, e, t, o) => { + for (var n = o > 1 ? void 0 : o ? Io(e, t) : e, i = s.length - 1, r; i >= 0; i--) + (r = s[i]) && (n = (o ? r(e, t, n) : r(n)) || n); + return o && n && So(e, t, n), n; +}, fe = /* @__PURE__ */ ((s) => (s.Close = "close", s))(fe || {}); +const z = class extends xe { + /** + * Constructs the instance + * + * @param params - popover construction params + */ + constructor(s) { + super(), this.scopeElement = document.body, this.listeners = new at(), this.scrollLocker = new pt(), this.nodes = { + wrapper: null, + popover: null, + nothingFoundMessage: null, + customContent: null, + items: null, + overlay: null + }, this.messages = { + nothingFound: "Nothing found", + search: "Search" + }, this.onFlip = () => { + this.items.find((t) => t.isFocused).onFocus(); + }, this.items = s.items.map((e) => new P(e)), s.scopeElement !== void 0 && (this.scopeElement = s.scopeElement), s.messages && (this.messages = { + ...this.messages, + ...s.messages + }), s.customContentFlippableItems && (this.customContentFlippableItems = s.customContentFlippableItems), this.make(), s.customContent && this.addCustomContent(s.customContent), this.initializeFlipper(); + } + /** + * Popover CSS classes + */ + static get CSS() { + return { + popover: "ce-popover", + popoverOpenTop: "ce-popover--open-top", + popoverOpened: "ce-popover--opened", + search: "ce-popover__search", + nothingFoundMessage: "ce-popover__nothing-found-message", + nothingFoundMessageDisplayed: "ce-popover__nothing-found-message--displayed", + customContent: "ce-popover__custom-content", + customContentHidden: "ce-popover__custom-content--hidden", + items: "ce-popover__items", + overlay: "ce-popover__overlay", + overlayHidden: "ce-popover__overlay--hidden" + }; + } + /** + * Returns HTML element corresponding to the popover + */ + getElement() { + return this.nodes.wrapper; + } + /** + * Returns true if some item inside popover is focused + */ + hasFocus() { + return this.flipper.hasFocus(); + } + /** + * Open popover + */ + show() { + this.shouldOpenBottom || (this.nodes.popover.style.setProperty( + "--popover-height", + this.height + "px" + ), this.nodes.popover.classList.add(z.CSS.popoverOpenTop)), this.nodes.overlay.classList.remove(z.CSS.overlayHidden), this.nodes.popover.classList.add(z.CSS.popoverOpened), this.flipper.activate(this.flippableElements), this.search !== void 0 && setTimeout(() => { + this.search.focus(); + }, 100), te() && this.scrollLocker.lock(); + } + /** + * Closes popover + */ + hide() { + this.nodes.popover.classList.remove(z.CSS.popoverOpened), this.nodes.popover.classList.remove(z.CSS.popoverOpenTop), this.nodes.overlay.classList.add(z.CSS.overlayHidden), this.flipper.deactivate(), this.items.forEach((s) => s.reset()), this.search !== void 0 && this.search.clear(), te() && this.scrollLocker.unlock(), this.emit( + "close" + /* Close */ + ); + } + /** + * Clears memory + */ + destroy() { + this.flipper.deactivate(), this.listeners.removeAll(), te() && this.scrollLocker.unlock(); + } + /** + * Constructs HTML element corresponding to popover + */ + make() { + this.nodes.popover = d.make("div", [z.CSS.popover]), this.nodes.nothingFoundMessage = d.make( + "div", + [z.CSS.nothingFoundMessage], + { + textContent: this.messages.nothingFound + } + ), this.nodes.popover.appendChild(this.nodes.nothingFoundMessage), this.nodes.items = d.make("div", [z.CSS.items]), this.items.forEach((s) => { + this.nodes.items.appendChild(s.getElement()); + }), this.nodes.popover.appendChild(this.nodes.items), this.listeners.on(this.nodes.popover, "click", (s) => { + const e = this.getTargetItem(s); + e !== void 0 && this.handleItemClick(e); + }), this.nodes.wrapper = d.make("div"), this.nodes.overlay = d.make("div", [ + z.CSS.overlay, + z.CSS.overlayHidden + ]), this.listeners.on(this.nodes.overlay, "click", () => { + this.hide(); + }), this.nodes.wrapper.appendChild(this.nodes.overlay), this.nodes.wrapper.appendChild(this.nodes.popover); + } + /** + * Adds search to the popover + */ + // private addSearch(): void { + // this.search = new SearchInput({ + // items: this.items, + // placeholder: this.messages.search, + // onSearch: (query: string, result: PopoverItem[]): void => { + // this.items.forEach((item) => { + // const isHidden = !result.includes(item); + // item.toggleHidden(isHidden); + // }); + // this.toggleNothingFoundMessage(result.length === 0); + // this.toggleCustomContent(query !== ""); + // /** List of elements available for keyboard navigation considering search query applied */ + // const flippableElements = + // query === "" + // ? this.flippableElements + // : result.map((item) => item.getElement()); + // if (this.flipper.isActivated) { + // /** Update flipper items with only visible */ + // this.flipper.deactivate(); + // this.flipper.activate(flippableElements); + // } + // }, + // }); + // const searchElement = this.search.getElement(); + // searchElement.classList.add(Popover.CSS.search); + // this.nodes.popover.insertBefore( + // searchElement, + // this.nodes.popover.firstChild + // ); + // } + /** + * Adds custom html content to the popover + * + * @param content - html content to append + */ + addCustomContent(s) { + this.nodes.customContent = s, this.nodes.customContent.classList.add(z.CSS.customContent), this.nodes.popover.insertBefore(s, this.nodes.popover.firstChild); + } + /** + * Retrieves popover item that is the target of the specified event + * + * @param event - event to retrieve popover item from + */ + getTargetItem(s) { + return this.items.find( + (e) => s.composedPath().includes(e.getElement()) + ); + } + /** + * Handles item clicks + * + * @param item - item to handle click of + */ + handleItemClick(s) { + s.isDisabled || (this.items.filter((e) => e !== s).forEach((e) => e.reset()), s.handleClick(), this.toggleItemActivenessIfNeeded(s), s.closeOnActivate && this.hide()); + } + /** + * Creates Flipper instance which allows to navigate between popover items via keyboard + */ + initializeFlipper() { + this.flipper = new G({ + items: this.flippableElements, + focusedItemClass: P.CSS.focused, + allowedKeys: [B.TAB, B.UP, B.DOWN, B.ENTER] + }), this.flipper.onFlip(this.onFlip); + } + /** + * Returns list of elements available for keyboard navigation. + * Contains both usual popover items elements and custom html content. + */ + get flippableElements() { + const s = this.items.map((t) => t.getElement()); + return (this.customContentFlippableItems || []).concat(s); + } + get height() { + let s = 0; + if (this.nodes.popover === null) + return s; + const e = this.nodes.popover.cloneNode(!0); + return e.style.visibility = "hidden", e.style.position = "absolute", e.style.top = "-1000px", e.classList.add(z.CSS.popoverOpened), document.body.appendChild(e), s = e.offsetHeight, e.remove(), s; + } + /** + * Checks if popover should be opened bottom. + * It should happen when there is enough space below or not enough space above + */ + get shouldOpenBottom() { + const s = this.nodes.popover.getBoundingClientRect(), e = this.scopeElement.getBoundingClientRect(), t = this.height, o = s.top + t, n = s.top - t, i = Math.min( + window.innerHeight, + e.bottom + ); + return n < e.top || o <= i; + } + /** + * Toggles nothing found message visibility + * + * @param isDisplayed - true if the message should be displayed + */ + toggleNothingFoundMessage(s) { + this.nodes.nothingFoundMessage.classList.toggle( + z.CSS.nothingFoundMessageDisplayed, + s + ); + } + /** + * Toggles custom content visibility + * + * @param isDisplayed - true if custom content should be displayed + */ + toggleCustomContent(s) { + var e; + (e = this.nodes.customContent) == null || e.classList.toggle( + z.CSS.customContentHidden, + s + ); + } + /** + * - Toggles item active state, if clicked popover item has property 'toggle' set to true. + * + * - Performs radiobutton-like behavior if the item has property 'toggle' set to string key. + * (All the other items with the same key get inactive, and the item gets active) + * + * @param clickedItem - popover item that was clicked + */ + toggleItemActivenessIfNeeded(s) { + if (s.toggle === !0 && s.toggleActive(), typeof s.toggle == "string") { + const e = this.items.filter( + (t) => t.toggle === s.toggle + ); + if (e.length === 1) { + s.toggleActive(); + return; + } + e.forEach((t) => { + t.toggleActive(t === s); + }); + } + } +}; +let He = z; +Mo([ + ce +], He.prototype, "height", 1); +class Lo extends T { + constructor() { + super(...arguments), this.opened = !1, this.selection = new k(), this.onPopoverClose = () => { + this.close(); + }; + } + /** + * Module Events + * + * @returns {{opened: string, closed: string}} + */ + get events() { + return { + opened: "block-settings-opened", + closed: "block-settings-closed" + }; + } + /** + * Block Settings CSS + */ + get CSS() { + return { + settings: "ce-settings" + }; + } + /** + * Getter for inner popover's flipper instance + * + * @todo remove once BlockSettings becomes standalone non-module class + */ + get flipper() { + var e; + return (e = this.popover) == null ? void 0 : e.flipper; + } + /** + * Panel with block settings with 2 sections: + * - Tool's Settings + * - Default Settings [Move, Remove, etc] + */ + make() { + this.nodes.wrapper = d.make("div", [this.CSS.settings]); + } + /** + * Destroys module + */ + destroy() { + this.removeAllNodes(); + } + /** + * Open Block Settings pane + * + * @param targetBlock - near which Block we should open BlockSettings + */ + open(e = this.Editor.BlockManager.currentBlock) { + this.opened = !0, this.selection.save(), e.selected = !0, this.Editor.BlockSelection.clearCache(); + const [t, o] = e.getTunes(); + this.eventsDispatcher.emit(this.events.opened), this.popover = new He({ + searchable: !0, + items: t.map((n) => this.resolveTuneAliases(n)), + customContent: o, + customContentFlippableItems: this.getControls(o), + scopeElement: this.Editor.API.methods.ui.nodes.redactor, + messages: { + nothingFound: W.ui(Z.ui.popover, "Nothing found"), + search: W.ui(Z.ui.popover, "Filter") + } + }), this.popover.on(fe.Close, this.onPopoverClose), this.nodes.wrapper.append(this.popover.getElement()), this.popover.show(); + } + /** + * Returns root block settings element + */ + getElement() { + return this.nodes.wrapper; + } + /** + * Close Block Settings pane + */ + close() { + this.opened = !1, k.isAtEditor || this.selection.restore(), this.selection.clearSaved(), !this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted && this.Editor.BlockManager.currentBlock && (this.Editor.BlockManager.currentBlock.selected = !1), this.eventsDispatcher.emit(this.events.closed), this.popover && (this.popover.off(fe.Close, this.onPopoverClose), this.popover.destroy(), this.popover.getElement().remove(), this.popover = null); + } + /** + * Returns list of buttons and inputs inside specified container + * + * @param container - container to query controls inside of + */ + getControls(e) { + const { StylesAPI: t } = this.Editor, o = e.querySelectorAll( + `.${t.classes.settingsButton}, ${d.allInputsSelector}` + ); + return Array.from(o); + } + /** + * Resolves aliases in tunes menu items + * + * @param item - item with resolved aliases + */ + resolveTuneAliases(e) { + const t = Bo(e, { label: "title" }); + return e.confirmation && (t.confirmation = this.resolveTuneAliases(e.confirmation)), t; + } +} +class $ extends T { + constructor() { + super(...arguments), this.opened = !1, this.tools = [], this.flipper = null, this.togglingCallback = null; + } + /** + * CSS getter + */ + static get CSS() { + return { + conversionToolbarWrapper: "ce-conversion-toolbar", + conversionToolbarShowed: "ce-conversion-toolbar--showed", + conversionToolbarTools: "ce-conversion-toolbar__tools", + conversionToolbarLabel: "ce-conversion-toolbar__label", + conversionTool: "ce-conversion-tool", + conversionToolCurrent: "ce-conversion-tool--current", + conversionToolIcon: "ce-conversion-tool__icon", + conversionToolCheckIcon: "ce-conversion-tool__check-icon", + conversionToolSecondaryLabel: "ce-conversion-tool__secondary-label", + conversionToolFocused: "ce-conversion-tool--focused", + conversionToolActive: "ce-conversion-tool--active" + }; + } + /** + * Create UI of Conversion Toolbar + */ + make() { + this.nodes.wrapper = d.make("div", [ + $.CSS.conversionToolbarWrapper, + ...this.isRtl ? [this.Editor.UI.CSS.editorRtlFix] : [] + ]), this.nodes.tools = d.make( + "div", + $.CSS.conversionToolbarTools + ); + const e = d.make("div", $.CSS.conversionToolbarLabel, { + textContent: W.ui( + Z.ui.inlineToolbar.converter, + "Convert to" + ) + }); + return this.addTools(), this.enableFlipper(), d.append(this.nodes.wrapper, e), d.append(this.nodes.wrapper, this.nodes.tools), this.nodes.wrapper; + } + /** + * Deactivates flipper and removes all nodes + */ + destroy() { + this.flipper && (this.flipper.deactivate(), this.flipper = null), this.removeAllNodes(); + } + /** + * Toggle conversion dropdown visibility + * + * @param {Function} [togglingCallback] — callback that will accept opening state + */ + toggle(e) { + this.opened ? this.close() : this.open(), D(e) && (this.togglingCallback = e); + } + /** + * Shows Conversion Toolbar + */ + open() { + this.filterTools(), this.opened = !0, this.nodes.wrapper.classList.add( + $.CSS.conversionToolbarShowed + ), window.requestAnimationFrame(() => { + this.flipper.activate( + this.tools.map((e) => e.button).filter((e) => !e.classList.contains( + $.CSS.conversionToolHidden + )) + ), this.flipper.focusFirst(), D(this.togglingCallback) && this.togglingCallback(!0); + }); + } + /** + * Closes Conversion Toolbar + */ + close() { + this.opened = !1, this.flipper.deactivate(), this.nodes.wrapper.classList.remove( + $.CSS.conversionToolbarShowed + ), D(this.togglingCallback) && this.togglingCallback(!1); + } + /** + * Returns true if it has more than one tool available for convert in + */ + hasTools() { + return this.tools.length === 1 ? this.tools[0].name !== this.config.defaultBlock : !0; + } + /** + * Replaces one Block with another + * For that Tools must provide import/export methods + * + * @param {string} replacingToolName - name of Tool which replaces current + * @param blockDataOverrides - If this conversion fired by the one of multiple Toolbox items, extend converted data with this item's "data" overrides + */ + async replaceWithBlock(e, t) { + const { BlockManager: o, BlockSelection: n, InlineToolbar: i, Caret: r } = this.Editor; + o.convert( + this.Editor.BlockManager.currentBlock, + e, + t + ), n.clearSelection(), this.close(), i.close(), window.requestAnimationFrame(() => { + r.setToBlock( + this.Editor.BlockManager.currentBlock, + r.positions.END + ); + }); + } + /** + * Iterates existing Tools and inserts to the ConversionToolbar + * if tools have ability to import + */ + addTools() { + const e = this.Editor.Tools.blockTools; + Array.from(e.entries()).forEach(([t, o]) => { + var i; + const n = o.conversionConfig; + !n || !n.import || (i = o.toolbox) == null || i.forEach( + (r) => this.addToolIfValid(t, r) + ); + }); + } + /** + * Inserts a tool to the ConversionToolbar if the tool's toolbox config is valid + * + * @param name - tool's name + * @param toolboxSettings - tool's single toolbox setting + */ + addToolIfValid(e, t) { + K(t) || !t.icon || this.addTool(e, t); + } + /** + * Add tool to the Conversion Toolbar + * + * @param toolName - name of Tool to add + * @param toolboxItem - tool's toolbox item data + */ + addTool(e, t) { + var a; + const o = d.make("div", [$.CSS.conversionTool]), n = d.make("div", [$.CSS.conversionToolIcon]), i = d.make("div", [ + $.CSS.conversionToolCheckIcon + ]); + switch (o.dataset.tool = e, e) { + case "paragraph": + n.innerHTML = ` + + `; + break; + case "header1": + n.innerHTML = ''; + break; + case "header2": + n.innerHTML = ''; + break; + case "header3": + n.innerHTML = ''; + break; + case "unorderedList": + n.innerHTML = ''; + break; + case "orderedList": + n.innerHTML = ''; + break; + case "blockChecklist": + n.innerHTML = ''; + break; + default: + n.innerHTML = t.icon; + } + i.innerHTML = '', d.append(o, n), d.append( + o, + d.text( + W.t( + Z.toolNames, + t.title || ae(e) + ) + ) + ), d.append(o, i); + const r = (a = this.Editor.Tools.blockTools.get(e)) == null ? void 0 : a.shortcut; + if (r) { + const l = d.make( + "span", + $.CSS.conversionToolSecondaryLabel, + { + innerText: Ne(r) + } + ); + d.append(o, l); + } + d.append(this.nodes.tools, o), this.tools.push({ + name: e, + button: o, + toolboxItem: t + }), this.listeners.on(o, "click", async () => { + await this.replaceWithBlock(e, t.data); + }); + } + /** + * Get current tool button and add icon + */ + async filterTools() { + const { currentBlock: e } = this.Editor.BlockManager, t = await e.getActiveToolboxEntry(); + function o(n, i) { + return n.icon === i.icon && n.title === i.title; + } + this.tools.forEach((n) => { + let i = !1; + if (t) { + const r = o( + t, + n.toolboxItem + ); + i = n.button.dataset.tool === e.name && r; + } + n.button.classList.toggle( + $.CSS.conversionToolCurrent, + i + ); + }); + } + /** + * Prepare Flipper to be able to leaf tools by arrows/tab + */ + enableFlipper() { + this.flipper = new G({ + focusedItemClass: $.CSS.conversionToolFocused + }); + } +} +var Oe = {}, _o = { + get exports() { + return Oe; + }, + set exports(s) { + Oe = s; + } +}; +/*! + * Library for handling keyboard shortcuts + * @copyright CodeX (https://codex.so) + * @license MIT + * @author CodeX (https://codex.so) + * @version 1.2.0 + */ +(function(s, e) { + (function(t, o) { + s.exports = o(); + })(window, function() { + return function(t) { + var o = {}; + function n(i) { + if (o[i]) + return o[i].exports; + var r = o[i] = { i, l: !1, exports: {} }; + return t[i].call(r.exports, r, r.exports, n), r.l = !0, r.exports; + } + return n.m = t, n.c = o, n.d = function(i, r, a) { + n.o(i, r) || Object.defineProperty(i, r, { enumerable: !0, get: a }); + }, n.r = function(i) { + typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 }); + }, n.t = function(i, r) { + if (1 & r && (i = n(i)), 8 & r || 4 & r && typeof i == "object" && i && i.__esModule) + return i; + var a = /* @__PURE__ */ Object.create(null); + if (n.r(a), Object.defineProperty(a, "default", { enumerable: !0, value: i }), 2 & r && typeof i != "string") + for (var l in i) + n.d(a, l, function(c) { + return i[c]; + }.bind(null, l)); + return a; + }, n.n = function(i) { + var r = i && i.__esModule ? function() { + return i.default; + } : function() { + return i; + }; + return n.d(r, "a", r), r; + }, n.o = function(i, r) { + return Object.prototype.hasOwnProperty.call(i, r); + }, n.p = "", n(n.s = 0); + }([function(t, o, n) { + function i(l, c) { + for (var u = 0; u < c.length; u++) { + var h = c[u]; + h.enumerable = h.enumerable || !1, h.configurable = !0, "value" in h && (h.writable = !0), Object.defineProperty(l, h.key, h); + } + } + function r(l, c, u) { + return c && i(l.prototype, c), u && i(l, u), l; + } + n.r(o); + var a = function() { + function l(c) { + var u = this; + (function(h, f) { + if (!(h instanceof f)) + throw new TypeError("Cannot call a class as a function"); + })(this, l), this.commands = {}, this.keys = {}, this.name = c.name, this.parseShortcutName(c.name), this.element = c.on, this.callback = c.callback, this.executeShortcut = function(h) { + u.execute(h); + }, this.element.addEventListener("keydown", this.executeShortcut, !1); + } + return r(l, null, [{ key: "supportedCommands", get: function() { + return { SHIFT: ["SHIFT"], CMD: ["CMD", "CONTROL", "COMMAND", "WINDOWS", "CTRL"], ALT: ["ALT", "OPTION"] }; + } }, { key: "keyCodes", get: function() { + return { 0: 48, 1: 49, 2: 50, 3: 51, 4: 52, 5: 53, 6: 54, 7: 55, 8: 56, 9: 57, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71, H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79, P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87, X: 88, Y: 89, Z: 90, BACKSPACE: 8, ENTER: 13, ESCAPE: 27, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, INSERT: 45, DELETE: 46, ".": 190 }; + } }]), r(l, [{ key: "parseShortcutName", value: function(c) { + c = c.split("+"); + for (var u = 0; u < c.length; u++) { + c[u] = c[u].toUpperCase(); + var h = !1; + for (var f in l.supportedCommands) + if (l.supportedCommands[f].includes(c[u])) { + h = this.commands[f] = !0; + break; + } + h || (this.keys[c[u]] = !0); + } + for (var m in l.supportedCommands) + this.commands[m] || (this.commands[m] = !1); + } }, { key: "execute", value: function(c) { + var u, h = { CMD: c.ctrlKey || c.metaKey, SHIFT: c.shiftKey, ALT: c.altKey }, f = !0; + for (u in this.commands) + this.commands[u] !== h[u] && (f = !1); + var m, p = !0; + for (m in this.keys) + p = p && c.keyCode === l.keyCodes[m]; + f && p && this.callback(c); + } }, { key: "remove", value: function() { + this.element.removeEventListener("keydown", this.executeShortcut); + } }]), l; + }(); + o.default = a; + }]).default; + }); +})(_o); +const Oo = /* @__PURE__ */ ve(Oe); +class Ao { + constructor() { + this.registeredShortcuts = /* @__PURE__ */ new Map(); + } + /** + * Register shortcut + * + * @param shortcut - shortcut options + */ + add(e) { + if (this.findShortcut(e.on, e.name)) + throw Error( + `Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.` + ); + const o = new Oo({ + name: e.name, + on: e.on, + callback: e.handler + }), n = this.registeredShortcuts.get(e.on) || []; + this.registeredShortcuts.set(e.on, [...n, o]); + } + /** + * Remove shortcut + * + * @param element - Element shortcut is set for + * @param name - shortcut name + */ + remove(e, t) { + const o = this.findShortcut(e, t); + if (!o) + return; + o.remove(); + const n = this.registeredShortcuts.get(e); + this.registeredShortcuts.set(e, n.filter((i) => i !== o)); + } + /** + * Get Shortcut instance if exist + * + * @param element - Element shorcut is set for + * @param shortcut - shortcut name + * @returns {number} index - shortcut index if exist + */ + findShortcut(e, t) { + return (this.registeredShortcuts.get(e) || []).find(({ name: n }) => n === t); + } +} +const le = new Ao(); +var No = Object.defineProperty, Ro = Object.getOwnPropertyDescriptor, ft = (s, e, t, o) => { + for (var n = o > 1 ? void 0 : o ? Ro(e, t) : e, i = s.length - 1, r; i >= 0; i--) + (r = s[i]) && (n = (o ? r(e, t, n) : r(n)) || n); + return o && n && No(e, t, n), n; +}, be = /* @__PURE__ */ ((s) => (s.Opened = "toolbox-opened", s.Closed = "toolbox-closed", s.BlockAdded = "toolbox-block-added", s))(be || {}); +const gt = class extends xe { + /** + * Toolbox constructor + * + * @param options - available parameters + * @param options.api - Editor API methods + * @param options.tools - Tools available to check whether some of them should be displayed at the Toolbox or not + */ + constructor({ api: s, tools: e, i18nLabels: t }) { + super(), this.opened = !1, this.nodes = { + toolbox: null + }, this.onPopoverClose = () => { + this.opened = !1, this.emit( + "toolbox-closed" + /* Closed */ + ); + }, this.api = s, this.tools = e, this.i18nLabels = t; + } + /** + * Returns True if Toolbox is Empty and nothing to show + * + * @returns {boolean} + */ + get isEmpty() { + return this.toolsToBeDisplayed.length === 0; + } + /** + * CSS styles + * + * @returns {Object} + */ + static get CSS() { + return { + toolbox: "ce-toolbox" + }; + } + /** + * Makes the Toolbox + */ + make() { + return this.popover = new He({ + scopeElement: this.api.ui.nodes.redactor, + searchable: !0, + messages: { + nothingFound: this.i18nLabels.nothingFound, + search: this.i18nLabels.filter + }, + items: this.toolboxItemsToBeDisplayed + }), this.popover.on(fe.Close, this.onPopoverClose), this.enableShortcuts(), this.nodes.toolbox = this.popover.getElement(), this.nodes.toolbox.classList.add(gt.CSS.toolbox), this.nodes.toolbox; + } + /** + * Returns true if the Toolbox has the Flipper activated and the Flipper has selected button + */ + hasFocus() { + var s; + return (s = this.popover) == null ? void 0 : s.hasFocus(); + } + /** + * Destroy Module + */ + destroy() { + var s; + super.destroy(), this.nodes && this.nodes.toolbox && (this.nodes.toolbox.remove(), this.nodes.toolbox = null), this.removeAllShortcuts(), (s = this.popover) == null || s.off(fe.Close, this.onPopoverClose); + } + /** + * Toolbox Tool's button click handler + * + * @param toolName - tool type to be activated + * @param blockDataOverrides - Block data predefined by the activated Toolbox item + */ + toolButtonActivated(s, e) { + this.insertNewBlock(s, e); + } + /** + * Open Toolbox with Tools + */ + open() { + var s; + this.isEmpty || ((s = this.popover) == null || s.show(), this.opened = !0, this.emit( + "toolbox-opened" + /* Opened */ + )); + } + /** + * Close Toolbox + */ + close() { + var s; + (s = this.popover) == null || s.hide(), this.opened = !1, this.emit( + "toolbox-closed" + /* Closed */ + ); + } + /** + * Close Toolbox + */ + toggle() { + this.opened ? this.close() : this.open(); + } + get toolsToBeDisplayed() { + const s = []; + return this.tools.forEach((e) => { + e.toolbox && s.push(e); + }), s; + } + get toolboxItemsToBeDisplayed() { + const s = (e, t) => ({ + icon: e.icon, + title: W.t(Z.toolNames, e.title || ae(t.name)), + name: t.name, + onActivate: () => { + this.toolButtonActivated(t.name, e.data); + }, + secondaryLabel: t.shortcut ? Ne(t.shortcut) : "" + }); + return this.toolsToBeDisplayed.reduce((e, t) => (Array.isArray(t.toolbox) ? t.toolbox.forEach((o) => { + e.push(s(o, t)); + }) : t.toolbox !== void 0 && e.push(s(t.toolbox, t)), e), []); + } + /** + * Iterate all tools and enable theirs shortcuts if specified + */ + enableShortcuts() { + this.toolsToBeDisplayed.forEach((s) => { + const e = s.shortcut; + e && this.enableShortcutForTool(s.name, e); + }); + } + /** + * Enable shortcut Block Tool implemented shortcut + * + * @param {string} toolName - Tool name + * @param {string} shortcut - shortcut according to the ShortcutData Module format + */ + enableShortcutForTool(s, e) { + le.add({ + name: e, + on: this.api.ui.nodes.redactor, + handler: (t) => { + t.preventDefault(); + const o = this.api.blocks.getCurrentBlockIndex(), n = this.api.blocks.getBlockByIndex(o); + if (n) + try { + this.api.blocks.convert(n.id, s), window.requestAnimationFrame(() => { + this.api.caret.setToBlock(o, "end"); + }); + return; + } catch { + } + this.insertNewBlock(s); + } + }); + } + /** + * Removes all added shortcuts + * Fired when the Read-Only mode is activated + */ + removeAllShortcuts() { + this.toolsToBeDisplayed.forEach((s) => { + const e = s.shortcut; + e && le.remove(this.api.ui.nodes.redactor, e); + }); + } + /** + * Inserts new block + * Can be called when button clicked on Toolbox or by ShortcutData + * + * @param {string} toolName - Tool name + * @param blockDataOverrides - predefined Block data + */ + async insertNewBlock(s, e) { + const t = this.api.blocks.getCurrentBlockIndex(), o = this.api.blocks.getBlockByIndex(t); + if (!o) + return; + const n = o.isEmpty ? t : t + 1; + let i; + if (e) { + const a = await this.api.blocks.composeBlockData(s); + i = Object.assign(a, e); + } + const r = this.api.blocks.insert( + s, + i, + void 0, + n, + void 0, + o.isEmpty + ); + r.call(X.APPEND_CALLBACK), this.api.caret.setToBlock(n), this.emit("toolbox-block-added", { + block: r + }), this.api.toolbar.close(); + } +}; +let Fe = gt; +ft([ + ce +], Fe.prototype, "toolsToBeDisplayed", 1); +ft([ + ce +], Fe.prototype, "toolboxItemsToBeDisplayed", 1); +const bt = "block hovered", Do = '', Po = ''; +class Ho extends T { + /** + * @class + * @param moduleConfiguration - Module Configuration + * @param moduleConfiguration.config - Editor's config + * @param moduleConfiguration.eventsDispatcher - Editor's event dispatcher + */ + constructor({ config: e, eventsDispatcher: t }) { + super({ + config: e, + eventsDispatcher: t + }), this.toolboxInstance = null, this.tooltip = new Pe(); + } + /** + * CSS styles + * + * @returns {object} + */ + get CSS() { + return { + toolbar: "ce-toolbar", + content: "ce-toolbar__content", + actions: "ce-toolbar__actions", + actionsOpened: "ce-toolbar__actions--opened", + toolbarOpened: "ce-toolbar--opened", + openedToolboxHolderModifier: "codex-editor--toolbox-opened", + plusButton: "ce-toolbar__plus", + plusButtonShortcut: "ce-toolbar__plus-shortcut", + settingsToggler: "ce-toolbar__settings-btn", + settingsTogglerHidden: "ce-toolbar__settings-btn--hidden" + }; + } + /** + * Returns the Toolbar opening state + * + * @returns {boolean} + */ + get opened() { + return this.nodes.wrapper.classList.contains(this.CSS.toolbarOpened); + } + /** + * Public interface for accessing the Toolbox + */ + get toolbox() { + var e; + return { + opened: (e = this.toolboxInstance) == null ? void 0 : e.opened, + close: () => { + var t; + (t = this.toolboxInstance) == null || t.close(); + }, + open: () => { + if (this.toolboxInstance === null) { + L( + "toolbox.open() called before initialization is finished", + "warn" + ); + return; + } + this.Editor.BlockManager.currentBlock = this.hoveredBlock, this.toolboxInstance.open(); + }, + toggle: () => { + if (this.toolboxInstance === null) { + L( + "toolbox.toggle() called before initialization is finished", + "warn" + ); + return; + } + this.toolboxInstance.toggle(); + }, + hasFocus: () => { + var t; + return (t = this.toolboxInstance) == null ? void 0 : t.hasFocus(); + } + }; + } + /** + * Block actions appearance manipulations + */ + get blockActions() { + return { + hide: () => { + this.nodes.actions.classList.remove(this.CSS.actionsOpened); + }, + show: () => { + this.nodes.actions.classList.add(this.CSS.actionsOpened); + } + }; + } + /** + * Methods for working with Block Tunes toggler + */ + get blockTunesToggler() { + return { + hide: () => this.nodes.settingsToggler.classList.add( + this.CSS.settingsTogglerHidden + ), + show: () => this.nodes.settingsToggler.classList.remove( + this.CSS.settingsTogglerHidden + ) + }; + } + /** + * Toggles read-only mode + * + * @param {boolean} readOnlyEnabled - read-only mode + */ + toggleReadOnly(e) { + e ? (this.destroy(), this.Editor.BlockSettings.destroy(), this.disableModuleBindings()) : window.requestIdleCallback( + () => { + this.drawUI(), this.enableModuleBindings(); + }, + { timeout: 2e3 } + ); + } + /** + * Move Toolbar to the passed (or current) Block + * + * @param block - block to move Toolbar near it + */ + moveAndOpen(e = this.Editor.BlockManager.currentBlock) { + if (this.toolboxInstance === null) { + L( + "Can't open Toolbar since Editor initialization is not finished yet", + "warn" + ); + return; + } + if (this.toolboxInstance.opened && this.toolboxInstance.close(), this.Editor.BlockSettings.opened && this.Editor.BlockSettings.close(), !e) + return; + this.hoveredBlock = e; + const t = e.holder, { isMobile: o } = this.Editor.UI, n = e.pluginsContent, i = window.getComputedStyle(n), r = parseInt( + i.paddingTop, + 10 + ), a = t.offsetHeight; + let l; + o ? l = t.offsetTop + a : l = t.offsetTop + r, this.nodes.wrapper.style.top = `${Math.floor(l)}px`, this.Editor.BlockManager.blocks.length === 1 && e.isEmpty ? this.blockTunesToggler.hide() : this.blockTunesToggler.show(), this.open(); + } + /** + * Close the Toolbar + */ + close() { + var e; + this.Editor.ReadOnly.isEnabled || (this.nodes.wrapper.classList.remove(this.CSS.toolbarOpened), this.blockActions.hide(), (e = this.toolboxInstance) == null || e.close(), this.Editor.BlockSettings.close()); + } + /** + * Open Toolbar with Plus Button and Actions + * + * @param {boolean} withBlockActions - by default, Toolbar opens with Block Actions. + * This flag allows to open Toolbar without Actions. + */ + open(e = !0) { + re(() => { + this.nodes.wrapper.classList.add(this.CSS.toolbarOpened), e ? this.blockActions.show() : this.blockActions.hide(); + }, 50)(); + } + /** + * Draws Toolbar elements + */ + make() { + this.nodes.wrapper = d.make("div", this.CSS.toolbar), ["content", "actions"].forEach((t) => { + this.nodes[t] = d.make("div", this.CSS[t]); + }), d.append(this.nodes.wrapper, this.nodes.content), d.append(this.nodes.content, this.nodes.actions), this.nodes.plusButton = d.make("div", this.CSS.plusButton, { + innerHTML: Po + }), d.append(this.nodes.actions, this.nodes.plusButton), this.readOnlyMutableListeners.on( + this.nodes.plusButton, + "click", + () => { + this.tooltip.hide(!0), this.plusButtonClicked(); + }, + !1 + ); + const e = d.make("div"); + e.appendChild( + document.createTextNode(W.ui(Z.ui.toolbar.toolbox, "Add")) + ), e.appendChild( + d.make("div", this.CSS.plusButtonShortcut, { + textContent: "⇥ Tab" + }) + ), this.tooltip.onHover(this.nodes.plusButton, e, { + hidingDelay: 400 + }), this.nodes.settingsToggler = d.make("span", this.CSS.settingsToggler, { + innerHTML: Do + }), d.append(this.nodes.actions, this.nodes.settingsToggler), this.tooltip.onHover( + this.nodes.settingsToggler, + W.ui(Z.ui.blockTunes.toggler, "Click to tune"), + { + hidingDelay: 400 + } + ), d.append(this.nodes.actions, this.makeToolbox()), d.append(this.nodes.actions, this.Editor.BlockSettings.getElement()), d.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper); + } + /** + * Creates the Toolbox instance and return it's rendered element + */ + makeToolbox() { + return this.toolboxInstance = new Fe({ + api: this.Editor.API.methods, + tools: this.Editor.Tools.blockTools, + i18nLabels: { + filter: W.ui(Z.ui.popover, "Filter"), + nothingFound: W.ui(Z.ui.popover, "Nothing found") + } + }), this.toolboxInstance.on(be.Opened, () => { + this.Editor.UI.nodes.wrapper.classList.add( + this.CSS.openedToolboxHolderModifier + ); + }), this.toolboxInstance.on(be.Closed, () => { + this.Editor.UI.nodes.wrapper.classList.remove( + this.CSS.openedToolboxHolderModifier + ); + }), this.toolboxInstance.on(be.BlockAdded, ({ block: e }) => { + const { BlockManager: t, Caret: o } = this.Editor, n = t.getBlockById(e.id); + n.inputs.length === 0 && (n === t.lastBlock ? (t.insertAtEnd(), o.setToBlock(t.lastBlock)) : o.setToBlock(t.nextBlock)); + }), this.toolboxInstance.make(); + } + /** + * Handler for Plus Button + */ + plusButtonClicked() { + var e; + this.Editor.BlockManager.currentBlock = this.hoveredBlock, (e = this.toolboxInstance) == null || e.toggle(); + } + /** + * Enable bindings + */ + enableModuleBindings() { + this.readOnlyMutableListeners.on( + this.nodes.settingsToggler, + "mousedown", + (e) => { + var t; + e.stopPropagation(), this.settingsTogglerClicked(), (t = this.toolboxInstance) != null && t.opened && this.toolboxInstance.close(), this.tooltip.hide(!0); + }, + !0 + ), te() || this.eventsDispatcher.on(bt, (e) => { + var t; + this.Editor.BlockSettings.opened || (t = this.toolboxInstance) != null && t.opened || this.moveAndOpen(e.block); + }); + } + /** + * Disable bindings + */ + disableModuleBindings() { + this.readOnlyMutableListeners.clearAll(); + } + /** + * Clicks on the Block Settings toggler + */ + settingsTogglerClicked() { + this.Editor.BlockManager.currentBlock = this.hoveredBlock, this.Editor.BlockSettings.opened ? this.Editor.BlockSettings.close() : this.Editor.BlockSettings.open(this.hoveredBlock); + } + /** + * Draws Toolbar UI + * + * Toolbar contains BlockSettings and Toolbox. + * That's why at first we draw its components and then Toolbar itself + * + * Steps: + * - Make Toolbar dependent components like BlockSettings, Toolbox and so on + * - Make itself and append dependent nodes to itself + * + */ + drawUI() { + this.Editor.BlockSettings.make(), this.make(); + } + /** + * Removes all created and saved HTMLElements + * It is used in Read-Only mode + */ + destroy() { + this.removeAllNodes(), this.toolboxInstance && this.toolboxInstance.destroy(), this.tooltip.destroy(); + } +} +var we = /* @__PURE__ */ ((s) => (s[s.Block = 0] = "Block", s[s.Inline = 1] = "Inline", s[s.Tune = 2] = "Tune", s))(we || {}), me = /* @__PURE__ */ ((s) => (s.Shortcut = "shortcut", s.Toolbox = "toolbox", s.EnabledInlineTools = "inlineToolbar", s.EnabledBlockTunes = "tunes", s.Config = "config", s))(me || {}), mt = /* @__PURE__ */ ((s) => (s.Shortcut = "shortcut", s.SanitizeConfig = "sanitize", s))(mt || {}), se = /* @__PURE__ */ ((s) => (s.IsEnabledLineBreaks = "enableLineBreaks", s.Toolbox = "toolbox", s.ConversionConfig = "conversionConfig", s.IsReadOnlySupported = "isReadOnlySupported", s.PasteConfig = "pasteConfig", s))(se || {}), je = /* @__PURE__ */ ((s) => (s.IsInline = "isInline", s.Title = "title", s))(je || {}), kt = /* @__PURE__ */ ((s) => (s.IsTune = "isTune", s))(kt || {}); +class ze { + /** + * @class + * @param {ConstructorOptions} options - Constructor options + */ + constructor({ + name: e, + constructable: t, + config: o, + api: n, + isDefault: i, + isInternal: r = !1, + defaultPlaceholder: a + }) { + this.api = n, this.name = e, this.constructable = t, this.config = o, this.isDefault = i, this.isInternal = r, this.defaultPlaceholder = a; + } + /** + * Returns Tool user configuration + */ + get settings() { + const e = this.config.config || {}; + return this.isDefault && !("placeholder" in e) && this.defaultPlaceholder && (e.placeholder = this.defaultPlaceholder), e; + } + /** + * Calls Tool's reset method + */ + reset() { + if (D(this.constructable.reset)) + return this.constructable.reset(); + } + /** + * Calls Tool's prepare method + */ + prepare() { + if (D(this.constructable.prepare)) + return this.constructable.prepare({ + toolName: this.name, + config: this.settings + }); + } + /** + * Returns shortcut for Tool (internal or specified by user) + */ + get shortcut() { + const e = this.constructable.shortcut; + return this.config.shortcut || e; + } + /** + * Returns Tool's sanitizer configuration + */ + get sanitizeConfig() { + return this.constructable.sanitize || {}; + } + /** + * Returns true if Tools is inline + */ + isInline() { + return this.type === 1; + } + /** + * Returns true if Tools is block + */ + isBlock() { + return this.type === 0; + } + /** + * Returns true if Tools is tune + */ + isTune() { + return this.type === 2; + } +} +const Fo = ` + +`; +class jo extends T { + /** + * @class + * @param moduleConfiguration - Module Configuration + * @param moduleConfiguration.config - Editor's config + * @param moduleConfiguration.eventsDispatcher - Editor's event dispatcher + */ + constructor({ config: e, eventsDispatcher: t }) { + super({ + config: e, + eventsDispatcher: t + }), this.CSS = { + inlineToolbar: "ce-inline-toolbar", + inlineToolbarShowed: "ce-inline-toolbar--showed", + inlineToolbarLeftOriented: "ce-inline-toolbar--left-oriented", + inlineToolbarRightOriented: "ce-inline-toolbar--right-oriented", + inlineToolbarShortcut: "ce-inline-toolbar__shortcut", + buttonsWrapper: "ce-inline-toolbar__buttons", + actionsWrapper: "ce-inline-toolbar__actions", + inlineToolButton: "ce-inline-tool", + inputField: "cdx-input", + focusedButton: "ce-inline-tool--focused", + conversionToggler: "ce-inline-toolbar__dropdown", + conversionTogglerArrow: "ce-inline-toolbar__dropdown-arrow", + conversionTogglerHidden: "ce-inline-toolbar__dropdown--hidden", + conversionTogglerContent: "ce-inline-toolbar__dropdown-content", + togglerAndButtonsWrapper: "ce-inline-toolbar__toggler-and-button-wrapper" + }, this.opened = !1, this.toolbarVerticalMargin = te() ? 20 : 6, this.buttonsList = null, this.width = 0, this.flipper = null, this.tooltip = new Pe(); + } + /** + * Toggles read-only mode + * + * @param {boolean} readOnlyEnabled - read-only mode + */ + toggleReadOnly(e) { + e ? (this.destroy(), this.Editor.ConversionToolbar.destroy()) : window.requestIdleCallback(() => { + this.make(); + }, { timeout: 2e3 }); + } + /** + * Moving / appearance + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + /** + * Shows Inline Toolbar if something is selected + * + * @param [needToClose] - pass true to close toolbar if it is not allowed. + * Avoid to use it just for closing IT, better call .close() clearly. + * @param [needToShowConversionToolbar] - pass false to not to show Conversion Toolbar + */ + tryToShow(e = !1, t = !0) { + if (!this.allowedToShow()) { + e && this.close(); + return; + } + this.move(), this.open(t), this.Editor.Toolbar.close(); + } + /** + * Move Toolbar to the selected text + */ + move() { + const e = k.rect, t = this.Editor.UI.nodes.wrapper.getBoundingClientRect(), o = { + x: e.x - t.left + 145, + y: e.y - t.top - 40 + }, n = document.getElementsByClassName("ce-inline-toolbar")[0].clientWidth, i = document.getElementsByClassName("ce-block__content")[0].getBoundingClientRect(); + i.width < 650 && t.right - e.x < n ? o.x = o.x - (n - (t.right - e.x)) : i.width >= 650 && i.right - e.x < n && (o.x -= n - (i.right - e.x)), this.nodes.wrapper.style.left = Math.floor(o.x) + "px", this.nodes.wrapper.style.top = Math.floor(o.y) + "px"; + } + /** + * Hides Inline Toolbar + */ + close() { + this.opened && (this.Editor.ReadOnly.isEnabled || (this.nodes.wrapper.classList.remove(this.CSS.inlineToolbarShowed), Array.from(this.toolsInstances.entries()).forEach( + ([e, t]) => { + const o = this.getToolShortcut(e); + o && le.remove(this.Editor.UI.nodes.redactor, o), D(t.clear) && t.clear(); + } + ), this.opened = !1, this.flipper.deactivate(), this.Editor.ConversionToolbar.close())); + } + /** + * Shows Inline Toolbar + * + * @param [needToShowConversionToolbar] - pass false to not to show Conversion Toolbar + */ + open(e = !0) { + if (this.opened) + return; + this.addToolsFiltered(), this.nodes.wrapper.classList.add(this.CSS.inlineToolbarShowed), this.buttonsList = this.nodes.buttons.querySelectorAll( + `.${this.CSS.inlineToolButton}` + ), this.opened = !0, e && this.Editor.ConversionToolbar.hasTools() ? this.setConversionTogglerContent() : this.nodes.conversionToggler.hidden = !0; + let t = Array.from(this.buttonsList); + t.unshift(this.nodes.conversionToggler), t = t.filter((o) => !o.hidden), this.flipper.activate(t); + } + /** + * Check if node is contained by Inline Toolbar + * + * @param {Node} node — node to check + */ + containsNode(e) { + return this.nodes.wrapper.contains(e); + } + /** + * Removes UI and its components + */ + destroy() { + this.flipper && (this.flipper.deactivate(), this.flipper = null), this.removeAllNodes(), this.tooltip.destroy(); + } + /** + * Making DOM + */ + make() { + this.nodes.wrapper = d.make("div", [ + this.CSS.inlineToolbar, + ...this.isRtl ? [this.Editor.UI.CSS.editorRtlFix] : [] + ]), this.nodes.togglerAndButtonsWrapper = d.make( + "div", + this.CSS.togglerAndButtonsWrapper + ), this.nodes.buttons = d.make("div", this.CSS.buttonsWrapper), this.nodes.actions = d.make("div", this.CSS.actionsWrapper), this.listeners.on(this.nodes.wrapper, "mousedown", (e) => { + e.target.closest( + `.${this.CSS.actionsWrapper}` + ) || e.preventDefault(); + }), d.append(this.nodes.wrapper, [ + this.nodes.togglerAndButtonsWrapper, + this.nodes.actions + ]), d.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper), this.addConversionToggler(), d.append(this.nodes.togglerAndButtonsWrapper, this.nodes.buttons), this.prepareConversionToolbar(), window.requestAnimationFrame(() => { + this.recalculateWidth(); + }), this.enableFlipper(); + } + /** + * Need to show Inline Toolbar or not + */ + allowedToShow() { + const e = ["IMG", "INPUT"], t = k.get(), o = k.text; + if (!t || !t.anchorNode || t.isCollapsed || o.length < 1) + return !1; + const n = d.isElement(t.anchorNode) ? t.anchorNode : t.anchorNode.parentElement; + if (t && e.includes(n.tagName) || n.closest('[contenteditable="true"]') === null) + return !1; + const r = this.Editor.BlockManager.getBlock( + t.anchorNode + ); + return r ? r.tool.inlineTools.size !== 0 : !1; + } + /** + * Recalculate inline toolbar width + */ + recalculateWidth() { + this.width = this.nodes.wrapper.offsetWidth; + } + /** + * Create a toggler for Conversion Dropdown + * and prepend it to the buttons list + */ + addConversionToggler() { + this.nodes.conversionToggler = d.make("div", this.CSS.conversionToggler), this.nodes.conversionTogglerContent = d.make( + "div", + this.CSS.conversionTogglerContent + ); + const e = d.make("div", this.CSS.conversionTogglerArrow, { + innerHTML: Fo + }); + this.nodes.conversionToggler.appendChild(this.nodes.conversionTogglerContent), this.nodes.conversionToggler.appendChild(e), this.nodes.togglerAndButtonsWrapper.appendChild( + this.nodes.conversionToggler + ), this.listeners.on(this.nodes.conversionToggler, "click", () => { + this.Editor.ConversionToolbar.toggle((t) => { + !t && this.opened ? this.flipper.activate() : this.opened && this.flipper.deactivate(); + }); + }), te() === !1 && this.tooltip.onHover(this.nodes.conversionToggler, W.ui(Z.ui.inlineToolbar.converter, "Convert to"), { + placement: "top", + hidingDelay: 100 + }); + } + /** + * Changes Conversion Dropdown content for current block's Tool + */ + async setConversionTogglerContent() { + const { BlockManager: e } = this.Editor, { currentBlock: t } = e, o = t.name, n = t.tool.conversionConfig, i = n && n.export; + this.nodes.conversionToggler.hidden = !i, this.nodes.conversionToggler.classList.toggle( + this.CSS.conversionTogglerHidden, + !i + ); + const r = await t.getActiveToolboxEntry() || {}; + this.nodes.conversionTogglerContent.innerHTML = r.icon || r.title || ae(o); + } + /** + * Makes the Conversion Dropdown + */ + prepareConversionToolbar() { + const e = this.Editor.ConversionToolbar.make(); + d.append(this.nodes.wrapper, e); + } + /** + * Working with Tools + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + /** + * Append only allowed Tools + */ + addToolsFiltered() { + const e = k.get(), t = this.Editor.BlockManager.getBlock( + e.anchorNode + ); + this.nodes.buttons.innerHTML = "", this.nodes.actions.innerHTML = "", this.toolsInstances = /* @__PURE__ */ new Map(), Array.from(t.tool.inlineTools.values()).forEach((o) => { + this.addTool(o); + }), this.recalculateWidth(); + } + /** + * Add tool button and activate clicks + * + * @param {InlineTool} tool - InlineTool object + */ + addTool(e) { + const t = e.create(), o = t.render(); + if (!o) { + L("Render method must return an instance of Node", "warn", e.name); + return; + } + if (o.dataset.tool = e.name, this.nodes.buttons.appendChild(o), this.toolsInstances.set(e.name, t), D(t.renderActions)) { + const a = t.renderActions(); + this.nodes.actions.appendChild(a); + } + this.listeners.on(o, "click", (a) => { + this.toolClicked(t), a.preventDefault(); + }); + const n = this.getToolShortcut(e.name); + if (n) + try { + this.enableShortcuts(t, n); + } catch { + } + const i = d.make("div"), r = W.t( + Z.toolNames, + e.title || ae(e.name) + ); + i.appendChild(d.text(r)), n && i.appendChild( + d.make("div", this.CSS.inlineToolbarShortcut, { + textContent: Ne(n) + }) + ), te() === !1 && this.tooltip.onHover(o, i, { + placement: "top", + hidingDelay: 100 + }), t.checkState(k.get()); + } + /** + * Get shortcut name for tool + * + * @param toolName — Tool name + */ + getToolShortcut(e) { + const { Tools: t } = this.Editor, o = t.inlineTools.get(e), n = t.internal.inlineTools; + return Array.from(n.keys()).includes(e) ? this.inlineTools[e][mt.Shortcut] : o.shortcut; + } + /** + * Enable Tool shortcut with Editor Shortcuts Module + * + * @param {InlineTool} tool - Tool instance + * @param {string} shortcut - shortcut according to the ShortcutData Module format + */ + enableShortcuts(e, t) { + le.add({ + name: t, + handler: (o) => { + const { currentBlock: n } = this.Editor.BlockManager; + n && n.tool.enabledInlineTools && (o.preventDefault(), this.toolClicked(e)); + }, + on: this.Editor.UI.nodes.redactor + }); + } + /** + * Inline Tool button clicks + * + * @param {InlineTool} tool - Tool's instance + */ + toolClicked(e) { + const t = k.range; + e.surround(t), this.checkToolsState(), e.renderActions !== void 0 && this.flipper.deactivate(); + } + /** + * Check Tools` state by selection + */ + checkToolsState() { + this.toolsInstances.forEach((e) => { + e.checkState(k.get()); + }); + } + /** + * Get inline tools tools + * Tools that has isInline is true + */ + get inlineTools() { + const e = {}; + return Array.from(this.Editor.Tools.inlineTools.entries()).forEach( + ([t, o]) => { + e[t] = o.create(); + } + ), e; + } + /** + * Allow to leaf buttons by arrows / tab + * Buttons will be filled on opening + */ + enableFlipper() { + this.flipper = new G({ + focusedItemClass: this.CSS.focusedButton, + allowedKeys: [ + B.ENTER, + B.TAB + ] + }); + } +} +class zo extends T { + /** + * All keydowns on Block + * + * @param {KeyboardEvent} event - keydown + */ + keydown(e) { + switch (this.beforeKeydownProcessing(e), e.keyCode) { + case B.BACKSPACE: + this.backspace(e); + break; + case B.DELETE: + this.delete(e); + break; + case B.ENTER: + this.enter(e); + break; + case B.DOWN: + case B.RIGHT: + this.arrowRightAndDown(e); + break; + case B.UP: + case B.LEFT: + this.arrowLeftAndUp(e); + break; + case B.TAB: + this.tabPressed(e); + break; + } + } + /** + * Fires on keydown before event processing + * + * @param {KeyboardEvent} event - keydown + */ + beforeKeydownProcessing(e) { + this.needToolbarClosing(e) && ot(e.keyCode) && (this.Editor.Toolbar.close(), this.Editor.ConversionToolbar.close(), e.ctrlKey || e.metaKey || e.altKey || e.shiftKey || (this.Editor.BlockManager.clearFocused(), this.Editor.BlockSelection.clearSelection(e))); + } + /** + * Key up on Block: + * - shows Inline Toolbar if something selected + * - shows conversion toolbar with 85% of block selection + * + * @param {KeyboardEvent} event - keyup event + */ + keyup(e) { + e.shiftKey || this.Editor.UI.checkEmptiness(); + } + /** + * Open Toolbox to leaf Tools + * + * @param {KeyboardEvent} event - tab keydown event + */ + tabPressed(e) { + this.Editor.BlockSelection.clearSelection(e); + const { BlockManager: t, InlineToolbar: o, ConversionToolbar: n } = this.Editor, i = t.currentBlock; + if (!i) + return; + const r = i.isEmpty, a = i.tool.isDefault && r, l = !r && n.opened, c = !r && !k.isCollapsed && o.opened; + a ? this.activateToolbox() : !l && !c && this.activateBlockSettings(); + } + /** + * Add drop target styles + * + * @param {DragEvent} event - drag over event + */ + dragOver(e) { + const t = this.Editor.BlockManager.getBlockByChildNode(e.target); + t.dropTarget = !0; + } + /** + * Remove drop target style + * + * @param {DragEvent} event - drag leave event + */ + dragLeave(e) { + const t = this.Editor.BlockManager.getBlockByChildNode(e.target); + t.dropTarget = !1; + } + /** + * Copying selected blocks + * Before putting to the clipboard we sanitize all blocks and then copy to the clipboard + * + * @param {ClipboardEvent} event - clipboard event + */ + handleCommandC(e) { + const { BlockSelection: t } = this.Editor; + t.anyBlockSelected && t.copySelectedBlocks(e); + } + /** + * Copy and Delete selected Blocks + * + * @param {ClipboardEvent} event - clipboard event + */ + handleCommandX(e) { + const { BlockSelection: t, BlockManager: o, Caret: n } = this.Editor; + t.anyBlockSelected && t.copySelectedBlocks(e).then(() => { + const i = o.removeSelectedBlocks(), r = o.insertDefaultBlockAtIndex(i, !0); + n.setToBlock(r, n.positions.START), t.clearSelection(e); + }); + } + /** + * ENTER pressed on block + * + * @param {KeyboardEvent} event - keydown + */ + enter(e) { + const { BlockManager: t, UI: o } = this.Editor; + if (t.currentBlock.tool.isLineBreaksEnabled || o.someToolbarOpened && o.someFlipperButtonFocused || e.shiftKey) + return; + let i = this.Editor.BlockManager.currentBlock; + this.Editor.Caret.isAtStart && !this.Editor.BlockManager.currentBlock.hasMedia ? this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex) : this.Editor.Caret.isAtEnd ? i = this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex + 1) : i = this.Editor.BlockManager.split(), this.Editor.Caret.setToBlock(i), this.Editor.Toolbar.moveAndOpen(i), e.preventDefault(); + } + /** + * Handle backspace keydown on Block + * + * @param {KeyboardEvent} event - keydown + */ + backspace(e) { + const { BlockManager: t, Caret: o } = this.Editor, { currentBlock: n, previousBlock: i } = t; + if (!k.isCollapsed || !o.isAtStart) + return; + if (e.preventDefault(), this.Editor.Toolbar.close(), !(n.currentInput === n.firstInput)) { + o.navigatePrevious(); + return; + } + if (i === null) + return; + if (i.isEmpty) { + t.removeBlock(i); + return; + } + if (n.isEmpty) { + t.removeBlock(n); + const l = t.currentBlock; + o.setToBlock(l, o.positions.END); + return; + } + qe(n, i) ? this.mergeBlocks(i, n) : o.setToBlock(i, o.positions.END); + } + /** + * Handles delete keydown on Block + * Removes char after the caret. + * If caret is at the end of the block, merge next block with current + * + * @param {KeyboardEvent} event - keydown + */ + delete(e) { + const { BlockManager: t, Caret: o } = this.Editor, { currentBlock: n, nextBlock: i } = t; + if (!k.isCollapsed || !o.isAtEnd) + return; + if (e.preventDefault(), this.Editor.Toolbar.close(), !(n.currentInput === n.lastInput)) { + o.navigateNext(); + return; + } + if (i === null) + return; + if (i.isEmpty) { + t.removeBlock(i); + return; + } + if (n.isEmpty) { + t.removeBlock(n), o.setToBlock(i, o.positions.START); + return; + } + qe(n, i) ? this.mergeBlocks(n, i) : o.setToBlock(i, o.positions.START); + } + /** + * Merge passed Blocks + * + * @param targetBlock - to which Block we want to merge + * @param blockToMerge - what Block we want to merge + */ + mergeBlocks(e, t) { + const { BlockManager: o, Caret: n, Toolbar: i } = this.Editor; + n.createShadow(e.pluginsContent), o.mergeBlocks(e, t).then(() => { + window.requestAnimationFrame(() => { + n.restoreCaret(e.pluginsContent), e.pluginsContent.normalize(), i.close(); + }); + }); + } + /** + * Handle right and down keyboard keys + * + * @param {KeyboardEvent} event - keyboard event + */ + arrowRightAndDown(e) { + const t = G.usedKeys.includes(e.keyCode) && (!e.shiftKey || e.keyCode === B.TAB); + if (this.Editor.UI.someToolbarOpened && t) + return; + this.Editor.BlockManager.clearFocused(), this.Editor.Toolbar.close(); + const o = this.Editor.Caret.isAtEnd || this.Editor.BlockSelection.anyBlockSelected; + if (e.shiftKey && e.keyCode === B.DOWN && o) { + this.Editor.CrossBlockSelection.toggleBlockSelectedState(); + return; + } + (e.keyCode === B.DOWN || e.keyCode === B.RIGHT && !this.isRtl ? this.Editor.Caret.navigateNext() : this.Editor.Caret.navigatePrevious()) ? e.preventDefault() : re(() => { + this.Editor.BlockManager.currentBlock && this.Editor.BlockManager.currentBlock.updateCurrentInput(); + }, 20)(), this.Editor.BlockSelection.clearSelection(e); + } + /** + * Handle left and up keyboard keys + * + * @param {KeyboardEvent} event - keyboard event + */ + arrowLeftAndUp(e) { + if (this.Editor.UI.someToolbarOpened) { + if (G.usedKeys.includes(e.keyCode) && (!e.shiftKey || e.keyCode === B.TAB)) + return; + this.Editor.UI.closeAllToolbars(); + } + this.Editor.BlockManager.clearFocused(), this.Editor.Toolbar.close(); + const t = this.Editor.Caret.isAtStart || this.Editor.BlockSelection.anyBlockSelected; + if (e.shiftKey && e.keyCode === B.UP && t) { + this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1); + return; + } + (e.keyCode === B.UP || e.keyCode === B.LEFT && !this.isRtl ? this.Editor.Caret.navigatePrevious() : this.Editor.Caret.navigateNext()) ? e.preventDefault() : re(() => { + this.Editor.BlockManager.currentBlock && this.Editor.BlockManager.currentBlock.updateCurrentInput(); + }, 20)(), this.Editor.BlockSelection.clearSelection(e); + } + /** + * Cases when we need to close Toolbar + * + * @param {KeyboardEvent} event - keyboard event + */ + needToolbarClosing(e) { + const t = e.keyCode === B.ENTER && this.Editor.Toolbar.toolbox.opened, o = e.keyCode === B.ENTER && this.Editor.BlockSettings.opened, n = e.keyCode === B.ENTER && this.Editor.InlineToolbar.opened, i = e.keyCode === B.ENTER && this.Editor.ConversionToolbar.opened, r = e.keyCode === B.TAB; + return !(e.shiftKey || r || t || o || n || i); + } + /** + * If Toolbox is not open, then just open it and show plus button + */ + activateToolbox() { + this.Editor.Toolbar.opened || this.Editor.Toolbar.moveAndOpen(), this.Editor.Toolbar.toolbox.open(); + } + /** + * Open Toolbar and show BlockSettings before flipping Tools + */ + activateBlockSettings() { + this.Editor.Toolbar.opened || (this.Editor.BlockManager.currentBlock.focused = !0, this.Editor.Toolbar.moveAndOpen()), this.Editor.BlockSettings.opened || this.Editor.BlockSettings.open(); + } +} +class Be { + /** + * @class + * @param {HTMLElement} workingArea — editor`s working node + */ + constructor(e) { + this.blocks = [], this.workingArea = e; + } + /** + * Get length of Block instances array + * + * @returns {number} + */ + get length() { + return this.blocks.length; + } + /** + * Get Block instances array + * + * @returns {Block[]} + */ + get array() { + return this.blocks; + } + /** + * Get blocks html elements array + * + * @returns {HTMLElement[]} + */ + get nodes() { + return nt(this.workingArea.children); + } + /** + * Proxy trap to implement array-like setter + * + * @example + * blocks[0] = new Block(...) + * @param {Blocks} instance — Blocks instance + * @param {PropertyKey} property — block index or any Blocks class property key to set + * @param {Block} value — value to set + * @returns {boolean} + */ + static set(e, t, o) { + return isNaN(Number(t)) ? (Reflect.set(e, t, o), !0) : (e.insert(+t, o), !0); + } + /** + * Proxy trap to implement array-like getter + * + * @param {Blocks} instance — Blocks instance + * @param {PropertyKey} property — Blocks class property key + * @returns {Block|*} + */ + static get(e, t) { + return isNaN(Number(t)) ? Reflect.get(e, t) : e.get(+t); + } + /** + * Push new Block to the blocks array and append it to working area + * + * @param {Block} block - Block to add + */ + push(e) { + this.blocks.push(e), this.insertToDOM(e); + } + /** + * Swaps blocks with indexes first and second + * + * @param {number} first - first block index + * @param {number} second - second block index + * @deprecated — use 'move' instead + */ + swap(e, t) { + const o = this.blocks[t]; + d.swap(this.blocks[e].holder, o.holder), this.blocks[t] = this.blocks[e], this.blocks[e] = o; + } + /** + * Move a block from one to another index + * + * @param {number} toIndex - new index of the block + * @param {number} fromIndex - block to move + */ + move(e, t) { + const o = this.blocks.splice(t, 1)[0], n = e - 1, i = Math.max(0, n), r = this.blocks[i]; + e > 0 ? this.insertToDOM(o, "afterend", r) : this.insertToDOM(o, "beforebegin", r), this.blocks.splice(e, 0, o); + const a = this.composeBlockEvent("move", { + fromIndex: t, + toIndex: e + }); + o.call(X.MOVED, a); + } + /** + * Insert new Block at passed index + * + * @param {number} index — index to insert Block + * @param {Block} block — Block to insert + * @param {boolean} replace — it true, replace block on given index + */ + insert(e, t, o = !1) { + if (!this.length) { + this.push(t); + return; + } + e > this.length && (e = this.length), o && (this.blocks[e].holder.remove(), this.blocks[e].call(X.REMOVED)); + const n = o ? 1 : 0; + if (this.blocks.splice(e, n, t), e > 0) { + const i = this.blocks[e - 1]; + this.insertToDOM(t, "afterend", i); + } else { + const i = this.blocks[e + 1]; + i ? this.insertToDOM(t, "beforebegin", i) : this.insertToDOM(t); + } + } + /** + * Replaces block under passed index with passed block + * + * @param index - index of existed block + * @param block - new block + */ + replace(e, t) { + if (this.blocks[e] === void 0) + throw Error("Incorrect index"); + this.blocks[e].holder.replaceWith(t.holder), this.blocks[e] = t; + } + /** + * Inserts several blocks at once + * + * @param blocks - blocks to insert + * @param index - index to insert blocks at + */ + insertMany(e, t) { + const o = new DocumentFragment(); + for (const n of e) + o.appendChild(n.holder); + if (this.length > 0) { + if (t > 0) { + const n = Math.min(t - 1, this.length - 1); + this.blocks[n].holder.after(o); + } else + t === 0 && this.workingArea.prepend(o); + this.blocks.splice(t, 0, ...e); + } else + this.blocks.push(...e), this.workingArea.appendChild(o); + e.forEach((n) => n.call(X.RENDERED)); + } + /** + * Remove block + * + * @param {number} index - index of Block to remove + */ + remove(e) { + isNaN(e) && (e = this.length - 1), this.blocks[e].holder.remove(), this.blocks[e].call(X.REMOVED), this.blocks.splice(e, 1); + } + /** + * Remove all blocks + */ + removeAll() { + this.workingArea.innerHTML = "", this.blocks.forEach((e) => e.call(X.REMOVED)), this.blocks.length = 0; + } + /** + * Insert Block after passed target + * + * @todo decide if this method is necessary + * @param {Block} targetBlock — target after which Block should be inserted + * @param {Block} newBlock — Block to insert + */ + insertAfter(e, t) { + const o = this.blocks.indexOf(e); + this.insert(o + 1, t); + } + /** + * Get Block by index + * + * @param {number} index — Block index + * @returns {Block} + */ + get(e) { + return this.blocks[e]; + } + /** + * Return index of passed Block + * + * @param {Block} block - Block to find + * @returns {number} + */ + indexOf(e) { + return this.blocks.indexOf(e); + } + /** + * Insert new Block into DOM + * + * @param {Block} block - Block to insert + * @param {InsertPosition} position — insert position (if set, will use insertAdjacentElement) + * @param {Block} target — Block related to position + */ + insertToDOM(e, t, o) { + t ? o.holder.insertAdjacentElement(t, e.holder) : this.workingArea.appendChild(e.holder), e.call(X.RENDERED); + } + /** + * Composes Block event with passed type and details + * + * @param {string} type - event type + * @param {object} detail - event detail + */ + composeBlockEvent(e, t) { + return new CustomEvent(e, { + detail: t + }); + } +} +const Ge = "block-removed", Je = "block-added", Uo = "block-moved", Qe = "block-changed"; +class $o { + constructor() { + this.completed = Promise.resolve(); + } + /** + * Add new promise to queue + * + * @param operation - promise should be added to queue + */ + add(e) { + return new Promise((t, o) => { + this.completed = this.completed.then(e).then(t).catch(o); + }); + } +} +class Wo extends T { + constructor() { + super(...arguments), this._currentBlockIndex = -1, this._blocks = null; + } + /** + * Returns current Block index + * + * @returns {number} + */ + get currentBlockIndex() { + return this._currentBlockIndex; + } + /** + * Set current Block index and fire Block lifecycle callbacks + * + * @param {number} newIndex - index of Block to set as current + */ + set currentBlockIndex(e) { + this._currentBlockIndex = e; + } + /** + * returns first Block + * + * @returns {Block} + */ + get firstBlock() { + return this._blocks[0]; + } + /** + * returns last Block + * + * @returns {Block} + */ + get lastBlock() { + return this._blocks[this._blocks.length - 1]; + } + /** + * Get current Block instance + * + * @returns {Block} + */ + get currentBlock() { + return this._blocks[this.currentBlockIndex]; + } + /** + * Set passed Block as a current + * + * @param block - block to set as a current + */ + set currentBlock(e) { + this.currentBlockIndex = this.getBlockIndex(e); + } + /** + * Returns next Block instance + * + * @returns {Block|null} + */ + get nextBlock() { + return this.currentBlockIndex === this._blocks.length - 1 ? null : this._blocks[this.currentBlockIndex + 1]; + } + /** + * Return first Block with inputs after current Block + * + * @returns {Block | undefined} + */ + get nextContentfulBlock() { + return this.blocks.slice(this.currentBlockIndex + 1).find((t) => !!t.inputs.length); + } + /** + * Return first Block with inputs before current Block + * + * @returns {Block | undefined} + */ + get previousContentfulBlock() { + return this.blocks.slice(0, this.currentBlockIndex).reverse().find((t) => !!t.inputs.length); + } + /** + * Returns previous Block instance + * + * @returns {Block|null} + */ + get previousBlock() { + return this.currentBlockIndex === 0 ? null : this._blocks[this.currentBlockIndex - 1]; + } + /** + * Get array of Block instances + * + * @returns {Block[]} {@link Blocks#array} + */ + get blocks() { + return this._blocks.array; + } + /** + * Check if each Block is empty + * + * @returns {boolean} + */ + get isEditorEmpty() { + return this.blocks.every((e) => e.isEmpty); + } + /** + * Should be called after Editor.UI preparation + * Define this._blocks property + */ + prepare() { + const e = new Be(this.Editor.UI.nodes.redactor); + this._blocks = new Proxy(e, { + set: Be.set, + get: Be.get + }), this.listeners.on( + document, + "copy", + (t) => this.Editor.BlockEvents.handleCommandC(t) + ); + } + /** + * Toggle read-only state + * + * If readOnly is true: + * - Unbind event handlers from created Blocks + * + * if readOnly is false: + * - Bind event handlers to all existing Blocks + * + * @param {boolean} readOnlyEnabled - "read only" state + */ + toggleReadOnly(e) { + e ? this.disableModuleBindings() : this.enableModuleBindings(); + } + /** + * Creates Block instance by tool name + * + * @param {object} options - block creation options + * @param {string} options.tool - tools passed in editor config {@link EditorConfig#tools} + * @param {string} [options.id] - unique id for this block + * @param {BlockToolData} [options.data] - constructor params + * @returns {Block} + */ + composeBlock({ + tool: e, + data: t = {}, + id: o = void 0, + tunes: n = {} + }) { + const i = this.Editor.ReadOnly.isEnabled, r = this.Editor.Tools.blockTools.get(e), a = new H( + { + id: o, + data: t, + tool: r, + api: this.Editor.API, + readOnly: i, + tunesData: n + }, + this.eventsDispatcher + ); + return i || window.requestIdleCallback( + () => { + this.bindBlockEvents(a); + }, + { timeout: 2e3 } + ), a; + } + /** + * Insert new block into _blocks + * + * @param {object} options - insert options + * @param {string} [options.id] - block's unique id + * @param {string} [options.tool] - plugin name, by default method inserts the default block type + * @param {object} [options.data] - plugin data + * @param {number} [options.index] - index where to insert new Block + * @param {boolean} [options.needToFocus] - flag shows if needed to update current Block index + * @param {boolean} [options.replace] - flag shows if block by passed index should be replaced with inserted one + * @returns {Block} + */ + insert({ + id: e = void 0, + tool: t = this.config.defaultBlock, + data: o = {}, + index: n, + needToFocus: i = !0, + replace: r = !1, + tunes: a = {} + } = {}) { + let l = n; + l === void 0 && (l = this.currentBlockIndex + (r ? 0 : 1)); + const c = this.composeBlock({ + id: e, + tool: t, + data: o, + tunes: a + }); + return r && this.blockDidMutated( + Ge, + this.getBlockByIndex(l), + { + index: l + } + ), this._blocks.insert(l, c, r), this.blockDidMutated(Je, c, { + index: l + }), i ? this.currentBlockIndex = l : l <= this.currentBlockIndex && this.currentBlockIndex++, c; + } + /** + * Inserts several blocks at once + * + * @param blocks - blocks to insert + * @param index - index where to insert + */ + insertMany(e, t = 0) { + this._blocks.insertMany(e, t); + } + /** + * Update Block data. + * + * Currently we don't have an 'update' method in the Tools API, so we just create a new block with the same id and type + * Should not trigger 'block-removed' or 'block-added' events + * + * @param block - block to update + * @param data - new data + */ + async update(e, t) { + const o = await e.data, n = this.composeBlock({ + id: e.id, + tool: e.name, + data: Object.assign({}, o, t), + tunes: e.tunes + }), i = this.getBlockIndex(e); + return this._blocks.replace(i, n), this.blockDidMutated(Qe, n, { + index: i + }), n; + } + /** + * Replace passed Block with the new one with specified Tool and data + * + * @param block - block to replace + * @param newTool - new Tool name + * @param data - new Tool data + */ + replace(e, t, o) { + const n = this.getBlockIndex(e); + this.insert({ + tool: t, + data: o, + index: n, + replace: !0 + }); + } + /** + * Insert pasted content. Call onPaste callback after insert. + * + * @param {string} toolName - name of Tool to insert + * @param {PasteEvent} pasteEvent - pasted data + * @param {boolean} replace - should replace current block + */ + paste(e, t, o = !1) { + const n = this.insert({ + tool: e, + replace: o + }); + try { + n.call(X.ON_PASTE, t); + } catch (i) { + L(`${e}: onPaste callback call is failed`, "error", i); + } + return n; + } + /** + * Insert new default block at passed index + * + * @param {number} index - index where Block should be inserted + * @param {boolean} needToFocus - if true, updates current Block index + * + * TODO: Remove method and use insert() with index instead (?) + * @returns {Block} inserted Block + */ + insertDefaultBlockAtIndex(e, t = !1) { + const o = this.composeBlock({ tool: this.config.defaultBlock }); + return this._blocks[e] = o, this.blockDidMutated(Je, o, { + index: e + }), t ? this.currentBlockIndex = e : e <= this.currentBlockIndex && this.currentBlockIndex++, o; + } + /** + * Always inserts at the end + * + * @returns {Block} + */ + insertAtEnd() { + return this.currentBlockIndex = this.blocks.length - 1, this.insert(); + } + /** + * Merge two blocks + * + * @param {Block} targetBlock - previous block will be append to this block + * @param {Block} blockToMerge - block that will be merged with target block + * @returns {Promise} - the sequence that can be continued + */ + async mergeBlocks(e, t) { + const o = await t.data; + K(o) || await e.mergeWith(o), this.removeBlock(t), this.currentBlockIndex = this._blocks.indexOf(e); + } + /** + * Remove passed Block + * + * @param block - Block to remove + * @param addLastBlock - if true, adds new default block at the end. @todo remove this logic and use event-bus instead + */ + removeBlock(e, t = !0) { + return new Promise((o) => { + const n = this._blocks.indexOf(e); + if (!this.validateIndex(n)) + throw new Error("Can't find a Block to remove"); + e.destroy(), this._blocks.remove(n), this.blockDidMutated(Ge, e, { + index: n + }), this.currentBlockIndex >= n && this.currentBlockIndex--, this.blocks.length ? n === 0 && (this.currentBlockIndex = 0) : (this.currentBlockIndex = -1, t && this.insert()), o(); + }); + } + /** + * Remove only selected Blocks + * and returns first Block index where started removing... + * + * @returns {number|undefined} + */ + removeSelectedBlocks() { + let e; + for (let t = this.blocks.length - 1; t >= 0; t--) + this.blocks[t].selected && (this.removeBlock(this.blocks[t]), e = t); + return e; + } + /** + * Attention! + * After removing insert the new default typed Block and focus on it + * Removes all blocks + */ + removeAllBlocks() { + for (let e = this.blocks.length - 1; e >= 0; e--) + this._blocks.remove(e); + this.currentBlockIndex = -1, this.insert(), this.currentBlock.firstInput.focus(); + } + /** + * Split current Block + * 1. Extract content from Caret position to the Block`s end + * 2. Insert a new Block below current one with extracted content + * + * @returns {Block} + */ + split() { + const e = this.Editor.Caret.extractFragmentFromCaretPosition(), t = d.make("div"); + e && t.appendChild(e); + const o = { + text: d.isEmpty(t) ? "" : t.innerHTML + }; + return this.insert({ data: o }); + } + /** + * Returns Block by passed index + * + * @param {number} index - index to get. -1 to get last + * @returns {Block} + */ + getBlockByIndex(e) { + return e === -1 && (e = this._blocks.length - 1), this._blocks[e]; + } + /** + * Returns an index for passed Block + * + * @param block - block to find index + */ + getBlockIndex(e) { + return this._blocks.indexOf(e); + } + /** + * Returns the Block by passed id + * + * @param id - id of block to get + * @returns {Block} + */ + getBlockById(e) { + return this._blocks.array.find((t) => t.id === e); + } + /** + * Get Block instance by html element + * + * @param {Node} element - html element to get Block by + */ + getBlock(e) { + d.isElement(e) || (e = e.parentNode); + const t = this._blocks.nodes, o = e.closest(`.${H.CSS.wrapper}`), n = t.indexOf(o); + if (n >= 0) + return this._blocks[n]; + } + /** + * Remove selection from all Blocks then highlight only Current Block + */ + highlightCurrentNode() { + this.clearFocused(), this.currentBlock.focused = !0; + } + /** + * Remove selection from all Blocks + */ + clearFocused() { + this.blocks.forEach((e) => { + e.focused = !1; + }); + } + /** + * 1) Find first-level Block from passed child Node + * 2) Mark it as current + * + * @param {Node} childNode - look ahead from this node. + * @returns {Block | undefined} can return undefined in case when the passed child note is not a part of the current editor instance + */ + setCurrentBlockByChildNode(e) { + d.isElement(e) || (e = e.parentNode); + const t = e.closest( + `.${H.CSS.wrapper}` + ); + if (!t) + return; + const o = t.closest( + `.${this.Editor.UI.CSS.editorWrapper}` + ); + if (o != null && o.isEqualNode( + this.Editor.UI.nodes.wrapper + )) + return this.currentBlockIndex = this._blocks.nodes.indexOf( + t + ), this.currentBlock.updateCurrentInput(), this.currentBlock; + } + /** + * Return block which contents passed node + * + * @param {Node} childNode - node to get Block by + * @returns {Block} + */ + getBlockByChildNode(e) { + d.isElement(e) || (e = e.parentNode); + const t = e.closest( + `.${H.CSS.wrapper}` + ); + return this.blocks.find((o) => o.holder === t); + } + /** + * Swap Blocks Position + * + * @param {number} fromIndex - index of first block + * @param {number} toIndex - index of second block + * @deprecated — use 'move' instead + */ + swap(e, t) { + this._blocks.swap(e, t), this.currentBlockIndex = t; + } + /** + * Move a block to a new index + * + * @param {number} toIndex - index where to move Block + * @param {number} fromIndex - index of Block to move + */ + move(e, t = this.currentBlockIndex) { + if (isNaN(e) || isNaN(t)) { + L("Warning during 'move' call: incorrect indices provided.", "warn"); + return; + } + if (!this.validateIndex(e) || !this.validateIndex(t)) { + L( + "Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.", + "warn" + ); + return; + } + this._blocks.move(e, t), this.currentBlockIndex = e, this.blockDidMutated(Uo, this.currentBlock, { + fromIndex: t, + toIndex: e + }); + } + /** + * Converts passed Block to the new Tool + * Uses Conversion Config + * + * @param blockToConvert - Block that should be converted + * @param targetToolName - name of the Tool to convert to + * @param blockDataOverrides - optional new Block data overrides + */ + async convert(e, t, o) { + if (!await e.save()) + throw new Error( + "Could not convert Block. Failed to extract original Block data." + ); + const i = this.Editor.Tools.blockTools.get(t); + if (!i) + throw new Error( + `Could not convert Block. Tool «${t}» not found.` + ); + const r = await e.exportDataAsString(), a = q(r, i.sanitizeConfig); + let l = qt( + a, + i.conversionConfig + ); + o && (l = Object.assign(l, o)), this.replace(e, i.name, l); + } + /** + * Sets current Block Index -1 which means unknown + * and clear highlights + */ + dropPointer() { + this.currentBlockIndex = -1, this.clearFocused(); + } + /** + * Clears Editor + * + * @param {boolean} needToAddDefaultBlock - 1) in internal calls (for example, in api.blocks.render) + * we don't need to add an empty default block + * 2) in api.blocks.clear we should add empty block + */ + async clear(e = !1) { + const t = new $o(); + this.blocks.forEach((o) => { + t.add(async () => { + await this.removeBlock(o, !1); + }); + }), await t.completed, this.dropPointer(), e && this.insert(), this.Editor.UI.checkEmptiness(); + } + /** + * Cleans up all the block tools' resources + * This is called when editor is destroyed + */ + async destroy() { + await Promise.all( + this.blocks.map((e) => e.destroy()) + ); + } + /** + * Bind Block events + * + * @param {Block} block - Block to which event should be bound + */ + bindBlockEvents(e) { + const { BlockEvents: t } = this.Editor; + this.readOnlyMutableListeners.on( + e.holder, + "keydown", + (o) => { + t.keydown(o); + } + ), this.readOnlyMutableListeners.on( + e.holder, + "keyup", + (o) => { + t.keyup(o); + } + ), this.readOnlyMutableListeners.on( + e.holder, + "dragover", + (o) => { + t.dragOver(o); + } + ), this.readOnlyMutableListeners.on( + e.holder, + "dragleave", + (o) => { + t.dragLeave(o); + } + ), e.on("didMutated", (o) => this.blockDidMutated(Qe, o, { + index: this.getBlockIndex(o) + })); + } + /** + * Disable mutable handlers and bindings + */ + disableModuleBindings() { + this.readOnlyMutableListeners.clearAll(); + } + /** + * Enables all module handlers and bindings for all Blocks + */ + enableModuleBindings() { + this.readOnlyMutableListeners.on( + document, + "cut", + (e) => this.Editor.BlockEvents.handleCommandX(e) + ), this.blocks.forEach((e) => { + this.bindBlockEvents(e); + }); + } + /** + * Validates that the given index is not lower than 0 or higher than the amount of blocks + * + * @param {number} index - index of blocks array to validate + * @returns {boolean} + */ + validateIndex(e) { + return !(e < 0 || e >= this._blocks.length); + } + /** + * Block mutation callback + * + * @param mutationType - what happened with block + * @param block - mutated block + * @param detailData - additional data to pass with change event + */ + blockDidMutated(e, t, o) { + const n = new CustomEvent(e, { + detail: { + target: new ee(t), + ...o + } + }); + return this.eventsDispatcher.emit(lt, { + event: n + }), t; + } +} +class Vo extends T { + constructor() { + super(...arguments), this.anyBlockSelectedCache = null, this.needToSelectAll = !1, this.nativeInputSelected = !1, this.readyToBlockSelection = !1; + } + /** + * Sanitizer Config + * + * @returns {SanitizerConfig} + */ + get sanitizerConfig() { + return { + p: {}, + h1: {}, + h2: {}, + h3: {}, + h4: {}, + h5: {}, + h6: {}, + ol: {}, + ul: {}, + li: {}, + br: !0, + img: { + src: !0, + width: !0, + height: !0 + }, + a: { + href: !0 + }, + b: {}, + i: {}, + u: {} + }; + } + /** + * Flag that identifies all Blocks selection + * + * @returns {boolean} + */ + get allBlocksSelected() { + const { BlockManager: e } = this.Editor; + return e.blocks.every((t) => t.selected === !0); + } + /** + * Set selected all blocks + * + * @param {boolean} state - state to set + */ + set allBlocksSelected(e) { + const { BlockManager: t } = this.Editor; + t.blocks.forEach((o) => { + o.selected = e; + }), this.clearCache(); + } + /** + * Flag that identifies any Block selection + * + * @returns {boolean} + */ + get anyBlockSelected() { + const { BlockManager: e } = this.Editor; + return this.anyBlockSelectedCache === null && (this.anyBlockSelectedCache = e.blocks.some((t) => t.selected === !0)), this.anyBlockSelectedCache; + } + /** + * Return selected Blocks array + * + * @returns {Block[]} + */ + get selectedBlocks() { + return this.Editor.BlockManager.blocks.filter((e) => e.selected); + } + /** + * Module Preparation + * Registers Shortcuts CMD+A and CMD+C + * to select all and copy them + */ + prepare() { + this.selection = new k(), le.add({ + name: "CMD+A", + handler: (e) => { + const { BlockManager: t, ReadOnly: o } = this.Editor; + if (o.isEnabled) { + e.preventDefault(), this.selectAllBlocks(); + return; + } + t.currentBlock && this.handleCommandA(e); + }, + on: this.Editor.UI.nodes.redactor + }); + } + /** + * Toggle read-only state + * + * - Remove all ranges + * - Unselect all Blocks + */ + toggleReadOnly() { + k.get().removeAllRanges(), this.allBlocksSelected = !1; + } + /** + * Remove selection of Block + * + * @param {number?} index - Block index according to the BlockManager's indexes + */ + unSelectBlockByIndex(e) { + const { BlockManager: t } = this.Editor; + let o; + isNaN(e) ? o = t.currentBlock : o = t.getBlockByIndex(e), o.selected = !1, this.clearCache(); + } + /** + * Clear selection from Blocks + * + * @param {Event} reason - event caused clear of selection + * @param {boolean} restoreSelection - if true, restore saved selection + */ + clearSelection(e, t = !1) { + const { BlockManager: o, Caret: n, RectangleSelection: i } = this.Editor; + this.needToSelectAll = !1, this.nativeInputSelected = !1, this.readyToBlockSelection = !1; + const r = e && e instanceof KeyboardEvent, a = r && ot(e.keyCode); + if (this.anyBlockSelected && r && a && !k.isSelectionExists) { + const l = o.removeSelectedBlocks(); + o.insertDefaultBlockAtIndex(l, !0), n.setToBlock(o.currentBlock), re(() => { + const c = e.key; + n.insertContentAtCaretPosition(c.length > 1 ? "" : c); + }, 20)(); + } + if (this.Editor.CrossBlockSelection.clear(e), !this.anyBlockSelected || i.isRectActivated()) { + this.Editor.RectangleSelection.clearSelection(); + return; + } + t && this.selection.restore(), this.allBlocksSelected = !1; + } + /** + * Reduce each Block and copy its content + * + * @param {ClipboardEvent} e - copy/cut event + * @returns {Promise} + */ + copySelectedBlocks(e) { + e.preventDefault(); + const t = d.make("div"); + this.selectedBlocks.forEach((i) => { + const r = q(i.holder.innerHTML, this.sanitizerConfig), a = d.make("p"); + a.innerHTML = r, t.appendChild(a); + }); + const o = Array.from(t.childNodes).map((i) => i.textContent).join(` + +`), n = t.innerHTML; + return e.clipboardData.setData("text/plain", o), e.clipboardData.setData("text/html", n), Promise.all(this.selectedBlocks.map((i) => i.save())).then((i) => { + try { + e.clipboardData.setData(this.Editor.Paste.MIME_TYPE, JSON.stringify(i)); + } catch { + } + }); + } + /** + * select Block + * + * @param {number?} index - Block index according to the BlockManager's indexes + */ + selectBlockByIndex(e) { + const { BlockManager: t } = this.Editor; + t.clearFocused(); + let o; + isNaN(e) ? o = t.currentBlock : o = t.getBlockByIndex(e), this.selection.save(), k.get().removeAllRanges(), o.selected = !0, this.clearCache(), this.Editor.InlineToolbar.close(); + } + /** + * Clear anyBlockSelected cache + */ + clearCache() { + this.anyBlockSelectedCache = null; + } + /** + * Module destruction + * De-registers Shortcut CMD+A + */ + destroy() { + le.remove(this.Editor.UI.nodes.redactor, "CMD+A"); + } + /** + * First CMD+A selects all input content by native behaviour, + * next CMD+A keypress selects all blocks + * + * @param {KeyboardEvent} event - keyboard event + */ + handleCommandA(e) { + if (this.Editor.RectangleSelection.clearSelection(), d.isNativeInput(e.target) && !this.readyToBlockSelection) { + this.readyToBlockSelection = !0; + return; + } + const o = this.Editor.BlockManager.getBlock(e.target).inputs; + if (o.length > 1 && !this.readyToBlockSelection) { + this.readyToBlockSelection = !0; + return; + } + if (o.length === 1 && !this.needToSelectAll) { + this.needToSelectAll = !0; + return; + } + this.needToSelectAll ? (e.preventDefault(), this.selectAllBlocks(), this.needToSelectAll = !1, this.readyToBlockSelection = !1, this.Editor.ConversionToolbar.close()) : this.readyToBlockSelection && (e.preventDefault(), this.selectBlockByIndex(), this.needToSelectAll = !0); + } + /** + * Select All Blocks + * Each Block has selected setter that makes Block copyable + */ + selectAllBlocks() { + this.selection.save(), k.get().removeAllRanges(), this.allBlocksSelected = !0, this.Editor.InlineToolbar.close(); + } +} +class ke extends T { + /** + * Allowed caret positions in input + * + * @static + * @returns {{START: string, END: string, DEFAULT: string}} + */ + get positions() { + return { + START: "start", + END: "end", + DEFAULT: "default" + }; + } + /** + * Elements styles that can be useful for Caret Module + */ + static get CSS() { + return { + shadowCaret: "cdx-shadow-caret" + }; + } + /** + * Get's deepest first node and checks if offset is zero + * + * @returns {boolean} + */ + get isAtStart() { + const e = k.get(), t = d.getDeepestNode(this.Editor.BlockManager.currentBlock.currentInput); + let o = e.focusNode; + if (d.isNativeInput(t)) + return t.selectionEnd === 0; + if (!e.anchorNode) + return !1; + let n = o.textContent.search(/\S/); + n === -1 && (n = 0); + let i = e.focusOffset; + return o.nodeType !== Node.TEXT_NODE && o.childNodes.length && (o.childNodes[i] ? (o = o.childNodes[i], i = 0) : (o = o.childNodes[i - 1], i = o.textContent.length)), (d.isLineBreakTag(t) || d.isEmpty(t)) && this.getHigherLevelSiblings(o, "left").every((l) => { + const c = d.isLineBreakTag(l), u = l.children.length === 1 && d.isLineBreakTag(l.children[0]), h = c || u; + return d.isEmpty(l) && !h; + }) && i === n ? !0 : t === null || o === t && i <= n; + } + /** + * Get's deepest last node and checks if offset is last node text length + * + * @returns {boolean} + */ + get isAtEnd() { + const e = k.get(); + let t = e.focusNode; + const o = d.getDeepestNode(this.Editor.BlockManager.currentBlock.currentInput, !0); + if (d.isNativeInput(o)) + return o.selectionEnd === o.value.length; + if (!e.focusNode) + return !1; + let n = e.focusOffset; + if (t.nodeType !== Node.TEXT_NODE && t.childNodes.length && (t.childNodes[n - 1] ? (t = t.childNodes[n - 1], n = t.textContent.length) : (t = t.childNodes[0], n = 0)), d.isLineBreakTag(o) || d.isEmpty(o)) { + const r = this.getHigherLevelSiblings(t, "right"); + if (r.every((l, c) => c === r.length - 1 && d.isLineBreakTag(l) || d.isEmpty(l) && !d.isLineBreakTag(l)) && n === t.textContent.length) + return !0; + } + const i = o.textContent.replace(/\s+$/, ""); + return t === o && n >= i.length; + } + /** + * Method gets Block instance and puts caret to the text node with offset + * There two ways that method applies caret position: + * - first found text node: sets at the beginning, but you can pass an offset + * - last found text node: sets at the end of the node. Also, you can customize the behaviour + * + * @param {Block} block - Block class + * @param {string} position - position where to set caret. + * If default - leave default behaviour and apply offset if it's passed + * @param {number} offset - caret offset regarding to the text node + */ + setToBlock(e, t = this.positions.DEFAULT, o = 0) { + const { BlockManager: n } = this.Editor; + let i; + switch (t) { + case this.positions.START: + i = e.firstInput; + break; + case this.positions.END: + i = e.lastInput; + break; + default: + i = e.currentInput; + } + if (!i) + return; + const r = d.getDeepestNode(i, t === this.positions.END), a = d.getContentLength(r); + switch (!0) { + case t === this.positions.START: + o = 0; + break; + case t === this.positions.END: + case o > a: + o = a; + break; + } + re(() => { + this.set(r, o); + }, 20)(), n.setCurrentBlockByChildNode(e.holder), n.currentBlock.currentInput = i; + } + /** + * Set caret to the current input of current Block. + * + * @param {HTMLElement} input - input where caret should be set + * @param {string} position - position of the caret. + * If default - leave default behaviour and apply offset if it's passed + * @param {number} offset - caret offset regarding to the text node + */ + setToInput(e, t = this.positions.DEFAULT, o = 0) { + const { currentBlock: n } = this.Editor.BlockManager, i = d.getDeepestNode(e); + switch (t) { + case this.positions.START: + this.set(i, 0); + break; + case this.positions.END: + this.set(i, d.getContentLength(i)); + break; + default: + o && this.set(i, o); + } + n.currentInput = e; + } + /** + * Creates Document Range and sets caret to the element with offset + * + * @param {HTMLElement} element - target node. + * @param {number} offset - offset + */ + set(e, t = 0) { + const { top: o, bottom: n } = k.setCursor(e, t), { innerHeight: i } = window; + o < 0 && window.scrollBy(0, o), n > i && window.scrollBy(0, n - i); + } + /** + * Set Caret to the last Block + * If last block is not empty, append another empty block + */ + setToTheLastBlock() { + const e = this.Editor.BlockManager.lastBlock; + if (e) + if (e.tool.isDefault && e.isEmpty) + this.setToBlock(e); + else { + const t = this.Editor.BlockManager.insertAtEnd(); + this.setToBlock(t); + } + } + /** + * Extract content fragment of current Block from Caret position to the end of the Block + */ + extractFragmentFromCaretPosition() { + const e = k.get(); + if (e.rangeCount) { + const t = e.getRangeAt(0), o = this.Editor.BlockManager.currentBlock.currentInput; + if (t.deleteContents(), o) + if (d.isNativeInput(o)) { + const n = o, i = document.createDocumentFragment(), r = n.value.substring(0, n.selectionStart), a = n.value.substring(n.selectionStart); + return i.textContent = a, n.value = r, i; + } else { + const n = t.cloneRange(); + return n.selectNodeContents(o), n.setStart(t.endContainer, t.endOffset), n.extractContents(); + } + } + } + /** + * Set's caret to the next Block or Tool`s input + * Before moving caret, we should check if caret position is at the end of Plugins node + * Using {@link Dom#getDeepestNode} to get a last node and match with current selection + * + * @returns {boolean} + */ + navigateNext() { + const { BlockManager: e } = this.Editor, { currentBlock: t, nextContentfulBlock: o } = e, { nextInput: n } = t, i = this.isAtEnd; + let r = o; + if (!r && !n) { + if (t.tool.isDefault || !i) + return !1; + r = e.insertAtEnd(); + } + return i ? (n ? this.setToInput(n, this.positions.START) : this.setToBlock(r, this.positions.START), !0) : !1; + } + /** + * Set's caret to the previous Tool`s input or Block + * Before moving caret, we should check if caret position is start of the Plugins node + * Using {@link Dom#getDeepestNode} to get a last node and match with current selection + * + * @returns {boolean} + */ + navigatePrevious() { + const { currentBlock: e, previousContentfulBlock: t } = this.Editor.BlockManager; + if (!e) + return !1; + const { previousInput: o } = e; + return !t && !o ? !1 : this.isAtStart ? (o ? this.setToInput(o, this.positions.END) : this.setToBlock(t, this.positions.END), !0) : !1; + } + /** + * Inserts shadow element after passed element where caret can be placed + * + * @param {Element} element - element after which shadow caret should be inserted + */ + createShadow(e) { + const t = document.createElement("span"); + t.classList.add(ke.CSS.shadowCaret), e.insertAdjacentElement("beforeend", t); + } + /** + * Restores caret position + * + * @param {HTMLElement} element - element where caret should be restored + */ + restoreCaret(e) { + const t = e.querySelector(`.${ke.CSS.shadowCaret}`); + if (!t) + return; + new k().expandToTag(t); + const n = document.createRange(); + n.selectNode(t), n.extractContents(); + } + /** + * Inserts passed content at caret position + * + * @param {string} content - content to insert + */ + insertContentAtCaretPosition(e) { + const t = document.createDocumentFragment(), o = document.createElement("div"), n = k.get(), i = k.range; + o.innerHTML = e, Array.from(o.childNodes).forEach((c) => t.appendChild(c)), t.childNodes.length === 0 && t.appendChild(new Text()); + const r = t.lastChild; + i.deleteContents(), i.insertNode(t); + const a = document.createRange(), l = r.nodeType === Node.TEXT_NODE ? r : r.firstChild; + l !== null && l.textContent !== null && a.setStart(l, l.textContent.length), n.removeAllRanges(), n.addRange(a); + } + /** + * Get all first-level (first child of [contenteditable]) siblings from passed node + * Then you can check it for emptiness + * + * @example + *
+ * @param {HTMLElement} from - element from which siblings should be searched + * @param {'left' | 'right'} direction - direction of search + * @returns {HTMLElement[]} + */ + getHigherLevelSiblings(e, t) { + let o = e; + const n = []; + for (; o.parentNode && o.parentNode.contentEditable !== "true"; ) + o = o.parentNode; + const i = t === "left" ? "previousSibling" : "nextSibling"; + for (; o[i]; ) + o = o[i], n.push(o); + return n; + } +} +class Yo extends T { + constructor() { + super(...arguments), this.onMouseUp = () => { + this.listeners.off(document, "mouseover", this.onMouseOver), this.listeners.off(document, "mouseup", this.onMouseUp); + }, this.onMouseOver = (e) => { + const { BlockManager: t, BlockSelection: o } = this.Editor, n = t.getBlockByChildNode(e.relatedTarget) || this.lastSelectedBlock, i = t.getBlockByChildNode(e.target); + if (!(!n || !i) && i !== n) { + if (n === this.firstSelectedBlock) { + k.get().removeAllRanges(), n.selected = !0, i.selected = !0, o.clearCache(); + return; + } + if (i === this.firstSelectedBlock) { + n.selected = !1, i.selected = !1, o.clearCache(); + return; + } + this.Editor.InlineToolbar.close(), this.toggleBlocksSelectedState(n, i), this.lastSelectedBlock = i; + } + }; + } + /** + * Module preparation + * + * @returns {Promise} + */ + async prepare() { + this.listeners.on(document, "mousedown", (e) => { + this.enableCrossBlockSelection(e); + }); + } + /** + * Sets up listeners + * + * @param {MouseEvent} event - mouse down event + */ + watchSelection(e) { + if (e.button !== _t.LEFT) + return; + const { BlockManager: t } = this.Editor; + this.firstSelectedBlock = t.getBlock(e.target), this.lastSelectedBlock = this.firstSelectedBlock, this.listeners.on(document, "mouseover", this.onMouseOver), this.listeners.on(document, "mouseup", this.onMouseUp); + } + /** + * return boolean is cross block selection started + */ + get isCrossBlockSelectionStarted() { + return !!this.firstSelectedBlock && !!this.lastSelectedBlock; + } + /** + * Change selection state of the next Block + * Used for CBS via Shift + arrow keys + * + * @param {boolean} next - if true, toggle next block. Previous otherwise + */ + toggleBlockSelectedState(e = !0) { + const { BlockManager: t, BlockSelection: o } = this.Editor; + this.lastSelectedBlock || (this.lastSelectedBlock = this.firstSelectedBlock = t.currentBlock), this.firstSelectedBlock === this.lastSelectedBlock && (this.firstSelectedBlock.selected = !0, o.clearCache(), k.get().removeAllRanges()); + const n = t.blocks.indexOf(this.lastSelectedBlock) + (e ? 1 : -1), i = t.blocks[n]; + i && (this.lastSelectedBlock.selected !== i.selected ? (i.selected = !0, o.clearCache()) : (this.lastSelectedBlock.selected = !1, o.clearCache()), this.lastSelectedBlock = i, this.Editor.InlineToolbar.close(), i.holder.scrollIntoView({ + block: "nearest" + })); + } + /** + * Clear saved state + * + * @param {Event} reason - event caused clear of selection + */ + clear(e) { + const { BlockManager: t, BlockSelection: o, Caret: n } = this.Editor, i = t.blocks.indexOf(this.firstSelectedBlock), r = t.blocks.indexOf(this.lastSelectedBlock); + if (o.anyBlockSelected && i > -1 && r > -1) + if (e && e instanceof KeyboardEvent) + switch (e.keyCode) { + case B.DOWN: + case B.RIGHT: + n.setToBlock(t.blocks[Math.max(i, r)], n.positions.END); + break; + case B.UP: + case B.LEFT: + n.setToBlock(t.blocks[Math.min(i, r)], n.positions.START); + break; + default: + n.setToBlock(t.blocks[Math.max(i, r)], n.positions.END); + } + else + n.setToBlock(t.blocks[Math.max(i, r)], n.positions.END); + this.firstSelectedBlock = this.lastSelectedBlock = null; + } + /** + * Enables Cross Block Selection + * + * @param {MouseEvent} event - mouse down event + */ + enableCrossBlockSelection(e) { + const { UI: t } = this.Editor; + k.isCollapsed || this.Editor.BlockSelection.clearSelection(e), t.nodes.redactor.contains(e.target) ? this.watchSelection(e) : this.Editor.BlockSelection.clearSelection(e); + } + /** + * Change blocks selection state between passed two blocks. + * + * @param {Block} firstBlock - first block in range + * @param {Block} lastBlock - last block in range + */ + toggleBlocksSelectedState(e, t) { + const { BlockManager: o, BlockSelection: n } = this.Editor, i = o.blocks.indexOf(e), r = o.blocks.indexOf(t), a = e.selected !== t.selected; + for (let l = Math.min(i, r); l <= Math.max(i, r); l++) { + const c = o.blocks[l]; + c !== this.firstSelectedBlock && c !== (a ? e : t) && (o.blocks[l].selected = !o.blocks[l].selected, n.clearCache()); + } + } +} +class Zo extends T { + constructor() { + super(...arguments), this.isStartedAtEditor = !1; + } + /** + * Toggle read-only state + * + * if state is true: + * - disable all drag-n-drop event handlers + * + * if state is false: + * - restore drag-n-drop event handlers + * + * @param {boolean} readOnlyEnabled - "read only" state + */ + toggleReadOnly(e) { + e ? this.disableModuleBindings() : this.enableModuleBindings(); + } + /** + * Add drag events listeners to editor zone + */ + enableModuleBindings() { + const { UI: e } = this.Editor; + this.readOnlyMutableListeners.on(e.nodes.holder, "drop", async (t) => { + await this.processDrop(t); + }, !0), this.readOnlyMutableListeners.on(e.nodes.holder, "dragstart", () => { + this.processDragStart(); + }), this.readOnlyMutableListeners.on(e.nodes.holder, "dragover", (t) => { + this.processDragOver(t); + }, !0); + } + /** + * Unbind drag-n-drop event handlers + */ + disableModuleBindings() { + this.readOnlyMutableListeners.clearAll(); + } + /** + * Handle drop event + * + * @param {DragEvent} dropEvent - drop event + */ + async processDrop(e) { + const { + BlockManager: t, + Caret: o, + Paste: n + } = this.Editor; + e.preventDefault(), t.blocks.forEach((r) => { + r.dropTarget = !1; + }), k.isAtEditor && !k.isCollapsed && this.isStartedAtEditor && document.execCommand("delete"), this.isStartedAtEditor = !1; + const i = t.setCurrentBlockByChildNode(e.target); + if (i) + this.Editor.Caret.setToBlock(i, o.positions.END); + else { + const r = t.setCurrentBlockByChildNode(t.lastBlock.holder); + this.Editor.Caret.setToBlock(r, o.positions.END); + } + await n.processDataTransfer(e.dataTransfer, !0); + } + /** + * Handle drag start event + */ + processDragStart() { + k.isAtEditor && !k.isCollapsed && (this.isStartedAtEditor = !0), this.Editor.InlineToolbar.close(); + } + /** + * @param {DragEvent} dragEvent - drag event + */ + processDragOver(e) { + e.preventDefault(); + } +} +class Ko extends T { + /** + * Prepare the module + * + * @param options - options used by the modification observer module + * @param options.config - Editor configuration object + * @param options.eventsDispatcher - common Editor event bus + */ + constructor({ config: e, eventsDispatcher: t }) { + super({ + config: e, + eventsDispatcher: t + }), this.disabled = !1, this.batchingTimeout = null, this.batchingOnChangeQueue = /* @__PURE__ */ new Map(), this.batchTime = 400, this.mutationObserver = new MutationObserver((o) => { + this.redactorChanged(o); + }), this.eventsDispatcher.on(lt, (o) => { + this.particularBlockChanged(o.event); + }), this.eventsDispatcher.on(ct, () => { + this.disable(); + }), this.eventsDispatcher.on(dt, () => { + this.enable(); + }); + } + /** + * Enables onChange event + */ + enable() { + this.mutationObserver.observe( + this.Editor.UI.nodes.redactor, + { + childList: !0, + subtree: !0, + characterData: !0, + attributes: !0 + } + ), this.disabled = !1; + } + /** + * Disables onChange event + */ + disable() { + this.mutationObserver.disconnect(), this.disabled = !0; + } + /** + * Call onChange event passed to Editor.js configuration + * + * @param event - some of our custom change events + */ + particularBlockChanged(e) { + this.disabled || !D(this.config.onChange) || (this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`, e), this.batchingTimeout && clearTimeout(this.batchingTimeout), this.batchingTimeout = setTimeout(() => { + let t; + this.batchingOnChangeQueue.size === 1 ? t = this.batchingOnChangeQueue.values().next().value : t = Array.from(this.batchingOnChangeQueue.values()), this.config.onChange && this.config.onChange(this.Editor.API.methods, t), this.batchingOnChangeQueue.clear(); + }, this.batchTime)); + } + /** + * Fired on every blocks wrapper dom change + * + * @param mutations - mutations happened + */ + redactorChanged(e) { + this.eventsDispatcher.emit(Ie, { + mutations: e + }); + } +} +const vt = class extends T { + constructor() { + super(...arguments), this.MIME_TYPE = "application/x-editor-js", this.toolsTags = {}, this.tagsByTool = {}, this.toolsPatterns = [], this.toolsFiles = {}, this.exceptionList = [], this.processTool = (s) => { + try { + const e = s.create({}, {}, !1); + if (s.pasteConfig === !1) { + this.exceptionList.push(s.name); + return; + } + if (!D(e.onPaste)) + return; + this.getTagsConfig(s), this.getFilesConfig(s), this.getPatternsConfig(s); + } catch (e) { + L( + `Paste handling for «${s.name}» Tool hasn't been set up because of the error`, + "warn", + e + ); + } + }, this.handlePasteEvent = async (s) => { + const { BlockManager: e, Toolbar: t } = this.Editor, o = e.setCurrentBlockByChildNode(s.target); + !o || this.isNativeBehaviour(s.target) && !s.clipboardData.types.includes("Files") || o && this.exceptionList.includes(o.name) || (s.preventDefault(), this.processDataTransfer(s.clipboardData), e.clearFocused(), t.close()); + }; + } + /** + * Set onPaste callback and collect tools` paste configurations + */ + async prepare() { + this.processTools(); + } + /** + * Set read-only state + * + * @param {boolean} readOnlyEnabled - read only flag value + */ + toggleReadOnly(s) { + s ? this.unsetCallback() : this.setCallback(); + } + /** + * Handle pasted or dropped data transfer object + * + * @param {DataTransfer} dataTransfer - pasted or dropped data transfer object + * @param {boolean} isDragNDrop - true if data transfer comes from drag'n'drop events + */ + async processDataTransfer(s, e = !1) { + const { Tools: t } = this.Editor, o = s.types; + if ((o.includes ? o.includes("Files") : o.contains("Files")) && !K(this.toolsFiles)) { + await this.processFiles(s.files); + return; + } + const i = s.getData(this.MIME_TYPE), r = s.getData("text/plain"); + let a = s.getData("text/html"); + const l = document.createElement("div"); + if (l.innerHTML = a, l.querySelectorAll("*").forEach((m) => { + m instanceof HTMLElement && (m.style.fontFamily = "inherit", m.style.color = "inherit", m.style.fontSize = "inherit", m.style.backgroundColor = "initial"); + }), a = l.innerHTML, i) + try { + this.insertEditorJSData(JSON.parse(i)); + return; + } catch { + } + e && r.trim() && a.trim() && (a = "

" + (a.trim() ? a : r) + "

"); + const u = Object.keys(this.toolsTags).reduce((m, p) => (m[p.toLowerCase()] = this.toolsTags[p].sanitizationConfig ?? {}, m), {}), h = Object.assign({}, u, t.getAllInlineToolsSanitizeConfig(), { br: {} }), f = q(a, h); + !f.trim() || f.trim() === r || !d.isHTMLString(f) ? await this.processText(r) : await this.processText(f, !0); + } + /** + * Process pasted text and divide them into Blocks + * + * @param {string} data - text to process. Can be HTML or plain. + * @param {boolean} isHTML - if passed string is HTML, this parameter should be true + */ + async processText(s, e = !1) { + const { Caret: t, BlockManager: o } = this.Editor, n = e ? this.processHTML(s) : this.processPlain(s); + if (!n.length) + return; + if (n.length === 1) { + n[0].isBlock ? this.processSingleBlock(n.pop()) : this.processInlinePaste(n.pop()); + return; + } + const r = o.currentBlock && o.currentBlock.tool.isDefault && o.currentBlock.isEmpty; + n.map( + async (a, l) => this.insertBlock(a, l === 0 && r) + ), o.currentBlock && t.setToBlock(o.currentBlock, t.positions.END); + } + /** + * Set onPaste callback handler + */ + setCallback() { + this.listeners.on(this.Editor.UI.nodes.holder, "paste", this.handlePasteEvent); + } + /** + * Unset onPaste callback handler + */ + unsetCallback() { + this.listeners.off(this.Editor.UI.nodes.holder, "paste", this.handlePasteEvent); + } + /** + * Get and process tool`s paste configs + */ + processTools() { + const s = this.Editor.Tools.blockTools; + Array.from(s.values()).forEach(this.processTool); + } + /** + * Get tags name list from either tag name or sanitization config. + * + * @param {string | object} tagOrSanitizeConfig - tag name or sanitize config object. + * @returns {string[]} array of tags. + */ + collectTagNames(s) { + return J(s) ? [s] : j(s) ? Object.keys(s) : []; + } + /** + * Get tags to substitute by Tool + * + * @param tool - BlockTool object + */ + getTagsConfig(s) { + if (s.pasteConfig === !1) + return; + const e = s.pasteConfig.tags || [], t = []; + e.forEach((o) => { + const n = this.collectTagNames(o); + t.push(...n), n.forEach((i) => { + if (Object.prototype.hasOwnProperty.call(this.toolsTags, i)) { + L( + `Paste handler for «${s.name}» Tool on «${i}» tag is skipped because it is already used by «${this.toolsTags[i].tool.name}» Tool.`, + "warn" + ); + return; + } + const r = j(o) ? o[i] : null; + this.toolsTags[i.toUpperCase()] = { + tool: s, + sanitizationConfig: r + }; + }); + }), this.tagsByTool[s.name] = t.map((o) => o.toUpperCase()); + } + /** + * Get files` types and extensions to substitute by Tool + * + * @param tool - BlockTool object + */ + getFilesConfig(s) { + if (s.pasteConfig === !1) + return; + const { files: e = {} } = s.pasteConfig; + let { extensions: t, mimeTypes: o } = e; + !t && !o || (t && !Array.isArray(t) && (L(`«extensions» property of the onDrop config for «${s.name}» Tool should be an array`), t = []), o && !Array.isArray(o) && (L(`«mimeTypes» property of the onDrop config for «${s.name}» Tool should be an array`), o = []), o && (o = o.filter((n) => Dt(n) ? !0 : (L(`MIME type value «${n}» for the «${s.name}» Tool is not a valid MIME type`, "warn"), !1))), this.toolsFiles[s.name] = { + extensions: t || [], + mimeTypes: o || [] + }); + } + /** + * Get RegExp patterns to substitute by Tool + * + * @param tool - BlockTool object + */ + getPatternsConfig(s) { + s.pasteConfig === !1 || !s.pasteConfig.patterns || K(s.pasteConfig.patterns) || Object.entries(s.pasteConfig.patterns).forEach(([e, t]) => { + t instanceof RegExp || L( + `Pattern ${t} for «${s.name}» Tool is skipped because it should be a Regexp instance.`, + "warn" + ), this.toolsPatterns.push({ + key: e, + pattern: t, + tool: s + }); + }); + } + /** + * Check if browser behavior suits better + * + * @param {EventTarget} element - element where content has been pasted + * @returns {boolean} + */ + isNativeBehaviour(s) { + return d.isNativeInput(s); + } + /** + * Get files from data transfer object and insert related Tools + * + * @param {FileList} items - pasted or dropped items + */ + async processFiles(s) { + const { BlockManager: e } = this.Editor; + let t; + t = await Promise.all( + Array.from(s).map((i) => this.processFile(i)) + ), t = t.filter((i) => !!i); + const n = e.currentBlock.tool.isDefault && e.currentBlock.isEmpty; + t.forEach( + (i, r) => { + e.paste(i.type, i.event, r === 0 && n); + } + ); + } + /** + * Get information about file and find Tool to handle it + * + * @param {File} file - file to process + */ + async processFile(s) { + const e = Rt(s), t = Object.entries(this.toolsFiles).find(([i, { mimeTypes: r, extensions: a }]) => { + const [l, c] = s.type.split("/"), u = a.find((f) => f.toLowerCase() === e.toLowerCase()), h = r.find((f) => { + const [m, p] = f.split("/"); + return m === l && (p === c || p === "*"); + }); + return !!u || !!h; + }); + if (!t) + return; + const [o] = t; + return { + event: this.composePasteEvent("file", { + file: s + }), + type: o + }; + } + /** + * Split HTML string to blocks and return it as array of Block data + * + * @param {string} innerHTML - html string to process + * @returns {PasteData[]} + */ + processHTML(s) { + const { Tools: e } = this.Editor, t = d.make("DIV"); + return t.innerHTML = s, this.getNodes(t).map((n) => { + let i, r = e.defaultTool, a = !1; + switch (n.nodeType) { + case Node.DOCUMENT_FRAGMENT_NODE: + i = d.make("div"), i.appendChild(n); + break; + case Node.ELEMENT_NODE: + i = n, a = !0, this.toolsTags[i.tagName] && (r = this.toolsTags[i.tagName].tool); + break; + } + const { tags: l } = r.pasteConfig || { tags: [] }, c = l.reduce((f, m) => (this.collectTagNames(m).forEach((v) => { + const O = j(m) ? m[v] : null; + f[v.toLowerCase()] = O || {}; + }), f), {}), u = Object.assign({}, c, r.baseSanitizeConfig); + if (i.tagName.toLowerCase() === "table") { + const f = q(i.outerHTML, u); + i = d.make("div", void 0, { + innerHTML: f + }).firstChild; + } else + i.innerHTML = q(i.innerHTML, u); + const h = this.composePasteEvent("tag", { + data: i + }); + return { + content: i, + isBlock: a, + tool: r.name, + event: h + }; + }).filter((n) => { + const i = d.isEmpty(n.content), r = d.isSingleTag(n.content); + return !i || r; + }); + } + /** + * Split plain text by new line symbols and return it as array of Block data + * + * @param {string} plain - string to process + * @returns {PasteData[]} + */ + processPlain(s) { + const { defaultBlock: e } = this.config; + if (!s) + return []; + const t = e; + return s.split(/\r?\n/).filter((o) => o.trim()).map((o) => { + const n = d.make("div"); + n.textContent = o; + const i = this.composePasteEvent("tag", { + data: n + }); + return { + content: n, + tool: t, + isBlock: !1, + event: i + }; + }); + } + /** + * Process paste of single Block tool content + * + * @param {PasteData} dataToInsert - data of Block to insert + */ + async processSingleBlock(s) { + const { Caret: e, BlockManager: t } = this.Editor, { currentBlock: o } = t; + if (!o || s.tool !== o.name || !d.containsOnlyInlineElements(s.content.innerHTML)) { + this.insertBlock(s, (o == null ? void 0 : o.tool.isDefault) && o.isEmpty); + return; + } + e.insertContentAtCaretPosition(s.content.innerHTML); + } + /** + * Process paste to single Block: + * 1. Find patterns` matches + * 2. Insert new block if it is not the same type as current one + * 3. Just insert text if there is no substitutions + * + * @param {PasteData} dataToInsert - data of Block to insert + */ + async processInlinePaste(s) { + const { BlockManager: e, Caret: t } = this.Editor, { content: o } = s; + if (e.currentBlock && e.currentBlock.tool.isDefault && o.textContent.length < vt.PATTERN_PROCESSING_MAX_LENGTH) { + const i = await this.processPattern(o.textContent); + if (i) { + const r = e.currentBlock && e.currentBlock.tool.isDefault && e.currentBlock.isEmpty, a = e.paste(i.tool, i.event, r); + t.setToBlock(a, t.positions.END); + return; + } + } + if (e.currentBlock && e.currentBlock.currentInput) { + const i = e.currentBlock.tool.baseSanitizeConfig; + document.execCommand( + "insertHTML", + !1, + q(o.innerHTML, i) + ); + } else + this.insertBlock(s); + } + /** + * Get patterns` matches + * + * @param {string} text - text to process + * @returns {Promise<{event: PasteEvent, tool: string}>} + */ + async processPattern(s) { + const e = this.toolsPatterns.find((o) => { + const n = o.pattern.exec(s); + return n ? s === n.shift() : !1; + }); + return e ? { + event: this.composePasteEvent("pattern", { + key: e.key, + data: s + }), + tool: e.tool.name + } : void 0; + } + /** + * Insert pasted Block content to Editor + * + * @param {PasteData} data - data to insert + * @param {boolean} canReplaceCurrentBlock - if true and is current Block is empty, will replace current Block + * @returns {void} + */ + insertBlock(s, e = !1) { + const { BlockManager: t, Caret: o } = this.Editor, { currentBlock: n } = t; + let i; + if (e && n && n.isEmpty) { + i = t.paste(s.tool, s.event, !0), o.setToBlock(i, o.positions.END); + return; + } + i = t.paste(s.tool, s.event), o.setToBlock(i, o.positions.END); + } + /** + * Insert data passed as application/x-editor-js JSON + * + * @param {Array} blocks — Blocks' data to insert + * @returns {void} + */ + insertEditorJSData(s) { + const { BlockManager: e, Caret: t, Tools: o } = this.Editor; + ht( + s, + (i) => o.blockTools.get(i).sanitizeConfig + ).forEach(({ tool: i, data: r }, a) => { + let l = !1; + a === 0 && (l = e.currentBlock && e.currentBlock.tool.isDefault && e.currentBlock.isEmpty); + const c = e.insert({ + tool: i, + data: r, + replace: l + }); + t.setToBlock(c, t.positions.END); + }); + } + /** + * Fetch nodes from Element node + * + * @param {Node} node - current node + * @param {Node[]} nodes - processed nodes + * @param {Node} destNode - destination node + */ + processElementNode(s, e, t) { + const o = Object.keys(this.toolsTags), n = s, { tool: i } = this.toolsTags[n.tagName] || {}, r = this.tagsByTool[i == null ? void 0 : i.name] || [], a = o.includes(n.tagName), l = d.blockElements.includes(n.tagName.toLowerCase()), c = Array.from(n.children).some( + ({ tagName: h }) => o.includes(h) && !r.includes(h) + ), u = Array.from(n.children).some( + ({ tagName: h }) => d.blockElements.includes(h.toLowerCase()) + ); + if (!l && !a && !c) + return t.appendChild(n), [...e, t]; + if (a && !c || l && !u && !c) + return [...e, t, n]; + } + /** + * Recursively divide HTML string to two types of nodes: + * 1. Block element + * 2. Document Fragments contained text and markup tags like a, b, i etc. + * + * @param {Node} wrapper - wrapper of paster HTML content + * @returns {Node[]} + */ + getNodes(s) { + const e = Array.from(s.childNodes); + let t; + const o = (n, i) => { + if (d.isEmpty(i) && !d.isSingleTag(i)) + return n; + const r = n[n.length - 1]; + let a = new DocumentFragment(); + switch (r && d.isFragment(r) && (a = n.pop()), i.nodeType) { + case Node.ELEMENT_NODE: + if (t = this.processElementNode(i, n, a), t) + return t; + break; + case Node.TEXT_NODE: + return a.appendChild(i), [...n, a]; + default: + return [...n, a]; + } + return [...n, ...Array.from(i.childNodes).reduce(o, [])]; + }; + return e.reduce(o, []); + } + /** + * Compose paste event with passed type and detail + * + * @param {string} type - event type + * @param {PasteEventDetail} detail - event detail + */ + composePasteEvent(s, e) { + return new CustomEvent(s, { + detail: e + }); + } +}; +let xt = vt; +xt.PATTERN_PROCESSING_MAX_LENGTH = 450; +class Xo extends T { + constructor() { + super(...arguments), this.toolsDontSupportReadOnly = [], this.readOnlyEnabled = !1; + } + /** + * Returns state of read only mode + */ + get isEnabled() { + return this.readOnlyEnabled; + } + /** + * Set initial state + */ + async prepare() { + const { Tools: e } = this.Editor, { blockTools: t } = e, o = []; + Array.from(t.entries()).forEach(([n, i]) => { + i.isReadOnlySupported || o.push(n); + }), this.toolsDontSupportReadOnly = o, this.config.readOnly && o.length > 0 && this.throwCriticalError(), this.toggle(this.config.readOnly); + } + /** + * Set read-only mode or toggle current state + * Call all Modules `toggleReadOnly` method and re-render Editor + * + * @param {boolean} state - (optional) read-only state or toggle + */ + async toggle(e = !this.readOnlyEnabled) { + e && this.toolsDontSupportReadOnly.length > 0 && this.throwCriticalError(); + const t = this.readOnlyEnabled; + this.readOnlyEnabled = e; + for (const n in this.Editor) + this.Editor[n].toggleReadOnly && this.Editor[n].toggleReadOnly(e); + if (t === e) + return this.readOnlyEnabled; + const o = await this.Editor.Saver.save(); + return await this.Editor.BlockManager.clear(), await this.Editor.Renderer.render(o.blocks), this.readOnlyEnabled; + } + /** + * Throws an error about tools which don't support read-only mode + */ + throwCriticalError() { + throw new rt( + `To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.` + ); + } +} +class pe extends T { + constructor() { + super(...arguments), this.isRectSelectionActivated = !1, this.SCROLL_SPEED = 3, this.HEIGHT_OF_SCROLL_ZONE = 40, this.BOTTOM_SCROLL_ZONE = 1, this.TOP_SCROLL_ZONE = 2, this.MAIN_MOUSE_BUTTON = 0, this.mousedown = !1, this.isScrolling = !1, this.inScrollZone = null, this.startX = 0, this.startY = 0, this.mouseX = 0, this.mouseY = 0, this.stackOfSelected = [], this.listenerIds = []; + } + /** + * CSS classes for the Block + * + * @returns {{wrapper: string, content: string}} + */ + static get CSS() { + return { + overlay: "codex-editor-overlay", + overlayContainer: "codex-editor-overlay__container", + rect: "codex-editor-overlay__rectangle", + topScrollZone: "codex-editor-overlay__scroll-zone--top", + bottomScrollZone: "codex-editor-overlay__scroll-zone--bottom" + }; + } + /** + * Module Preparation + * Creating rect and hang handlers + */ + prepare() { + this.enableModuleBindings(); + } + /** + * Init rect params + * + * @param {number} pageX - X coord of mouse + * @param {number} pageY - Y coord of mouse + */ + startSelection(e, t) { + const o = document.elementFromPoint(e - window.pageXOffset, t - window.pageYOffset); + o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`) || (this.Editor.BlockSelection.allBlocksSelected = !1, this.clearSelection(), this.stackOfSelected = []); + const i = [ + `.${H.CSS.content}`, + `.${this.Editor.Toolbar.CSS.toolbar}`, + `.${this.Editor.InlineToolbar.CSS.inlineToolbar}` + ], r = o.closest("." + this.Editor.UI.CSS.editorWrapper), a = i.some((l) => !!o.closest(l)); + !r || a || (this.mousedown = !0, this.startX = e, this.startY = t); + } + /** + * Clear all params to end selection + */ + endSelection() { + this.mousedown = !1, this.startX = 0, this.startY = 0, this.overlayRectangle.style.display = "none"; + } + /** + * is RectSelection Activated + */ + isRectActivated() { + return this.isRectSelectionActivated; + } + /** + * Mark that selection is end + */ + clearSelection() { + this.isRectSelectionActivated = !1; + } + /** + * Sets Module necessary event handlers + */ + enableModuleBindings() { + const { container: e } = this.genHTML(); + this.listeners.on(e, "mousedown", (t) => { + this.processMouseDown(t); + }, !1), this.listeners.on(document.body, "mousemove", Ee((t) => { + this.processMouseMove(t); + }, 10), { + passive: !0 + }), this.listeners.on(document.body, "mouseleave", () => { + this.processMouseLeave(); + }), this.listeners.on(window, "scroll", Ee((t) => { + this.processScroll(t); + }, 10), { + passive: !0 + }), this.listeners.on(document.body, "mouseup", () => { + this.processMouseUp(); + }, !1); + } + /** + * Handle mouse down events + * + * @param {MouseEvent} mouseEvent - mouse event payload + */ + processMouseDown(e) { + if (e.button !== this.MAIN_MOUSE_BUTTON) + return; + e.target.closest(d.allInputsSelector) !== null || this.startSelection(e.pageX, e.pageY); + } + /** + * Handle mouse move events + * + * @param {MouseEvent} mouseEvent - mouse event payload + */ + processMouseMove(e) { + this.changingRectangle(e), this.scrollByZones(e.clientY); + } + /** + * Handle mouse leave + */ + processMouseLeave() { + this.clearSelection(), this.endSelection(); + } + /** + * @param {MouseEvent} mouseEvent - mouse event payload + */ + processScroll(e) { + this.changingRectangle(e); + } + /** + * Handle mouse up + */ + processMouseUp() { + this.clearSelection(), this.endSelection(); + } + /** + * Scroll If mouse in scroll zone + * + * @param {number} clientY - Y coord of mouse + */ + scrollByZones(e) { + if (this.inScrollZone = null, e <= this.HEIGHT_OF_SCROLL_ZONE && (this.inScrollZone = this.TOP_SCROLL_ZONE), document.documentElement.clientHeight - e <= this.HEIGHT_OF_SCROLL_ZONE && (this.inScrollZone = this.BOTTOM_SCROLL_ZONE), !this.inScrollZone) { + this.isScrolling = !1; + return; + } + this.isScrolling || (this.scrollVertical(this.inScrollZone === this.TOP_SCROLL_ZONE ? -this.SCROLL_SPEED : this.SCROLL_SPEED), this.isScrolling = !0); + } + /** + * Generates required HTML elements + * + * @returns {Object} + */ + genHTML() { + const { UI: e } = this.Editor, t = e.nodes.holder.querySelector("." + e.CSS.editorWrapper), o = d.make("div", pe.CSS.overlay, {}), n = d.make("div", pe.CSS.overlayContainer, {}), i = d.make("div", pe.CSS.rect, {}); + return n.appendChild(i), o.appendChild(n), t.appendChild(o), this.overlayRectangle = i, { + container: t, + overlay: o + }; + } + /** + * Activates scrolling if blockSelection is active and mouse is in scroll zone + * + * @param {number} speed - speed of scrolling + */ + scrollVertical(e) { + if (!(this.inScrollZone && this.mousedown)) + return; + const t = window.pageYOffset; + window.scrollBy(0, e), this.mouseY += window.pageYOffset - t, setTimeout(() => { + this.scrollVertical(e); + }, 0); + } + /** + * Handles the change in the rectangle and its effect + * + * @param {MouseEvent} event - mouse event + */ + changingRectangle(e) { + if (!this.mousedown) + return; + e.pageY !== void 0 && (this.mouseX = e.pageX, this.mouseY = e.pageY); + const { rightPos: t, leftPos: o, index: n } = this.genInfoForMouseSelection(), i = this.startX > t && this.mouseX > t, r = this.startX < o && this.mouseX < o; + this.rectCrossesBlocks = !(i || r), this.isRectSelectionActivated || (this.rectCrossesBlocks = !1, this.isRectSelectionActivated = !0, this.shrinkRectangleToPoint(), this.overlayRectangle.style.display = "block"), this.updateRectangleSize(), this.Editor.Toolbar.close(), n !== void 0 && (this.trySelectNextBlock(n), this.inverseSelection(), k.get().removeAllRanges()); + } + /** + * Shrink rect to singular point + */ + shrinkRectangleToPoint() { + this.overlayRectangle.style.left = `${this.startX - window.pageXOffset}px`, this.overlayRectangle.style.top = `${this.startY - window.pageYOffset}px`, this.overlayRectangle.style.bottom = `calc(100% - ${this.startY - window.pageYOffset}px`, this.overlayRectangle.style.right = `calc(100% - ${this.startX - window.pageXOffset}px`; + } + /** + * Select or unselect all of blocks in array if rect is out or in selectable area + */ + inverseSelection() { + const t = this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected; + if (this.rectCrossesBlocks && !t) + for (const o of this.stackOfSelected) + this.Editor.BlockSelection.selectBlockByIndex(o); + if (!this.rectCrossesBlocks && t) + for (const o of this.stackOfSelected) + this.Editor.BlockSelection.unSelectBlockByIndex(o); + } + /** + * Updates size of rectangle + */ + updateRectangleSize() { + this.mouseY >= this.startY ? (this.overlayRectangle.style.top = `${this.startY - window.pageYOffset}px`, this.overlayRectangle.style.bottom = `calc(100% - ${this.mouseY - window.pageYOffset}px`) : (this.overlayRectangle.style.bottom = `calc(100% - ${this.startY - window.pageYOffset}px`, this.overlayRectangle.style.top = `${this.mouseY - window.pageYOffset}px`), this.mouseX >= this.startX ? (this.overlayRectangle.style.left = `${this.startX - window.pageXOffset}px`, this.overlayRectangle.style.right = `calc(100% - ${this.mouseX - window.pageXOffset}px`) : (this.overlayRectangle.style.right = `calc(100% - ${this.startX - window.pageXOffset}px`, this.overlayRectangle.style.left = `${this.mouseX - window.pageXOffset}px`); + } + /** + * Collects information needed to determine the behavior of the rectangle + * + * @returns {object} index - index next Block, leftPos - start of left border of Block, rightPos - right border + */ + genInfoForMouseSelection() { + const t = document.body.offsetWidth / 2, o = this.mouseY - window.pageYOffset, n = document.elementFromPoint(t, o), i = this.Editor.BlockManager.getBlockByChildNode(n); + let r; + i !== void 0 && (r = this.Editor.BlockManager.blocks.findIndex((h) => h.holder === i.holder)); + const a = this.Editor.BlockManager.lastBlock.holder.querySelector("." + H.CSS.content), l = Number.parseInt(window.getComputedStyle(a).width, 10) / 2, c = t - l, u = t + l; + return { + index: r, + leftPos: c, + rightPos: u + }; + } + /** + * Select block with index index + * + * @param index - index of block in redactor + */ + addBlockInSelection(e) { + this.rectCrossesBlocks && this.Editor.BlockSelection.selectBlockByIndex(e), this.stackOfSelected.push(e); + } + /** + * Adds a block to the selection and determines which blocks should be selected + * + * @param {object} index - index of new block in the reactor + */ + trySelectNextBlock(e) { + const t = this.stackOfSelected[this.stackOfSelected.length - 1] === e, o = this.stackOfSelected.length, n = 1, i = -1, r = 0; + if (t) + return; + const a = this.stackOfSelected[o - 1] - this.stackOfSelected[o - 2] > 0; + let l = r; + o > 1 && (l = a ? n : i); + const c = e > this.stackOfSelected[o - 1] && l === n, u = e < this.stackOfSelected[o - 1] && l === i, f = !(c || u || l === r); + if (!f && (e > this.stackOfSelected[o - 1] || this.stackOfSelected[o - 1] === void 0)) { + let v = this.stackOfSelected[o - 1] + 1 || e; + for (v; v <= e; v++) + this.addBlockInSelection(v); + return; + } + if (!f && e < this.stackOfSelected[o - 1]) { + for (let v = this.stackOfSelected[o - 1] - 1; v >= e; v--) + this.addBlockInSelection(v); + return; + } + if (!f) + return; + let m = o - 1, p; + for (e > this.stackOfSelected[o - 1] ? p = () => e > this.stackOfSelected[m] : p = () => e < this.stackOfSelected[m]; p(); ) + this.rectCrossesBlocks && this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[m]), this.stackOfSelected.pop(), m--; + } +} +class qo extends T { + /** + * Renders passed blocks as one batch + * + * @param blocksData - blocks to render + */ + async render(e) { + return new Promise((t) => { + const { Tools: o, BlockManager: n } = this.Editor, i = e.map(({ type: r, data: a, tunes: l, id: c }) => { + o.available.has(r) === !1 && (Y(`Tool «${r}» is not found. Check 'tools' property at the Editor.js config.`, "warn"), a = this.composeStubDataForTool(r, a, c), r = o.stubTool); + let u; + try { + u = n.composeBlock({ + id: c, + tool: r, + data: a, + tunes: l + }); + } catch (h) { + L(`Block «${r}» skipped because of plugins error`, "error", { + data: a, + error: h + }), a = this.composeStubDataForTool(r, a, c), r = o.stubTool, u = n.composeBlock({ + id: c, + tool: r, + data: a, + tunes: l + }); + } + return u; + }); + n.insertMany(i), window.requestIdleCallback(() => { + t(); + }, { timeout: 2e3 }); + }); + } + /** + * Create data for the Stub Tool that will be used instead of unavailable tool + * + * @param tool - unavailable tool name to stub + * @param data - data of unavailable block + * @param [id] - id of unavailable block + */ + composeStubDataForTool(e, t, o) { + const { Tools: n } = this.Editor; + let i = e; + if (n.unavailable.has(e)) { + const r = n.unavailable.get(e).toolbox; + r !== void 0 && r[0].title !== void 0 && (i = r[0].title); + } + return { + savedData: { + id: o, + type: e, + data: t + }, + title: i + }; + } +} +class Go extends T { + /** + * Composes new chain of Promises to fire them alternatelly + * + * @returns {OutputData} + */ + async save() { + const { BlockManager: e, Tools: t } = this.Editor, o = e.blocks, n = []; + try { + o.forEach((a) => { + n.push(this.getSavedData(a)); + }); + const i = await Promise.all(n), r = await ht(i, (a) => t.blockTools.get(a).sanitizeConfig); + return this.makeOutput(r); + } catch (i) { + Y("Saving failed due to the Error %o", "error", i); + } + } + /** + * Saves and validates + * + * @param {Block} block - Editor's Tool + * @returns {ValidatedData} - Tool's validated data + */ + async getSavedData(e) { + const t = await e.save(), o = t && await e.validate(t.data); + return { + ...t, + isValid: o + }; + } + /** + * Creates output object with saved data, time and version of editor + * + * @param {ValidatedData} allExtractedData - data extracted from Blocks + * @returns {OutputData} + */ + makeOutput(e) { + const t = []; + return e.forEach(({ id: o, tool: n, data: i, tunes: r, isValid: a }) => { + if (!a) { + L(`Block «${n}» skipped because saved data is invalid`); + return; + } + if (n === this.Editor.Tools.stubTool) { + t.push(i); + return; + } + const l = { + id: o, + type: n, + data: i, + ...!K(r) && { + tunes: r + } + }; + t.push(l); + }), { + time: +/* @__PURE__ */ new Date(), + blocks: t, + version: "2.28.0-rc.3" + }; + } +} +var Ae = {}, Jo = { + get exports() { + return Ae; + }, + set exports(s) { + Ae = s; + } +}; +(function(s, e) { + (function(t, o) { + s.exports = o(); + })(window, function() { + return function(t) { + var o = {}; + function n(i) { + if (o[i]) + return o[i].exports; + var r = o[i] = { i, l: !1, exports: {} }; + return t[i].call(r.exports, r, r.exports, n), r.l = !0, r.exports; + } + return n.m = t, n.c = o, n.d = function(i, r, a) { + n.o(i, r) || Object.defineProperty(i, r, { enumerable: !0, get: a }); + }, n.r = function(i) { + typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 }); + }, n.t = function(i, r) { + if (1 & r && (i = n(i)), 8 & r || 4 & r && typeof i == "object" && i && i.__esModule) + return i; + var a = /* @__PURE__ */ Object.create(null); + if (n.r(a), Object.defineProperty(a, "default", { enumerable: !0, value: i }), 2 & r && typeof i != "string") + for (var l in i) + n.d(a, l, function(c) { + return i[c]; + }.bind(null, l)); + return a; + }, n.n = function(i) { + var r = i && i.__esModule ? function() { + return i.default; + } : function() { + return i; + }; + return n.d(r, "a", r), r; + }, n.o = function(i, r) { + return Object.prototype.hasOwnProperty.call(i, r); + }, n.p = "/", n(n.s = 4); + }([function(t, o, n) { + var i = n(1), r = n(2); + typeof (r = r.__esModule ? r.default : r) == "string" && (r = [[t.i, r, ""]]); + var a = { insert: "head", singleton: !1 }; + i(r, a), t.exports = r.locals || {}; + }, function(t, o, n) { + var i, r = function() { + return i === void 0 && (i = !!(window && document && document.all && !window.atob)), i; + }, a = function() { + var C = {}; + return function(x) { + if (C[x] === void 0) { + var w = document.querySelector(x); + if (window.HTMLIFrameElement && w instanceof window.HTMLIFrameElement) + try { + w = w.contentDocument.head; + } catch { + w = null; + } + C[x] = w; + } + return C[x]; + }; + }(), l = []; + function c(C) { + for (var x = -1, w = 0; w < l.length; w++) + if (l[w].identifier === C) { + x = w; + break; + } + return x; + } + function u(C, x) { + for (var w = {}, I = [], R = 0; R < C.length; R++) { + var b = C[R], g = x.base ? b[0] + x.base : b[0], y = w[g] || 0, E = "".concat(g, " ").concat(y); + w[g] = y + 1; + var _ = c(E), S = { css: b[1], media: b[2], sourceMap: b[3] }; + _ !== -1 ? (l[_].references++, l[_].updater(S)) : l.push({ identifier: E, updater: A(S, x), references: 1 }), I.push(E); + } + return I; + } + function h(C) { + var x = document.createElement("style"), w = C.attributes || {}; + if (w.nonce === void 0) { + var I = n.nc; + I && (w.nonce = I); + } + if (Object.keys(w).forEach(function(b) { + x.setAttribute(b, w[b]); + }), typeof C.insert == "function") + C.insert(x); + else { + var R = a(C.insert || "head"); + if (!R) + throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); + R.appendChild(x); + } + return x; + } + var f, m = (f = [], function(C, x) { + return f[C] = x, f.filter(Boolean).join(` +`); + }); + function p(C, x, w, I) { + var R = w ? "" : I.media ? "@media ".concat(I.media, " {").concat(I.css, "}") : I.css; + if (C.styleSheet) + C.styleSheet.cssText = m(x, R); + else { + var b = document.createTextNode(R), g = C.childNodes; + g[x] && C.removeChild(g[x]), g.length ? C.insertBefore(b, g[x]) : C.appendChild(b); + } + } + function v(C, x, w) { + var I = w.css, R = w.media, b = w.sourceMap; + if (R ? C.setAttribute("media", R) : C.removeAttribute("media"), b && btoa && (I += ` +/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(b)))), " */")), C.styleSheet) + C.styleSheet.cssText = I; + else { + for (; C.firstChild; ) + C.removeChild(C.firstChild); + C.appendChild(document.createTextNode(I)); + } + } + var O = null, N = 0; + function A(C, x) { + var w, I, R; + if (x.singleton) { + var b = N++; + w = O || (O = h(x)), I = p.bind(null, w, b, !1), R = p.bind(null, w, b, !0); + } else + w = h(x), I = v.bind(null, w, x), R = function() { + (function(g) { + if (g.parentNode === null) + return !1; + g.parentNode.removeChild(g); + })(w); + }; + return I(C), function(g) { + if (g) { + if (g.css === C.css && g.media === C.media && g.sourceMap === C.sourceMap) + return; + I(C = g); + } else + R(); + }; + } + t.exports = function(C, x) { + (x = x || {}).singleton || typeof x.singleton == "boolean" || (x.singleton = r()); + var w = u(C = C || [], x); + return function(I) { + if (I = I || [], Object.prototype.toString.call(I) === "[object Array]") { + for (var R = 0; R < w.length; R++) { + var b = c(w[R]); + l[b].references--; + } + for (var g = u(I, x), y = 0; y < w.length; y++) { + var E = c(w[y]); + l[E].references === 0 && (l[E].updater(), l.splice(E, 1)); + } + w = g; + } + }; + }; + }, function(t, o, n) { + (o = n(3)(!1)).push([t.i, `.ce-paragraph { + line-height: 1.6em; + outline: none; +} + +.ce-paragraph[data-placeholder]:empty::before{ + content: attr(data-placeholder); + color: #707684; + font-weight: normal; + opacity: 0; +} + +/** Show placeholder at the first paragraph if Editor is empty */ +.codex-editor--empty .ce-block:first-child .ce-paragraph[data-placeholder]:empty::before { + opacity: 1; +} + +.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph[data-placeholder]:empty::before, +.codex-editor--empty .ce-block:first-child .ce-paragraph[data-placeholder]:empty:focus::before { + opacity: 0; +} + +.ce-paragraph p:first-of-type{ + margin-top: 0; +} + +.ce-paragraph p:last-of-type{ + margin-bottom: 0; +} +`, ""]), t.exports = o; + }, function(t, o, n) { + t.exports = function(i) { + var r = []; + return r.toString = function() { + return this.map(function(a) { + var l = function(c, u) { + var h = c[1] || "", f = c[3]; + if (!f) + return h; + if (u && typeof btoa == "function") { + var m = (v = f, O = btoa(unescape(encodeURIComponent(JSON.stringify(v)))), N = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(O), "/*# ".concat(N, " */")), p = f.sources.map(function(A) { + return "/*# sourceURL=".concat(f.sourceRoot || "").concat(A, " */"); + }); + return [h].concat(p).concat([m]).join(` +`); + } + var v, O, N; + return [h].join(` +`); + }(a, i); + return a[2] ? "@media ".concat(a[2], " {").concat(l, "}") : l; + }).join(""); + }, r.i = function(a, l, c) { + typeof a == "string" && (a = [[null, a, ""]]); + var u = {}; + if (c) + for (var h = 0; h < this.length; h++) { + var f = this[h][0]; + f != null && (u[f] = !0); + } + for (var m = 0; m < a.length; m++) { + var p = [].concat(a[m]); + c && u[p[0]] || (l && (p[2] ? p[2] = "".concat(l, " and ").concat(p[2]) : p[2] = l), r.push(p)); + } + }, r; + }; + }, function(t, o, n) { + n.r(o), n.d(o, "default", function() { + return a; + }), n(0); + function i(l, c) { + for (var u = 0; u < c.length; u++) { + var h = c[u]; + h.enumerable = h.enumerable || !1, h.configurable = !0, "value" in h && (h.writable = !0), Object.defineProperty(l, h.key, h); + } + } + function r(l, c, u) { + return c && i(l.prototype, c), u && i(l, u), l; + } + /** + * Base Paragraph Block for the Editor.js. + * Represents a regular text block + * + * @author CodeX (team@codex.so) + * @copyright CodeX 2018 + * @license The MIT License (MIT) + */ + var a = function() { + function l(c) { + var u = c.data, h = c.config, f = c.api, m = c.readOnly; + (function(p, v) { + if (!(p instanceof v)) + throw new TypeError("Cannot call a class as a function"); + })(this, l), this.api = f, this.readOnly = m, this._CSS = { block: this.api.styles.block, wrapper: "ce-paragraph" }, this.readOnly || (this.onKeyUp = this.onKeyUp.bind(this)), this._placeholder = h.placeholder ? h.placeholder : l.DEFAULT_PLACEHOLDER, this._data = {}, this._element = null, this._preserveBlank = h.preserveBlank !== void 0 && h.preserveBlank, this.data = u; + } + return r(l, null, [{ key: "DEFAULT_PLACEHOLDER", get: function() { + return ""; + } }]), r(l, [{ key: "onKeyUp", value: function(c) { + c.code !== "Backspace" && c.code !== "Delete" || this._element.textContent === "" && (this._element.innerHTML = ""); + } }, { key: "drawView", value: function() { + var c = document.createElement("DIV"); + return c.classList.add(this._CSS.wrapper, this._CSS.block), c.contentEditable = !1, c.dataset.placeholder = this.api.i18n.t(this._placeholder), this.readOnly || (c.contentEditable = !0, c.addEventListener("keyup", this.onKeyUp)), c; + } }, { key: "render", value: function() { + return this._element === null && (this._element = this.drawView()), this.hydrate(), this._element; + } }, { key: "merge", value: function(c) { + var u = { text: this.data.text + c.text }; + this.data = u; + } }, { key: "validate", value: function(c) { + return !(c.text.trim() === "" && !this._preserveBlank); + } }, { key: "save", value: function(c) { + return { text: c.innerHTML }; + } }, { key: "onPaste", value: function(c) { + var u = { text: c.detail.data.innerHTML }; + this.data = u; + } }, { key: "hydrate", value: function() { + var c = this; + window.requestAnimationFrame(function() { + c._element.innerHTML = c._data.text || ""; + }); + } }, { key: "data", get: function() { + if (this._element !== null) { + var c = this._element.innerHTML; + this._data.text = c; + } + return this._data; + }, set: function(c) { + this._data = c || {}, this._element !== null && this.hydrate(); + } }], [{ key: "conversionConfig", get: function() { + return { export: "text", import: "text" }; + } }, { key: "sanitize", get: function() { + return { text: { br: !0 } }; + } }, { key: "isReadOnlySupported", get: function() { + return !0; + } }, { key: "pasteConfig", get: function() { + return { tags: ["P"] }; + } }, { key: "toolbox", get: function() { + return { icon: '', title: "Text" }; + } }]), l; + }(); + }]).default; + }); +})(Jo); +const Qo = /* @__PURE__ */ ve(Ae), en = ` + +`; +class Ue { + constructor() { + this.commandName = "bold", this.CSS = { + button: "ce-inline-tool", + buttonActive: "ce-inline-tool--active", + buttonModifier: "ce-inline-tool--bold" + }, this.nodes = { + button: void 0 + }; + } + /** + * Sanitizer Rule + * Leave tags + * + * @returns {object} + */ + static get sanitize() { + return { + b: {} + }; + } + /** + * Create button for Inline Toolbar + */ + render() { + return this.nodes.button = document.createElement("button"), this.nodes.button.type = "button", this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier), this.nodes.button.innerHTML = en, this.nodes.button; + } + /** + * Wrap range with tag + */ + surround() { + document.execCommand(this.commandName); + } + /** + * Check selection and set activated state to button if there are tag + * + * @returns {boolean} + */ + checkState() { + const e = document.queryCommandState(this.commandName); + return this.nodes.button.classList.toggle(this.CSS.buttonActive, e), e; + } + /** + * Set a shortcut + * + * @returns {boolean} + */ + get shortcut() { + return "CMD+B"; + } +} +Ue.isInline = !0; +Ue.title = "Bold"; +const tn = ` + +`; +class $e { + constructor() { + this.commandName = "italic", this.CSS = { + button: "ce-inline-tool", + buttonActive: "ce-inline-tool--active", + buttonModifier: "ce-inline-tool--italic" + }, this.nodes = { + button: null + }; + } + /** + * Sanitizer Rule + * Leave tags + * + * @returns {object} + */ + static get sanitize() { + return { + i: {} + }; + } + /** + * Create button for Inline Toolbar + */ + render() { + return this.nodes.button = document.createElement("button"), this.nodes.button.type = "button", this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier), this.nodes.button.innerHTML = tn, this.nodes.button; + } + /** + * Wrap range with tag + */ + surround() { + document.execCommand(this.commandName); + } + /** + * Check selection and set activated state to button if there are tag + */ + checkState() { + const e = document.queryCommandState(this.commandName); + return this.nodes.button.classList.toggle(this.CSS.buttonActive, e), e; + } + /** + * Set a shortcut + */ + get shortcut() { + return "CMD+I"; + } +} +$e.isInline = !0; +$e.title = "Italic"; +const et = ` + +`, on = ` + +`; +class We { + /** + * @param api - Editor.js API + */ + constructor({ api: e }) { + this.commandLink = "createLink", this.commandUnlink = "unlink", this.ENTER_KEY = 13, this.CSS = { + button: "ce-inline-tool", + buttonActive: "ce-inline-tool--active", + buttonModifier: "ce-inline-tool--link", + buttonUnlink: "ce-inline-tool--unlink", + input: "ce-inline-tool-input", + inputShowed: "ce-inline-tool-input--showed" + }, this.nodes = { + button: null, + input: null + }, this.inputOpened = !1, this.toolbar = e.toolbar, this.inlineToolbar = e.inlineToolbar, this.notifier = e.notifier, this.i18n = e.i18n, this.selection = new k(); + } + /** + * Sanitizer Rule + * Leave
tags + * + * @returns {object} + */ + static get sanitize() { + return { + a: { + href: !0, + target: "_blank", + rel: "nofollow" + } + }; + } + /** + * Create button for Inline Toolbar + */ + render() { + return this.nodes.button = document.createElement("button"), this.nodes.button.type = "button", this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier), this.nodes.button.innerHTML = et, this.nodes.button; + } + /** + * Input for the link + */ + renderActions() { + return this.nodes.input = document.createElement("input"), this.nodes.input.placeholder = this.i18n.t("Add a link"), this.nodes.input.classList.add(this.CSS.input), this.nodes.input.addEventListener("keydown", (e) => { + e.keyCode === this.ENTER_KEY && this.enterPressed(e); + }), this.nodes.input; + } + /** + * Handle clicks on the Inline Toolbar icon + * + * @param {Range} range - range to wrap with link + */ + surround(e) { + if (e) { + this.inputOpened ? (this.selection.restore(), this.selection.removeFakeBackground()) : (this.selection.setFakeBackground(), this.selection.save()); + const t = this.selection.findParentTag("A"); + if (t) { + const o = document.getElementsByClassName("unlink-button")[0]; + this.selection.expandToTag(t), this.unlink(), this.nodes.input.value = "", this.nodes.button.classList.remove(this.CSS.buttonUnlink), this.nodes.button.classList.remove(this.CSS.buttonActive), o.remove(), this.inlineToolbar.close(); + return; + } + } + this.toggleActions(); + } + /** + * Check selection and set activated state to button if there are tag + */ + checkState() { + const e = this.selection.findParentTag("A"), t = document.createElement("button"); + if (e) { + this.nodes.button.innerHTML = on, this.nodes.button.classList.add(this.CSS.buttonUnlink), this.nodes.button.classList.add(this.CSS.buttonActive), this.openActions(), t.classList.add("unlink-button"), t.textContent = this.i18n.t("Remove"), t.addEventListener("click", () => { + this.selection.expandToTag(e), this.unlink(), this.nodes.input.value = "", this.nodes.button.classList.remove(this.CSS.buttonUnlink), this.nodes.button.classList.remove(this.CSS.buttonActive), t.remove(), this.inlineToolbar.close(); + }); + const o = e.getAttribute("href"); + this.nodes.input.value = o !== "null" ? o : "", this.nodes.input.value !== "" && !document.querySelector(".unlink-button") && document.querySelector(".ce-inline-toolbar__actions").appendChild(t), this.selection.save(); + } else + this.nodes.button.innerHTML = et, this.nodes.button.classList.remove(this.CSS.buttonUnlink), this.nodes.button.classList.remove(this.CSS.buttonActive); + return !!e; + } + /** + * Function called with Inline Toolbar closing + */ + clear() { + this.closeActions(); + } + /** + * Set a shortcut + */ + get shortcut() { + return "CMD+K"; + } + /** + * Show/close link input + */ + toggleActions() { + this.inputOpened ? this.closeActions(!1) : this.openActions(!0); + } + /** + * @param {boolean} needFocus - on link creation we need to focus input. On editing - nope. + */ + openActions(e = !1) { + const t = document.getElementsByClassName( + "ce-inline-toolbar" + )[0]; + this.nodes.input.classList.add(this.CSS.inputShowed), t.style.transform = "translate(-50%, -33px)", e && this.nodes.input.focus(), this.inputOpened = !0; + } + /** + * Close input + * + * @param {boolean} clearSavedSelection — we don't need to clear saved selection + * on toggle-clicks on the icon of opened Toolbar + */ + closeActions(e = !0) { + const t = document.getElementsByClassName( + "ce-inline-toolbar" + )[0]; + if (this.selection.isFakeBackgroundEnabled) { + const o = new k(); + o.save(), this.selection.restore(), this.selection.removeFakeBackground(), o.restore(); + } + this.nodes.input.classList.remove(this.CSS.inputShowed), t.style.transform = "", this.nodes.input.value = "", e && this.selection.clearSaved(), this.inputOpened = !1; + } + /** + * Enter pressed on input + * + * @param {KeyboardEvent} event - enter keydown event + */ + enterPressed(e) { + let t = this.nodes.input.value || ""; + if (!t.trim()) { + this.selection.restore(), this.unlink(), e.preventDefault(), this.closeActions(); + return; + } + if (!this.validateURL(t)) { + this.notifier.show({ + message: "Pasted link is not valid.", + style: "error" + }), L("Incorrect Link pasted", "warn", t); + return; + } + t = this.prepareLink(t), this.selection.restore(), this.selection.removeFakeBackground(), this.insertLink(t), e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), this.selection.collapseToEnd(), this.inlineToolbar.close(); + } + /** + * Detects if passed string is URL + * + * @param {string} str - string to validate + * @returns {boolean} + */ + validateURL(e) { + return !/\s/.test(e); + } + /** + * Process link before injection + * - sanitize + * - add protocol for links like 'google.com' + * + * @param {string} link - raw user input + */ + prepareLink(e) { + return e = e.trim(), e = this.addProtocol(e), e; + } + /** + * Add 'http' protocol to the links like 'vc.ru', 'google.com' + * + * @param {string} link - string to process + */ + addProtocol(e) { + if (/^(\w+):(\/\/)?/.test(e)) + return e; + const t = /^\/[^/\s]/.test(e), o = e.substring(0, 1) === "#", n = /^\/\/[^/\s]/.test(e); + return !t && !o && !n && (e = "http://" + e), e; + } + /** + * Inserts tag with "href" + * + * @param {string} link - "href" value + */ + insertLink(e) { + const t = this.selection.findParentTag("A"); + t && this.selection.expandToTag(t), document.execCommand(this.commandLink, !1, e), this.selection.findParentTag("A").setAttribute("target", "_blank"); + } + /** + * Removes tag + */ + unlink() { + document.execCommand(this.commandUnlink); + } +} +We.isInline = !0; +We.title = "Link"; +class wt { + /** + * @param options - constructor options + * @param options.data - stub tool data + * @param options.api - Editor.js API + */ + constructor({ data: e, api: t }) { + this.CSS = { + wrapper: "ce-stub", + info: "ce-stub__info", + title: "ce-stub__title", + subtitle: "ce-stub__subtitle" + }, this.api = t, this.title = e.title || this.api.i18n.t("Error"), this.subtitle = this.api.i18n.t("The block can not be displayed correctly."), this.savedData = e.savedData, this.wrapper = this.make(); + } + /** + * Returns stub holder + * + * @returns {HTMLElement} + */ + render() { + return this.wrapper; + } + /** + * Return original Tool data + * + * @returns {BlockToolData} + */ + save() { + return this.savedData; + } + /** + * Create Tool html markup + * + * @returns {HTMLElement} + */ + make() { + const e = d.make("div", this.CSS.wrapper), t = To, o = d.make("div", this.CSS.info), n = d.make("div", this.CSS.title, { + textContent: this.title + }), i = d.make("div", this.CSS.subtitle, { + textContent: this.subtitle + }); + return e.innerHTML = t, o.appendChild(n), o.appendChild(i), e.appendChild(o), e; + } +} +wt.isReadOnlySupported = !0; +class nn extends ze { + constructor() { + super(...arguments), this.type = we.Inline; + } + /** + * Returns title for Inline Tool if specified by user + */ + get title() { + return this.constructable[je.Title]; + } + /** + * Constructs new InlineTool instance from constructable + */ + create() { + return new this.constructable({ + api: this.api.getMethodsForTool(this), + config: this.settings + }); + } +} +class sn extends ze { + constructor() { + super(...arguments), this.type = we.Tune; + } + /** + * Constructs new BlockTune instance from constructable + * + * @param data - Tune data + * @param block - Block API object + */ + create(e, t) { + return new this.constructable({ + api: this.api.getMethodsForTool(this), + config: this.settings, + block: t, + data: e + }); + } +} +class U extends Map { + /** + * Returns Block Tools collection + */ + get blockTools() { + const e = Array.from(this.entries()).filter(([, t]) => t.isBlock()); + return new U(e); + } + /** + * Returns Inline Tools collection + */ + get inlineTools() { + const e = Array.from(this.entries()).filter(([, t]) => t.isInline()); + return new U(e); + } + /** + * Returns Block Tunes collection + */ + get blockTunes() { + const e = Array.from(this.entries()).filter(([, t]) => t.isTune()); + return new U(e); + } + /** + * Returns internal Tools collection + */ + get internalTools() { + const e = Array.from(this.entries()).filter(([, t]) => t.isInternal); + return new U(e); + } + /** + * Returns Tools collection provided by user + */ + get externalTools() { + const e = Array.from(this.entries()).filter(([, t]) => !t.isInternal); + return new U(e); + } +} +var rn = Object.defineProperty, an = Object.getOwnPropertyDescriptor, Ct = (s, e, t, o) => { + for (var n = o > 1 ? void 0 : o ? an(e, t) : e, i = s.length - 1, r; i >= 0; i--) + (r = s[i]) && (n = (o ? r(e, t, n) : r(n)) || n); + return o && n && rn(e, t, n), n; +}; +class Ve extends ze { + constructor() { + super(...arguments), this.type = we.Block, this.inlineTools = new U(), this.tunes = new U(); + } + /** + * Creates new Tool instance + * + * @param data - Tool data + * @param block - BlockAPI for current Block + * @param readOnly - True if Editor is in read-only mode + */ + create(e, t, o) { + return new this.constructable({ + data: e, + block: t, + readOnly: o, + api: this.api.getMethodsForTool(this), + config: this.settings + }); + } + /** + * Returns true if read-only mode is supported by Tool + */ + get isReadOnlySupported() { + return this.constructable[se.IsReadOnlySupported] === !0; + } + /** + * Returns true if Tool supports linebreaks + */ + get isLineBreaksEnabled() { + return this.constructable[se.IsEnabledLineBreaks]; + } + /** + * Returns Tool toolbox configuration (internal or user-specified). + * + * Merges internal and user-defined toolbox configs based on the following rules: + * + * - If both internal and user-defined toolbox configs are arrays their items are merged. + * Length of the second one is kept. + * + * - If both are objects their properties are merged. + * + * - If one is an object and another is an array than internal config is replaced with user-defined + * config. This is made to allow user to override default tool's toolbox representation (single/multiple entries) + */ + get toolbox() { + const e = this.constructable[se.Toolbox], t = this.config[me.Toolbox]; + if (!K(e) && t !== !1) + return t ? Array.isArray(e) ? Array.isArray(t) ? t.map((o, n) => { + const i = e[n]; + return i ? { + ...i, + ...o + } : o; + }) : [t] : Array.isArray(t) ? t : [ + { + ...e, + ...t + } + ] : Array.isArray(e) ? e : [e]; + } + /** + * Returns Tool conversion configuration + */ + get conversionConfig() { + return this.constructable[se.ConversionConfig]; + } + /** + * Returns enabled inline tools for Tool + */ + get enabledInlineTools() { + return this.config[me.EnabledInlineTools] || !1; + } + /** + * Returns enabled tunes for Tool + */ + get enabledBlockTunes() { + return this.config[me.EnabledBlockTunes]; + } + /** + * Returns Tool paste configuration + */ + get pasteConfig() { + return this.constructable[se.PasteConfig] ?? {}; + } + get sanitizeConfig() { + const e = super.sanitizeConfig, t = this.baseSanitizeConfig; + if (K(e)) + return t; + const o = {}; + for (const n in e) + if (Object.prototype.hasOwnProperty.call(e, n)) { + const i = e[n]; + j(i) ? o[n] = Object.assign({}, t, i) : o[n] = i; + } + return o; + } + get baseSanitizeConfig() { + const e = {}; + return Array.from(this.inlineTools.values()).forEach((t) => Object.assign(e, t.sanitizeConfig)), Array.from(this.tunes.values()).forEach((t) => Object.assign(e, t.sanitizeConfig)), e; + } +} +Ct([ + ce +], Ve.prototype, "sanitizeConfig", 1); +Ct([ + ce +], Ve.prototype, "baseSanitizeConfig", 1); +class ln { + /** + * @class + * @param config - tools config + * @param editorConfig - EditorJS config + * @param api - EditorJS API module + */ + constructor(e, t, o) { + this.api = o, this.config = e, this.editorConfig = t; + } + /** + * Returns Tool object based on it's type + * + * @param name - tool name + */ + get(e) { + const { class: t, isInternal: o = !1, ...n } = this.config[e], i = this.getConstructor(t); + return new i({ + name: e, + constructable: t, + config: n, + api: this.api, + isDefault: e === this.editorConfig.defaultBlock, + defaultPlaceholder: this.editorConfig.placeholder, + isInternal: o + }); + } + /** + * Find appropriate Tool object constructor for Tool constructable + * + * @param constructable - Tools constructable + */ + getConstructor(e) { + switch (!0) { + case e[je.IsInline]: + return nn; + case e[kt.IsTune]: + return sn; + default: + return Ve; + } + } +} +const cn = ` + +`; +class yt { + /** + * MoveDownTune constructor + * + * @param {API} api — Editor's API + */ + constructor({ api: e }) { + this.CSS = { + animation: "wobble" + }, this.api = e; + } + /** + * Tune's appearance in block settings menu + */ + render() { + return { + icon: cn, + title: this.api.i18n.t("Move down"), + onActivate: () => this.handleClick(), + name: "move-down" + }; + } + /** + * Handle clicks on 'move down' button + */ + handleClick() { + const e = this.api.blocks.getCurrentBlockIndex(), t = this.api.blocks.getBlockByIndex(e + 1); + if (!t) + throw new Error("Unable to move Block down since it is already the last"); + const o = t.holder, n = o.getBoundingClientRect(); + let i = Math.abs( + window.innerHeight - o.offsetHeight + ); + n.top < window.innerHeight && (i = window.scrollY + o.offsetHeight), window.scrollTo(0, i), this.api.blocks.move(e + 1), this.api.toolbar.toggleBlockSettings(!0); + } +} +yt.isTune = !0; +const dn = ` + +`; +class Bt { + /** + * DeleteTune constructor + * + * @param {API} api - Editor's API + */ + constructor({ api: e }) { + this.api = e; + } + /** + * Tune's appearance in block settings menu + */ + render() { + return { + icon: dn, + title: this.api.i18n.t("Delete"), + name: "delete", + onActivate: () => this.handleClick() + }; + } + /** + * Delete block conditions passed + */ + handleClick() { + this.api.blocks.delete(); + } +} +Bt.isTune = !0; +const hn = ` + +`; +class Et { + /** + * MoveUpTune constructor + * + * @param {API} api - Editor's API + */ + constructor({ api: e }) { + this.CSS = { + animation: "wobble" + }, this.api = e; + } + /** + * Tune's appearance in block settings menu + */ + render() { + return { + icon: hn, + title: this.api.i18n.t("Move up"), + onActivate: () => this.handleClick(), + name: "move-up" + }; + } + /** + * Move current block up + */ + handleClick() { + const e = this.api.blocks.getCurrentBlockIndex(), t = this.api.blocks.getBlockByIndex(e), o = this.api.blocks.getBlockByIndex( + e - 1 + ); + if (e === 0 || !t || !o) + throw new Error("Unable to move Block up since it is already the first"); + const n = t.holder, i = o.holder, r = n.getBoundingClientRect(), a = i.getBoundingClientRect(); + let l; + a.top > 0 ? l = Math.abs(r.top) - Math.abs(a.top) : l = Math.abs(r.top) + a.height, window.scrollBy(0, -1 * l), this.api.blocks.move(e - 1), this.api.toolbar.toggleBlockSettings(!0); + } +} +Et.isTune = !0; +var un = Object.defineProperty, pn = Object.getOwnPropertyDescriptor, fn = (s, e, t, o) => { + for (var n = o > 1 ? void 0 : o ? pn(e, t) : e, i = s.length - 1, r; i >= 0; i--) + (r = s[i]) && (n = (o ? r(e, t, n) : r(n)) || n); + return o && n && un(e, t, n), n; +}; +class Tt extends T { + constructor() { + super(...arguments), this.stubTool = "stub", this.toolsAvailable = new U(), this.toolsUnavailable = new U(); + } + /** + * Returns available Tools + */ + get available() { + return this.toolsAvailable; + } + /** + * Returns unavailable Tools + */ + get unavailable() { + return this.toolsUnavailable; + } + /** + * Return Tools for the Inline Toolbar + */ + get inlineTools() { + return this.available.inlineTools; + } + /** + * Return editor block tools + */ + get blockTools() { + return this.available.blockTools; + } + /** + * Return available Block Tunes + * + * @returns {object} - object of Inline Tool's classes + */ + get blockTunes() { + return this.available.blockTunes; + } + /** + * Returns default Tool object + */ + get defaultTool() { + return this.blockTools.get(this.config.defaultBlock); + } + /** + * Returns internal tools + */ + get internal() { + return this.available.internalTools; + } + /** + * Creates instances via passed or default configuration + * + * @returns {Promise} + */ + async prepare() { + if (this.validateTools(), this.config.tools = Te({}, this.internalTools, this.config.tools), !Object.prototype.hasOwnProperty.call(this.config, "tools") || Object.keys(this.config.tools).length === 0) + throw Error("Can't start without tools"); + const e = this.prepareConfig(); + this.factory = new ln(e, this.config, this.Editor.API); + const t = this.getListOfPrepareFunctions(e); + if (t.length === 0) + return Promise.resolve(); + await Nt( + t, + (o) => { + this.toolPrepareMethodSuccess(o); + }, + (o) => { + this.toolPrepareMethodFallback(o); + } + ), this.prepareBlockTools(); + } + getAllInlineToolsSanitizeConfig() { + const e = {}; + return Array.from(this.inlineTools.values()).forEach((t) => { + Object.assign(e, t.sanitizeConfig); + }), e; + } + /** + * Calls each Tool reset method to clean up anything set by Tool + */ + destroy() { + Object.values(this.available).forEach(async (e) => { + D(e.reset) && await e.reset(); + }); + } + /** + * Returns internal tools + * Includes Bold, Italic, Link and Paragraph + */ + get internalTools() { + return { + bold: { + class: Ue, + isInternal: !0 + }, + italic: { + class: $e, + isInternal: !0 + }, + link: { + class: We, + isInternal: !0 + }, + paragraph: { + class: Qo, + inlineToolbar: !0, + isInternal: !0 + }, + stub: { + class: wt, + isInternal: !0 + }, + moveUp: { + class: Et, + isInternal: !0 + }, + moveDown: { + class: yt, + isInternal: !0 + }, + delete: { + class: Bt, + isInternal: !0 + } + }; + } + /** + * Tool prepare method success callback + * + * @param {object} data - append tool to available list + */ + toolPrepareMethodSuccess(e) { + const t = this.factory.get(e.toolName); + if (t.isInline()) { + const n = ["render", "surround", "checkState"].filter( + (i) => !t.create()[i] + ); + if (n.length) { + L( + `Incorrect Inline Tool: ${t.name}. Some of required methods is not implemented %o`, + "warn", + n + ), this.toolsUnavailable.set(t.name, t); + return; + } + } + this.toolsAvailable.set(t.name, t); + } + /** + * Tool prepare method fail callback + * + * @param {object} data - append tool to unavailable list + */ + toolPrepareMethodFallback(e) { + this.toolsUnavailable.set(e.toolName, this.factory.get(e.toolName)); + } + /** + * Binds prepare function of plugins with user or default config + * + * @returns {Array} list of functions that needs to be fired sequentially + * @param config - tools config + */ + getListOfPrepareFunctions(e) { + const t = []; + return Object.entries(e).forEach(([o, n]) => { + t.push({ + // eslint-disable-next-line @typescript-eslint/no-empty-function + function: D(n.class.prepare) ? n.class.prepare : () => { + }, + data: { + toolName: o, + config: n.config + } + }); + }), t; + } + /** + * Assign enabled Inline Tools and Block Tunes for Block Tool + */ + prepareBlockTools() { + Array.from(this.blockTools.values()).forEach((e) => { + this.assignInlineToolsToBlockTool(e), this.assignBlockTunesToBlockTool(e); + }); + } + /** + * Assign enabled Inline Tools for Block Tool + * + * @param tool - Block Tool + */ + assignInlineToolsToBlockTool(e) { + if (this.config.inlineToolbar !== !1) { + if (e.enabledInlineTools === !0) { + e.inlineTools = new U( + Array.isArray(this.config.inlineToolbar) ? this.config.inlineToolbar.map((t) => [ + t, + this.inlineTools.get(t) + ]) : ( + /** + * If common settings is 'true' or not specified (will be set as true at core.ts), get the default order + */ + Array.from(this.inlineTools.entries()) + ) + ); + return; + } + Array.isArray(e.enabledInlineTools) && (e.inlineTools = new U( + e.enabledInlineTools.map((t) => [ + t, + this.inlineTools.get(t) + ]) + )); + } + } + /** + * Assign enabled Block Tunes for Block Tool + * + * @param tool — Block Tool + */ + assignBlockTunesToBlockTool(e) { + if (e.enabledBlockTunes !== !1) { + if (Array.isArray(e.enabledBlockTunes)) { + const t = new U( + e.enabledBlockTunes.map((o) => [o, this.blockTunes.get(o)]) + ); + e.tunes = new U([ + ...t, + ...this.blockTunes.internalTools + ]); + return; + } + if (Array.isArray(this.config.tunes)) { + const t = new U( + this.config.tunes.map((o) => [o, this.blockTunes.get(o)]) + ); + e.tunes = new U([ + ...t, + ...this.blockTunes.internalTools + ]); + return; + } + e.tunes = this.blockTunes.internalTools; + } + } + /** + * Validate Tools configuration objects and throw Error for user if it is invalid + */ + validateTools() { + for (const e in this.config.tools) + if (Object.prototype.hasOwnProperty.call(this.config.tools, e)) { + if (e in this.internalTools) + return; + const t = this.config.tools[e]; + if (!D(t) && !D(t.class)) + throw Error( + `Tool «${e}» must be a constructor function or an object with function in the «class» property` + ); + } + } + /** + * Unify tools config + */ + prepareConfig() { + const e = {}; + for (const t in this.config.tools) + j(this.config.tools[t]) ? e[t] = this.config.tools[t] : e[t] = { + class: this.config.tools[t] + }; + return e; + } +} +fn([ + ce +], Tt.prototype, "getAllInlineToolsSanitizeConfig", 1); +const gn = `:root{--boxShadow1: 0 2px 8px rgb(0, 0, 0, .1);--boxShadow2: 0 8px 24px rgb(0, 0, 0, .1);--boxShadow3: 0 12px 40px rgb(0, 0, 0, .1);--blue0: #e7f5ff;--blue1: #d0ebff;--blue2: #afd8fb;--blue3: #84bff7;--blue4: #64abf1;--blue5: #4593fc;--blue6: #3182f6;--blue7: #1b64da;--blue8: #1f58b2;--blue9: #1a4aa6;--gray0: #f8f9fa;--gray1: #f1f3f5;--gray2: #e9ecef;--gray3: #dee2e6;--gray4: #ced4da;--gray5: #adb5bd;--gray6: #868e96;--gray7: #495057;--gray8: #343a40;--gray9: #212529;--red_12: rgb(249, 61, 63, .12);--redCloudy: #d78582;--red: #f93d3f;--redDark: #cb0101;--orange_12: rgb(255, 99, 60, .12);--orangeCloudy: #ed8e6a;--orange: #ff633c;--orangeDark: #e94600;--yellow_12: rgb(255, 202, 60, .12);--yellowCloudy: #f9e079;--yellow: #ffca3c;--yellowDark: #ba6100;--green_12: rgb(14, 184, 122, .12);--greenCloudy: #67c1a0;--green: #0eb87a;--greenDark: #00796e;--purple_12: rgb(115, 84, 230, .12);--purpleCloudy: #8e82d7;--purple: #7354e6;--purpleDark: #4f3292;--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1d202b;--color-active-icon: #388ae5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 12px;--icon-size--mobile: 12px;--block-padding-vertical: .4em;--color-line-gray: #eff0f1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 201px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 201px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 201px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0px;left:0px;right:0px;bottom:0px;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}@media (max-width: 200px){.ce-toolbar--opened{display:-webkit-box;display:-ms-flexbox;display:flex}}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}@media (max-width: 200px){.ce-toolbar__content{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-line-pack:center;align-content:center;margin:0;max-width:100%}}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0;height:100%}@media (max-width: 200px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}.ce-toolbar__plus--hidden{visibility:hidden}@media (max-width: 200px){.ce-toolbar__plus{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}.ce-toolbar__plus{position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a;border-radius:8px;z-index:2;position:static}@media (max-width: 200px){.ce-toolbar__plus{-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a}}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;height:26px}@media (max-width: 200px){.ce-toolbar__actions{position:absolute;right:auto;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 200px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;width:18px;height:100%;cursor:pointer;user-select:none}@media (max-width: 200px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 201px){.ce-toolbar__settings-btn{width:18px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 200px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a;border-radius:8px;z-index:2;position:static}@media (max-width: 200px){.ce-toolbar__settings-btn{-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a}}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:16px;height:16px}@media (min-width: 201px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 201px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{border-radius:4px!important}.ce-inline-toolbar{--y-offset: 8px;position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a;border-radius:8px;z-index:2;border:none;-webkit-transform:translateX(-50%) translateY(8px) scale(.9);transform:translate(-50%) translateY(8px) scale(.9);opacity:0;visibility:hidden;-webkit-transition:opacity .25s ease,-webkit-transform .15s ease;transition:opacity .25s ease,-webkit-transform .15s ease;transition:transform .15s ease,opacity .25s ease;transition:transform .15s ease,opacity .25s ease,-webkit-transform .15s ease;will-change:transform,opacity;top:0;left:0;z-index:3}@media (max-width: 200px){.ce-inline-toolbar{-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a}}.ce-inline-toolbar--left-oriented:before{left:15px;margin-left:0}.ce-inline-toolbar--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-inline-toolbar--showed{opacity:1;visibility:visible;-webkit-transform:translateX(-50%);transform:translate(-50%)}.ce-inline-toolbar--left-oriented{-webkit-transform:translateX(-23px) translateY(8px) scale(.94);transform:translate(-23px) translateY(8px) scale(.94)}.ce-inline-toolbar--left-oriented.ce-inline-toolbar--showed{-webkit-transform:translateX(-23px);transform:translate(-23px)}.ce-inline-toolbar--right-oriented{-webkit-transform:translateX(-100%) translateY(8px) scale(.94);transform:translate(-100%) translateY(8px) scale(.94);margin-left:23px}.ce-inline-toolbar--right-oriented.ce-inline-toolbar--showed{-webkit-transform:translateX(-100%);transform:translate(-100%)}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}.ce-inline-toolbar__buttons,.ce-inline-toolbar__actions{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__actions .unlink-button{font-size:11px!important}.ce-inline-toolbar__actions .unlink-button{background:inherit;border:none;-webkit-box-shadow:none;box-shadow:none;-webkit-tap-highlight-color:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;outline-style:none;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:end;font-weight:400;line-height:16px;color:#868e96;padding:8px 10px 8px 0;cursor:pointer;white-space:nowrap;min-width:60px}.ce-inline-toolbar__actions .unlink-button:focus{outline:0}.ce-inline-toolbar__actions input,.ce-inline-toolbar__actions .unlink-button{border-top:1px solid #dee2e6}.ce-inline-toolbar__dropdown{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;padding:0 10px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid #dee2e6;border-radius:4px 0 0 4px}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#e9ecef}}.ce-inline-toolbar__dropdown:active{background:#f1f3f5}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content{font-size:14px!important}.ce-inline-toolbar__dropdown-content{display:-webkit-box;display:-ms-flexbox;display:flex;font-weight:500}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex;margin-left:4px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{padding:0 10px!important}.ce-inline-tool{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:32px;height:32px;line-height:32px;text-align:center;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;border-radius:0;line-height:normal;width:auto;min-width:24px}.ce-inline-tool svg{width:12px;height:12px}@media (max-width: 200px){.ce-inline-tool svg{width:12px;height:12px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#eff2f5}}.ce-inline-tool--active{color:#4593fc}.ce-inline-tool--focused{background:rgba(34,186,255,.08)!important}.ce-inline-tool--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.ce-inline-tool--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.ce-inline-tool .icon{height:12px}.ce-inline-tool:last-child{border-radius:0 4px 4px 0}.ce-inline-tool:hover{background:#e9ecef}.ce-inline-tool:active{background:#f1f3f5}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{font-size:11px!important}.ce-inline-tool-input{outline:none;border:0;border-radius:0 0 4px 4px;margin:0;line-height:16px;padding:8px 5px 8px 10px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;color:#212529}.ce-inline-tool-input::-webkit-input-placeholder{color:#adb5bd}.ce-inline-tool-input::-moz-placeholder{color:#adb5bd}.ce-inline-tool-input:-ms-input-placeholder{color:#adb5bd}.ce-inline-tool-input::-ms-input-placeholder{color:#adb5bd}.ce-inline-tool-input::placeholder{color:#adb5bd}.ce-inline-tool-input--showed{display:block}.ce-conversion-toolbar{position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a;z-index:2;opacity:0;visibility:hidden;will-change:transform,opacity;-webkit-transition:opacity .1s ease,-webkit-transform .1s ease;transition:opacity .1s ease,-webkit-transform .1s ease;transition:transform .1s ease,opacity .1s ease;transition:transform .1s ease,opacity .1s ease,-webkit-transform .1s ease;-webkit-transform:translateY(-8px);transform:translateY(-8px);left:-1px;width:160px;margin-top:5px;-webkit-box-sizing:content-box;box-sizing:content-box;padding-bottom:8px;border-radius:4px;border:none}@media (max-width: 200px){.ce-conversion-toolbar{-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a}}.ce-conversion-toolbar--left-oriented:before{left:15px;margin-left:0}.ce-conversion-toolbar--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-conversion-toolbar--showed{opacity:1;visibility:visible;-webkit-transform:none;transform:none}.ce-conversion-toolbar [hidden]{display:none!important}.ce-conversion-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-conversion-toolbar__label{color:#868e96;font-size:11px;line-height:16px;padding:12px 12px 4px}.ce-conversion-tool{display:-webkit-box;display:-ms-flexbox;display:flex;padding:4px 14.5px 4px 12px;font-size:13px;line-height:18px;color:#343a40;cursor:pointer;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-conversion-tool--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.ce-conversion-tool:hover{background:#e9ecef}.ce-conversion-tool:active{background:#f1f3f5}.ce-conversion-tool__icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:20px;height:20px;border:.5px solid #dee2e6;border-radius:2px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:4px;background:#fff}.ce-conversion-tool__icon svg{color:#343a40}.ce-conversion-tool__check-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-left:auto;opacity:0;width:12px;height:8px}.ce-conversion-tool--current .ce-conversion-tool__check-icon{opacity:1}.ce-conversion-tool--current .ce-conversion-tool__check-icon svg{fill:#343a40}.ce-conversion-tool--last{margin-right:0!important}.ce-conversion-tool--active{color:#4593fc!important}.ce-conversion-tool--active{-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-conversion-tool__secondary-label{color:#707684;font-size:12px;margin-left:auto;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;margin-bottom:-2px;opacity:.6}@media (max-width: 200px){.ce-conversion-tool__secondary-label{display:none}}.ce-settings__button{padding:8px 16px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;cursor:pointer}.ce-settings__button:hover{background-color:#e9ecef}.ce-settings__button:active{background-color:#f1f3f5}.ce-settings__button-icon-container{width:20px;height:20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-settings__button-icon-container svg{fill:#868e96}.ce-settings__button-text{font-size:13px!important}.ce-settings__button-text{line-height:18px;color:#343a40;margin-left:4px;white-space:nowrap}.ce-settings__button-shortcut-text{font-size:11px!important}.ce-settings__button-shortcut-text{line-height:16px;color:#adb5bd;margin-left:auto}.ce-settings__button--disabled{cursor:not-allowed!important}.ce-settings__button--disabled{opacity:.3}.ce-settings__button--selected{color:#4593fc}@media (min-width: 201px){.codex-editor--narrow .ce-settings{left:44px}.codex-editor--narrow .ce-settings .ce-popover{right:0;left:auto;left:initial}}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #4593fc;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#4593fc;background:repeating-linear-gradient(90deg,#4593fc,#4593fc 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@media (min-width: 201px){.codex-editor--narrow .ce-block--focused{margin-right:-50px;padding-right:50px}}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{padding:0!important}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:32px;height:32px;line-height:32px;text-align:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0}.cdx-settings-button svg{width:12px;height:12px}@media (max-width: 200px){.cdx-settings-button svg{width:12px;height:12px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-settings-button--active{color:#4593fc}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button:not(:nth-child(3n + 3)){margin-right:3px}.cdx-settings-button:nth-child(n + 4){margin-top:3px}.cdx-settings-button--active svg{fill:#4593fc}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 200px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#4593fc;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #eff0f1;color:#707684;font-size:14px}.ce-stub svg{width:12px;height:12px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 200px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n + 3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 201px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0px;right:5px}}@media (min-width: 201px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:rgba(232,232,235,.49);border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{color:#707684}.cdx-search-field__input{font-size:14px!important}.cdx-search-field__input{outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 8px;--width: 220px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #e8e8eb;--color-shadow: rgba(0, 0, 0, .1);--color-background: white;--color-text-primary: var(--gray8);--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #eff0f1;--color-text-icon-active: #388ae5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #eff2f5;--color-background-item-confirm: #e24a4a;--color-background-item-confirm-hover: #ce4343;min-width:var(--width);width:var(--width);border-radius:var(--border-radius);-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0 8px 24px var(--color-shadow);box-shadow:0 8px 24px var(--color-shadow);position:absolute;left:44px;top:calc(100% + var(--offset-from-target));background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;pointer-events:none;padding:0;border:none}.ce-popover--opened{opacity:1;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;padding:8px 0}@media (max-width: 200px){.ce-popover--opened{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}@media (max-width: 200px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1d202b;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}.ce-popover--open-top{top:calc(-1 * (var(--offset-from-target) + var(--popover-height)))}@media (max-width: 200px){.ce-popover{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}.ce-popover .ce-popover__search{display:none}}.ce-popover__search,.ce-popover__custom-content:not(:empty){margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover__custom-content:not(:empty){padding:4px}@media (min-width: 201px){.ce-popover__custom-content:not(:empty){padding:0}}.ce-popover__custom-content--hidden{display:none}.ce-popover-item{--icon-size: 20px;--icon-size-mobile: 28px;padding:8px 16px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;cursor:pointer}@media (max-width: 200px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:20px;height:20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:4px}.ce-popover-item__icon svg{color:#868e96}@media (max-width: 200px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{color:#868e96}}.ce-popover-item__title{font-size:13px!important}.ce-popover-item__title{line-height:18px;color:#343a40;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;margin-left:auto;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;margin-bottom:-2px;opacity:.6}@media (max-width: 200px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer;background-color:#e9ecef}.ce-popover-item:hover:active{background-color:#f1f3f5}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}.ce-popover-item:hover .ce-popover-item__icon{-webkit-box-shadow:none;box-shadow:none}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__icon{color:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}.ce-popover-item--confirmation .ce-popover-item__icon,.ce-popover-item--active .ce-popover-item__icon,.ce-popover-item--focused .ce-popover-item__icon{-webkit-box-shadow:none;box-shadow:none}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}} +`; +class bn extends T { + constructor() { + super(...arguments), this.isMobile = !1, this.contentRectCache = void 0, this.resizeDebouncer = Pt(() => { + this.windowResize(); + }, 200); + } + /** + * Editor.js UI CSS class names + * + * @returns {{editorWrapper: string, editorZone: string}} + */ + get CSS() { + return { + editorWrapper: "codex-editor", + editorWrapperNarrow: "codex-editor--narrow", + editorZone: "codex-editor__redactor", + editorZoneHidden: "codex-editor__redactor--hidden", + editorEmpty: "codex-editor--empty", + editorRtlFix: "codex-editor--rtl" + }; + } + /** + * Return Width of center column of Editor + * + * @returns {DOMRect} + */ + get contentRect() { + if (this.contentRectCache) + return this.contentRectCache; + const e = this.nodes.wrapper.querySelector(`.${H.CSS.content}`); + return e ? (this.contentRectCache = e.getBoundingClientRect(), this.contentRectCache) : { + width: 650, + left: 0, + right: 0 + }; + } + /** + * Making main interface + */ + async prepare() { + this.checkIsMobile(), this.make(), this.loadStyles(); + } + /** + * Toggle read-only state + * + * If readOnly is true: + * - removes all listeners from main UI module elements + * + * if readOnly is false: + * - enables all listeners to UI module elements + * + * @param {boolean} readOnlyEnabled - "read only" state + */ + toggleReadOnly(e) { + e ? this.disableModuleBindings() : this.enableModuleBindings(); + } + /** + * Check if Editor is empty and set CSS class to wrapper + */ + checkEmptiness() { + const { BlockManager: e } = this.Editor; + this.nodes.wrapper.classList.toggle( + this.CSS.editorEmpty, + e.isEditorEmpty + ); + } + /** + * Check if one of Toolbar is opened + * Used to prevent global keydowns (for example, Enter) conflicts with Enter-on-toolbar + * + * @returns {boolean} + */ + get someToolbarOpened() { + const { Toolbar: e, BlockSettings: t, InlineToolbar: o, ConversionToolbar: n } = this.Editor; + return t.opened || o.opened || n.opened || e.toolbox.opened; + } + /** + * Check for some Flipper-buttons is under focus + */ + get someFlipperButtonFocused() { + return this.Editor.Toolbar.toolbox.hasFocus() ? !0 : Object.entries(this.Editor).filter(([e, t]) => t.flipper instanceof G).some(([e, t]) => t.flipper.hasFocus()); + } + /** + * Clean editor`s UI + */ + destroy() { + this.nodes.holder.innerHTML = ""; + } + /** + * Close all Editor's toolbars + */ + closeAllToolbars() { + const { Toolbar: e, BlockSettings: t, InlineToolbar: o, ConversionToolbar: n } = this.Editor; + t.close(), o.close(), n.close(), e.toolbox.close(); + } + /** + * Check for mobile mode and cache a result + */ + checkIsMobile() { + this.isMobile = window.innerWidth < it; + } + /** + * Makes Editor.js interface + */ + make() { + this.nodes.holder = d.getHolder(this.config.holder), this.nodes.wrapper = d.make("div", [ + this.CSS.editorWrapper, + ...this.isRtl ? [this.CSS.editorRtlFix] : [] + ]), this.nodes.redactor = d.make("div", this.CSS.editorZone), this.nodes.redactor.style.paddingBottom = this.config.minHeight + "px", this.nodes.wrapper.appendChild(this.nodes.redactor), this.nodes.holder.appendChild(this.nodes.wrapper); + } + /** + * Appends CSS + */ + loadStyles() { + const e = "editor-js-styles"; + if (d.get(e)) + return; + const t = d.make("style", null, { + id: e, + textContent: gn.toString() + }); + d.prepend(document.head, t); + } + /** + * Bind events on the Editor.js interface + */ + enableModuleBindings() { + this.readOnlyMutableListeners.on( + this.nodes.redactor, + "click", + (e) => { + this.redactorClicked(e); + }, + !1 + ), this.readOnlyMutableListeners.on( + this.nodes.redactor, + "mousedown", + (e) => { + this.documentTouched(e); + }, + !0 + ), this.readOnlyMutableListeners.on( + this.nodes.redactor, + "touchstart", + (e) => { + this.documentTouched(e); + }, + !0 + ), this.readOnlyMutableListeners.on( + document, + "keydown", + (e) => { + this.documentKeydown(e); + }, + !0 + ), this.readOnlyMutableListeners.on( + document, + "mousedown", + (e) => { + this.documentClicked(e); + }, + !0 + ), this.readOnlyMutableListeners.on( + document, + "selectionchange", + () => { + this.selectionChanged(); + }, + !0 + ), this.readOnlyMutableListeners.on( + window, + "resize", + () => { + this.resizeDebouncer(); + }, + { + passive: !0 + } + ), this.watchBlockHoveredEvents(); + } + /** + * Listen redactor mousemove to emit 'block-hovered' event + */ + watchBlockHoveredEvents() { + let e; + this.readOnlyMutableListeners.on( + this.nodes.redactor, + "mousemove", + Ee((t) => { + const o = t.target.closest(".ce-block"); + this.Editor.BlockSelection.anyBlockSelected || o && e !== o && (e = o, this.eventsDispatcher.emit(bt, { + block: this.Editor.BlockManager.getBlockByChildNode(o) + })); + }, 20), + { + passive: !0 + } + ); + } + /** + * Unbind events on the Editor.js interface + */ + disableModuleBindings() { + this.readOnlyMutableListeners.clearAll(); + } + /** + * Resize window handler + */ + windowResize() { + this.contentRectCache = null, this.checkIsMobile(); + } + /** + * All keydowns on document + * + * @param {KeyboardEvent} event - keyboard event + */ + documentKeydown(e) { + switch (e.keyCode) { + case B.ENTER: + this.enterPressed(e); + break; + case B.BACKSPACE: + case B.DELETE: + this.backspacePressed(e); + break; + case B.ESC: + this.escapePressed(e); + break; + default: + this.defaultBehaviour(e); + break; + } + } + /** + * Ignore all other document's keydown events + * + * @param {KeyboardEvent} event - keyboard event + */ + defaultBehaviour(e) { + const { currentBlock: t } = this.Editor.BlockManager, o = e.target.closest( + `.${this.CSS.editorWrapper}` + ), n = e.altKey || e.ctrlKey || e.metaKey || e.shiftKey; + if (t !== void 0 && o === null) { + this.Editor.BlockEvents.keydown(e); + return; + } + o || t && n || (this.Editor.BlockManager.dropPointer(), this.Editor.Toolbar.close()); + } + /** + * @param {KeyboardEvent} event - keyboard event + */ + backspacePressed(e) { + const { BlockManager: t, BlockSelection: o, Caret: n } = this.Editor; + if (o.anyBlockSelected && !k.isSelectionExists) { + const i = t.removeSelectedBlocks(); + n.setToBlock( + t.insertDefaultBlockAtIndex(i, !0), + n.positions.START + ), o.clearSelection(e), e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(); + } + } + /** + * Escape pressed + * If some of Toolbar components are opened, then close it otherwise close Toolbar + * + * @param {Event} event - escape keydown event + */ + escapePressed(e) { + this.Editor.BlockSelection.clearSelection(e), this.Editor.Toolbar.toolbox.opened ? (this.Editor.Toolbar.toolbox.close(), this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock)) : this.Editor.BlockSettings.opened ? this.Editor.BlockSettings.close() : this.Editor.ConversionToolbar.opened ? this.Editor.ConversionToolbar.close() : this.Editor.InlineToolbar.opened ? this.Editor.InlineToolbar.close() : this.Editor.Toolbar.close(); + } + /** + * Enter pressed on document + * + * @param {KeyboardEvent} event - keyboard event + */ + enterPressed(e) { + const { BlockManager: t, BlockSelection: o } = this.Editor, n = t.currentBlockIndex >= 0; + if (o.anyBlockSelected && !k.isSelectionExists) { + o.clearSelection(e), e.preventDefault(), e.stopImmediatePropagation(), e.stopPropagation(); + return; + } + if (!this.someToolbarOpened && n && e.target.tagName === "BODY") { + const i = this.Editor.BlockManager.insert(); + this.Editor.Caret.setToBlock(i), this.Editor.BlockManager.highlightCurrentNode(), this.Editor.Toolbar.moveAndOpen(i); + } + this.Editor.BlockSelection.clearSelection(e); + } + /** + * All clicks on document + * + * @param {MouseEvent} event - Click event + */ + documentClicked(e) { + if (!e.isTrusted) + return; + const t = e.target; + this.nodes.holder.contains(t) || k.isAtEditor || (this.Editor.BlockManager.dropPointer(), this.Editor.Toolbar.close()); + const n = this.Editor.BlockSettings.nodes.wrapper.contains(t), i = this.Editor.Toolbar.nodes.settingsToggler.contains(t), r = n || i; + if (this.Editor.BlockSettings.opened && !r) { + this.Editor.BlockSettings.close(); + const a = this.Editor.BlockManager.getBlockByChildNode(t); + this.Editor.Toolbar.moveAndOpen(a); + } + this.Editor.BlockSelection.clearSelection(e); + } + /** + * First touch on editor + * Fired before click + * + * Used to change current block — we need to do it before 'selectionChange' event. + * Also: + * - Move and show the Toolbar + * - Set a Caret + * + * @param {MouseEvent | TouchEvent} event - touch or mouse event + */ + documentTouched(e) { + let t = e.target; + if (t === this.nodes.redactor) { + const o = e instanceof MouseEvent ? e.clientX : e.touches[0].clientX, n = e instanceof MouseEvent ? e.clientY : e.touches[0].clientY; + t = document.elementFromPoint(o, n); + } + try { + this.Editor.BlockManager.setCurrentBlockByChildNode(t), this.Editor.BlockManager.highlightCurrentNode(); + } catch { + this.Editor.RectangleSelection.isRectActivated() || this.Editor.Caret.setToTheLastBlock(); + } + this.Editor.Toolbar.moveAndOpen(); + } + /** + * All clicks on the redactor zone + * + * @param {MouseEvent} event - click event + * @description + * - By clicks on the Editor's bottom zone: + * - if last Block is empty, set a Caret to this + * - otherwise, add a new empty Block and set a Caret to that + */ + redactorClicked(e) { + const { BlockSelection: t } = this.Editor; + if (!k.isCollapsed) + return; + const o = () => { + e.stopImmediatePropagation(), e.stopPropagation(); + }, n = e.target, i = e.metaKey || e.ctrlKey; + if (d.isAnchor(n) && i) { + o(); + const u = n.getAttribute("href"), h = Ft(u); + zt(h); + return; + } + const r = this.Editor.BlockManager.getBlockByIndex(-1), a = d.offset(r.holder).bottom, l = e.pageY; + if (e.target instanceof Element && e.target.isEqualNode(this.nodes.redactor) && /** + * If there is cross block selection started, target will be equal to redactor so we need additional check + */ + !t.anyBlockSelected && /** + * Prevent caret jumping (to last block) when clicking between blocks + */ + a < l) { + o(); + const { BlockManager: u, Caret: h, Toolbar: f } = this.Editor; + (!u.lastBlock.tool.isDefault || !u.lastBlock.isEmpty) && u.insertAtEnd(), h.setToTheLastBlock(), f.moveAndOpen(u.lastBlock); + } + } + /** + * Handle selection changes on mobile devices + * Uses for showing the Inline Toolbar + */ + selectionChanged() { + const { CrossBlockSelection: e, BlockSelection: t } = this.Editor, o = k.anchorElement; + if (e.isCrossBlockSelectionStarted && t.anyBlockSelected && k.get().removeAllRanges(), !o) { + k.range || this.Editor.InlineToolbar.close(); + return; + } + const n = o.closest(`.${H.CSS.content}`) === null; + if (n && (this.Editor.InlineToolbar.containsNode(o) || this.Editor.InlineToolbar.close(), !(o.dataset.inlineToolbar === "true"))) + return; + this.Editor.BlockManager.currentBlock || this.Editor.BlockManager.setCurrentBlockByChildNode(o); + const i = n !== !0; + this.Editor.InlineToolbar.tryToShow(!0, i); + } +} +const mn = { + // API Modules + BlocksAPI: Gt, + CaretAPI: Jt, + EventsAPI: Qt, + I18nAPI: Re, + API: eo, + InlineToolbarAPI: to, + ListenersAPI: oo, + NotifierAPI: ro, + ReadOnlyAPI: ao, + SanitizerAPI: go, + SaverAPI: bo, + SelectionAPI: mo, + StylesAPI: ko, + ToolbarAPI: vo, + TooltipAPI: Co, + UiAPI: yo, + // Toolbar Modules + BlockSettings: Lo, + ConversionToolbar: $, + Toolbar: Ho, + InlineToolbar: jo, + // Modules + BlockEvents: zo, + BlockManager: Wo, + BlockSelection: Vo, + Caret: ke, + CrossBlockSelection: Yo, + DragNDrop: Zo, + ModificationsObserver: Ko, + Paste: xt, + ReadOnly: Xo, + RectangleSelection: pe, + Renderer: qo, + Saver: Go, + Tools: Tt, + UI: bn +}; +class kn { + /** + * @param {EditorConfig} config - user configuration + */ + constructor(e) { + this.moduleInstances = {}, this.eventsDispatcher = new xe(); + let t, o; + this.isReady = new Promise((n, i) => { + t = n, o = i; + }), Promise.resolve().then(async () => { + this.configuration = e, this.validate(), this.init(), await this.start(), await this.render(); + const { BlockManager: n, Caret: i, UI: r, ModificationsObserver: a } = this.moduleInstances; + r.checkEmptiness(), a.enable(), this.configuration.autofocus && (i.setToBlock(n.blocks[0], i.positions.START), n.highlightCurrentNode()), t(); + }).catch((n) => { + L(`Editor.js is not ready because of ${n}`, "error"), o(n); + }); + } + /** + * Setting for configuration + * + * @param {EditorConfig|string} config - Editor's config to set + */ + set configuration(e) { + var o, n; + j(e) ? this.config = { + ...e + } : this.config = { + holder: e + }, Se(!!this.config.holderId, "config.holderId", "config.holder"), this.config.holderId && !this.config.holder && (this.config.holder = this.config.holderId, this.config.holderId = null), this.config.holder == null && (this.config.holder = "editorjs"), this.config.logLevel || (this.config.logLevel = tt.VERBOSE), Ot(this.config.logLevel), Se(!!this.config.initialBlock, "config.initialBlock", "config.defaultBlock"), this.config.defaultBlock = this.config.defaultBlock || this.config.initialBlock || "paragraph", this.config.minHeight = this.config.minHeight !== void 0 ? this.config.minHeight : 300; + const t = { + type: this.config.defaultBlock, + data: {} + }; + this.config.placeholder = this.config.placeholder || !1, this.config.sanitizer = this.config.sanitizer || { + p: !0, + b: !0, + a: !0 + }, this.config.hideToolbar = this.config.hideToolbar ? this.config.hideToolbar : !1, this.config.tools = this.config.tools || {}, this.config.i18n = this.config.i18n || {}, this.config.data = this.config.data || { blocks: [] }, this.config.onReady = this.config.onReady || (() => { + }), this.config.onChange = this.config.onChange || (() => { + }), this.config.inlineToolbar = this.config.inlineToolbar !== void 0 ? this.config.inlineToolbar : !0, (K(this.config.data) || !this.config.data.blocks || this.config.data.blocks.length === 0) && (this.config.data = { blocks: [t] }), this.config.readOnly = this.config.readOnly || !1, (o = this.config.i18n) != null && o.messages && W.setDictionary(this.config.i18n.messages), this.config.i18n.direction = ((n = this.config.i18n) == null ? void 0 : n.direction) || "ltr"; + } + /** + * Returns private property + * + * @returns {EditorConfig} + */ + get configuration() { + return this.config; + } + /** + * Checks for required fields in Editor's config + */ + validate() { + const { holderId: e, holder: t } = this.config; + if (e && t) + throw Error("«holderId» and «holder» param can't assign at the same time."); + if (J(t) && !d.get(t)) + throw Error(`element with ID «${t}» is missing. Pass correct holder's ID.`); + if (t && j(t) && !d.isElement(t)) + throw Error("«holder» value must be an Element node"); + } + /** + * Initializes modules: + * - make and save instances + * - configure + */ + init() { + this.constructModules(), this.configureModules(); + } + /** + * Start Editor! + * + * Get list of modules that needs to be prepared and return a sequence (Promise) + * + * @returns {Promise} + */ + async start() { + await [ + "Tools", + "UI", + "BlockManager", + "Paste", + "BlockSelection", + "RectangleSelection", + "CrossBlockSelection", + "ReadOnly" + ].reduce( + (t, o) => t.then(async () => { + try { + await this.moduleInstances[o].prepare(); + } catch (n) { + if (n instanceof rt) + throw new Error(n.message); + L(`Module ${o} was skipped because of %o`, "warn", n); + } + }), + Promise.resolve() + ); + } + /** + * Render initial data + */ + render() { + return this.moduleInstances.Renderer.render(this.config.data.blocks); + } + /** + * Make modules instances and save it to the @property this.moduleInstances + */ + constructModules() { + Object.entries(mn).forEach(([e, t]) => { + try { + this.moduleInstances[e] = new t({ + config: this.configuration, + eventsDispatcher: this.eventsDispatcher + }); + } catch (o) { + L("[constructModules]", `Module ${e} skipped because`, "error", o); + } + }); + } + /** + * Modules instances configuration: + * - pass other modules to the 'state' property + * - ... + */ + configureModules() { + for (const e in this.moduleInstances) + Object.prototype.hasOwnProperty.call(this.moduleInstances, e) && (this.moduleInstances[e].state = this.getModulesDiff(e)); + } + /** + * Return modules without passed name + * + * @param {string} name - module for witch modules difference should be calculated + */ + getModulesDiff(e) { + const t = {}; + for (const o in this.moduleInstances) + o !== e && (t[o] = this.moduleInstances[o]); + return t; + } +} +/** + * Editor.js + * + * @license Apache-2.0 + * @see Editor.js + * @author CodeX Team + */ +class vn { + /** Editor version */ + static get version() { + return "2.28.0-rc.3"; + } + /** + * @param {EditorConfig|string|undefined} [configuration] - user configuration + */ + constructor(e) { + let t = () => { + }; + j(e) && D(e.onReady) && (t = e.onReady); + const o = new kn(e); + this.isReady = o.isReady.then(() => { + this.exportAPI(o), t(); + }); + } + /** + * Export external API methods + * + * @param {Core} editor — Editor's instance + */ + exportAPI(e) { + const t = ["configuration"], o = () => { + Object.values(e.moduleInstances).forEach((i) => { + D(i.destroy) && i.destroy(), i.listeners.removeAll(); + }), e = null; + for (const i in this) + Object.prototype.hasOwnProperty.call(this, i) && delete this[i]; + Object.setPrototypeOf(this, null); + }; + t.forEach((i) => { + this[i] = e[i]; + }), this.destroy = o, Object.setPrototypeOf(this, e.moduleInstances.API.methods), delete this.exportAPI, Object.entries({ + blocks: { + clear: "clear", + render: "render" + }, + caret: { + focus: "focus" + }, + events: { + on: "on", + off: "off", + emit: "emit" + }, + saver: { + save: "save" + } + }).forEach(([i, r]) => { + Object.entries(r).forEach(([a, l]) => { + this[l] = e.moduleInstances.API.methods[i][a]; + }); + }); + } +} +export { + vn as default +}; diff --git a/dist/editorjs.umd.js b/dist/editorjs.umd.js new file mode 100644 index 000000000..b5573abfb --- /dev/null +++ b/dist/editorjs.umd.js @@ -0,0 +1,101 @@ +(function(he,J){typeof exports=="object"&&typeof module<"u"?module.exports=J():typeof define=="function"&&define.amd?define(J):(he=typeof globalThis<"u"?globalThis:he||self,he.EditorJS=J())})(this,function(){"use strict";var he=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function J(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function ye(){}Object.assign(ye,{default:ye,register:ye,revert:function(){},__esModule:!0}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(s){const e=(this.document||this.ownerDocument).querySelectorAll(s);let t=e.length;for(;--t>=0&&e.item(t)!==this;);return t>-1}),Element.prototype.closest||(Element.prototype.closest=function(s){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(s))return e;e=e.parentElement||e.parentNode}while(e!==null);return null}),Element.prototype.prepend||(Element.prototype.prepend=function(e){const t=document.createDocumentFragment();Array.isArray(e)||(e=[e]),e.forEach(o=>{const n=o instanceof Node;t.appendChild(n?o:document.createTextNode(o))}),this.insertBefore(t,this.firstChild)}),Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(s){s=arguments.length===0?!0:!!s;const e=this.parentNode,t=window.getComputedStyle(e,null),o=parseInt(t.getPropertyValue("border-top-width")),n=parseInt(t.getPropertyValue("border-left-width")),i=this.offsetTop-e.offsetTope.scrollTop+e.clientHeight,a=this.offsetLeft-e.offsetLefte.scrollLeft+e.clientWidth,c=i&&!r;(i||r)&&s&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(a||l)&&s&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-n+this.clientWidth/2),(i||r||a||l)&&!s&&this.scrollIntoView(c)}),window.requestIdleCallback=window.requestIdleCallback||function(s){const e=Date.now();return setTimeout(function(){s({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)},window.cancelIdleCallback=window.cancelIdleCallback||function(s){clearTimeout(s)};let It=(s=21)=>crypto.getRandomValues(new Uint8Array(s)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var Ze=(s=>(s.VERBOSE="VERBOSE",s.INFO="INFO",s.WARN="WARN",s.ERROR="ERROR",s))(Ze||{});const B={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91},Mt={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function ue(s,e,t="log",o,n="color: inherit"){if(!("console"in window)||!window.console[t])return;const i=["info","log","warn","error"].includes(t),r=[];switch(ue.logLevel){case"ERROR":if(t!=="error")return;break;case"WARN":if(!["error","warn"].includes(t))return;break;case"INFO":if(!i||s)return;break}o&&r.push(o);const a="Editor.js 2.28.0-rc.3",l=`line-height: 1em; + color: #006FEA; + display: inline-block; + font-size: 11px; + line-height: 1em; + background-color: #fff; + padding: 4px 9px; + border-radius: 30px; + border: 1px solid rgba(56, 138, 229, 0.16); + margin: 4px 5px 4px 0;`;s&&(i?(r.unshift(l,n),e=`%c${a}%c ${e}`):e=`( ${a} )${e}`);try{i?o?console[t](`${e} %o`,...r):console[t](e,...r):console[t](e)}catch{}}ue.logLevel="VERBOSE";function Lt(s){ue.logLevel=s}const L=ue.bind(window,!1),Y=ue.bind(window,!0);function ee(s){return Object.prototype.toString.call(s).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function D(s){return ee(s)==="function"||ee(s)==="asyncfunction"}function F(s){return ee(s)==="object"}function Q(s){return ee(s)==="string"}function _t(s){return ee(s)==="boolean"}function Ke(s){return ee(s)==="number"}function Xe(s){return ee(s)==="undefined"}function Z(s){return s?Object.keys(s).length===0&&s.constructor===Object:!0}function qe(s){return s>47&&s<58||s===32||s===13||s===229||s>64&&s<91||s>95&&s<112||s>185&&s<193||s>218&&s<223}async function Ot(s,e=()=>{},t=()=>{}){async function o(n,i,r){try{await n.function(n.data),await i(Xe(n.data)?{}:n.data)}catch{r(Xe(n.data)?{}:n.data)}}return s.reduce(async(n,i)=>(await n,o(i,e,t)),Promise.resolve())}function Ge(s){return Array.prototype.slice.call(s)}function ie(s,e){return function(){const t=this,o=arguments;window.setTimeout(()=>s.apply(t,o),e)}}function At(s){return s.name.split(".").pop()}function Nt(s){return/^[-\w]+\/([-+\w]+|\*)$/.test(s)}function Rt(s,e,t){let o;return(...n)=>{const i=this,r=()=>{o=null,t||s.apply(i,n)},a=t&&!o;window.clearTimeout(o),o=window.setTimeout(r,e),a&&s.apply(i,n)}}function Be(s,e,t=void 0){let o,n,i,r=null,a=0;t||(t={});const l=function(){a=t.leading===!1?0:Date.now(),r=null,i=s.apply(o,n),r||(o=n=null)};return function(){const c=Date.now();!a&&t.leading===!1&&(a=c);const u=e-(c-a);return o=this,n=arguments,u<=0||u>e?(r&&(clearTimeout(r),r=null),a=c,i=s.apply(o,n),r||(o=n=null)):!r&&t.trailing!==!1&&(r=setTimeout(l,u)),i}}function Dt(){const s={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(s).find(t=>window.navigator.appVersion.toLowerCase().indexOf(t)!==-1);return e&&(s[e]=!0),s}function se(s){return s[0].toUpperCase()+s.slice(1)}function Ee(s,...e){if(!e.length)return s;const t=e.shift();if(F(s)&&F(t))for(const o in t)F(t[o])?(s[o]||Object.assign(s,{[o]:{}}),Ee(s[o],t[o])):Object.assign(s,{[o]:t[o]});return Ee(s,...e)}function Te(s){const e=Dt();return s=s.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi," + "),e.mac?s=s.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):s=s.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),s}function Pt(s){try{return new URL(s).href}catch{}return s.substring(0,2)==="//"?window.location.protocol+s:window.location.origin+s}function Ht(){return It(10)}function Ft(s){window.open(s,"_blank")}function jt(s=""){return`${s}${Math.floor(Math.random()*1e8).toString(16)}`}function Se(s,e,t){const o=`«${e}» is deprecated and will be removed in the next major release. Please use the «${t}» instead.`;s&&Y(o,"warn")}function re(s,e,t){const o=t.value?"value":"get",n=t[o],i=`#${e}Cache`;if(t[o]=function(...r){return this[i]===void 0&&(this[i]=n.apply(this,...r)),this[i]},o==="get"&&t.set){const r=t.set;t.set=function(a){delete s[i],r.apply(this,a)}}return t}const Je=200;function te(){return window.matchMedia(`(max-width: ${Je}px)`).matches}const Qe=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function zt(s,e){const t=Array.isArray(s)||F(s),o=Array.isArray(e)||F(e);return t||o?JSON.stringify(s)===JSON.stringify(e):s===e}class d{static isSingleTag(e){return e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return e&&e.tagName&&["BR","WBR"].includes(e.tagName)}static make(e,t=null,o={}){const n=document.createElement(e);Array.isArray(t)?n.classList.add(...t):t&&n.classList.add(t);for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i]);return n}static text(e){return document.createTextNode(e)}static append(e,t){Array.isArray(t)?t.forEach(o=>e.appendChild(o)):e.appendChild(t)}static prepend(e,t){Array.isArray(t)?(t=t.reverse(),t.forEach(o=>e.prepend(o))):e.prepend(t)}static swap(e,t){const o=document.createElement("div"),n=e.parentNode;n.insertBefore(o,e),n.insertBefore(e,t),n.insertBefore(t,o),n.removeChild(o)}static find(e=document,t){return e.querySelector(t)}static get(e){return document.getElementById(e)}static findAll(e=document,t){return e.querySelectorAll(t)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(t=>`input[type="${t}"]`).join(", ")}static findAllInputs(e){return Ge(e.querySelectorAll(d.allInputsSelector)).reduce((t,o)=>d.isNativeInput(o)||d.containsOnlyInlineElements(o)?[...t,o]:[...t,...d.getDeepestBlockElements(o)],[])}static getDeepestNode(e,t=!1){const o=t?"lastChild":"firstChild",n=t?"previousSibling":"nextSibling";if(e&&e.nodeType===Node.ELEMENT_NODE&&e[o]){let i=e[o];if(d.isSingleTag(i)&&!d.isNativeInput(i)&&!d.isLineBreakTag(i))if(i[n])i=i[n];else if(i.parentNode[n])i=i.parentNode[n];else return i.parentNode;return this.getDeepestNode(i,t)}return e}static isElement(e){return Ke(e)?!1:e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return Ke(e)?!1:e&&e.nodeType&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){const t=["INPUT","TEXTAREA"];return e&&e.tagName?t.includes(e.tagName):!1}static canSetCaret(e){let t=!0;if(d.isNativeInput(e))switch(e.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":t=!1;break}else t=d.isContentEditable(e);return t}static isNodeEmpty(e){let t;return this.isSingleTag(e)&&!this.isLineBreakTag(e)?!1:(this.isElement(e)&&this.isNativeInput(e)?t=e.value:t=e.textContent.replace("​",""),t.trim().length===0)}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e){e.normalize();const t=[e];for(;t.length>0;)if(e=t.shift(),!!e){if(this.isLeaf(e)&&!this.isNodeEmpty(e))return!1;e.childNodes&&t.push(...Array.from(e.childNodes))}return!0}static isHTMLString(e){const t=d.make("div");return t.innerHTML=e,t.childElementCount>0}static getContentLength(e){return d.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:e.textContent.length}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){let t;Q(e)?(t=document.createElement("div"),t.innerHTML=e):t=e;const o=n=>!d.blockElements.includes(n.tagName.toLowerCase())&&Array.from(n.children).every(o);return Array.from(t.children).every(o)}static getDeepestBlockElements(e){return d.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((t,o)=>[...t,...d.getDeepestBlockElements(o)],[])}static getHolder(e){return Q(e)?document.getElementById(e):e}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static offset(e){const t=e.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,n=window.pageYOffset||document.documentElement.scrollTop,i=t.top+n,r=t.left+o;return{top:i,left:r,bottom:i+t.height,right:r+t.width}}}const et={ui:{blockTunes:{toggler:{"Click to tune":"","or drag to move":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{Add:""}},popover:{Filter:"","Nothing found":""}},toolNames:{Text:"",Link:"",Bold:"",Italic:""},tools:{link:{"Add a link":"Add a link",Remove:"Remove"},stub:{"The block can not be displayed correctly.":""}},blockTunes:{delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}}},ae=class{static ui(s,e){return ae._t(s,e)}static t(s,e){return ae._t(s,e)}static setDictionary(s){ae.currentDictionary=s}static _t(s,e){const t=ae.getNamespace(s);return!t||!t[e]?e:t[e]}static getNamespace(s){return s.split(".").reduce((t,o)=>!t||!Object.keys(t).length?{}:t[o],ae.currentDictionary)}};let $=ae;$.currentDictionary=et;class tt extends Error{}class ke{constructor(){this.subscribers={}}on(e,t){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(t)}once(e,t){e in this.subscribers||(this.subscribers[e]=[]);const o=n=>{const i=t(n),r=this.subscribers[e].indexOf(o);return r!==-1&&this.subscribers[e].splice(r,1),i};this.subscribers[e].push(o)}emit(e,t){Z(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,n)=>{const i=n(o);return i!==void 0?i:o},t)}off(e,t){if(this.subscribers[e]===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}for(let o=0;o{const l=this.allListeners.indexOf(i[a]);l>-1&&(this.allListeners.splice(l,1),r.element.removeEventListener(r.eventType,r.handler,r.options))})}offById(e){const t=this.findById(e);t&&t.element.removeEventListener(t.eventType,t.handler,t.options)}findOne(e,t,o){const n=this.findAll(e,t,o);return n.length>0?n[0]:null}findAll(e,t,o){let n;const i=e?this.findByEventTarget(e):[];return e&&t&&o?n=i.filter(r=>r.eventType===t&&r.handler===o):e&&t?n=i.filter(r=>r.eventType===t):n=i,n}removeAll(){this.allListeners.map(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(t=>{if(t.element===e)return t})}findByType(e){return this.allListeners.filter(t=>{if(t.eventType===e)return t})}findByHandler(e){return this.allListeners.filter(t=>{if(t.handler===e)return t})}findById(e){return this.allListeners.find(t=>t.id===e)}}class T{constructor({config:e,eventsDispatcher:t}){if(this.nodes={},this.listeners=new ot,this.readOnlyMutableListeners={on:(o,n,i,r=!1)=>{this.mutableListenerIds.push(this.listeners.on(o,n,i,r))},clearAll:()=>{for(const o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===T)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=t}set state(e){this.Editor=e}removeAllNodes(){for(const e in this.nodes){const t=this.nodes[e];t instanceof HTMLElement&&t.remove()}}get isRtl(){return this.config.i18n.direction==="rtl"}}class k{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor",this.commandRemoveFormat="removeFormat"}static get CSS(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}static get anchorNode(){const e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){const e=window.getSelection();if(!e)return null;const t=e.anchorNode;return t?d.isElement(t)?t:t.parentElement:null}static get anchorOffset(){const e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){const e=window.getSelection();return e?e.isCollapsed:null}static get isAtEditor(){return this.isSelectionAtEditor(k.get())}static isSelectionAtEditor(e){if(!e)return!1;let t=e.anchorNode||e.focusNode;t&&t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);let o=null;return t&&t instanceof Element&&(o=t.closest(`.${k.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtEditor(e){if(!e)return;let t=e.startContainer;t&&t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);let o=null;return t&&t instanceof Element&&(o=t.closest(`.${k.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){return!!k.get().anchorNode}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){let e=document.selection,t,o={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control")return e=e,t=e.createRange(),o.x=t.boundingLeft,o.y=t.boundingTop,o.width=t.boundingWidth,o.height=t.boundingHeight,o;if(!window.getSelection)return L("Method window.getSelection is not supported","warn"),o;if(e=window.getSelection(),e.rangeCount===null||isNaN(e.rangeCount))return L("Method SelectionUtils.rangeCount is not supported","warn"),o;if(e.rangeCount===0)return o;if(t=e.getRangeAt(0).cloneRange(),t.getBoundingClientRect&&(o=t.getBoundingClientRect()),o.x===0&&o.y===0){const n=document.createElement("span");if(n.getBoundingClientRect){n.appendChild(document.createTextNode("​")),t.insertNode(n),o=n.getBoundingClientRect();const i=n.parentNode;i.removeChild(n),i.normalize()}}return o}static get text(){return window.getSelection?window.getSelection().toString():""}static get(){return window.getSelection()}static setCursor(e,t=0){const o=document.createRange(),n=window.getSelection();return d.isNativeInput(e)?d.canSetCaret(e)?(e.focus(),e.selectionStart=e.selectionEnd=t,e.getBoundingClientRect()):void 0:(o.setStart(e,t),o.setEnd(e,t),n.removeAllRanges(),n.addRange(o),o.getBoundingClientRect())}static isRangeInsideContainer(e){const t=k.range;return t===null?!1:e.contains(t.startContainer)}static addFakeCursor(){const e=k.range;if(e===null)return;const t=d.make("span","codex-editor__fake-cursor");t.dataset.mutationFree="true",e.collapse(),e.insertNode(t)}static isFakeCursorInsideContainer(e){return d.find(e,".codex-editor__fake-cursor")!==null}static removeFakeCursor(e=document.body){const t=d.find(e,".codex-editor__fake-cursor");t&&t.remove()}removeFakeBackground(){this.isFakeBackgroundEnabled&&(this.isFakeBackgroundEnabled=!1,document.execCommand(this.commandRemoveFormat))}setFakeBackground(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}save(){this.savedSelectionRange=k.range}restore(){if(!this.savedSelectionRange)return;const e=window.getSelection();e.removeAllRanges(),e.addRange(this.savedSelectionRange)}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){const e=window.getSelection(),t=document.createRange();t.selectNodeContents(e.focusNode),t.collapse(!1),e.removeAllRanges(),e.addRange(t)}findParentTag(e,t,o=10){const n=window.getSelection();let i=null;return!n||!n.anchorNode||!n.focusNode?null:([n.anchorNode,n.focusNode].forEach(a=>{let l=o;for(;l>0&&a.parentNode&&!(a.tagName===e&&(i=a,t&&a.classList&&!a.classList.contains(t)&&(i=null),i));)a=a.parentNode,l--}),i)}expandToTag(e){const t=window.getSelection();t.removeAllRanges();const o=document.createRange();o.selectNodeContents(e),t.addRange(o)}}function Ut(s,e){const{type:t,target:o,addedNodes:n,removedNodes:i}=s;if(o===e)return!0;if(["characterData","attributes"].includes(t)){const l=o.nodeType===Node.TEXT_NODE?o.parentNode:o;return e.contains(l)}const r=Array.from(n).some(l=>e.contains(l)),a=Array.from(i).some(l=>e.contains(l));return r||a}const Ie="redactor dom changed",nt="block changed",it="fake cursor is about to be toggled",st="fake cursor have been set";function rt(s,e){return s.mergeable&&s.name===e.name}function $t(s,e){const t=e==null?void 0:e.export;return D(t)?t(s):Q(t)?s[t]:(t!==void 0&&L("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")}function Wt(s,e){const t=e==null?void 0:e.import;return D(t)?t(s):Q(t)?{[t]:s}:(t!==void 0&&L("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})}var X=(s=>(s.APPEND_CALLBACK="appendCallback",s.RENDERED="rendered",s.MOVED="moved",s.UPDATED="updated",s.REMOVED="removed",s.ON_PASTE="onPaste",s))(X||{});class H extends ke{constructor({id:e=Ht(),data:t,tool:o,api:n,readOnly:i,tunesData:r},a){super(),this.cachedInputs=[],this.toolRenderedElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.unavailableTunesData={},this.inputIndex=0,this.editorEventBus=null,this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(l=void 0)=>{const c=l===void 0,u=l instanceof InputEvent;!c&&!u&&this.detectToolRootChange(l);let h;c||u?h=!0:h=!(l.length>0&&l.every(m=>{const{addedNodes:p,removedNodes:v,target:O}=m;return[...Array.from(p),...Array.from(v),O].some(A=>d.isElement(A)?A.dataset.mutationFree==="true":!1)})),h&&(this.dropInputsCache(),this.updateCurrentInput(),this.call("updated"),this.emit("didMutated",this))},this.name=o.name,this.id=e,this.settings=o.settings,this.config=o.settings.config||{},this.api=n,this.editorEventBus=a||null,this.blockAPI=new oe(this),this.tool=o,this.toolInstance=o.create(t,this.blockAPI,i),this.tunes=o.tunes,this.composeTunes(r),this.holder=this.compose(),window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents()})}static get CSS(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",focused:"ce-block--focused",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;const e=d.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){const t=this.inputs.findIndex(o=>o===e||o.contains(e));t!==-1&&(this.inputIndex=t)}get firstInput(){return this.inputs[0]}get lastInput(){const e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!Z(e.data)?e.data:{})}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return D(this.toolInstance.merge)}get isEmpty(){const e=d.isEmpty(this.pluginsContent),t=!this.hasMedia;return e&&t}get hasMedia(){const e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set focused(e){this.holder.classList.toggle(H.CSS.focused,e)}get focused(){return this.holder.classList.contains(H.CSS.focused)}set selected(e){var n,i;this.holder.classList.toggle(H.CSS.selected,e);const t=e===!0&&k.isRangeInsideContainer(this.holder),o=e===!1&&k.isFakeCursorInsideContainer(this.holder);(t||o)&&((n=this.editorEventBus)==null||n.emit(it,{state:e}),t?k.addFakeCursor():k.removeFakeCursor(this.holder),(i=this.editorEventBus)==null||i.emit(st,{state:e}))}get selected(){return this.holder.classList.contains(H.CSS.selected)}set stretched(e){this.holder.classList.toggle(H.CSS.wrapperStretched,e)}get stretched(){return this.holder.classList.contains(H.CSS.wrapperStretched)}set dropTarget(e){this.holder.classList.toggle(H.CSS.dropTarget,e)}get pluginsContent(){return this.toolRenderedElement}call(e,t){if(D(this.toolInstance[e])){e==="appendCallback"&&L("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[e].call(this.toolInstance,t)}catch(o){L(`Error during '${e}' call: ${o.message}`,"error")}}}async mergeWith(e){await this.toolInstance.merge(e)}async save(){const e=await this.toolInstance.save(this.pluginsContent),t=this.unavailableTunesData;[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([i,r])=>{if(D(r.save))try{t[i]=r.save()}catch(a){L(`Tune ${r.constructor.name} save method throws an Error %o`,"warn",a)}});const o=window.performance.now();let n;return Promise.resolve(e).then(i=>(n=window.performance.now(),{id:this.id,tool:this.name,data:i,tunes:t,time:n-o})).catch(i=>{L(`Saving process for ${this.name} tool failed due to the ${i}`,"log","red")})}async validate(e){let t=!0;return this.toolInstance.validate instanceof Function&&(t=await this.toolInstance.validate(e)),t}getTunes(){const e=document.createElement("div"),t=[],o=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[],n=[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(i=>i.render());return[o,n].flat().forEach(i=>{d.isElement(i)?e.appendChild(i):Array.isArray(i)?t.push(...i):t.push(i)}),[t,e]}updateCurrentInput(){this.currentInput=d.isNativeInput(document.activeElement)||!k.anchorNode?document.activeElement:k.anchorNode}dispatchChange(){this.didMutated()}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),D(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){const e=this.tool.toolbox;if(e.length===1)return Promise.resolve(this.tool.toolbox[0]);const t=await this.data;return e.find(n=>Object.entries(n.data).some(([i,r])=>t[i]&&zt(t[i],r)))}async exportDataAsString(){const e=await this.data;return $t(e,this.tool.conversionConfig)}compose(){const e=d.make("div",H.CSS.wrapper),t=d.make("div",H.CSS.content),o=this.toolInstance.render();e.dataset.id=this.id,this.toolRenderedElement=o,t.appendChild(this.toolRenderedElement);let n=t;return[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].forEach(i=>{if(D(i.wrap))try{n=i.wrap(n)}catch(r){L(`Tune ${i.constructor.name} wrap method throws an Error %o`,"warn",r)}}),e.appendChild(n),e}composeTunes(e){Array.from(this.tunes.values()).forEach(t=>{(t.isInternal?this.defaultTunesInstances:this.tunesInstances).set(t.name,t.create(e[t.name],this.blockAPI))}),Object.entries(e).forEach(([t,o])=>{this.tunesInstances.has(t)||(this.unavailableTunesData[t]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),d.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),d.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=t=>{const{mutations:o}=t;o.some(i=>Ut(i,this.toolRenderedElement))&&this.didMutated(o)},(e=this.editorEventBus)==null||e.on(Ie,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.editorEventBus)==null||e.off(Ie,this.redactorDomChangedCallback)}detectToolRootChange(e){e.forEach(t=>{if(Array.from(t.removedNodes).includes(this.toolRenderedElement)){const n=t.addedNodes[t.addedNodes.length-1];this.toolRenderedElement=n}})}dropInputsCache(){this.cachedInputs=[]}}class Vt extends T{constructor(){super(...arguments),this.insert=(e=this.config.defaultBlock,t={},o={},n,i,r,a)=>{const l=this.Editor.BlockManager.insert({id:a,tool:e,data:t,index:n,needToFocus:i,replace:r});return new oe(l)},this.composeBlockData=async e=>{const t=this.Editor.Tools.blockTools.get(e);return new H({tool:t,api:this.Editor.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,t)=>{const{BlockManager:o}=this.Editor,n=o.getBlockById(e);if(n===void 0)throw new Error(`Block with id "${e}" not found`);const i=await o.update(n,t);return new oe(i)},this.convert=(e,t,o)=>{var h,f;const{BlockManager:n,Tools:i}=this.Editor,r=n.getBlockById(e);if(!r)throw new Error(`Block with id "${e}" not found`);const a=i.blockTools.get(r.name),l=i.blockTools.get(t);if(!l)throw new Error(`Block Tool with type "${t}" not found`);const c=((h=a==null?void 0:a.conversionConfig)==null?void 0:h.export)!==void 0,u=((f=l.conversionConfig)==null?void 0:f.import)!==void 0;if(c&&u)n.convert(r,t,o);else{const m=[c?!1:se(r.name),u?!1:se(t)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${r.name}" to "${t}" is not possible. ${m} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,t=this.Editor.BlockManager.blocks.length-1)=>{this.validateIndex(t);const o=e.map(({id:n,type:i,data:r})=>this.Editor.BlockManager.composeBlock({id:n,tool:i||this.config.defaultBlock,data:r}));return this.Editor.BlockManager.insertMany(o,t),o.map(n=>new oe(n))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),swap:(e,t)=>this.swap(e,t),move:(e,t)=>this.move(e,t),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),stretchBlock:(e,t=!0)=>this.stretchBlock(e,t),insertNewBlock:()=>this.insertNewBlock(),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert}}getBlocksCount(){return this.Editor.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Editor.BlockManager.currentBlockIndex}getBlockIndex(e){const t=this.Editor.BlockManager.getBlockById(e);if(!t){Y("There is no block with id `"+e+"`","warn");return}return this.Editor.BlockManager.getBlockIndex(t)}getBlockByIndex(e){const t=this.Editor.BlockManager.getBlockByIndex(e);if(t===void 0){Y("There is no block at index `"+e+"`","warn");return}return new oe(t)}getById(e){const t=this.Editor.BlockManager.getBlockById(e);return t===void 0?(Y("There is no block with id `"+e+"`","warn"),null):new oe(t)}swap(e,t){L("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(e,t)}move(e,t){this.Editor.BlockManager.move(e,t)}delete(e=this.Editor.BlockManager.currentBlockIndex){try{const t=this.Editor.BlockManager.getBlockByIndex(e);this.Editor.BlockManager.removeBlock(t)}catch(t){Y(t,"warn");return}this.Editor.BlockManager.blocks.length===0&&this.Editor.BlockManager.insert(),this.Editor.BlockManager.currentBlock&&this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END),this.Editor.Toolbar.close()}clear(){this.Editor.BlockManager.clear(!0),this.Editor.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");return await this.Editor.BlockManager.clear(),this.Editor.Renderer.render(e.blocks)}renderFromHTML(e){return this.Editor.BlockManager.clear(),this.Editor.Paste.processText(e,!0)}stretchBlock(e,t=!0){Se(!0,"blocks.stretchBlock()","BlockAPI");const o=this.Editor.BlockManager.getBlockByIndex(e);o&&(o.stretched=t)}insertNewBlock(){L("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}}class Yt extends T{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.firstBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock,e,t),!0):!1,this.setToLastBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.lastBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock,e,t),!0):!1,this.setToPreviousBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.previousBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock,e,t),!0):!1,this.setToNextBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.nextBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock,e,t),!0):!1,this.setToBlock=(e,t=this.Editor.Caret.positions.DEFAULT,o=0)=>this.Editor.BlockManager.blocks[e]?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.blocks[e],t,o),!0):!1,this.focus=(e=!1)=>e?this.setToLastBlock(this.Editor.Caret.positions.END):this.setToFirstBlock(this.Editor.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}}class Zt extends T{get methods(){return{emit:(e,t)=>this.emit(e,t),off:(e,t)=>this.off(e,t),on:(e,t)=>this.on(e,t)}}on(e,t){this.eventsDispatcher.on(e,t)}emit(e,t){this.eventsDispatcher.emit(e,t)}off(e,t){this.eventsDispatcher.off(e,t)}}class Me extends T{static getNamespace(e){return e.isTune()?`blockTunes.${e.name}`:`tools.${e.name}`}get methods(){return{t:()=>{Y("I18n.t() method can be accessed only from Tools","warn")}}}getMethodsForTool(e){return Object.assign(this.methods,{t:t=>$.t(Me.getNamespace(e),t)})}}class Kt extends T{get methods(){return{blocks:this.Editor.BlocksAPI.methods,caret:this.Editor.CaretAPI.methods,events:this.Editor.EventsAPI.methods,listeners:this.Editor.ListenersAPI.methods,notifier:this.Editor.NotifierAPI.methods,sanitizer:this.Editor.SanitizerAPI.methods,saver:this.Editor.SaverAPI.methods,selection:this.Editor.SelectionAPI.methods,styles:this.Editor.StylesAPI.classes,toolbar:this.Editor.ToolbarAPI.methods,inlineToolbar:this.Editor.InlineToolbarAPI.methods,tooltip:this.Editor.TooltipAPI.methods,i18n:this.Editor.I18nAPI.methods,readOnly:this.Editor.ReadOnlyAPI.methods,ui:this.Editor.UiAPI.methods}}getMethodsForTool(e){return Object.assign(this.methods,{i18n:this.Editor.I18nAPI.getMethodsForTool(e)})}}class Xt extends T{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Editor.InlineToolbar.tryToShow()}close(){this.Editor.InlineToolbar.close()}}class qt extends T{get methods(){return{on:(e,t,o,n)=>this.on(e,t,o,n),off:(e,t,o,n)=>this.off(e,t,o,n),offById:e=>this.offById(e)}}on(e,t,o,n){return this.listeners.on(e,t,o,n)}off(e,t,o,n){this.listeners.off(e,t,o,n)}offById(e){this.listeners.offById(e)}}var Le={},Gt={get exports(){return Le},set exports(s){Le=s}};(function(s,e){(function(t,o){s.exports=o()})(window,function(){return function(t){var o={};function n(i){if(o[i])return o[i].exports;var r=o[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=o,n.d=function(i,r,a){n.o(i,r)||Object.defineProperty(i,r,{enumerable:!0,get:a})},n.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},n.t=function(i,r){if(1&r&&(i=n(i)),8&r||4&r&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&r&&typeof i!="string")for(var l in i)n.d(a,l,function(c){return i[c]}.bind(null,l));return a},n.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(r,"a",r),r},n.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},n.p="/",n(n.s=0)}([function(t,o,n){n(1),t.exports=function(){var i=n(6),r="cdx-notify--bounce-in",a=null;return{show:function(l){if(l.message){(function(){if(a)return!0;a=i.getWrapper(),document.body.appendChild(a)})();var c=null,u=l.time||8e3;switch(l.type){case"confirm":c=i.confirm(l);break;case"prompt":c=i.prompt(l);break;default:c=i.alert(l),window.setTimeout(function(){c.remove()},u)}a.appendChild(c),c.classList.add(r)}}}}()},function(t,o,n){var i=n(2);typeof i=="string"&&(i=[[t.i,i,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(4)(i,r),i.locals&&(t.exports=i.locals)},function(t,o,n){(t.exports=n(3)(!1)).push([t.i,`.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:'';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:'';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}`,""])},function(t,o){t.exports=function(n){var i=[];return i.toString=function(){return this.map(function(r){var a=function(l,c){var u=l[1]||"",h=l[3];if(!h)return u;if(c&&typeof btoa=="function"){var f=(p=h,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(p))))+" */"),m=h.sources.map(function(v){return"/*# sourceURL="+h.sourceRoot+v+" */"});return[u].concat(m).concat([f]).join(` +`)}var p;return[u].join(` +`)}(r,n);return r[2]?"@media "+r[2]+"{"+a+"}":a}).join("")},i.i=function(r,a){typeof r=="string"&&(r=[[null,r,""]]);for(var l={},c=0;c=0&&f.splice(g,1)}function A(b){var g=document.createElement("style");return b.attrs.type===void 0&&(b.attrs.type="text/css"),C(g,b.attrs),O(b,g),g}function C(b,g){Object.keys(g).forEach(function(y){b.setAttribute(y,g[y])})}function x(b,g){var y,E,_,S;if(g.transform&&b.css){if(!(S=g.transform(b.css)))return function(){};b.css=S}if(g.singleton){var j=h++;y=u||(u=A(g)),E=R.bind(null,y,j,!1),_=R.bind(null,y,j,!0)}else b.sourceMap&&typeof URL=="function"&&typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function"&&typeof Blob=="function"&&typeof btoa=="function"?(y=function(M){var V=document.createElement("link");return M.attrs.type===void 0&&(M.attrs.type="text/css"),M.attrs.rel="stylesheet",C(V,M.attrs),O(M,V),V}(g),E=function(M,V,me){var ne=me.css,Ye=me.sourceMap,fn=V.convertToAbsoluteUrls===void 0&&Ye;(V.convertToAbsoluteUrls||fn)&&(ne=m(ne)),Ye&&(ne+=` +/*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(Ye))))+" */");var gn=new Blob([ne],{type:"text/css"}),St=M.href;M.href=URL.createObjectURL(gn),St&&URL.revokeObjectURL(St)}.bind(null,y,g),_=function(){N(y),y.href&&URL.revokeObjectURL(y.href)}):(y=A(g),E=function(M,V){var me=V.css,ne=V.media;if(ne&&M.setAttribute("media",ne),M.styleSheet)M.styleSheet.cssText=me;else{for(;M.firstChild;)M.removeChild(M.firstChild);M.appendChild(document.createTextNode(me))}}.bind(null,y),_=function(){N(y)});return E(b),function(M){if(M){if(M.css===b.css&&M.media===b.media&&M.sourceMap===b.sourceMap)return;E(b=M)}else _()}}t.exports=function(b,g){if(typeof DEBUG<"u"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(g=g||{}).attrs=typeof g.attrs=="object"?g.attrs:{},g.singleton||typeof g.singleton=="boolean"||(g.singleton=l()),g.insertInto||(g.insertInto="head"),g.insertAt||(g.insertAt="bottom");var y=v(b,g);return p(y,g),function(E){for(var _=[],S=0;Sthis.show(e)}}show(e){return this.notifier.show(e)}}class to extends T{get methods(){const e=()=>this.isEnabled;return{toggle:t=>this.toggle(t),get isEnabled(){return e()}}}toggle(e){return this.Editor.ReadOnly.toggle(e)}get isEnabled(){return this.Editor.ReadOnly.isEnabled}}var _e={},oo={get exports(){return _e},set exports(s){_e=s}};(function(s,e){(function(t,o){s.exports=o()})(he,function(){function t(h){var f=h.tags,m=Object.keys(f),p=m.map(function(v){return typeof f[v]}).every(function(v){return v==="object"||v==="boolean"||v==="function"});if(!p)throw new Error("The configuration was invalid");this.config=h}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function n(h){return o.indexOf(h.nodeName)!==-1}var i=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function r(h){return i.indexOf(h.nodeName)!==-1}t.prototype.clean=function(h){const f=document.implementation.createHTMLDocument(),m=f.createElement("div");return m.innerHTML=h,this._sanitize(f,m),m.innerHTML},t.prototype._sanitize=function(h,f){var m=a(h,f),p=m.firstChild();if(p)do{if(p.nodeType===Node.TEXT_NODE)if(p.data.trim()===""&&(p.previousElementSibling&&n(p.previousElementSibling)||p.nextElementSibling&&n(p.nextElementSibling))){f.removeChild(p),this._sanitize(h,f);break}else continue;if(p.nodeType===Node.COMMENT_NODE){f.removeChild(p),this._sanitize(h,f);break}var v=r(p),O;v&&(O=Array.prototype.some.call(p.childNodes,n));var N=!!f.parentNode,A=n(f)&&n(p)&&N,C=p.nodeName.toLowerCase(),x=l(this.config,C,p),w=v&&O;if(w||c(p,x)||!this.config.keepNestedBlockElements&&A){if(!(p.nodeName==="SCRIPT"||p.nodeName==="STYLE"))for(;p.childNodes.length>0;)f.insertBefore(p.childNodes[0],p);f.removeChild(p),this._sanitize(h,f);break}for(var I=0;I"u"?!0:typeof f=="boolean"?!f:!1}function u(h,f,m){var p=h.name.toLowerCase();return f===!0?!1:typeof f[p]=="function"?!f[p](h.value,m):typeof f[p]>"u"||f[p]===!1?!0:typeof f[p]=="string"?f[p]!==h.value:!1}return t})})(oo);const no=_e;function at(s,e){return s.map(t=>{const o=D(e)?e(t.tool):e;return Z(o)||(t.data=Oe(t.data,o)),t})}function q(s,e={}){const t={tags:e};return new no(t).clean(s)}function Oe(s,e){return Array.isArray(s)?io(s,e):F(s)?so(s,e):Q(s)?ro(s,e):s}function io(s,e){return s.map(t=>Oe(t,e))}function so(s,e){const t={};for(const o in s){if(!Object.prototype.hasOwnProperty.call(s,o))continue;const n=s[o],i=ao(e[o])?e[o]:e;t[o]=Oe(n,i)}return t}function ro(s,e){return F(e)?q(s,e):e===!1?q(s,{}):s}function ao(s){return F(s)||_t(s)||D(s)}class lo extends T{get methods(){return{clean:(e,t)=>this.clean(e,t)}}clean(e,t){return q(e,t)}}class co extends T{get methods(){return{save:()=>this.save()}}save(){const e="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(Y(e,"warn"),Promise.reject(new Error(e))):this.Editor.Saver.save()}}class ho extends T{get methods(){return{findParentTag:(e,t)=>this.findParentTag(e,t),expandToTag:e=>this.expandToTag(e)}}findParentTag(e,t){return new k().findParentTag(e,t)}expandToTag(e){new k().expandToTag(e)}}class uo extends T{get classes(){return{block:"cdx-block",inlineToolButton:"ce-inline-tool",inlineToolButtonActive:"ce-inline-tool--active",input:"cdx-input",loader:"cdx-loader",button:"cdx-button",settingsButton:"cdx-settings-button",settingsButtonActive:"cdx-settings-button--active"}}}class po extends T{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Editor.Toolbar.moveAndOpen()}close(){this.Editor.Toolbar.close()}toggleBlockSettings(e){if(this.Editor.BlockManager.currentBlockIndex===-1){Y("Could't toggle the Toolbar because there is no block selected ","warn");return}e??!this.Editor.BlockSettings.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close()}toggleToolbox(e){if(this.Editor.BlockManager.currentBlockIndex===-1){Y("Could't toggle the Toolbox because there is no block selected ","warn");return}e??!this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()):this.Editor.Toolbar.toolbox.close()}}var Ae={},fo={get exports(){return Ae},set exports(s){Ae=s}};/*! + * CodeX.Tooltips + * + * @version 1.0.5 + * + * @licence MIT + * @author CodeX + * + * + */(function(s,e){(function(t,o){s.exports=o()})(window,function(){return function(t){var o={};function n(i){if(o[i])return o[i].exports;var r=o[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=o,n.d=function(i,r,a){n.o(i,r)||Object.defineProperty(i,r,{enumerable:!0,get:a})},n.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},n.t=function(i,r){if(1&r&&(i=n(i)),8&r||4&r&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&r&&typeof i!="string")for(var l in i)n.d(a,l,function(c){return i[c]}.bind(null,l));return a},n.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(r,"a",r),r},n.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},n.p="",n(n.s=0)}([function(t,o,n){t.exports=n(1)},function(t,o,n){n.r(o),n.d(o,"default",function(){return i});class i{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=10,this.offsetLeft=10,this.offsetRight=10,this.hidingDelay=0,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.loadStyles(),this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:"ct",tooltipContent:"ct__content",tooltipShown:"ct--shown",placement:{left:"ct--left",bottom:"ct--bottom",right:"ct--right",top:"ct--top"}}}show(a,l,c){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);const u=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},c);if(u.hidingDelay&&(this.hidingDelay=u.hidingDelay),this.nodes.content.innerHTML="",typeof l=="string")this.nodes.content.appendChild(document.createTextNode(l));else{if(!(l instanceof Node))throw Error("[CodeX Tooltip] Wrong type of «content» passed. It should be an instance of Node or String. But "+typeof l+" given.");this.nodes.content.appendChild(l)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),u.placement){case"top":this.placeTop(a,u);break;case"left":this.placeLeft(a,u);break;case"right":this.placeRight(a,u);break;case"bottom":default:this.placeBottom(a,u)}u&&u.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},u.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(a=!1){if(this.hidingDelay&&!a)return this.hidingTimeout&&clearTimeout(this.hidingTimeout),void(this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay));this.nodes.wrapper.classList.remove(this.CSS.tooltipShown),this.showed=!1,this.showingTimeout&&clearTimeout(this.showingTimeout)}onHover(a,l,c){a.addEventListener("mouseenter",()=>{this.show(a,l,c)}),a.addEventListener("mouseleave",()=>{this.hide()})}destroy(){this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll)}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper)}loadStyles(){const a="codex-tooltips-style";if(document.getElementById(a))return;const l=n(2),c=this.make("style",null,{textContent:l.toString(),id:a});this.prepend(document.head,c)}placeBottom(a,l){const c=a.getBoundingClientRect(),u=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,h=c.bottom+window.pageYOffset+this.offsetTop+l.marginTop;this.applyPlacement("bottom",u,h)}placeTop(a,l){const c=a.getBoundingClientRect(),u=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,h=c.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",u,h)}placeLeft(a,l){const c=a.getBoundingClientRect(),u=c.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-l.marginLeft,h=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",u,h)}placeRight(a,l){const c=a.getBoundingClientRect(),u=c.right+this.offsetRight+l.marginRight,h=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",u,h)}applyPlacement(a,l,c){this.nodes.wrapper.classList.add(this.CSS.placement[a]),this.nodes.wrapper.style.left=l+"px",this.nodes.wrapper.style.top=c+"px"}make(a,l=null,c={}){const u=document.createElement(a);Array.isArray(l)?u.classList.add(...l):l&&u.classList.add(l);for(const h in c)c.hasOwnProperty(h)&&(u[h]=c[h]);return u}append(a,l){Array.isArray(l)?l.forEach(c=>a.appendChild(c)):a.appendChild(l)}prepend(a,l){Array.isArray(l)?(l=l.reverse()).forEach(c=>a.prepend(c)):a.prepend(l)}}},function(t,o){t.exports=`.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url('data:image/svg+xml;charset=utf-8,') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}`}]).default})})(fo);const go=J(Ae);class Ne{constructor(){this.lib=new go}destroy(){this.lib.destroy()}show(e,t,o){this.lib.show(e,t,o)}hide(e=!1){this.lib.hide(e)}onHover(e,t,o){this.lib.onHover(e,t,o)}}class bo extends T{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.tooltip=new Ne}destroy(){this.tooltip.destroy()}get methods(){return{show:(e,t,o)=>this.show(e,t,o),hide:()=>this.hide(),onHover:(e,t,o)=>this.onHover(e,t,o)}}show(e,t,o){this.tooltip.show(e,t,o)}hide(){this.tooltip.hide()}onHover(e,t,o){this.tooltip.onHover(e,t,o)}}class mo extends T{get methods(){return{nodes:this.editorNodes}}get editorNodes(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}}function lt(s,e){const t={};return Object.entries(s).forEach(([o,n])=>{if(F(n)){const i=e?`${e}.${o}`:o;Object.values(n).every(a=>Q(a))?t[o]=i:t[o]=lt(n,i);return}t[o]=n}),t}const K=lt(et);function ko(s,e){const t={};return Object.keys(s).forEach(o=>{const n=e[o];n!==void 0?t[n]=s[o]:t[o]=s[o]}),t}const vo='',xo='';class P{constructor(e){this.nodes={root:null,icon:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{this.nodes.root.classList.remove(P.CSS.noFocus)},this.removeSpecialHoverBehavior=()=>{this.nodes.root.classList.remove(P.CSS.noHover)},this.onErrorAnimationEnd=()=>{this.nodes.icon.classList.remove(P.CSS.wobbleAnimation),this.nodes.icon.removeEventListener("animationend",this.onErrorAnimationEnd)},this.params=e,this.nodes.root=this.make(e)}get isDisabled(){return this.params.isDisabled}get toggle(){return this.params.toggle}get title(){return this.params.title}get closeOnActivate(){return this.params.closeOnActivate}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root.classList.contains(P.CSS.focused)}static get CSS(){return{container:"ce-popover-item",title:"ce-popover-item__title",secondaryTitle:"ce-popover-item__secondary-title",icon:"ce-popover-item__icon",active:"ce-popover-item--active",disabled:"ce-popover-item--disabled",focused:"ce-popover-item--focused",hidden:"ce-popover-item--hidden",confirmationState:"ce-popover-item--confirmation",noHover:"ce-popover-item--no-hover",noFocus:"ce-popover-item--no-focus",wobbleAnimation:"wobble"}}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){this.nodes.root.classList.toggle(P.CSS.active,e)}toggleHidden(e){this.nodes.root.classList.toggle(P.CSS.hidden,e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}make(e){const t=d.make("div",P.CSS.container);return e.name&&(t.dataset.itemName=e.name),this.nodes.icon=d.make("div",P.CSS.icon,{innerHTML:e.icon||vo}),t.appendChild(this.nodes.icon),t.appendChild(d.make("div",P.CSS.title,{innerHTML:e.title||""})),e.secondaryLabel&&t.appendChild(d.make("div",P.CSS.secondaryTitle,{textContent:e.secondaryLabel})),e.isActive&&t.classList.add(P.CSS.active),e.isDisabled&&t.classList.add(P.CSS.disabled),t}enableConfirmationMode(e){const t={...this.params,...e,confirmation:e.confirmation},o=this.make(t);this.nodes.root.innerHTML=o.innerHTML,this.nodes.root.classList.add(P.CSS.confirmationState),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}disableConfirmationMode(){const e=this.make(this.params);this.nodes.root.innerHTML=e.innerHTML,this.nodes.root.classList.remove(P.CSS.confirmationState),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior()}enableSpecialHoverAndFocusBehavior(){this.nodes.root.classList.add(P.CSS.noHover),this.nodes.root.classList.add(P.CSS.noFocus),this.nodes.root.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),this.nodes.root.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){if(e.confirmation===void 0)try{e.onActivate(e),this.disableConfirmationMode()}catch{this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){this.nodes.icon.classList.contains(P.CSS.wobbleAnimation)||(this.nodes.icon.classList.add(P.CSS.wobbleAnimation),this.nodes.icon.addEventListener("animationend",this.onErrorAnimationEnd))}}const pe=class{constructor(s,e){this.cursor=-1,this.items=[],this.items=s||[],this.focusedCssClass=e}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(s){s=-1&&(this.dropCursor(),this.cursor=s,this.items[this.cursor].classList.add(this.focusedCssClass))}setItems(s){this.items=s}next(){this.cursor=this.leafNodesAndReturnIndex(pe.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(pe.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}leafNodesAndReturnIndex(s){if(this.items.length===0)return this.cursor;let e=this.cursor;return e===-1?e=s===pe.directions.RIGHT?-1:0:this.items[e].classList.remove(this.focusedCssClass),s===pe.directions.RIGHT?e=(e+1)%this.items.length:e=(this.items.length+e-1)%this.items.length,d.canSetCaret(this.items[e])&&ie(()=>k.setCursor(this.items[e]),50)(),this.items[e].classList.add(this.focusedCssClass),e}};let le=pe;le.directions={RIGHT:"right",LEFT:"left"};class G{constructor(e){this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=t=>{if(this.isEventReadyForHandling(t))switch(G.usedKeys.includes(t.keyCode)&&t.preventDefault(),t.keyCode){case B.TAB:this.handleTabPress(t);break;case B.LEFT:case B.UP:this.flipLeft();break;case B.RIGHT:case B.DOWN:this.flipRight();break;case B.ENTER:this.handleEnterPress(t);break}},this.iterator=new le(e.items,e.focusedItemClass),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||G.usedKeys}get isActivated(){return this.activated}static get usedKeys(){return[B.TAB,B.LEFT,B.RIGHT,B.ENTER,B.UP,B.DOWN]}activate(e,t){this.activated=!0,e&&this.iterator.setItems(e),t!==void 0&&this.iterator.setCursor(t),document.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),document.removeEventListener("keydown",this.onKeyDown)}focusFirst(){this.dropCursor(),this.flipRight()}flipLeft(){this.iterator.previous(),this.flipCallback()}flipRight(){this.iterator.next(),this.flipCallback()}hasFocus(){return!!this.iterator.currentItem}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(t=>t!==e)}dropCursor(){this.iterator.dropCursor()}isEventReadyForHandling(e){return this.activated&&this.allowedKeys.includes(e.keyCode)}handleTabPress(e){switch(e.shiftKey?le.directions.LEFT:le.directions.RIGHT){case le.directions.RIGHT:this.flipRight();break;case le.directions.LEFT:this.flipLeft();break}}handleEnterPress(e){this.activated&&(this.iterator.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),D(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach(e=>e())}}const fe=class{lock(){Qe?this.lockHard():document.body.classList.add(fe.CSS.scrollLocked)}unlock(){Qe?this.unlockHard():document.body.classList.remove(fe.CSS.scrollLocked)}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(fe.CSS.scrollLockedHard)}unlockHard(){document.body.classList.remove(fe.CSS.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};let ct=fe;ct.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"};var wo=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,yo=(s,e,t,o)=>{for(var n=o>1?void 0:o?Co(e,t):e,i=s.length-1,r;i>=0;i--)(r=s[i])&&(n=(o?r(e,t,n):r(n))||n);return o&&n&&wo(e,t,n),n},ge=(s=>(s.Close="close",s))(ge||{});const z=class extends ke{constructor(s){super(),this.scopeElement=document.body,this.listeners=new ot,this.scrollLocker=new ct,this.nodes={wrapper:null,popover:null,nothingFoundMessage:null,customContent:null,items:null,overlay:null},this.messages={nothingFound:"Nothing found",search:"Search"},this.onFlip=()=>{this.items.find(t=>t.isFocused).onFocus()},this.items=s.items.map(e=>new P(e)),s.scopeElement!==void 0&&(this.scopeElement=s.scopeElement),s.messages&&(this.messages={...this.messages,...s.messages}),s.customContentFlippableItems&&(this.customContentFlippableItems=s.customContentFlippableItems),this.make(),s.customContent&&this.addCustomContent(s.customContent),this.initializeFlipper()}static get CSS(){return{popover:"ce-popover",popoverOpenTop:"ce-popover--open-top",popoverOpened:"ce-popover--opened",search:"ce-popover__search",nothingFoundMessage:"ce-popover__nothing-found-message",nothingFoundMessageDisplayed:"ce-popover__nothing-found-message--displayed",customContent:"ce-popover__custom-content",customContentHidden:"ce-popover__custom-content--hidden",items:"ce-popover__items",overlay:"ce-popover__overlay",overlayHidden:"ce-popover__overlay--hidden"}}getElement(){return this.nodes.wrapper}hasFocus(){return this.flipper.hasFocus()}show(){this.shouldOpenBottom||(this.nodes.popover.style.setProperty("--popover-height",this.height+"px"),this.nodes.popover.classList.add(z.CSS.popoverOpenTop)),this.nodes.overlay.classList.remove(z.CSS.overlayHidden),this.nodes.popover.classList.add(z.CSS.popoverOpened),this.flipper.activate(this.flippableElements),this.search!==void 0&&setTimeout(()=>{this.search.focus()},100),te()&&this.scrollLocker.lock()}hide(){this.nodes.popover.classList.remove(z.CSS.popoverOpened),this.nodes.popover.classList.remove(z.CSS.popoverOpenTop),this.nodes.overlay.classList.add(z.CSS.overlayHidden),this.flipper.deactivate(),this.items.forEach(s=>s.reset()),this.search!==void 0&&this.search.clear(),te()&&this.scrollLocker.unlock(),this.emit("close")}destroy(){this.flipper.deactivate(),this.listeners.removeAll(),te()&&this.scrollLocker.unlock()}make(){this.nodes.popover=d.make("div",[z.CSS.popover]),this.nodes.nothingFoundMessage=d.make("div",[z.CSS.nothingFoundMessage],{textContent:this.messages.nothingFound}),this.nodes.popover.appendChild(this.nodes.nothingFoundMessage),this.nodes.items=d.make("div",[z.CSS.items]),this.items.forEach(s=>{this.nodes.items.appendChild(s.getElement())}),this.nodes.popover.appendChild(this.nodes.items),this.listeners.on(this.nodes.popover,"click",s=>{const e=this.getTargetItem(s);e!==void 0&&this.handleItemClick(e)}),this.nodes.wrapper=d.make("div"),this.nodes.overlay=d.make("div",[z.CSS.overlay,z.CSS.overlayHidden]),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.nodes.wrapper.appendChild(this.nodes.overlay),this.nodes.wrapper.appendChild(this.nodes.popover)}addCustomContent(s){this.nodes.customContent=s,this.nodes.customContent.classList.add(z.CSS.customContent),this.nodes.popover.insertBefore(s,this.nodes.popover.firstChild)}getTargetItem(s){return this.items.find(e=>s.composedPath().includes(e.getElement()))}handleItemClick(s){s.isDisabled||(this.items.filter(e=>e!==s).forEach(e=>e.reset()),s.handleClick(),this.toggleItemActivenessIfNeeded(s),s.closeOnActivate&&this.hide())}initializeFlipper(){this.flipper=new G({items:this.flippableElements,focusedItemClass:P.CSS.focused,allowedKeys:[B.TAB,B.UP,B.DOWN,B.ENTER]}),this.flipper.onFlip(this.onFlip)}get flippableElements(){const s=this.items.map(t=>t.getElement());return(this.customContentFlippableItems||[]).concat(s)}get height(){let s=0;if(this.nodes.popover===null)return s;const e=this.nodes.popover.cloneNode(!0);return e.style.visibility="hidden",e.style.position="absolute",e.style.top="-1000px",e.classList.add(z.CSS.popoverOpened),document.body.appendChild(e),s=e.offsetHeight,e.remove(),s}get shouldOpenBottom(){const s=this.nodes.popover.getBoundingClientRect(),e=this.scopeElement.getBoundingClientRect(),t=this.height,o=s.top+t,n=s.top-t,i=Math.min(window.innerHeight,e.bottom);return nt.toggle===s.toggle);if(e.length===1){s.toggleActive();return}e.forEach(t=>{t.toggleActive(t===s)})}}};let Re=z;yo([re],Re.prototype,"height",1);class Bo extends T{constructor(){super(...arguments),this.opened=!1,this.selection=new k,this.onPopoverClose=()=>{this.close()}}get events(){return{opened:"block-settings-opened",closed:"block-settings-closed"}}get CSS(){return{settings:"ce-settings"}}get flipper(){var e;return(e=this.popover)==null?void 0:e.flipper}make(){this.nodes.wrapper=d.make("div",[this.CSS.settings])}destroy(){this.removeAllNodes()}open(e=this.Editor.BlockManager.currentBlock){this.opened=!0,this.selection.save(),e.selected=!0,this.Editor.BlockSelection.clearCache();const[t,o]=e.getTunes();this.eventsDispatcher.emit(this.events.opened),this.popover=new Re({searchable:!0,items:t.map(n=>this.resolveTuneAliases(n)),customContent:o,customContentFlippableItems:this.getControls(o),scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:$.ui(K.ui.popover,"Nothing found"),search:$.ui(K.ui.popover,"Filter")}}),this.popover.on(ge.Close,this.onPopoverClose),this.nodes.wrapper.append(this.popover.getElement()),this.popover.show()}getElement(){return this.nodes.wrapper}close(){this.opened=!1,k.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&(this.Editor.BlockManager.currentBlock.selected=!1),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(ge.Close,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null)}getControls(e){const{StylesAPI:t}=this.Editor,o=e.querySelectorAll(`.${t.classes.settingsButton}, ${d.allInputsSelector}`);return Array.from(o)}resolveTuneAliases(e){const t=ko(e,{label:"title"});return e.confirmation&&(t.confirmation=this.resolveTuneAliases(e.confirmation)),t}}class W extends T{constructor(){super(...arguments),this.opened=!1,this.tools=[],this.flipper=null,this.togglingCallback=null}static get CSS(){return{conversionToolbarWrapper:"ce-conversion-toolbar",conversionToolbarShowed:"ce-conversion-toolbar--showed",conversionToolbarTools:"ce-conversion-toolbar__tools",conversionToolbarLabel:"ce-conversion-toolbar__label",conversionTool:"ce-conversion-tool",conversionToolCurrent:"ce-conversion-tool--current",conversionToolIcon:"ce-conversion-tool__icon",conversionToolCheckIcon:"ce-conversion-tool__check-icon",conversionToolSecondaryLabel:"ce-conversion-tool__secondary-label",conversionToolFocused:"ce-conversion-tool--focused",conversionToolActive:"ce-conversion-tool--active"}}make(){this.nodes.wrapper=d.make("div",[W.CSS.conversionToolbarWrapper,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),this.nodes.tools=d.make("div",W.CSS.conversionToolbarTools);const e=d.make("div",W.CSS.conversionToolbarLabel,{textContent:$.ui(K.ui.inlineToolbar.converter,"Convert to")});return this.addTools(),this.enableFlipper(),d.append(this.nodes.wrapper,e),d.append(this.nodes.wrapper,this.nodes.tools),this.nodes.wrapper}destroy(){this.flipper&&(this.flipper.deactivate(),this.flipper=null),this.removeAllNodes()}toggle(e){this.opened?this.close():this.open(),D(e)&&(this.togglingCallback=e)}open(){this.filterTools(),this.opened=!0,this.nodes.wrapper.classList.add(W.CSS.conversionToolbarShowed),window.requestAnimationFrame(()=>{this.flipper.activate(this.tools.map(e=>e.button).filter(e=>!e.classList.contains(W.CSS.conversionToolHidden))),this.flipper.focusFirst(),D(this.togglingCallback)&&this.togglingCallback(!0)})}close(){this.opened=!1,this.flipper.deactivate(),this.nodes.wrapper.classList.remove(W.CSS.conversionToolbarShowed),D(this.togglingCallback)&&this.togglingCallback(!1)}hasTools(){return this.tools.length===1?this.tools[0].name!==this.config.defaultBlock:!0}async replaceWithBlock(e,t){const{BlockManager:o,BlockSelection:n,InlineToolbar:i,Caret:r}=this.Editor;o.convert(this.Editor.BlockManager.currentBlock,e,t),n.clearSelection(),this.close(),i.close(),window.requestAnimationFrame(()=>{r.setToBlock(this.Editor.BlockManager.currentBlock,r.positions.END)})}addTools(){const e=this.Editor.Tools.blockTools;Array.from(e.entries()).forEach(([t,o])=>{var i;const n=o.conversionConfig;!n||!n.import||(i=o.toolbox)==null||i.forEach(r=>this.addToolIfValid(t,r))})}addToolIfValid(e,t){Z(t)||!t.icon||this.addTool(e,t)}addTool(e,t){var a;const o=d.make("div",[W.CSS.conversionTool]),n=d.make("div",[W.CSS.conversionToolIcon]),i=d.make("div",[W.CSS.conversionToolCheckIcon]);switch(o.dataset.tool=e,e){case"paragraph":n.innerHTML=` + + `;break;case"header1":n.innerHTML='';break;case"header2":n.innerHTML='';break;case"header3":n.innerHTML='';break;case"unorderedList":n.innerHTML='';break;case"orderedList":n.innerHTML='';break;case"blockChecklist":n.innerHTML='';break;default:n.innerHTML=t.icon}i.innerHTML='',d.append(o,n),d.append(o,d.text($.t(K.toolNames,t.title||se(e)))),d.append(o,i);const r=(a=this.Editor.Tools.blockTools.get(e))==null?void 0:a.shortcut;if(r){const l=d.make("span",W.CSS.conversionToolSecondaryLabel,{innerText:Te(r)});d.append(o,l)}d.append(this.nodes.tools,o),this.tools.push({name:e,button:o,toolboxItem:t}),this.listeners.on(o,"click",async()=>{await this.replaceWithBlock(e,t.data)})}async filterTools(){const{currentBlock:e}=this.Editor.BlockManager,t=await e.getActiveToolboxEntry();function o(n,i){return n.icon===i.icon&&n.title===i.title}this.tools.forEach(n=>{let i=!1;if(t){const r=o(t,n.toolboxItem);i=n.button.dataset.tool===e.name&&r}n.button.classList.toggle(W.CSS.conversionToolCurrent,i)})}enableFlipper(){this.flipper=new G({focusedItemClass:W.CSS.conversionToolFocused})}}var De={},Eo={get exports(){return De},set exports(s){De=s}};/*! + * Library for handling keyboard shortcuts + * @copyright CodeX (https://codex.so) + * @license MIT + * @author CodeX (https://codex.so) + * @version 1.2.0 + */(function(s,e){(function(t,o){s.exports=o()})(window,function(){return function(t){var o={};function n(i){if(o[i])return o[i].exports;var r=o[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=o,n.d=function(i,r,a){n.o(i,r)||Object.defineProperty(i,r,{enumerable:!0,get:a})},n.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},n.t=function(i,r){if(1&r&&(i=n(i)),8&r||4&r&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&r&&typeof i!="string")for(var l in i)n.d(a,l,function(c){return i[c]}.bind(null,l));return a},n.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(r,"a",r),r},n.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},n.p="",n(n.s=0)}([function(t,o,n){function i(l,c){for(var u=0;ui!==o))}findShortcut(e,t){return(this.registeredShortcuts.get(e)||[]).find(({name:n})=>n===t)}}const ce=new So;var Io=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,dt=(s,e,t,o)=>{for(var n=o>1?void 0:o?Mo(e,t):e,i=s.length-1,r;i>=0;i--)(r=s[i])&&(n=(o?r(e,t,n):r(n))||n);return o&&n&&Io(e,t,n),n},ve=(s=>(s.Opened="toolbox-opened",s.Closed="toolbox-closed",s.BlockAdded="toolbox-block-added",s))(ve||{});const ht=class extends ke{constructor({api:s,tools:e,i18nLabels:t}){super(),this.opened=!1,this.nodes={toolbox:null},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=s,this.tools=e,this.i18nLabels=t}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:"ce-toolbox"}}make(){return this.popover=new Re({scopeElement:this.api.ui.nodes.redactor,searchable:!0,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(ge.Close,this.onPopoverClose),this.enableShortcuts(),this.nodes.toolbox=this.popover.getElement(),this.nodes.toolbox.classList.add(ht.CSS.toolbox),this.nodes.toolbox}hasFocus(){var s;return(s=this.popover)==null?void 0:s.hasFocus()}destroy(){var s;super.destroy(),this.nodes&&this.nodes.toolbox&&(this.nodes.toolbox.remove(),this.nodes.toolbox=null),this.removeAllShortcuts(),(s=this.popover)==null||s.off(ge.Close,this.onPopoverClose)}toolButtonActivated(s,e){this.insertNewBlock(s,e)}open(){var s;this.isEmpty||((s=this.popover)==null||s.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var s;(s=this.popover)==null||s.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}get toolsToBeDisplayed(){const s=[];return this.tools.forEach(e=>{e.toolbox&&s.push(e)}),s}get toolboxItemsToBeDisplayed(){const s=(e,t)=>({icon:e.icon,title:$.t(K.toolNames,e.title||se(t.name)),name:t.name,onActivate:()=>{this.toolButtonActivated(t.name,e.data)},secondaryLabel:t.shortcut?Te(t.shortcut):""});return this.toolsToBeDisplayed.reduce((e,t)=>(Array.isArray(t.toolbox)?t.toolbox.forEach(o=>{e.push(s(o,t))}):t.toolbox!==void 0&&e.push(s(t.toolbox,t)),e),[])}enableShortcuts(){this.toolsToBeDisplayed.forEach(s=>{const e=s.shortcut;e&&this.enableShortcutForTool(s.name,e)})}enableShortcutForTool(s,e){ce.add({name:e,on:this.api.ui.nodes.redactor,handler:t=>{t.preventDefault();const o=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(o);if(n)try{this.api.blocks.convert(n.id,s),window.requestAnimationFrame(()=>{this.api.caret.setToBlock(o,"end")});return}catch{}this.insertNewBlock(s)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(s=>{const e=s.shortcut;e&&ce.remove(this.api.ui.nodes.redactor,e)})}async insertNewBlock(s,e){const t=this.api.blocks.getCurrentBlockIndex(),o=this.api.blocks.getBlockByIndex(t);if(!o)return;const n=o.isEmpty?t:t+1;let i;if(e){const a=await this.api.blocks.composeBlockData(s);i=Object.assign(a,e)}const r=this.api.blocks.insert(s,i,void 0,n,void 0,o.isEmpty);r.call(X.APPEND_CALLBACK),this.api.caret.setToBlock(n),this.emit("toolbox-block-added",{block:r}),this.api.toolbar.close()}};let Pe=ht;dt([re],Pe.prototype,"toolsToBeDisplayed",1),dt([re],Pe.prototype,"toolboxItemsToBeDisplayed",1);const ut="block hovered",Lo='',_o='';class Oo extends T{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.toolboxInstance=null,this.tooltip=new Ne}get CSS(){return{toolbar:"ce-toolbar",content:"ce-toolbar__content",actions:"ce-toolbar__actions",actionsOpened:"ce-toolbar__actions--opened",toolbarOpened:"ce-toolbar--opened",openedToolboxHolderModifier:"codex-editor--toolbox-opened",plusButton:"ce-toolbar__plus",plusButtonShortcut:"ce-toolbar__plus-shortcut",settingsToggler:"ce-toolbar__settings-btn",settingsTogglerHidden:"ce-toolbar__settings-btn--hidden"}}get opened(){return this.nodes.wrapper.classList.contains(this.CSS.toolbarOpened)}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var t;(t=this.toolboxInstance)==null||t.close()},open:()=>{if(this.toolboxInstance===null){L("toolbox.open() called before initialization is finished","warn");return}this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){L("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var t;return(t=this.toolboxInstance)==null?void 0:t.hasFocus()}}}get blockActions(){return{hide:()=>{this.nodes.actions.classList.remove(this.CSS.actionsOpened)},show:()=>{this.nodes.actions.classList.add(this.CSS.actionsOpened)}}}get blockTunesToggler(){return{hide:()=>this.nodes.settingsToggler.classList.add(this.CSS.settingsTogglerHidden),show:()=>this.nodes.settingsToggler.classList.remove(this.CSS.settingsTogglerHidden)}}toggleReadOnly(e){e?(this.destroy(),this.Editor.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(()=>{this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e=this.Editor.BlockManager.currentBlock){if(this.toolboxInstance===null){L("Can't open Toolbar since Editor initialization is not finished yet","warn");return}if(this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Editor.BlockSettings.opened&&this.Editor.BlockSettings.close(),!e)return;this.hoveredBlock=e;const t=e.holder,{isMobile:o}=this.Editor.UI,n=e.pluginsContent,i=window.getComputedStyle(n),r=parseInt(i.paddingTop,10),a=t.offsetHeight;let l;o?l=t.offsetTop+a:l=t.offsetTop+r,this.nodes.wrapper.style.top=`${Math.floor(l)}px`,this.Editor.BlockManager.blocks.length===1&&e.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var e;this.Editor.ReadOnly.isEnabled||(this.nodes.wrapper.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),(e=this.toolboxInstance)==null||e.close(),this.Editor.BlockSettings.close())}open(e=!0){ie(()=>{this.nodes.wrapper.classList.add(this.CSS.toolbarOpened),e?this.blockActions.show():this.blockActions.hide()},50)()}make(){this.nodes.wrapper=d.make("div",this.CSS.toolbar),["content","actions"].forEach(t=>{this.nodes[t]=d.make("div",this.CSS[t])}),d.append(this.nodes.wrapper,this.nodes.content),d.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=d.make("div",this.CSS.plusButton,{innerHTML:_o}),d.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",()=>{this.tooltip.hide(!0),this.plusButtonClicked()},!1);const e=d.make("div");e.appendChild(document.createTextNode($.ui(K.ui.toolbar.toolbox,"Add"))),e.appendChild(d.make("div",this.CSS.plusButtonShortcut,{textContent:"⇥ Tab"})),this.tooltip.onHover(this.nodes.plusButton,e,{hidingDelay:400}),this.nodes.settingsToggler=d.make("span",this.CSS.settingsToggler,{innerHTML:Lo}),d.append(this.nodes.actions,this.nodes.settingsToggler),this.tooltip.onHover(this.nodes.settingsToggler,$.ui(K.ui.blockTunes.toggler,"Click to tune"),{hidingDelay:400}),d.append(this.nodes.actions,this.makeToolbox()),d.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),d.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}makeToolbox(){return this.toolboxInstance=new Pe({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:$.ui(K.ui.popover,"Filter"),nothingFound:$.ui(K.ui.popover,"Nothing found")}}),this.toolboxInstance.on(ve.Opened,()=>{this.Editor.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(ve.Closed,()=>{this.Editor.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(ve.BlockAdded,({block:e})=>{const{BlockManager:t,Caret:o}=this.Editor,n=t.getBlockById(e.id);n.inputs.length===0&&(n===t.lastBlock?(t.insertAtEnd(),o.setToBlock(t.lastBlock)):o.setToBlock(t.nextBlock))}),this.toolboxInstance.make()}plusButtonClicked(){var e;this.Editor.BlockManager.currentBlock=this.hoveredBlock,(e=this.toolboxInstance)==null||e.toggle()}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",e=>{var t;e.stopPropagation(),this.settingsTogglerClicked(),(t=this.toolboxInstance)!=null&&t.opened&&this.toolboxInstance.close(),this.tooltip.hide(!0)},!0),te()||this.eventsDispatcher.on(ut,e=>{var t;this.Editor.BlockSettings.opened||(t=this.toolboxInstance)!=null&&t.opened||this.moveAndOpen(e.block)})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}settingsTogglerClicked(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.BlockSettings.open(this.hoveredBlock)}drawUI(){this.Editor.BlockSettings.make(),this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy(),this.tooltip.destroy()}}var xe=(s=>(s[s.Block=0]="Block",s[s.Inline=1]="Inline",s[s.Tune=2]="Tune",s))(xe||{}),we=(s=>(s.Shortcut="shortcut",s.Toolbox="toolbox",s.EnabledInlineTools="inlineToolbar",s.EnabledBlockTunes="tunes",s.Config="config",s))(we||{}),pt=(s=>(s.Shortcut="shortcut",s.SanitizeConfig="sanitize",s))(pt||{}),de=(s=>(s.IsEnabledLineBreaks="enableLineBreaks",s.Toolbox="toolbox",s.ConversionConfig="conversionConfig",s.IsReadOnlySupported="isReadOnlySupported",s.PasteConfig="pasteConfig",s))(de||{}),He=(s=>(s.IsInline="isInline",s.Title="title",s))(He||{}),ft=(s=>(s.IsTune="isTune",s))(ft||{});class Fe{constructor({name:e,constructable:t,config:o,api:n,isDefault:i,isInternal:r=!1,defaultPlaceholder:a}){this.api=n,this.name=e,this.constructable=t,this.config=o,this.isDefault=i,this.isInternal=r,this.defaultPlaceholder=a}get settings(){const e=this.config.config||{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(D(this.constructable.reset))return this.constructable.reset()}prepare(){if(D(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}get shortcut(){const e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===1}isBlock(){return this.type===0}isTune(){return this.type===2}}const Ao=` + +`;class No extends T{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.CSS={inlineToolbar:"ce-inline-toolbar",inlineToolbarShowed:"ce-inline-toolbar--showed",inlineToolbarLeftOriented:"ce-inline-toolbar--left-oriented",inlineToolbarRightOriented:"ce-inline-toolbar--right-oriented",inlineToolbarShortcut:"ce-inline-toolbar__shortcut",buttonsWrapper:"ce-inline-toolbar__buttons",actionsWrapper:"ce-inline-toolbar__actions",inlineToolButton:"ce-inline-tool",inputField:"cdx-input",focusedButton:"ce-inline-tool--focused",conversionToggler:"ce-inline-toolbar__dropdown",conversionTogglerArrow:"ce-inline-toolbar__dropdown-arrow",conversionTogglerHidden:"ce-inline-toolbar__dropdown--hidden",conversionTogglerContent:"ce-inline-toolbar__dropdown-content",togglerAndButtonsWrapper:"ce-inline-toolbar__toggler-and-button-wrapper"},this.opened=!1,this.toolbarVerticalMargin=te()?20:6,this.buttonsList=null,this.width=0,this.flipper=null,this.tooltip=new Ne}toggleReadOnly(e){e?(this.destroy(),this.Editor.ConversionToolbar.destroy()):window.requestIdleCallback(()=>{this.make()},{timeout:2e3})}tryToShow(e=!1,t=!0){if(!this.allowedToShow()){e&&this.close();return}this.move(),this.open(t),this.Editor.Toolbar.close()}move(){const e=k.rect,t=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),o={x:e.x-t.left+145,y:e.y-t.top-40},n=document.getElementsByClassName("ce-inline-toolbar")[0].clientWidth,i=document.getElementsByClassName("ce-block__content")[0].getBoundingClientRect();i.width<650&&t.right-e.x=650&&i.right-e.x{const o=this.getToolShortcut(e);o&&ce.remove(this.Editor.UI.nodes.redactor,o),D(t.clear)&&t.clear()}),this.opened=!1,this.flipper.deactivate(),this.Editor.ConversionToolbar.close()))}open(e=!0){if(this.opened)return;this.addToolsFiltered(),this.nodes.wrapper.classList.add(this.CSS.inlineToolbarShowed),this.buttonsList=this.nodes.buttons.querySelectorAll(`.${this.CSS.inlineToolButton}`),this.opened=!0,e&&this.Editor.ConversionToolbar.hasTools()?this.setConversionTogglerContent():this.nodes.conversionToggler.hidden=!0;let t=Array.from(this.buttonsList);t.unshift(this.nodes.conversionToggler),t=t.filter(o=>!o.hidden),this.flipper.activate(t)}containsNode(e){return this.nodes.wrapper.contains(e)}destroy(){this.flipper&&(this.flipper.deactivate(),this.flipper=null),this.removeAllNodes(),this.tooltip.destroy()}make(){this.nodes.wrapper=d.make("div",[this.CSS.inlineToolbar,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),this.nodes.togglerAndButtonsWrapper=d.make("div",this.CSS.togglerAndButtonsWrapper),this.nodes.buttons=d.make("div",this.CSS.buttonsWrapper),this.nodes.actions=d.make("div",this.CSS.actionsWrapper),this.listeners.on(this.nodes.wrapper,"mousedown",e=>{e.target.closest(`.${this.CSS.actionsWrapper}`)||e.preventDefault()}),d.append(this.nodes.wrapper,[this.nodes.togglerAndButtonsWrapper,this.nodes.actions]),d.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper),this.addConversionToggler(),d.append(this.nodes.togglerAndButtonsWrapper,this.nodes.buttons),this.prepareConversionToolbar(),window.requestAnimationFrame(()=>{this.recalculateWidth()}),this.enableFlipper()}allowedToShow(){const e=["IMG","INPUT"],t=k.get(),o=k.text;if(!t||!t.anchorNode||t.isCollapsed||o.length<1)return!1;const n=d.isElement(t.anchorNode)?t.anchorNode:t.anchorNode.parentElement;if(t&&e.includes(n.tagName)||n.closest('[contenteditable="true"]')===null)return!1;const r=this.Editor.BlockManager.getBlock(t.anchorNode);return r?r.tool.inlineTools.size!==0:!1}recalculateWidth(){this.width=this.nodes.wrapper.offsetWidth}addConversionToggler(){this.nodes.conversionToggler=d.make("div",this.CSS.conversionToggler),this.nodes.conversionTogglerContent=d.make("div",this.CSS.conversionTogglerContent);const e=d.make("div",this.CSS.conversionTogglerArrow,{innerHTML:Ao});this.nodes.conversionToggler.appendChild(this.nodes.conversionTogglerContent),this.nodes.conversionToggler.appendChild(e),this.nodes.togglerAndButtonsWrapper.appendChild(this.nodes.conversionToggler),this.listeners.on(this.nodes.conversionToggler,"click",()=>{this.Editor.ConversionToolbar.toggle(t=>{!t&&this.opened?this.flipper.activate():this.opened&&this.flipper.deactivate()})}),te()===!1&&this.tooltip.onHover(this.nodes.conversionToggler,$.ui(K.ui.inlineToolbar.converter,"Convert to"),{placement:"top",hidingDelay:100})}async setConversionTogglerContent(){const{BlockManager:e}=this.Editor,{currentBlock:t}=e,o=t.name,n=t.tool.conversionConfig,i=n&&n.export;this.nodes.conversionToggler.hidden=!i,this.nodes.conversionToggler.classList.toggle(this.CSS.conversionTogglerHidden,!i);const r=await t.getActiveToolboxEntry()||{};this.nodes.conversionTogglerContent.innerHTML=r.icon||r.title||se(o)}prepareConversionToolbar(){const e=this.Editor.ConversionToolbar.make();d.append(this.nodes.wrapper,e)}addToolsFiltered(){const e=k.get(),t=this.Editor.BlockManager.getBlock(e.anchorNode);this.nodes.buttons.innerHTML="",this.nodes.actions.innerHTML="",this.toolsInstances=new Map,Array.from(t.tool.inlineTools.values()).forEach(o=>{this.addTool(o)}),this.recalculateWidth()}addTool(e){const t=e.create(),o=t.render();if(!o){L("Render method must return an instance of Node","warn",e.name);return}if(o.dataset.tool=e.name,this.nodes.buttons.appendChild(o),this.toolsInstances.set(e.name,t),D(t.renderActions)){const a=t.renderActions();this.nodes.actions.appendChild(a)}this.listeners.on(o,"click",a=>{this.toolClicked(t),a.preventDefault()});const n=this.getToolShortcut(e.name);if(n)try{this.enableShortcuts(t,n)}catch{}const i=d.make("div"),r=$.t(K.toolNames,e.title||se(e.name));i.appendChild(d.text(r)),n&&i.appendChild(d.make("div",this.CSS.inlineToolbarShortcut,{textContent:Te(n)})),te()===!1&&this.tooltip.onHover(o,i,{placement:"top",hidingDelay:100}),t.checkState(k.get())}getToolShortcut(e){const{Tools:t}=this.Editor,o=t.inlineTools.get(e),n=t.internal.inlineTools;return Array.from(n.keys()).includes(e)?this.inlineTools[e][pt.Shortcut]:o.shortcut}enableShortcuts(e,t){ce.add({name:t,handler:o=>{const{currentBlock:n}=this.Editor.BlockManager;n&&n.tool.enabledInlineTools&&(o.preventDefault(),this.toolClicked(e))},on:this.Editor.UI.nodes.redactor})}toolClicked(e){const t=k.range;e.surround(t),this.checkToolsState(),e.renderActions!==void 0&&this.flipper.deactivate()}checkToolsState(){this.toolsInstances.forEach(e=>{e.checkState(k.get())})}get inlineTools(){const e={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach(([t,o])=>{e[t]=o.create()}),e}enableFlipper(){this.flipper=new G({focusedItemClass:this.CSS.focusedButton,allowedKeys:[B.ENTER,B.TAB]})}}class Ro extends T{keydown(e){switch(this.beforeKeydownProcessing(e),e.keyCode){case B.BACKSPACE:this.backspace(e);break;case B.DELETE:this.delete(e);break;case B.ENTER:this.enter(e);break;case B.DOWN:case B.RIGHT:this.arrowRightAndDown(e);break;case B.UP:case B.LEFT:this.arrowLeftAndUp(e);break;case B.TAB:this.tabPressed(e);break}}beforeKeydownProcessing(e){this.needToolbarClosing(e)&&qe(e.keyCode)&&(this.Editor.Toolbar.close(),this.Editor.ConversionToolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||(this.Editor.BlockManager.clearFocused(),this.Editor.BlockSelection.clearSelection(e)))}keyup(e){e.shiftKey||this.Editor.UI.checkEmptiness()}tabPressed(e){this.Editor.BlockSelection.clearSelection(e);const{BlockManager:t,InlineToolbar:o,ConversionToolbar:n}=this.Editor,i=t.currentBlock;if(!i)return;const r=i.isEmpty,a=i.tool.isDefault&&r,l=!r&&n.opened,c=!r&&!k.isCollapsed&&o.opened;a?this.activateToolbox():!l&&!c&&this.activateBlockSettings()}dragOver(e){const t=this.Editor.BlockManager.getBlockByChildNode(e.target);t.dropTarget=!0}dragLeave(e){const t=this.Editor.BlockManager.getBlockByChildNode(e.target);t.dropTarget=!1}handleCommandC(e){const{BlockSelection:t}=this.Editor;t.anyBlockSelected&&t.copySelectedBlocks(e)}handleCommandX(e){const{BlockSelection:t,BlockManager:o,Caret:n}=this.Editor;t.anyBlockSelected&&t.copySelectedBlocks(e).then(()=>{const i=o.removeSelectedBlocks(),r=o.insertDefaultBlockAtIndex(i,!0);n.setToBlock(r,n.positions.START),t.clearSelection(e)})}enter(e){const{BlockManager:t,UI:o}=this.Editor;if(t.currentBlock.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey)return;let i=this.Editor.BlockManager.currentBlock;this.Editor.Caret.isAtStart&&!this.Editor.BlockManager.currentBlock.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):this.Editor.Caret.isAtEnd?i=this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex+1):i=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i),e.preventDefault()}backspace(e){const{BlockManager:t,Caret:o}=this.Editor,{currentBlock:n,previousBlock:i}=t;if(!k.isCollapsed||!o.isAtStart)return;if(e.preventDefault(),this.Editor.Toolbar.close(),!(n.currentInput===n.firstInput)){o.navigatePrevious();return}if(i===null)return;if(i.isEmpty){t.removeBlock(i);return}if(n.isEmpty){t.removeBlock(n);const l=t.currentBlock;o.setToBlock(l,o.positions.END);return}rt(n,i)?this.mergeBlocks(i,n):o.setToBlock(i,o.positions.END)}delete(e){const{BlockManager:t,Caret:o}=this.Editor,{currentBlock:n,nextBlock:i}=t;if(!k.isCollapsed||!o.isAtEnd)return;if(e.preventDefault(),this.Editor.Toolbar.close(),!(n.currentInput===n.lastInput)){o.navigateNext();return}if(i===null)return;if(i.isEmpty){t.removeBlock(i);return}if(n.isEmpty){t.removeBlock(n),o.setToBlock(i,o.positions.START);return}rt(n,i)?this.mergeBlocks(n,i):o.setToBlock(i,o.positions.START)}mergeBlocks(e,t){const{BlockManager:o,Caret:n,Toolbar:i}=this.Editor;n.createShadow(e.pluginsContent),o.mergeBlocks(e,t).then(()=>{window.requestAnimationFrame(()=>{n.restoreCaret(e.pluginsContent),e.pluginsContent.normalize(),i.close()})})}arrowRightAndDown(e){const t=G.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===B.TAB);if(this.Editor.UI.someToolbarOpened&&t)return;this.Editor.BlockManager.clearFocused(),this.Editor.Toolbar.close();const o=this.Editor.Caret.isAtEnd||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===B.DOWN&&o){this.Editor.CrossBlockSelection.toggleBlockSelectedState();return}(e.keyCode===B.DOWN||e.keyCode===B.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious())?e.preventDefault():ie(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){if(this.Editor.UI.someToolbarOpened){if(G.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===B.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.BlockManager.clearFocused(),this.Editor.Toolbar.close();const t=this.Editor.Caret.isAtStart||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===B.UP&&t){this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1);return}(e.keyCode===B.UP||e.keyCode===B.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext())?e.preventDefault():ie(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}needToolbarClosing(e){const t=e.keyCode===B.ENTER&&this.Editor.Toolbar.toolbox.opened,o=e.keyCode===B.ENTER&&this.Editor.BlockSettings.opened,n=e.keyCode===B.ENTER&&this.Editor.InlineToolbar.opened,i=e.keyCode===B.ENTER&&this.Editor.ConversionToolbar.opened,r=e.keyCode===B.TAB;return!(e.shiftKey||r||t||o||n||i)}activateToolbox(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}activateBlockSettings(){this.Editor.Toolbar.opened||(this.Editor.BlockManager.currentBlock.focused=!0,this.Editor.Toolbar.moveAndOpen()),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}}class je{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return Ge(this.workingArea.children)}static set(e,t,o){return isNaN(Number(t))?(Reflect.set(e,t,o),!0):(e.insert(+t,o),!0)}static get(e,t){return isNaN(Number(t))?Reflect.get(e,t):e.get(+t)}push(e){this.blocks.push(e),this.insertToDOM(e)}swap(e,t){const o=this.blocks[t];d.swap(this.blocks[e].holder,o.holder),this.blocks[t]=this.blocks[e],this.blocks[e]=o}move(e,t){const o=this.blocks.splice(t,1)[0],n=e-1,i=Math.max(0,n),r=this.blocks[i];e>0?this.insertToDOM(o,"afterend",r):this.insertToDOM(o,"beforebegin",r),this.blocks.splice(e,0,o);const a=this.composeBlockEvent("move",{fromIndex:t,toIndex:e});o.call(X.MOVED,a)}insert(e,t,o=!1){if(!this.length){this.push(t);return}e>this.length&&(e=this.length),o&&(this.blocks[e].holder.remove(),this.blocks[e].call(X.REMOVED));const n=o?1:0;if(this.blocks.splice(e,n,t),e>0){const i=this.blocks[e-1];this.insertToDOM(t,"afterend",i)}else{const i=this.blocks[e+1];i?this.insertToDOM(t,"beforebegin",i):this.insertToDOM(t)}}replace(e,t){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(t.holder),this.blocks[e]=t}insertMany(e,t){const o=new DocumentFragment;for(const n of e)o.appendChild(n.holder);if(this.length>0){if(t>0){const n=Math.min(t-1,this.length-1);this.blocks[n].holder.after(o)}else t===0&&this.workingArea.prepend(o);this.blocks.splice(t,0,...e)}else this.blocks.push(...e),this.workingArea.appendChild(o);e.forEach(n=>n.call(X.RENDERED))}remove(e){isNaN(e)&&(e=this.length-1),this.blocks[e].holder.remove(),this.blocks[e].call(X.REMOVED),this.blocks.splice(e,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(X.REMOVED)),this.blocks.length=0}insertAfter(e,t){const o=this.blocks.indexOf(e);this.insert(o+1,t)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,t,o){t?o.holder.insertAdjacentElement(t,e.holder):this.workingArea.appendChild(e.holder),e.call(X.RENDERED)}composeBlockEvent(e,t){return new CustomEvent(e,{detail:t})}}const gt="block-removed",bt="block-added",Do="block-moved",mt="block-changed";class Po{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((t,o)=>{this.completed=this.completed.then(e).then(t).catch(o)})}}class Ho extends T{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this._blocks[0]}get lastBlock(){return this._blocks[this._blocks.length-1]}get currentBlock(){return this._blocks[this.currentBlockIndex]}set currentBlock(e){this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){return this.currentBlockIndex===this._blocks.length-1?null:this._blocks[this.currentBlockIndex+1]}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(t=>!!t.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(t=>!!t.inputs.length)}get previousBlock(){return this.currentBlockIndex===0?null:this._blocks[this.currentBlockIndex-1]}get blocks(){return this._blocks.array}get isEditorEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){const e=new je(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(e,{set:je.set,get:je.get}),this.listeners.on(document,"copy",t=>this.Editor.BlockEvents.handleCommandC(t))}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:t={},id:o=void 0,tunes:n={}}){const i=this.Editor.ReadOnly.isEnabled,r=this.Editor.Tools.blockTools.get(e),a=new H({id:o,data:t,tool:r,api:this.Editor.API,readOnly:i,tunesData:n},this.eventsDispatcher);return i||window.requestIdleCallback(()=>{this.bindBlockEvents(a)},{timeout:2e3}),a}insert({id:e=void 0,tool:t=this.config.defaultBlock,data:o={},index:n,needToFocus:i=!0,replace:r=!1,tunes:a={}}={}){let l=n;l===void 0&&(l=this.currentBlockIndex+(r?0:1));const c=this.composeBlock({id:e,tool:t,data:o,tunes:a});return r&&this.blockDidMutated(gt,this.getBlockByIndex(l),{index:l}),this._blocks.insert(l,c,r),this.blockDidMutated(bt,c,{index:l}),i?this.currentBlockIndex=l:l<=this.currentBlockIndex&&this.currentBlockIndex++,c}insertMany(e,t=0){this._blocks.insertMany(e,t)}async update(e,t){const o=await e.data,n=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},o,t),tunes:e.tunes}),i=this.getBlockIndex(e);return this._blocks.replace(i,n),this.blockDidMutated(mt,n,{index:i}),n}replace(e,t,o){const n=this.getBlockIndex(e);this.insert({tool:t,data:o,index:n,replace:!0})}paste(e,t,o=!1){const n=this.insert({tool:e,replace:o});try{n.call(X.ON_PASTE,t)}catch(i){L(`${e}: onPaste callback call is failed`,"error",i)}return n}insertDefaultBlockAtIndex(e,t=!1){const o=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[e]=o,this.blockDidMutated(bt,o,{index:e}),t?this.currentBlockIndex=e:e<=this.currentBlockIndex&&this.currentBlockIndex++,o}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,t){const o=await t.data;Z(o)||await e.mergeWith(o),this.removeBlock(t),this.currentBlockIndex=this._blocks.indexOf(e)}removeBlock(e,t=!0){return new Promise(o=>{const n=this._blocks.indexOf(e);if(!this.validateIndex(n))throw new Error("Can't find a Block to remove");e.destroy(),this._blocks.remove(n),this.blockDidMutated(gt,e,{index:n}),this.currentBlockIndex>=n&&this.currentBlockIndex--,this.blocks.length?n===0&&(this.currentBlockIndex=0):(this.currentBlockIndex=-1,t&&this.insert()),o()})}removeSelectedBlocks(){let e;for(let t=this.blocks.length-1;t>=0;t--)this.blocks[t].selected&&(this.removeBlock(this.blocks[t]),e=t);return e}removeAllBlocks(){for(let e=this.blocks.length-1;e>=0;e--)this._blocks.remove(e);this.currentBlockIndex=-1,this.insert(),this.currentBlock.firstInput.focus()}split(){const e=this.Editor.Caret.extractFragmentFromCaretPosition(),t=d.make("div");e&&t.appendChild(e);const o={text:d.isEmpty(t)?"":t.innerHTML};return this.insert({data:o})}getBlockByIndex(e){return e===-1&&(e=this._blocks.length-1),this._blocks[e]}getBlockIndex(e){return this._blocks.indexOf(e)}getBlockById(e){return this._blocks.array.find(t=>t.id===e)}getBlock(e){d.isElement(e)||(e=e.parentNode);const t=this._blocks.nodes,o=e.closest(`.${H.CSS.wrapper}`),n=t.indexOf(o);if(n>=0)return this._blocks[n]}highlightCurrentNode(){this.clearFocused(),this.currentBlock.focused=!0}clearFocused(){this.blocks.forEach(e=>{e.focused=!1})}setCurrentBlockByChildNode(e){d.isElement(e)||(e=e.parentNode);const t=e.closest(`.${H.CSS.wrapper}`);if(!t)return;const o=t.closest(`.${this.Editor.UI.CSS.editorWrapper}`);if(o!=null&&o.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(t),this.currentBlock.updateCurrentInput(),this.currentBlock}getBlockByChildNode(e){d.isElement(e)||(e=e.parentNode);const t=e.closest(`.${H.CSS.wrapper}`);return this.blocks.find(o=>o.holder===t)}swap(e,t){this._blocks.swap(e,t),this.currentBlockIndex=t}move(e,t=this.currentBlockIndex){if(isNaN(e)||isNaN(t)){L("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(t)){L("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this._blocks.move(e,t),this.currentBlockIndex=e,this.blockDidMutated(Do,this.currentBlock,{fromIndex:t,toIndex:e})}async convert(e,t,o){if(!await e.save())throw new Error("Could not convert Block. Failed to extract original Block data.");const i=this.Editor.Tools.blockTools.get(t);if(!i)throw new Error(`Could not convert Block. Tool «${t}» not found.`);const r=await e.exportDataAsString(),a=q(r,i.sanitizeConfig);let l=Wt(a,i.conversionConfig);o&&(l=Object.assign(l,o)),this.replace(e,i.name,l)}dropPointer(){this.currentBlockIndex=-1,this.clearFocused()}async clear(e=!1){const t=new Po;this.blocks.forEach(o=>{t.add(async()=>{await this.removeBlock(o,!1)})}),await t.completed,this.dropPointer(),e&&this.insert(),this.Editor.UI.checkEmptiness()}async destroy(){await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){const{BlockEvents:t}=this.Editor;this.readOnlyMutableListeners.on(e.holder,"keydown",o=>{t.keydown(o)}),this.readOnlyMutableListeners.on(e.holder,"keyup",o=>{t.keyup(o)}),this.readOnlyMutableListeners.on(e.holder,"dragover",o=>{t.dragOver(o)}),this.readOnlyMutableListeners.on(e.holder,"dragleave",o=>{t.dragLeave(o)}),e.on("didMutated",o=>this.blockDidMutated(mt,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>this.Editor.BlockEvents.handleCommandX(e)),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this._blocks.length)}blockDidMutated(e,t,o){const n=new CustomEvent(e,{detail:{target:new oe(t),...o}});return this.eventsDispatcher.emit(nt,{event:n}),t}}class Fo extends T{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1}get sanitizerConfig(){return{p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}}}get allBlocksSelected(){const{BlockManager:e}=this.Editor;return e.blocks.every(t=>t.selected===!0)}set allBlocksSelected(e){const{BlockManager:t}=this.Editor;t.blocks.forEach(o=>{o.selected=e}),this.clearCache()}get anyBlockSelected(){const{BlockManager:e}=this.Editor;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(t=>t.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Editor.BlockManager.blocks.filter(e=>e.selected)}prepare(){this.selection=new k,ce.add({name:"CMD+A",handler:e=>{const{BlockManager:t,ReadOnly:o}=this.Editor;if(o.isEnabled){e.preventDefault(),this.selectAllBlocks();return}t.currentBlock&&this.handleCommandA(e)},on:this.Editor.UI.nodes.redactor})}toggleReadOnly(){k.get().removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){const{BlockManager:t}=this.Editor;let o;isNaN(e)?o=t.currentBlock:o=t.getBlockByIndex(e),o.selected=!1,this.clearCache()}clearSelection(e,t=!1){const{BlockManager:o,Caret:n,RectangleSelection:i}=this.Editor;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;const r=e&&e instanceof KeyboardEvent,a=r&&qe(e.keyCode);if(this.anyBlockSelected&&r&&a&&!k.isSelectionExists){const l=o.removeSelectedBlocks();o.insertDefaultBlockAtIndex(l,!0),n.setToBlock(o.currentBlock),ie(()=>{const c=e.key;n.insertContentAtCaretPosition(c.length>1?"":c)},20)()}if(this.Editor.CrossBlockSelection.clear(e),!this.anyBlockSelected||i.isRectActivated()){this.Editor.RectangleSelection.clearSelection();return}t&&this.selection.restore(),this.allBlocksSelected=!1}copySelectedBlocks(e){e.preventDefault();const t=d.make("div");this.selectedBlocks.forEach(i=>{const r=q(i.holder.innerHTML,this.sanitizerConfig),a=d.make("p");a.innerHTML=r,t.appendChild(a)});const o=Array.from(t.childNodes).map(i=>i.textContent).join(` + +`),n=t.innerHTML;return e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",n),Promise.all(this.selectedBlocks.map(i=>i.save())).then(i=>{try{e.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(i))}catch{}})}selectBlockByIndex(e){const{BlockManager:t}=this.Editor;t.clearFocused();let o;isNaN(e)?o=t.currentBlock:o=t.getBlockByIndex(e),this.selection.save(),k.get().removeAllRanges(),o.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}clearCache(){this.anyBlockSelectedCache=null}destroy(){ce.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Editor.RectangleSelection.clearSelection(),d.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}const o=this.Editor.BlockManager.getBlock(e.target).inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1,this.Editor.ConversionToolbar.close()):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlockByIndex(),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),k.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}}class Ce extends T{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}get isAtStart(){const e=k.get(),t=d.getDeepestNode(this.Editor.BlockManager.currentBlock.currentInput);let o=e.focusNode;if(d.isNativeInput(t))return t.selectionEnd===0;if(!e.anchorNode)return!1;let n=o.textContent.search(/\S/);n===-1&&(n=0);let i=e.focusOffset;return o.nodeType!==Node.TEXT_NODE&&o.childNodes.length&&(o.childNodes[i]?(o=o.childNodes[i],i=0):(o=o.childNodes[i-1],i=o.textContent.length)),(d.isLineBreakTag(t)||d.isEmpty(t))&&this.getHigherLevelSiblings(o,"left").every(l=>{const c=d.isLineBreakTag(l),u=l.children.length===1&&d.isLineBreakTag(l.children[0]),h=c||u;return d.isEmpty(l)&&!h})&&i===n?!0:t===null||o===t&&i<=n}get isAtEnd(){const e=k.get();let t=e.focusNode;const o=d.getDeepestNode(this.Editor.BlockManager.currentBlock.currentInput,!0);if(d.isNativeInput(o))return o.selectionEnd===o.value.length;if(!e.focusNode)return!1;let n=e.focusOffset;if(t.nodeType!==Node.TEXT_NODE&&t.childNodes.length&&(t.childNodes[n-1]?(t=t.childNodes[n-1],n=t.textContent.length):(t=t.childNodes[0],n=0)),d.isLineBreakTag(o)||d.isEmpty(o)){const r=this.getHigherLevelSiblings(t,"right");if(r.every((l,c)=>c===r.length-1&&d.isLineBreakTag(l)||d.isEmpty(l)&&!d.isLineBreakTag(l))&&n===t.textContent.length)return!0}const i=o.textContent.replace(/\s+$/,"");return t===o&&n>=i.length}setToBlock(e,t=this.positions.DEFAULT,o=0){const{BlockManager:n}=this.Editor;let i;switch(t){case this.positions.START:i=e.firstInput;break;case this.positions.END:i=e.lastInput;break;default:i=e.currentInput}if(!i)return;const r=d.getDeepestNode(i,t===this.positions.END),a=d.getContentLength(r);switch(!0){case t===this.positions.START:o=0;break;case t===this.positions.END:case o>a:o=a;break}ie(()=>{this.set(r,o)},20)(),n.setCurrentBlockByChildNode(e.holder),n.currentBlock.currentInput=i}setToInput(e,t=this.positions.DEFAULT,o=0){const{currentBlock:n}=this.Editor.BlockManager,i=d.getDeepestNode(e);switch(t){case this.positions.START:this.set(i,0);break;case this.positions.END:this.set(i,d.getContentLength(i));break;default:o&&this.set(i,o)}n.currentInput=e}set(e,t=0){const{top:o,bottom:n}=k.setCursor(e,t),{innerHeight:i}=window;o<0&&window.scrollBy(0,o),n>i&&window.scrollBy(0,n-i)}setToTheLastBlock(){const e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{const t=this.Editor.BlockManager.insertAtEnd();this.setToBlock(t)}}extractFragmentFromCaretPosition(){const e=k.get();if(e.rangeCount){const t=e.getRangeAt(0),o=this.Editor.BlockManager.currentBlock.currentInput;if(t.deleteContents(),o)if(d.isNativeInput(o)){const n=o,i=document.createDocumentFragment(),r=n.value.substring(0,n.selectionStart),a=n.value.substring(n.selectionStart);return i.textContent=a,n.value=r,i}else{const n=t.cloneRange();return n.selectNodeContents(o),n.setStart(t.endContainer,t.endOffset),n.extractContents()}}}navigateNext(){const{BlockManager:e}=this.Editor,{currentBlock:t,nextContentfulBlock:o}=e,{nextInput:n}=t,i=this.isAtEnd;let r=o;if(!r&&!n){if(t.tool.isDefault||!i)return!1;r=e.insertAtEnd()}return i?(n?this.setToInput(n,this.positions.START):this.setToBlock(r,this.positions.START),!0):!1}navigatePrevious(){const{currentBlock:e,previousContentfulBlock:t}=this.Editor.BlockManager;if(!e)return!1;const{previousInput:o}=e;return!t&&!o?!1:this.isAtStart?(o?this.setToInput(o,this.positions.END):this.setToBlock(t,this.positions.END),!0):!1}createShadow(e){const t=document.createElement("span");t.classList.add(Ce.CSS.shadowCaret),e.insertAdjacentElement("beforeend",t)}restoreCaret(e){const t=e.querySelector(`.${Ce.CSS.shadowCaret}`);if(!t)return;new k().expandToTag(t);const n=document.createRange();n.selectNode(t),n.extractContents()}insertContentAtCaretPosition(e){const t=document.createDocumentFragment(),o=document.createElement("div"),n=k.get(),i=k.range;o.innerHTML=e,Array.from(o.childNodes).forEach(c=>t.appendChild(c)),t.childNodes.length===0&&t.appendChild(new Text);const r=t.lastChild;i.deleteContents(),i.insertNode(t);const a=document.createRange(),l=r.nodeType===Node.TEXT_NODE?r:r.firstChild;l!==null&&l.textContent!==null&&a.setStart(l,l.textContent.length),n.removeAllRanges(),n.addRange(a)}getHigherLevelSiblings(e,t){let o=e;const n=[];for(;o.parentNode&&o.parentNode.contentEditable!=="true";)o=o.parentNode;const i=t==="left"?"previousSibling":"nextSibling";for(;o[i];)o=o[i],n.push(o);return n}}class jo extends T{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{const{BlockManager:t,BlockSelection:o}=this.Editor,n=t.getBlockByChildNode(e.relatedTarget)||this.lastSelectedBlock,i=t.getBlockByChildNode(e.target);if(!(!n||!i)&&i!==n){if(n===this.firstSelectedBlock){k.get().removeAllRanges(),n.selected=!0,i.selected=!0,o.clearCache();return}if(i===this.firstSelectedBlock){n.selected=!1,i.selected=!1,o.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(n,i),this.lastSelectedBlock=i}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==Mt.LEFT)return;const{BlockManager:t}=this.Editor;this.firstSelectedBlock=t.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock}toggleBlockSelectedState(e=!0){const{BlockManager:t,BlockSelection:o}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=t.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),k.get().removeAllRanges());const n=t.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),i=t.blocks[n];i&&(this.lastSelectedBlock.selected!==i.selected?(i.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=i,this.Editor.InlineToolbar.close(),i.holder.scrollIntoView({block:"nearest"}))}clear(e){const{BlockManager:t,BlockSelection:o,Caret:n}=this.Editor,i=t.blocks.indexOf(this.firstSelectedBlock),r=t.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&i>-1&&r>-1)if(e&&e instanceof KeyboardEvent)switch(e.keyCode){case B.DOWN:case B.RIGHT:n.setToBlock(t.blocks[Math.max(i,r)],n.positions.END);break;case B.UP:case B.LEFT:n.setToBlock(t.blocks[Math.min(i,r)],n.positions.START);break;default:n.setToBlock(t.blocks[Math.max(i,r)],n.positions.END)}else n.setToBlock(t.blocks[Math.max(i,r)],n.positions.END);this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){const{UI:t}=this.Editor;k.isCollapsed||this.Editor.BlockSelection.clearSelection(e),t.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,t){const{BlockManager:o,BlockSelection:n}=this.Editor,i=o.blocks.indexOf(e),r=o.blocks.indexOf(t),a=e.selected!==t.selected;for(let l=Math.min(i,r);l<=Math.max(i,r);l++){const c=o.blocks[l];c!==this.firstSelectedBlock&&c!==(a?e:t)&&(o.blocks[l].selected=!o.blocks[l].selected,n.clearCache())}}}class zo extends T{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){const{UI:e}=this.Editor;this.readOnlyMutableListeners.on(e.nodes.holder,"drop",async t=>{await this.processDrop(t)},!0),this.readOnlyMutableListeners.on(e.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(e.nodes.holder,"dragover",t=>{this.processDragOver(t)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(e){const{BlockManager:t,Caret:o,Paste:n}=this.Editor;e.preventDefault(),t.blocks.forEach(r=>{r.dropTarget=!1}),k.isAtEditor&&!k.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;const i=t.setCurrentBlockByChildNode(e.target);if(i)this.Editor.Caret.setToBlock(i,o.positions.END);else{const r=t.setCurrentBlockByChildNode(t.lastBlock.holder);this.Editor.Caret.setToBlock(r,o.positions.END)}await n.processDataTransfer(e.dataTransfer,!0)}processDragStart(){k.isAtEditor&&!k.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(e){e.preventDefault()}}class Uo extends T{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=400,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(nt,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(it,()=>{this.disable()}),this.eventsDispatcher.on(st,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Editor.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!D(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let t;this.batchingOnChangeQueue.size===1?t=this.batchingOnChangeQueue.values().next().value:t=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,t),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(Ie,{mutations:e})}}const kt=class extends T{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=s=>{try{const e=s.create({},{},!1);if(s.pasteConfig===!1){this.exceptionList.push(s.name);return}if(!D(e.onPaste))return;this.getTagsConfig(s),this.getFilesConfig(s),this.getPatternsConfig(s)}catch(e){L(`Paste handling for «${s.name}» Tool hasn't been set up because of the error`,"warn",e)}},this.handlePasteEvent=async s=>{const{BlockManager:e,Toolbar:t}=this.Editor,o=e.setCurrentBlockByChildNode(s.target);!o||this.isNativeBehaviour(s.target)&&!s.clipboardData.types.includes("Files")||o&&this.exceptionList.includes(o.name)||(s.preventDefault(),this.processDataTransfer(s.clipboardData),e.clearFocused(),t.close())}}async prepare(){this.processTools()}toggleReadOnly(s){s?this.unsetCallback():this.setCallback()}async processDataTransfer(s,e=!1){const{Tools:t}=this.Editor,o=s.types;if((o.includes?o.includes("Files"):o.contains("Files"))&&!Z(this.toolsFiles)){await this.processFiles(s.files);return}const i=s.getData(this.MIME_TYPE),r=s.getData("text/plain");let a=s.getData("text/html");const l=document.createElement("div");if(l.innerHTML=a,l.querySelectorAll("*").forEach(m=>{m instanceof HTMLElement&&(m.style.fontFamily="inherit",m.style.color="inherit",m.style.fontSize="inherit",m.style.backgroundColor="initial")}),a=l.innerHTML,i)try{this.insertEditorJSData(JSON.parse(i));return}catch{}e&&r.trim()&&a.trim()&&(a="

"+(a.trim()?a:r)+"

");const u=Object.keys(this.toolsTags).reduce((m,p)=>(m[p.toLowerCase()]=this.toolsTags[p].sanitizationConfig??{},m),{}),h=Object.assign({},u,t.getAllInlineToolsSanitizeConfig(),{br:{}}),f=q(a,h);!f.trim()||f.trim()===r||!d.isHTMLString(f)?await this.processText(r):await this.processText(f,!0)}async processText(s,e=!1){const{Caret:t,BlockManager:o}=this.Editor,n=e?this.processHTML(s):this.processPlain(s);if(!n.length)return;if(n.length===1){n[0].isBlock?this.processSingleBlock(n.pop()):this.processInlinePaste(n.pop());return}const r=o.currentBlock&&o.currentBlock.tool.isDefault&&o.currentBlock.isEmpty;n.map(async(a,l)=>this.insertBlock(a,l===0&&r)),o.currentBlock&&t.setToBlock(o.currentBlock,t.positions.END)}setCallback(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}unsetCallback(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}processTools(){const s=this.Editor.Tools.blockTools;Array.from(s.values()).forEach(this.processTool)}collectTagNames(s){return Q(s)?[s]:F(s)?Object.keys(s):[]}getTagsConfig(s){if(s.pasteConfig===!1)return;const e=s.pasteConfig.tags||[],t=[];e.forEach(o=>{const n=this.collectTagNames(o);t.push(...n),n.forEach(i=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,i)){L(`Paste handler for «${s.name}» Tool on «${i}» tag is skipped because it is already used by «${this.toolsTags[i].tool.name}» Tool.`,"warn");return}const r=F(o)?o[i]:null;this.toolsTags[i.toUpperCase()]={tool:s,sanitizationConfig:r}})}),this.tagsByTool[s.name]=t.map(o=>o.toUpperCase())}getFilesConfig(s){if(s.pasteConfig===!1)return;const{files:e={}}=s.pasteConfig;let{extensions:t,mimeTypes:o}=e;!t&&!o||(t&&!Array.isArray(t)&&(L(`«extensions» property of the onDrop config for «${s.name}» Tool should be an array`),t=[]),o&&!Array.isArray(o)&&(L(`«mimeTypes» property of the onDrop config for «${s.name}» Tool should be an array`),o=[]),o&&(o=o.filter(n=>Nt(n)?!0:(L(`MIME type value «${n}» for the «${s.name}» Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[s.name]={extensions:t||[],mimeTypes:o||[]})}getPatternsConfig(s){s.pasteConfig===!1||!s.pasteConfig.patterns||Z(s.pasteConfig.patterns)||Object.entries(s.pasteConfig.patterns).forEach(([e,t])=>{t instanceof RegExp||L(`Pattern ${t} for «${s.name}» Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:e,pattern:t,tool:s})})}isNativeBehaviour(s){return d.isNativeInput(s)}async processFiles(s){const{BlockManager:e}=this.Editor;let t;t=await Promise.all(Array.from(s).map(i=>this.processFile(i))),t=t.filter(i=>!!i);const n=e.currentBlock.tool.isDefault&&e.currentBlock.isEmpty;t.forEach((i,r)=>{e.paste(i.type,i.event,r===0&&n)})}async processFile(s){const e=At(s),t=Object.entries(this.toolsFiles).find(([i,{mimeTypes:r,extensions:a}])=>{const[l,c]=s.type.split("/"),u=a.find(f=>f.toLowerCase()===e.toLowerCase()),h=r.find(f=>{const[m,p]=f.split("/");return m===l&&(p===c||p==="*")});return!!u||!!h});if(!t)return;const[o]=t;return{event:this.composePasteEvent("file",{file:s}),type:o}}processHTML(s){const{Tools:e}=this.Editor,t=d.make("DIV");return t.innerHTML=s,this.getNodes(t).map(n=>{let i,r=e.defaultTool,a=!1;switch(n.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:i=d.make("div"),i.appendChild(n);break;case Node.ELEMENT_NODE:i=n,a=!0,this.toolsTags[i.tagName]&&(r=this.toolsTags[i.tagName].tool);break}const{tags:l}=r.pasteConfig||{tags:[]},c=l.reduce((f,m)=>(this.collectTagNames(m).forEach(v=>{const O=F(m)?m[v]:null;f[v.toLowerCase()]=O||{}}),f),{}),u=Object.assign({},c,r.baseSanitizeConfig);if(i.tagName.toLowerCase()==="table"){const f=q(i.outerHTML,u);i=d.make("div",void 0,{innerHTML:f}).firstChild}else i.innerHTML=q(i.innerHTML,u);const h=this.composePasteEvent("tag",{data:i});return{content:i,isBlock:a,tool:r.name,event:h}}).filter(n=>{const i=d.isEmpty(n.content),r=d.isSingleTag(n.content);return!i||r})}processPlain(s){const{defaultBlock:e}=this.config;if(!s)return[];const t=e;return s.split(/\r?\n/).filter(o=>o.trim()).map(o=>{const n=d.make("div");n.textContent=o;const i=this.composePasteEvent("tag",{data:n});return{content:n,tool:t,isBlock:!1,event:i}})}async processSingleBlock(s){const{Caret:e,BlockManager:t}=this.Editor,{currentBlock:o}=t;if(!o||s.tool!==o.name||!d.containsOnlyInlineElements(s.content.innerHTML)){this.insertBlock(s,(o==null?void 0:o.tool.isDefault)&&o.isEmpty);return}e.insertContentAtCaretPosition(s.content.innerHTML)}async processInlinePaste(s){const{BlockManager:e,Caret:t}=this.Editor,{content:o}=s;if(e.currentBlock&&e.currentBlock.tool.isDefault&&o.textContent.length{const n=o.pattern.exec(s);return n?s===n.shift():!1});return e?{event:this.composePasteEvent("pattern",{key:e.key,data:s}),tool:e.tool.name}:void 0}insertBlock(s,e=!1){const{BlockManager:t,Caret:o}=this.Editor,{currentBlock:n}=t;let i;if(e&&n&&n.isEmpty){i=t.paste(s.tool,s.event,!0),o.setToBlock(i,o.positions.END);return}i=t.paste(s.tool,s.event),o.setToBlock(i,o.positions.END)}insertEditorJSData(s){const{BlockManager:e,Caret:t,Tools:o}=this.Editor;at(s,i=>o.blockTools.get(i).sanitizeConfig).forEach(({tool:i,data:r},a)=>{let l=!1;a===0&&(l=e.currentBlock&&e.currentBlock.tool.isDefault&&e.currentBlock.isEmpty);const c=e.insert({tool:i,data:r,replace:l});t.setToBlock(c,t.positions.END)})}processElementNode(s,e,t){const o=Object.keys(this.toolsTags),n=s,{tool:i}=this.toolsTags[n.tagName]||{},r=this.tagsByTool[i==null?void 0:i.name]||[],a=o.includes(n.tagName),l=d.blockElements.includes(n.tagName.toLowerCase()),c=Array.from(n.children).some(({tagName:h})=>o.includes(h)&&!r.includes(h)),u=Array.from(n.children).some(({tagName:h})=>d.blockElements.includes(h.toLowerCase()));if(!l&&!a&&!c)return t.appendChild(n),[...e,t];if(a&&!c||l&&!u&&!c)return[...e,t,n]}getNodes(s){const e=Array.from(s.childNodes);let t;const o=(n,i)=>{if(d.isEmpty(i)&&!d.isSingleTag(i))return n;const r=n[n.length-1];let a=new DocumentFragment;switch(r&&d.isFragment(r)&&(a=n.pop()),i.nodeType){case Node.ELEMENT_NODE:if(t=this.processElementNode(i,n,a),t)return t;break;case Node.TEXT_NODE:return a.appendChild(i),[...n,a];default:return[...n,a]}return[...n,...Array.from(i.childNodes).reduce(o,[])]};return e.reduce(o,[])}composePasteEvent(s,e){return new CustomEvent(s,{detail:e})}};let vt=kt;vt.PATTERN_PROCESSING_MAX_LENGTH=450;class $o extends T{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){const{Tools:e}=this.Editor,{blockTools:t}=e,o=[];Array.from(t.entries()).forEach(([n,i])=>{i.isReadOnlySupported||o.push(n)}),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly)}async toggle(e=!this.readOnlyEnabled){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();const t=this.readOnlyEnabled;this.readOnlyEnabled=e;for(const n in this.Editor)this.Editor[n].toggleReadOnly&&this.Editor[n].toggleReadOnly(e);if(t===e)return this.readOnlyEnabled;const o=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(o.blocks),this.readOnlyEnabled}throwCriticalError(){throw new tt(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}}class be extends T{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.listenerIds=[]}static get CSS(){return{overlay:"codex-editor-overlay",overlayContainer:"codex-editor-overlay__container",rect:"codex-editor-overlay__rectangle",topScrollZone:"codex-editor-overlay__scroll-zone--top",bottomScrollZone:"codex-editor-overlay__scroll-zone--bottom"}}prepare(){this.enableModuleBindings()}startSelection(e,t){const o=document.elementFromPoint(e-window.pageXOffset,t-window.pageYOffset);o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);const i=[`.${H.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],r=o.closest("."+this.Editor.UI.CSS.editorWrapper),a=i.some(l=>!!o.closest(l));!r||a||(this.mousedown=!0,this.startX=e,this.startY=t)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle.style.display="none"}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){const{container:e}=this.genHTML();this.listeners.on(e,"mousedown",t=>{this.processMouseDown(t)},!1),this.listeners.on(document.body,"mousemove",Be(t=>{this.processMouseMove(t)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",Be(t=>{this.processScroll(t)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){if(e.button!==this.MAIN_MOUSE_BUTTON)return;e.target.closest(d.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY)}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){const{UI:e}=this.Editor,t=e.nodes.holder.querySelector("."+e.CSS.editorWrapper),o=d.make("div",be.CSS.overlay,{}),n=d.make("div",be.CSS.overlayContainer,{}),i=d.make("div",be.CSS.rect,{});return n.appendChild(i),o.appendChild(n),t.appendChild(o),this.overlayRectangle=i,{container:t,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;const t=window.pageYOffset;window.scrollBy(0,e),this.mouseY+=window.pageYOffset-t,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);const{rightPos:t,leftPos:o,index:n}=this.genInfoForMouseSelection(),i=this.startX>t&&this.mouseX>t,r=this.startX=this.startY?(this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-window.pageYOffset}px`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.top=`${this.mouseY-window.pageYOffset}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-window.pageXOffset}px`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.left=`${this.mouseX-window.pageXOffset}px`)}genInfoForMouseSelection(){const t=document.body.offsetWidth/2,o=this.mouseY-window.pageYOffset,n=document.elementFromPoint(t,o),i=this.Editor.BlockManager.getBlockByChildNode(n);let r;i!==void 0&&(r=this.Editor.BlockManager.blocks.findIndex(h=>h.holder===i.holder));const a=this.Editor.BlockManager.lastBlock.holder.querySelector("."+H.CSS.content),l=Number.parseInt(window.getComputedStyle(a).width,10)/2,c=t-l,u=t+l;return{index:r,leftPos:c,rightPos:u}}addBlockInSelection(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){const t=this.stackOfSelected[this.stackOfSelected.length-1]===e,o=this.stackOfSelected.length,n=1,i=-1,r=0;if(t)return;const a=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0;let l=r;o>1&&(l=a?n:i);const c=e>this.stackOfSelected[o-1]&&l===n,u=ethis.stackOfSelected[o-1]||this.stackOfSelected[o-1]===void 0)){let v=this.stackOfSelected[o-1]+1||e;for(v;v<=e;v++)this.addBlockInSelection(v);return}if(!f&&e=e;v--)this.addBlockInSelection(v);return}if(!f)return;let m=o-1,p;for(e>this.stackOfSelected[o-1]?p=()=>e>this.stackOfSelected[m]:p=()=>e{const{Tools:o,BlockManager:n}=this.Editor,i=e.map(({type:r,data:a,tunes:l,id:c})=>{o.available.has(r)===!1&&(Y(`Tool «${r}» is not found. Check 'tools' property at the Editor.js config.`,"warn"),a=this.composeStubDataForTool(r,a,c),r=o.stubTool);let u;try{u=n.composeBlock({id:c,tool:r,data:a,tunes:l})}catch(h){L(`Block «${r}» skipped because of plugins error`,"error",{data:a,error:h}),a=this.composeStubDataForTool(r,a,c),r=o.stubTool,u=n.composeBlock({id:c,tool:r,data:a,tunes:l})}return u});n.insertMany(i),window.requestIdleCallback(()=>{t()},{timeout:2e3})})}composeStubDataForTool(e,t,o){const{Tools:n}=this.Editor;let i=e;if(n.unavailable.has(e)){const r=n.unavailable.get(e).toolbox;r!==void 0&&r[0].title!==void 0&&(i=r[0].title)}return{savedData:{id:o,type:e,data:t},title:i}}}class Vo extends T{async save(){const{BlockManager:e,Tools:t}=this.Editor,o=e.blocks,n=[];try{o.forEach(a=>{n.push(this.getSavedData(a))});const i=await Promise.all(n),r=await at(i,a=>t.blockTools.get(a).sanitizeConfig);return this.makeOutput(r)}catch(i){Y("Saving failed due to the Error %o","error",i)}}async getSavedData(e){const t=await e.save(),o=t&&await e.validate(t.data);return{...t,isValid:o}}makeOutput(e){const t=[];return e.forEach(({id:o,tool:n,data:i,tunes:r,isValid:a})=>{if(!a){L(`Block «${n}» skipped because saved data is invalid`);return}if(n===this.Editor.Tools.stubTool){t.push(i);return}const l={id:o,type:n,data:i,...!Z(r)&&{tunes:r}};t.push(l)}),{time:+new Date,blocks:t,version:"2.28.0-rc.3"}}}var ze={},Yo={get exports(){return ze},set exports(s){ze=s}};(function(s,e){(function(t,o){s.exports=o()})(window,function(){return function(t){var o={};function n(i){if(o[i])return o[i].exports;var r=o[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=o,n.d=function(i,r,a){n.o(i,r)||Object.defineProperty(i,r,{enumerable:!0,get:a})},n.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},n.t=function(i,r){if(1&r&&(i=n(i)),8&r||4&r&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&r&&typeof i!="string")for(var l in i)n.d(a,l,function(c){return i[c]}.bind(null,l));return a},n.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(r,"a",r),r},n.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},n.p="/",n(n.s=4)}([function(t,o,n){var i=n(1),r=n(2);typeof(r=r.__esModule?r.default:r)=="string"&&(r=[[t.i,r,""]]);var a={insert:"head",singleton:!1};i(r,a),t.exports=r.locals||{}},function(t,o,n){var i,r=function(){return i===void 0&&(i=!!(window&&document&&document.all&&!window.atob)),i},a=function(){var C={};return function(x){if(C[x]===void 0){var w=document.querySelector(x);if(window.HTMLIFrameElement&&w instanceof window.HTMLIFrameElement)try{w=w.contentDocument.head}catch{w=null}C[x]=w}return C[x]}}(),l=[];function c(C){for(var x=-1,w=0;w',title:"Text"}}}]),l}()}]).default})})(Yo);const Zo=J(ze),Ko=` + +`;class Ue{constructor(){this.commandName="bold",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--bold"},this.nodes={button:void 0}}static get sanitize(){return{b:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=Ko,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){const e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+B"}}Ue.isInline=!0,Ue.title="Bold";const Xo=` + +`;class $e{constructor(){this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}static get sanitize(){return{i:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=Xo,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){const e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+I"}}$e.isInline=!0,$e.title="Italic";const xt=` + +`,qo=` + +`;class We{constructor({api:e}){this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new k}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=xt,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",e=>{e.keyCode===this.ENTER_KEY&&this.enterPressed(e)}),this.nodes.input}surround(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());const t=this.selection.findParentTag("A");if(t){const o=document.getElementsByClassName("unlink-button")[0];this.selection.expandToTag(t),this.unlink(),this.nodes.input.value="",this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive),o.remove(),this.inlineToolbar.close();return}}this.toggleActions()}checkState(){const e=this.selection.findParentTag("A"),t=document.createElement("button");if(e){this.nodes.button.innerHTML=qo,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions(),t.classList.add("unlink-button"),t.textContent=this.i18n.t("Remove"),t.addEventListener("click",()=>{this.selection.expandToTag(e),this.unlink(),this.nodes.input.value="",this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive),t.remove(),this.inlineToolbar.close()});const o=e.getAttribute("href");this.nodes.input.value=o!=="null"?o:"",this.nodes.input.value!==""&&!document.querySelector(".unlink-button")&&document.querySelector(".ce-inline-toolbar__actions").appendChild(t),this.selection.save()}else this.nodes.button.innerHTML=xt,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!e}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(e=!1){const t=document.getElementsByClassName("ce-inline-toolbar")[0];this.nodes.input.classList.add(this.CSS.inputShowed),t.style.transform="translate(-50%, -33px)",e&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(e=!0){const t=document.getElementsByClassName("ce-inline-toolbar")[0];if(this.selection.isFakeBackgroundEnabled){const o=new k;o.save(),this.selection.restore(),this.selection.removeFakeBackground(),o.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),t.style.transform="",this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(e){let t=this.nodes.input.value||"";if(!t.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions();return}if(!this.validateURL(t)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),L("Incorrect Link pasted","warn",t);return}t=this.prepareLink(t),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(t),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return e=e.trim(),e=this.addProtocol(e),e}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;const t=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",n=/^\/\/[^/\s]/.test(e);return!t&&!o&&!n&&(e="http://"+e),e}insertLink(e){const t=this.selection.findParentTag("A");t&&this.selection.expandToTag(t),document.execCommand(this.commandLink,!1,e),this.selection.findParentTag("A").setAttribute("target","_blank")}unlink(){document.execCommand(this.commandUnlink)}}We.isInline=!0,We.title="Link";class wt{constructor({data:e,api:t}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=t,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){const e=d.make("div",this.CSS.wrapper),t=xo,o=d.make("div",this.CSS.info),n=d.make("div",this.CSS.title,{textContent:this.title}),i=d.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML=t,o.appendChild(n),o.appendChild(i),e.appendChild(o),e}}wt.isReadOnlySupported=!0;class Go extends Fe{constructor(){super(...arguments),this.type=xe.Inline}get title(){return this.constructable[He.Title]}create(){return new this.constructable({api:this.api.getMethodsForTool(this),config:this.settings})}}class Jo extends Fe{constructor(){super(...arguments),this.type=xe.Tune}create(e,t){return new this.constructable({api:this.api.getMethodsForTool(this),config:this.settings,block:t,data:e})}}class U extends Map{get blockTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isBlock());return new U(e)}get inlineTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInline());return new U(e)}get blockTunes(){const e=Array.from(this.entries()).filter(([,t])=>t.isTune());return new U(e)}get internalTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInternal);return new U(e)}get externalTools(){const e=Array.from(this.entries()).filter(([,t])=>!t.isInternal);return new U(e)}}var Qo=Object.defineProperty,en=Object.getOwnPropertyDescriptor,Ct=(s,e,t,o)=>{for(var n=o>1?void 0:o?en(e,t):e,i=s.length-1,r;i>=0;i--)(r=s[i])&&(n=(o?r(e,t,n):r(n))||n);return o&&n&&Qo(e,t,n),n};class Ve extends Fe{constructor(){super(...arguments),this.type=xe.Block,this.inlineTools=new U,this.tunes=new U}create(e,t,o){return new this.constructable({data:e,block:t,readOnly:o,api:this.api.getMethodsForTool(this),config:this.settings})}get isReadOnlySupported(){return this.constructable[de.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[de.IsEnabledLineBreaks]}get toolbox(){const e=this.constructable[de.Toolbox],t=this.config[we.Toolbox];if(!Z(e)&&t!==!1)return t?Array.isArray(e)?Array.isArray(t)?t.map((o,n)=>{const i=e[n];return i?{...i,...o}:o}):[t]:Array.isArray(t)?t:[{...e,...t}]:Array.isArray(e)?e:[e]}get conversionConfig(){return this.constructable[de.ConversionConfig]}get enabledInlineTools(){return this.config[we.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[we.EnabledBlockTunes]}get pasteConfig(){return this.constructable[de.PasteConfig]??{}}get sanitizeConfig(){const e=super.sanitizeConfig,t=this.baseSanitizeConfig;if(Z(e))return t;const o={};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n];F(i)?o[n]=Object.assign({},t,i):o[n]=i}return o}get baseSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),Array.from(this.tunes.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),e}}Ct([re],Ve.prototype,"sanitizeConfig",1),Ct([re],Ve.prototype,"baseSanitizeConfig",1);class tn{constructor(e,t,o){this.api=o,this.config=e,this.editorConfig=t}get(e){const{class:t,isInternal:o=!1,...n}=this.config[e],i=this.getConstructor(t);return new i({name:e,constructable:t,config:n,api:this.api,isDefault:e===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case e[He.IsInline]:return Go;case e[ft.IsTune]:return Jo;default:return Ve}}}const on=` + +`;class yt{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:on,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),t=this.api.blocks.getBlockByIndex(e+1);if(!t)throw new Error("Unable to move Block down since it is already the last");const o=t.holder,n=o.getBoundingClientRect();let i=Math.abs(window.innerHeight-o.offsetHeight);n.top + +`;class Bt{constructor({api:e}){this.api=e}render(){return{icon:nn,title:this.api.i18n.t("Delete"),name:"delete",onActivate:()=>this.handleClick()}}handleClick(){this.api.blocks.delete()}}Bt.isTune=!0;const sn=` + +`;class Et{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:sn,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),t=this.api.blocks.getBlockByIndex(e),o=this.api.blocks.getBlockByIndex(e-1);if(e===0||!t||!o)throw new Error("Unable to move Block up since it is already the first");const n=t.holder,i=o.holder,r=n.getBoundingClientRect(),a=i.getBoundingClientRect();let l;a.top>0?l=Math.abs(r.top)-Math.abs(a.top):l=Math.abs(r.top)+a.height,window.scrollBy(0,-1*l),this.api.blocks.move(e-1),this.api.toolbar.toggleBlockSettings(!0)}}Et.isTune=!0;var rn=Object.defineProperty,an=Object.getOwnPropertyDescriptor,ln=(s,e,t,o)=>{for(var n=o>1?void 0:o?an(e,t):e,i=s.length-1,r;i>=0;i--)(r=s[i])&&(n=(o?r(e,t,n):r(n))||n);return o&&n&&rn(e,t,n),n};class Tt extends T{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new U,this.toolsUnavailable=new U}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){return this.blockTools.get(this.config.defaultBlock)}get internal(){return this.available.internalTools}async prepare(){if(this.validateTools(),this.config.tools=Ee({},this.internalTools,this.config.tools),!Object.prototype.hasOwnProperty.call(this.config,"tools")||Object.keys(this.config.tools).length===0)throw Error("Can't start without tools");const e=this.prepareConfig();this.factory=new tn(e,this.config,this.Editor.API);const t=this.getListOfPrepareFunctions(e);if(t.length===0)return Promise.resolve();await Ot(t,o=>{this.toolPrepareMethodSuccess(o)},o=>{this.toolPrepareMethodFallback(o)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(t=>{Object.assign(e,t.sanitizeConfig)}),e}destroy(){Object.values(this.available).forEach(async e=>{D(e.reset)&&await e.reset()})}get internalTools(){return{bold:{class:Ue,isInternal:!0},italic:{class:$e,isInternal:!0},link:{class:We,isInternal:!0},paragraph:{class:Zo,inlineToolbar:!0,isInternal:!0},stub:{class:wt,isInternal:!0},moveUp:{class:Et,isInternal:!0},moveDown:{class:yt,isInternal:!0},delete:{class:Bt,isInternal:!0}}}toolPrepareMethodSuccess(e){const t=this.factory.get(e.toolName);if(t.isInline()){const n=["render","surround","checkState"].filter(i=>!t.create()[i]);if(n.length){L(`Incorrect Inline Tool: ${t.name}. Some of required methods is not implemented %o`,"warn",n),this.toolsUnavailable.set(t.name,t);return}}this.toolsAvailable.set(t.name,t)}toolPrepareMethodFallback(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}getListOfPrepareFunctions(e){const t=[];return Object.entries(e).forEach(([o,n])=>{t.push({function:D(n.class.prepare)?n.class.prepare:()=>{},data:{toolName:o,config:n.config}})}),t}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){if(this.config.inlineToolbar!==!1){if(e.enabledInlineTools===!0){e.inlineTools=new U(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(t=>[t,this.inlineTools.get(t)]):Array.from(this.inlineTools.entries()));return}Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new U(e.enabledInlineTools.map(t=>[t,this.inlineTools.get(t)])))}}assignBlockTunesToBlockTool(e){if(e.enabledBlockTunes!==!1){if(Array.isArray(e.enabledBlockTunes)){const t=new U(e.enabledBlockTunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new U([...t,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){const t=new U(this.config.tunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new U([...t,...this.blockTunes.internalTools]);return}e.tunes=this.blockTunes.internalTools}}validateTools(){for(const e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;const t=this.config.tools[e];if(!D(t)&&!D(t.class))throw Error(`Tool «${e}» must be a constructor function or an object with function in the «class» property`)}}prepareConfig(){const e={};for(const t in this.config.tools)F(this.config.tools[t])?e[t]=this.config.tools[t]:e[t]={class:this.config.tools[t]};return e}}ln([re],Tt.prototype,"getAllInlineToolsSanitizeConfig",1);const cn=`:root{--boxShadow1: 0 2px 8px rgb(0, 0, 0, .1);--boxShadow2: 0 8px 24px rgb(0, 0, 0, .1);--boxShadow3: 0 12px 40px rgb(0, 0, 0, .1);--blue0: #e7f5ff;--blue1: #d0ebff;--blue2: #afd8fb;--blue3: #84bff7;--blue4: #64abf1;--blue5: #4593fc;--blue6: #3182f6;--blue7: #1b64da;--blue8: #1f58b2;--blue9: #1a4aa6;--gray0: #f8f9fa;--gray1: #f1f3f5;--gray2: #e9ecef;--gray3: #dee2e6;--gray4: #ced4da;--gray5: #adb5bd;--gray6: #868e96;--gray7: #495057;--gray8: #343a40;--gray9: #212529;--red_12: rgb(249, 61, 63, .12);--redCloudy: #d78582;--red: #f93d3f;--redDark: #cb0101;--orange_12: rgb(255, 99, 60, .12);--orangeCloudy: #ed8e6a;--orange: #ff633c;--orangeDark: #e94600;--yellow_12: rgb(255, 202, 60, .12);--yellowCloudy: #f9e079;--yellow: #ffca3c;--yellowDark: #ba6100;--green_12: rgb(14, 184, 122, .12);--greenCloudy: #67c1a0;--green: #0eb87a;--greenDark: #00796e;--purple_12: rgb(115, 84, 230, .12);--purpleCloudy: #8e82d7;--purple: #7354e6;--purpleDark: #4f3292;--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1d202b;--color-active-icon: #388ae5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 12px;--icon-size--mobile: 12px;--block-padding-vertical: .4em;--color-line-gray: #eff0f1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 201px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 201px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 201px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0px;left:0px;right:0px;bottom:0px;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}@media (max-width: 200px){.ce-toolbar--opened{display:-webkit-box;display:-ms-flexbox;display:flex}}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}@media (max-width: 200px){.ce-toolbar__content{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-line-pack:center;align-content:center;margin:0;max-width:100%}}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0;height:100%}@media (max-width: 200px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}.ce-toolbar__plus--hidden{visibility:hidden}@media (max-width: 200px){.ce-toolbar__plus{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}.ce-toolbar__plus{position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a;border-radius:8px;z-index:2;position:static}@media (max-width: 200px){.ce-toolbar__plus{-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a}}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;height:26px}@media (max-width: 200px){.ce-toolbar__actions{position:absolute;right:auto;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 200px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;width:18px;height:100%;cursor:pointer;user-select:none}@media (max-width: 200px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 201px){.ce-toolbar__settings-btn{width:18px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 200px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a;border-radius:8px;z-index:2;position:static}@media (max-width: 200px){.ce-toolbar__settings-btn{-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a}}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:16px;height:16px}@media (min-width: 201px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 201px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{border-radius:4px!important}.ce-inline-toolbar{--y-offset: 8px;position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a;border-radius:8px;z-index:2;border:none;-webkit-transform:translateX(-50%) translateY(8px) scale(.9);transform:translate(-50%) translateY(8px) scale(.9);opacity:0;visibility:hidden;-webkit-transition:opacity .25s ease,-webkit-transform .15s ease;transition:opacity .25s ease,-webkit-transform .15s ease;transition:transform .15s ease,opacity .25s ease;transition:transform .15s ease,opacity .25s ease,-webkit-transform .15s ease;will-change:transform,opacity;top:0;left:0;z-index:3}@media (max-width: 200px){.ce-inline-toolbar{-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a}}.ce-inline-toolbar--left-oriented:before{left:15px;margin-left:0}.ce-inline-toolbar--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-inline-toolbar--showed{opacity:1;visibility:visible;-webkit-transform:translateX(-50%);transform:translate(-50%)}.ce-inline-toolbar--left-oriented{-webkit-transform:translateX(-23px) translateY(8px) scale(.94);transform:translate(-23px) translateY(8px) scale(.94)}.ce-inline-toolbar--left-oriented.ce-inline-toolbar--showed{-webkit-transform:translateX(-23px);transform:translate(-23px)}.ce-inline-toolbar--right-oriented{-webkit-transform:translateX(-100%) translateY(8px) scale(.94);transform:translate(-100%) translateY(8px) scale(.94);margin-left:23px}.ce-inline-toolbar--right-oriented.ce-inline-toolbar--showed{-webkit-transform:translateX(-100%);transform:translate(-100%)}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}.ce-inline-toolbar__buttons,.ce-inline-toolbar__actions{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__actions .unlink-button{font-size:11px!important}.ce-inline-toolbar__actions .unlink-button{background:inherit;border:none;-webkit-box-shadow:none;box-shadow:none;-webkit-tap-highlight-color:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;outline-style:none;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:end;font-weight:400;line-height:16px;color:#868e96;padding:8px 10px 8px 0;cursor:pointer;white-space:nowrap;min-width:60px}.ce-inline-toolbar__actions .unlink-button:focus{outline:0}.ce-inline-toolbar__actions input,.ce-inline-toolbar__actions .unlink-button{border-top:1px solid #dee2e6}.ce-inline-toolbar__dropdown{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;padding:0 10px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid #dee2e6;border-radius:4px 0 0 4px}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#e9ecef}}.ce-inline-toolbar__dropdown:active{background:#f1f3f5}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content{font-size:14px!important}.ce-inline-toolbar__dropdown-content{display:-webkit-box;display:-ms-flexbox;display:flex;font-weight:500}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex;margin-left:4px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{padding:0 10px!important}.ce-inline-tool{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:32px;height:32px;line-height:32px;text-align:center;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;border-radius:0;line-height:normal;width:auto;min-width:24px}.ce-inline-tool svg{width:12px;height:12px}@media (max-width: 200px){.ce-inline-tool svg{width:12px;height:12px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#eff2f5}}.ce-inline-tool--active{color:#4593fc}.ce-inline-tool--focused{background:rgba(34,186,255,.08)!important}.ce-inline-tool--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.ce-inline-tool--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.ce-inline-tool .icon{height:12px}.ce-inline-tool:last-child{border-radius:0 4px 4px 0}.ce-inline-tool:hover{background:#e9ecef}.ce-inline-tool:active{background:#f1f3f5}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{font-size:11px!important}.ce-inline-tool-input{outline:none;border:0;border-radius:0 0 4px 4px;margin:0;line-height:16px;padding:8px 5px 8px 10px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;color:#212529}.ce-inline-tool-input::-webkit-input-placeholder{color:#adb5bd}.ce-inline-tool-input::-moz-placeholder{color:#adb5bd}.ce-inline-tool-input:-ms-input-placeholder{color:#adb5bd}.ce-inline-tool-input::-ms-input-placeholder{color:#adb5bd}.ce-inline-tool-input::placeholder{color:#adb5bd}.ce-inline-tool-input--showed{display:block}.ce-conversion-toolbar{position:absolute;background-color:#fff;-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a;z-index:2;opacity:0;visibility:hidden;will-change:transform,opacity;-webkit-transition:opacity .1s ease,-webkit-transform .1s ease;transition:opacity .1s ease,-webkit-transform .1s ease;transition:transform .1s ease,opacity .1s ease;transition:transform .1s ease,opacity .1s ease,-webkit-transform .1s ease;-webkit-transform:translateY(-8px);transform:translateY(-8px);left:-1px;width:160px;margin-top:5px;-webkit-box-sizing:content-box;box-sizing:content-box;padding-bottom:8px;border-radius:4px;border:none}@media (max-width: 200px){.ce-conversion-toolbar{-webkit-box-shadow:0 8px 24px rgb(0,0,0,.1);box-shadow:0 8px 24px #0000001a}}.ce-conversion-toolbar--left-oriented:before{left:15px;margin-left:0}.ce-conversion-toolbar--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-conversion-toolbar--showed{opacity:1;visibility:visible;-webkit-transform:none;transform:none}.ce-conversion-toolbar [hidden]{display:none!important}.ce-conversion-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-conversion-toolbar__label{color:#868e96;font-size:11px;line-height:16px;padding:12px 12px 4px}.ce-conversion-tool{display:-webkit-box;display:-ms-flexbox;display:flex;padding:4px 14.5px 4px 12px;font-size:13px;line-height:18px;color:#343a40;cursor:pointer;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-conversion-tool--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.ce-conversion-tool:hover{background:#e9ecef}.ce-conversion-tool:active{background:#f1f3f5}.ce-conversion-tool__icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:20px;height:20px;border:.5px solid #dee2e6;border-radius:2px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:4px;background:#fff}.ce-conversion-tool__icon svg{color:#343a40}.ce-conversion-tool__check-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-left:auto;opacity:0;width:12px;height:8px}.ce-conversion-tool--current .ce-conversion-tool__check-icon{opacity:1}.ce-conversion-tool--current .ce-conversion-tool__check-icon svg{fill:#343a40}.ce-conversion-tool--last{margin-right:0!important}.ce-conversion-tool--active{color:#4593fc!important}.ce-conversion-tool--active{-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-conversion-tool__secondary-label{color:#707684;font-size:12px;margin-left:auto;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;margin-bottom:-2px;opacity:.6}@media (max-width: 200px){.ce-conversion-tool__secondary-label{display:none}}.ce-settings__button{padding:8px 16px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;cursor:pointer}.ce-settings__button:hover{background-color:#e9ecef}.ce-settings__button:active{background-color:#f1f3f5}.ce-settings__button-icon-container{width:20px;height:20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-settings__button-icon-container svg{fill:#868e96}.ce-settings__button-text{font-size:13px!important}.ce-settings__button-text{line-height:18px;color:#343a40;margin-left:4px;white-space:nowrap}.ce-settings__button-shortcut-text{font-size:11px!important}.ce-settings__button-shortcut-text{line-height:16px;color:#adb5bd;margin-left:auto}.ce-settings__button--disabled{cursor:not-allowed!important}.ce-settings__button--disabled{opacity:.3}.ce-settings__button--selected{color:#4593fc}@media (min-width: 201px){.codex-editor--narrow .ce-settings{left:44px}.codex-editor--narrow .ce-settings .ce-popover{right:0;left:auto;left:initial}}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #4593fc;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#4593fc;background:repeating-linear-gradient(90deg,#4593fc,#4593fc 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@media (min-width: 201px){.codex-editor--narrow .ce-block--focused{margin-right:-50px;padding-right:50px}}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{padding:0!important}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:32px;height:32px;line-height:32px;text-align:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0}.cdx-settings-button svg{width:12px;height:12px}@media (max-width: 200px){.cdx-settings-button svg{width:12px;height:12px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-settings-button--active{color:#4593fc}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button:not(:nth-child(3n + 3)){margin-right:3px}.cdx-settings-button:nth-child(n + 4){margin-top:3px}.cdx-settings-button--active svg{fill:#4593fc}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 200px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#4593fc;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #eff0f1;color:#707684;font-size:14px}.ce-stub svg{width:12px;height:12px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 200px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n + 3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 201px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0px;right:5px}}@media (min-width: 201px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:rgba(232,232,235,.49);border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{color:#707684}.cdx-search-field__input{font-size:14px!important}.cdx-search-field__input{outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 8px;--width: 220px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #e8e8eb;--color-shadow: rgba(0, 0, 0, .1);--color-background: white;--color-text-primary: var(--gray8);--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #eff0f1;--color-text-icon-active: #388ae5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #eff2f5;--color-background-item-confirm: #e24a4a;--color-background-item-confirm-hover: #ce4343;min-width:var(--width);width:var(--width);border-radius:var(--border-radius);-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0 8px 24px var(--color-shadow);box-shadow:0 8px 24px var(--color-shadow);position:absolute;left:44px;top:calc(100% + var(--offset-from-target));background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;pointer-events:none;padding:0;border:none}.ce-popover--opened{opacity:1;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;padding:8px 0}@media (max-width: 200px){.ce-popover--opened{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}@media (max-width: 200px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1d202b;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}.ce-popover--open-top{top:calc(-1 * (var(--offset-from-target) + var(--popover-height)))}@media (max-width: 200px){.ce-popover{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}.ce-popover .ce-popover__search{display:none}}.ce-popover__search,.ce-popover__custom-content:not(:empty){margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover__custom-content:not(:empty){padding:4px}@media (min-width: 201px){.ce-popover__custom-content:not(:empty){padding:0}}.ce-popover__custom-content--hidden{display:none}.ce-popover-item{--icon-size: 20px;--icon-size-mobile: 28px;padding:8px 16px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;cursor:pointer}@media (max-width: 200px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:20px;height:20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:4px}.ce-popover-item__icon svg{color:#868e96}@media (max-width: 200px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{color:#868e96}}.ce-popover-item__title{font-size:13px!important}.ce-popover-item__title{line-height:18px;color:#343a40;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;margin-left:auto;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;margin-bottom:-2px;opacity:.6}@media (max-width: 200px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer;background-color:#e9ecef}.ce-popover-item:hover:active{background-color:#f1f3f5}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}.ce-popover-item:hover .ce-popover-item__icon{-webkit-box-shadow:none;box-shadow:none}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__icon{color:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}.ce-popover-item--confirmation .ce-popover-item__icon,.ce-popover-item--active .ce-popover-item__icon,.ce-popover-item--focused .ce-popover-item__icon{-webkit-box-shadow:none;box-shadow:none}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}} +`;class dn extends T{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=void 0,this.resizeDebouncer=Rt(()=>{this.windowResize()},200)}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache)return this.contentRectCache;const e=this.nodes.wrapper.querySelector(`.${H.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.checkIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}checkEmptiness(){const{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o,ConversionToolbar:n}=this.Editor;return t.opened||o.opened||n.opened||e.toolbox.opened}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,t])=>t.flipper instanceof G).some(([e,t])=>t.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML=""}closeAllToolbars(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o,ConversionToolbar:n}=this.Editor;t.close(),o.close(),n.close(),e.toolbox.close()}checkIsMobile(){this.isMobile=window.innerWidth{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(this.nodes.redactor,"mousedown",e=>{this.documentTouched(e)},!0),this.readOnlyMutableListeners.on(this.nodes.redactor,"touchstart",e=>{this.documentTouched(e)},!0),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.readOnlyMutableListeners.on(document,"selectionchange",()=>{this.selectionChanged()},!0),this.readOnlyMutableListeners.on(window,"resize",()=>{this.resizeDebouncer()},{passive:!0}),this.watchBlockHoveredEvents()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",Be(t=>{const o=t.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||o&&e!==o&&(e=o,this.eventsDispatcher.emit(ut,{block:this.Editor.BlockManager.getBlockByChildNode(o)}))},20),{passive:!0})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.checkIsMobile()}documentKeydown(e){switch(e.keyCode){case B.ENTER:this.enterPressed(e);break;case B.BACKSPACE:case B.DELETE:this.backspacePressed(e);break;case B.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){const{currentBlock:t}=this.Editor.BlockManager,o=e.target.closest(`.${this.CSS.editorWrapper}`),n=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(t!==void 0&&o===null){this.Editor.BlockEvents.keydown(e);return}o||t&&n||(this.Editor.BlockManager.dropPointer(),this.Editor.Toolbar.close())}backspacePressed(e){const{BlockManager:t,BlockSelection:o,Caret:n}=this.Editor;if(o.anyBlockSelected&&!k.isSelectionExists){const i=t.removeSelectedBlocks();n.setToBlock(t.insertDefaultBlockAtIndex(i,!0),n.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.ConversionToolbar.opened?this.Editor.ConversionToolbar.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){const{BlockManager:t,BlockSelection:o}=this.Editor,n=t.currentBlockIndex>=0;if(o.anyBlockSelected&&!k.isSelectionExists){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&n&&e.target.tagName==="BODY"){const i=this.Editor.BlockManager.insert();this.Editor.Caret.setToBlock(i),this.Editor.BlockManager.highlightCurrentNode(),this.Editor.Toolbar.moveAndOpen(i)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){if(!e.isTrusted)return;const t=e.target;this.nodes.holder.contains(t)||k.isAtEditor||(this.Editor.BlockManager.dropPointer(),this.Editor.Toolbar.close());const n=this.Editor.BlockSettings.nodes.wrapper.contains(t),i=this.Editor.Toolbar.nodes.settingsToggler.contains(t),r=n||i;if(this.Editor.BlockSettings.opened&&!r){this.Editor.BlockSettings.close();const a=this.Editor.BlockManager.getBlockByChildNode(t);this.Editor.Toolbar.moveAndOpen(a)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let t=e.target;if(t===this.nodes.redactor){const o=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,n=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;t=document.elementFromPoint(o,n)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(t),this.Editor.BlockManager.highlightCurrentNode()}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){const{BlockSelection:t}=this.Editor;if(!k.isCollapsed)return;const o=()=>{e.stopImmediatePropagation(),e.stopPropagation()},n=e.target,i=e.metaKey||e.ctrlKey;if(d.isAnchor(n)&&i){o();const u=n.getAttribute("href"),h=Pt(u);Ft(h);return}const r=this.Editor.BlockManager.getBlockByIndex(-1),a=d.offset(r.holder).bottom,l=e.pageY;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!t.anyBlockSelected&&a{t=n,o=i}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();const{BlockManager:n,Caret:i,UI:r,ModificationsObserver:a}=this.moduleInstances;r.checkEmptiness(),a.enable(),this.configuration.autofocus&&(i.setToBlock(n.blocks[0],i.positions.START),n.highlightCurrentNode()),t()}).catch(n=>{L(`Editor.js is not ready because of ${n}`,"error"),o(n)})}set configuration(e){var o,n;F(e)?this.config={...e}:this.config={holder:e},Se(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=Ze.VERBOSE),Lt(this.config.logLevel),Se(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;const t={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(Z(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[t]}),this.config.readOnly=this.config.readOnly||!1,(o=this.config.i18n)!=null&&o.messages&&$.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((n=this.config.i18n)==null?void 0:n.direction)||"ltr"}get configuration(){return this.config}validate(){const{holderId:e,holder:t}=this.config;if(e&&t)throw Error("«holderId» and «holder» param can't assign at the same time.");if(Q(t)&&!d.get(t))throw Error(`element with ID «${t}» is missing. Pass correct holder's ID.`);if(t&&F(t)&&!d.isElement(t))throw Error("«holder» value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((t,o)=>t.then(async()=>{try{await this.moduleInstances[o].prepare()}catch(n){if(n instanceof tt)throw new Error(n.message);L(`Module ${o} was skipped because of %o`,"warn",n)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(hn).forEach(([e,t])=>{try{this.moduleInstances[e]=new t({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){L("[constructModules]",`Module ${e} skipped because`,"error",o)}})}configureModules(){for(const e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){const t={};for(const o in this.moduleInstances)o!==e&&(t[o]=this.moduleInstances[o]);return t}}/** + * Editor.js + * + * @license Apache-2.0 + * @see Editor.js + * @author CodeX Team + */class pn{static get version(){return"2.28.0-rc.3"}constructor(e){let t=()=>{};F(e)&&D(e.onReady)&&(t=e.onReady);const o=new un(e);this.isReady=o.isReady.then(()=>{this.exportAPI(o),t()})}exportAPI(e){const t=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(i=>{D(i.destroy)&&i.destroy(),i.listeners.removeAll()}),e=null;for(const i in this)Object.prototype.hasOwnProperty.call(this,i)&&delete this[i];Object.setPrototypeOf(this,null)};t.forEach(i=>{this[i]=e[i]}),this.destroy=o,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([i,r])=>{Object.entries(r).forEach(([a,l])=>{this[l]=e.moduleInstances.API.methods[i][a]})})}}return pn}); diff --git a/dist/editor.licenses.txt b/dist/vendor.LICENSE.txt similarity index 84% rename from dist/editor.licenses.txt rename to dist/vendor.LICENSE.txt index 8653d3f8e..0e4f15149 100644 --- a/dist/editor.licenses.txt +++ b/dist/vendor.LICENSE.txt @@ -1,31 +1,14 @@ -@babel/polyfill -MIT -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - +Name: @babel/register +Version: 7.21.0 +License: MIT +Private: false +Description: babel require hook +Repository: https://github.com/babel/babel.git +Homepage: https://babel.dev/docs/en/next/babel-register +Author: The Babel Team (https://babel.dev/team) +License Copyright: +=== -@babel/register -MIT MIT License Copyright (c) 2014-present Sebastian McKenzie and other contributors @@ -50,83 +33,53 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -@babel/runtime -MIT -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +--- +Name: nanoid +Version: 4.0.2 +License: MIT +Private: false +Description: A tiny (116 bytes), secure URL-friendly unique string ID generator +Repository: undefined +Author: Andrey Sitnik +License Copyright: +=== -@codexteam/shortcuts -MIT -MIT License +The MIT License (MIT) -Copyright (c) 2018 CodeX +Copyright 2017 Andrey Sitnik -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -@editorjs/paragraph -MIT -MIT License - -Copyright (c) 2018 CodeX - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +--- +Name: codex-notifier +Version: 1.1.2 +License: MIT +Private: false +Description: Simple notifications for your website +Repository: git+https://github.com/codex-team/js-notifier.git +Homepage: https://github.com/codex-team/js-notifier#readme +Author: CodeX Team +License Copyright: +=== -codex-notifier -MIT MIT License Copyright (c) 2017 CodeX @@ -150,41 +103,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -codex-tooltip -MIT -Copyright 2019 CodeX https://codex.so - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - +--- -core-js -MIT -Copyright (c) 2014-2020 Denis Pushkarev +Name: html-janitor +Version: 2.0.4 +License: null +Private: false +Repository: https://github.com/guardian/html-janitor.git +License Copyright: +=== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -html-janitor Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -388,35 +316,77 @@ Apache License limitations under the License. -nanoid -MIT -The MIT License (MIT) +--- -Copyright 2017 Andrey Sitnik +Name: codex-tooltip +Version: 1.0.5 +License: MIT +Private: false +Description: Simple tooltips module +Repository: git+https://github.com/codex-team/codex.tooltips +Homepage: https://github.com/codex-team/codex.tooltips +Author: CodeX +License Copyright: +=== -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +Copyright 2019 CodeX https://codex.so + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +--- + +Name: @codexteam/icons +Version: 0.3.0 +License: MIT +Private: false +Repository: git+https://github.com/codex-team/icon-pack.git +License Copyright: +=== + +MIT License + +Copyright (c) 2022 CodeX + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +--- +Name: @codexteam/shortcuts +Version: 1.2.0 +License: MIT +Private: false +Description: Library for handling keyboard shortcuts +Repository: git+https://github.com/codex-team/codex.shortcuts.git +Homepage: https://github.com/codex-team/codex.shortcuts#readme +Author: CodeX (https://codex.so) +License Copyright: +=== -regenerator-runtime -MIT MIT License -Copyright (c) 2014-present, Facebook, Inc. +Copyright (c) 2018 CodeX Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -435,3 +405,37 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +Name: @editorjs/paragraph +Version: 2.10.0 +License: MIT +Private: false +Description: Paragraph Tool for Editor.js +Repository: undefined +Author: CodeX +License Copyright: +=== + +MIT License + +Copyright (c) 2018 CodeX + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5aec72718..2bf0d40f1 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,11 +1,81 @@ # Changelog +### 2.28.0 + +- `New` - Block ids now displayed in DOM via a data-id attribute. Could be useful for plugins that want access a Block's element by id. +- `New` - The `blocks.convert(blockId, newType)` API method added. It allows to convert existing Block to a Block of another type. +- `New` - The `blocks.insertMany()` API method added. It allows to insert several Blocks to the specified index. +- `Improvement` - The Delete keydown at the end of the Block will now work opposite a Backspace at the start. Next Block will be removed (if empty) or merged with the current one. +- `Improvement` - The Delete keydown will work like a Backspace when several Blocks are selected. +- `Improvement` - If we have two empty Blocks, and press Backspace at the start of the second one, the previous will be removed instead of current. +- `Improvement` - Tools shortcuts could be used to convert one Block to another. +- `Improvement` - Tools shortcuts displayed in the Conversion Toolbar +- `Improvement` - Initialization Loader has been removed. +- `Improvement` - Selection style won't override your custom style for `::selection` outside the editor. +- `Improvement` - Performance optimizations: initialization speed increased, `blocks.render()` API method optimized. Big documents will be displayed faster. +- `Improvement` - "Editor saving" log removed +- `Improvement` - "I'm ready" log removed +- `Improvement` - The stub-block style simplified. +- `Improvement` - If some Block's tool will throw an error during construction, we will show Stub block instead of skipping it during render +- `Improvement` - Call of `blocks.clear()` now will trigger onChange with "block-removed" event for all removed blocks. +- `Improvement` - `BlockMutationType` and `BlockMutationEvent` types exported +- `Improvement` - `blocks.update(id, data)` now can accept partial data object — it will update only passed properties, others will remain the same. +- `Improvement` - `blocks.update(id, data)` now will trigger onChange with only `block-change` event. +- `Improvement` - `blocks.update(id, data)` will return a promise with BlockAPI object of changed block. + +### 2.27.2 + +- `Fix` - `onChange` won't be called when element with data-mutation-free changes some attribute + +### 2.27.1 + +- `Fix` - `onChange` will be called on removing the whole text in a block + +### 2.27.0 + +- `New` — *Toolbar API* — Added a new method for toggling the toolbox. +- `New` — Added types for block mutation events +- `New` — Batching added to the `onChange` callback. Now the second argument can contain an array of CustomEvents as well as a single one. Multiple changes made in a short period of time will be batched under a single `onChange` call. +- `Improvement` — *Toolbox* — Number of `close()` method calls optimized. +- `Improvement` — The `onChange` callback can be muted if all mutations contain nodes with the `data-mutation-free` attribute. +- `Improvement` — Pressing "Enter" at the end of a Block won't lead to redundant `block-changed` event triggering. Only `block-added` event will be dispatched. +- `Improvement` — The block mutation handler is now called on every block change (including background changes), instead of only when a block is focused +- `Improvement` — Number of caret saving method calls optimized for Block Tunes opening/closing. +- `Improvement` — Package size reduced by removing redundant files. +- `Refactoring` — Switched from Webpack to Vite as the build system. +- `Refactoring` — *Dependencies* — Upgraded Cypress to v12 and related libraries to the latest versions. +- `Refactoring` — *Dependencies* — Upgraded TypeScript to v5. +- `Refactoring` — `EventDispatcher` types improved. Now we can pass `EventsMap` via generic to specify a map of event names and their payloads that can be used in a particular EventDispatcher instance. +- `Refactoring` — All events in common editor Event Bus now have own type declarations. +- `Refactoring` — Removed the block mutation observer from blocks and attached a single observer to the editor's blocks wrapper element. +- `Refactoring` — Removed the debounce from the block mutation handler and used batching instead. +- `Refactoring` — Refactored the popover class for better performance and maintenance. +- `Fix` — The `onChange` callback won't trigger when block tunes are opened or closed. +- `Fix` — Resolved a compiler error caused by importing the `BlockToolData` type. +- `Fix` — Resolved a problem where the document would scroll to the beginning after moving a block above the viewport. +- `Fix`- Fixed several bugs caused by browser extensions — Removed the search for a block's container in the DOM on saving and kept it in memory instead, updating it when the tool changes a container element. +- `Fix` — *ToolsAPI* — `pasteConfig` getter with `false` value could be used to disable paste handling by Editor.js core. Could be useful if your tool has its own paste handler. +- `CI` — Ubuntu container is now used for Edge tests runner. +- `CI` — Node 16 is used for GitHib Actions. + +### 2.26.5 + +- `Fix` — *Types* — Remove unnecessary import that creates a dependency on the `cypress`. + +### 2.26.4 + +- `Improvement` — *Menu Config* — Property `label` renamed to `title`. + +### 2.26.3 + +- `Fix` — *Paste Module* — fix for a problem with specifying of `pasteConfig().tags` in upper case [#2208](https://github.com/codex-team/editor.js/issues/2208). ### 2.26.2 - `Fix` — *Menu Config* — Installed tunes are rendered above default tunes again. ### 2.26.1 + - `Improvement` — *Menu Config* — Now it becomes possible to create toggle groups. ### 2.26.0 @@ -27,6 +97,7 @@ - `Improvement` — *CodeStyle* — [CodeX ESLint Config](https://github.com/codex-team/eslint-config) has bee updated. All ESLint/Spelling issues resolved - `Improvement` — *ToolsAPI* — The `icon` property of the `toolbox` getter became optional. + ### 2.25.0 - `New` — *Tools API* — Introducing new feature — toolbox now can have multiple entries for one tool!
diff --git a/docs/api.md b/docs/api.md index 3f009185d..3111cbf8d 100644 --- a/docs/api.md +++ b/docs/api.md @@ -180,7 +180,7 @@ this.api.notifier.show({ }); ``` -![](https://capella.pics/14fcdbe4-d6eb-41d4-b66e-e0e86ccf1a4b.jpg) +![](assets/14fcdbe4-d6eb-41d4-b66e-e0e86ccf1a4b.jpg) Check out [`codex-notifier` package page](https://github.com/codex-team/js-notifier) on GitHub to find docs, params and examples. @@ -203,8 +203,6 @@ After executing the `destroy` method, editor inctance becomes an empty object. T Methods for showing Tooltip helper near your elements. Parameters are the same as in [CodeX Tooltips](http://github.com/codex-team/codex.tooltips) lib. -![](https://capella.pics/00e7094a-fdb9-429b-8015-9c56f19b4ef5.jpg) - #### Show Method shows tooltip with custom content on passed element diff --git a/docs/assets/01a55381-46cd-47c7-b92e-34765434f2ca.jpg b/docs/assets/01a55381-46cd-47c7-b92e-34765434f2ca.jpg new file mode 100644 index 000000000..cd81469f7 Binary files /dev/null and b/docs/assets/01a55381-46cd-47c7-b92e-34765434f2ca.jpg differ diff --git a/docs/assets/14fcdbe4-d6eb-41d4-b66e-e0e86ccf1a4b.jpg b/docs/assets/14fcdbe4-d6eb-41d4-b66e-e0e86ccf1a4b.jpg new file mode 100644 index 000000000..803ac0281 Binary files /dev/null and b/docs/assets/14fcdbe4-d6eb-41d4-b66e-e0e86ccf1a4b.jpg differ diff --git a/docs/assets/57267bab-f2f0-411b-a9d1-69abee6abab5.jpg b/docs/assets/57267bab-f2f0-411b-a9d1-69abee6abab5.jpg new file mode 100644 index 000000000..beb554a8d Binary files /dev/null and b/docs/assets/57267bab-f2f0-411b-a9d1-69abee6abab5.jpg differ diff --git a/docs/assets/6c1f708b-a30c-4ffd-a427-5b59a1a472e0.jpg b/docs/assets/6c1f708b-a30c-4ffd-a427-5b59a1a472e0.jpg new file mode 100644 index 000000000..a0018baa7 Binary files /dev/null and b/docs/assets/6c1f708b-a30c-4ffd-a427-5b59a1a472e0.jpg differ diff --git a/docs/assets/796de9eb-bbe0-485c-bc8f-9a4cb76641b7.jpg b/docs/assets/796de9eb-bbe0-485c-bc8f-9a4cb76641b7.jpg new file mode 100644 index 000000000..b05ac15a9 Binary files /dev/null and b/docs/assets/796de9eb-bbe0-485c-bc8f-9a4cb76641b7.jpg differ diff --git a/docs/assets/79ce946a-d636-41cd-aa96-d3bc5ecfde03.jpg b/docs/assets/79ce946a-d636-41cd-aa96-d3bc5ecfde03.jpg new file mode 100644 index 000000000..8430c5f94 Binary files /dev/null and b/docs/assets/79ce946a-d636-41cd-aa96-d3bc5ecfde03.jpg differ diff --git a/docs/assets/7ccbcfcd-1c49-4674-bea7-71021468a1bd.jpg b/docs/assets/7ccbcfcd-1c49-4674-bea7-71021468a1bd.jpg new file mode 100644 index 000000000..f5960e89a Binary files /dev/null and b/docs/assets/7ccbcfcd-1c49-4674-bea7-71021468a1bd.jpg differ diff --git a/docs/releases.md b/docs/releases.md index 675aaac60..a0fc44d7d 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -33,7 +33,7 @@ There is a [workflow](.github/workflows/publish-package-to-npm.yml) that fired o Use target version changelog as a description. -![](https://capella.pics/57267bab-f2f0-411b-a9d1-69abee6abab5.jpg) +![](assets/57267bab-f2f0-411b-a9d1-69abee6abab5.jpg) Then you can publish the release and wait for package publishing via action. @@ -44,7 +44,7 @@ This package version will be published to NPM with default `latest` tag. If you want to publish release candidate version, use suffix `-rc.*` for package version in package.json file and in tag on releases page. Workflow will detect it and mark a release as "pre-release". -![](https://capella.pics/796de9eb-bbe0-485c-bc8f-9a4cb76641b7.jpg) +![](assets/796de9eb-bbe0-485c-bc8f-9a4cb76641b7.jpg) This package version will be published to NPM with `next` tag. diff --git a/docs/tools-inline.md b/docs/tools-inline.md index d76e35307..604a5e4c8 100644 --- a/docs/tools-inline.md +++ b/docs/tools-inline.md @@ -129,8 +129,6 @@ Read more about Sanitizer configuration at the [Tools#sanitize](tools.md#sanitiz You can pass your Tool's title via `title` static getter. It can be used, for example, in the Tooltip with icon description that appears by hover. -![](https://capella.pics/00e7094a-fdb9-429b-8015-9c56f19b4ef5.jpg) - ```ts export default class BoldInlineTool implements InlineTool { /** diff --git a/docs/tools.md b/docs/tools.md index 7df5ceb64..fef129ed6 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -410,7 +410,7 @@ static get sanitize() { Editor.js has a Conversion Toolbar that allows user to convert one Block to another. -![](https://capella.pics/6c1f708b-a30c-4ffd-a427-5b59a1a472e0.jpg) +![](assets/6c1f708b-a30c-4ffd-a427-5b59a1a472e0.jpg) 1. You can add ability to your Tool to be converted. Specify «export» property of `conversionConfig`. 2. You can add ability to convert other Tools to your Tool. Specify «import» property of `conversionConfig`. diff --git a/docs/usage.md b/docs/usage.md index 5bb43c08f..f1fb4dd98 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -17,12 +17,12 @@ So how to use the Editor after [Installation](installation.md). - Select text fragment and apply a style or insert a link from the Inline Toolbar -![](https://capella.pics/7ccbcfcd-1c49-4674-bea7-71021468a1bd.jpg) +![](assets/7ccbcfcd-1c49-4674-bea7-71021468a1bd.jpg) - Use «three-dots» button on the right to open Block Settings. From here, you can move and delete a Block or apply Tool's settings, if it provided. For example, set a Heading level or List style. -![](https://capella.pics/01a55381-46cd-47c7-b92e-34765434f2ca.jpg) +![](assets/01a55381-46cd-47c7-b92e-34765434f2ca.jpg) ## Shortcuts diff --git a/example/example-dev.html b/example/example-dev.html index 04e584baa..3dc2fc5cf 100644 --- a/example/example-dev.html +++ b/example/example-dev.html @@ -13,8 +13,8 @@ href="https://fonts.googleapis.com/css?family=PT+Mono" rel="stylesheet" /> - - + +
Editor.js 🤩🧦🤨
@@ -142,7 +142,7 @@ diff --git a/example/example-i18n.html b/example/example-i18n.html index 930dbaef8..bc1aaf7a9 100644 --- a/example/example-i18n.html +++ b/example/example-i18n.html @@ -10,8 +10,8 @@ Editor.js 🤩🧦🤨 example - - + + @@ -61,7 +61,7 @@ - + + diff --git a/example/example-popup.html b/example/example-popup.html index 2579d27b3..e59fd6cd7 100644 --- a/example/example-popup.html +++ b/example/example-popup.html @@ -9,7 +9,7 @@ Editor.js 🤩🧦🤨 example: Popup - + @@ -111,7 +111,7 @@

- + diff --git a/example/example-rtl.html b/example/example-rtl.html index 298381dc2..abeab23b4 100644 --- a/example/example-rtl.html +++ b/example/example-rtl.html @@ -9,8 +9,8 @@ Editor.js RTL example - - + + @@ -70,7 +70,7 @@ - + + + diff --git a/index.html b/index.html new file mode 100644 index 000000000..03037f39d --- /dev/null +++ b/index.html @@ -0,0 +1,411 @@ + + + + + Editor.js 🤩🧦🤨 example + + + + + + + +
+ +
+
+
+ editor.save() +
+
+
+ Readonly: + + Off + +   +
+ toggle +
+
+
+
+ Show + blocks boundaries +
+
+
+
+ Enable + thin mode +
+
+
+
+
+
+
+
+
+

+
+      
+    
+
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/package.json b/package.json index dc197cc8c..b68bdb35e 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "@editorjs/editorjs", - "version": "2.26.2", + "version": "2.28.0-rc.3", "description": "Editor.js — Native JS, based on API and Open Source", - "main": "dist/editor.js", + "main": "dist/editorjs.umd.js", + "module": "dist/editorjs.mjs", "types": "./types/index.d.ts", "keywords": [ "codex editor", @@ -12,16 +13,12 @@ "editorjs" ], "scripts": { - "clear": "rimraf dist && mkdirp dist", - "build": "yarn clear && yarn build:webpack:prod", - "build:dev": "yarn clear && yarn build:webpack:dev", - "build:webpack:dev": "webpack --mode development --progress --display-error-details --display-entrypoints --watch", - "build:webpack:prod": "webpack --mode production", + "dev": "vite", + "build": "vite build", "lint": "eslint src/ --ext .ts && yarn lint:tests", "lint:errors": "eslint src/ --ext .ts --quiet", "lint:fix": "eslint src/ --ext .ts --fix", "lint:tests": "eslint test/ --ext .ts", - "ci:pull_paragraph": "git submodule update --init ./src/tools/paragraph", "pull_tools": "git submodule update --init --recursive", "_tools:checkout": "git submodule foreach \"git checkout master || git checkout main\"", "_tools:pull": "git submodule foreach git pull", @@ -40,64 +37,41 @@ "url": "git+https://github.com/codex-team/editor.js.git" }, "devDependencies": { - "@babel/core": "^7.9.0", - "@babel/plugin-transform-runtime": "^7.9.0", - "@babel/polyfill": "^7.8.7", - "@babel/preset-env": "^7.9.5", - "@babel/preset-typescript": "^7.13.0", - "@babel/register": "^7.9.0", - "@babel/runtime": "^7.9.2", + "@babel/register": "^7.21.0", + "@codexteam/icons": "^0.3.0", "@codexteam/shortcuts": "^1.1.1", - "@cypress/code-coverage": "^3.9.2", - "@cypress/webpack-preprocessor": "^5.6.0", + "@cypress/code-coverage": "^3.10.3", "@editorjs/code": "^2.7.0", "@editorjs/delimiter": "^1.2.0", - "@editorjs/header": "^2.6.1", + "@editorjs/header": "^2.7.0", + "@editorjs/paragraph": "^2.10.0", "@editorjs/simple-image": "^1.4.1", - "@types/node": "^14.14.35", - "@types/webpack": "^4.41.12", - "@types/webpack-env": "^1.15.2", - "babel-loader": "^8.1.0", - "babel-plugin-add-module-exports": "^1.0.0", - "babel-plugin-class-display-name": "^2.1.0", - "babel-plugin-istanbul": "^6.0.0", - "core-js": "3.6.5", - "css-loader": "^3.5.3", - "cssnano": "^4.1.10", - "cypress": "^6.8.0", - "cypress-intellij-reporter": "^0.0.6", - "eslint": "^8.28.0", + "@types/node": "^18.15.11", + "chai-subset": "^1.6.0", + "codex-notifier": "^1.1.2", + "codex-tooltip": "^1.0.5", + "core-js": "3.30.0", + "cypress": "^12.9.0", + "cypress-intellij-reporter": "^0.0.7", + "cypress-terminal-report": "^5.3.2", + "eslint": "^8.37.0", "eslint-config-codex": "^1.7.1", - "eslint-loader": "^4.0.2", "eslint-plugin-chai-friendly": "^0.7.2", - "eslint-plugin-cypress": "^2.12.1", - "extract-text-webpack-plugin": "^3.0.2", - "license-webpack-plugin": "^2.1.4", - "mkdirp": "^1.0.4", + "eslint-plugin-cypress": "2.12.1", + "html-janitor": "^2.0.4", + "nanoid": "^4.0.2", "postcss-apply": "^0.12.0", - "postcss-import": "^12.0.1", - "postcss-loader": "^3.0.0", - "postcss-nested": "^4.1.2", - "postcss-nested-ancestors": "^2.0.0", - "postcss-preset-env": "^6.6.0", - "rimraf": "^3.0.2", - "stylelint": "^13.3.3", - "terser-webpack-plugin": "^2.3.6", - "ts-loader": "^7.0.1", + "postcss-nested": "4.1.2", + "postcss-preset-env": "^8.3.0", + "rollup-plugin-license": "^3.0.1", + "stylelint": "^15.4.0", "tslint": "^6.1.1", - "typescript": "3.8.3", - "webpack": "^4.43.0", - "webpack-cli": "^3.3.11" + "typescript": "5.0.3", + "vite": "^4.2.1", + "vite-plugin-css-injected-by-js": "^3.1.0" }, "collective": { "type": "opencollective", "url": "https://opencollective.com/editorjs" - }, - "dependencies": { - "@codexteam/icons": "^0.0.4", - "codex-notifier": "^1.1.2", - "codex-tooltip": "^1.0.5", - "html-janitor": "^2.0.4", - "nanoid": "^3.1.22" } } diff --git a/example/assets/codex2x.png b/public/assets/codex2x.png similarity index 100% rename from example/assets/codex2x.png rename to public/assets/codex2x.png diff --git a/example/assets/demo.css b/public/assets/demo.css similarity index 100% rename from example/assets/demo.css rename to public/assets/demo.css diff --git a/example/assets/json-preview.js b/public/assets/json-preview.js similarity index 100% rename from example/assets/json-preview.js rename to public/assets/json-preview.js diff --git a/src/codex.ts b/src/codex.ts index 8d1a7e2e4..991e43308 100644 --- a/src/codex.ts +++ b/src/codex.ts @@ -7,7 +7,7 @@ import { EditorConfig } from '../types'; */ import '@babel/register'; -import 'components/polyfills'; +import './components/polyfills'; import Core from './components/core'; import * as _ from './components/utils'; @@ -16,11 +16,9 @@ declare const VERSION: string; /** * Editor.js * - * Short Description (눈_눈;) - * - * @version 2.18.0 * @license Apache-2.0 - * @author CodeX-Team + * @see Editor.js + * @author CodeX Team */ export default class EditorJS { /** diff --git a/src/components/__module.ts b/src/components/__module.ts index c5391422e..4ad521adf 100644 --- a/src/components/__module.ts +++ b/src/components/__module.ts @@ -3,6 +3,7 @@ import { EditorConfig } from '../../types'; import { ModuleConfig } from '../types-internal/module-config'; import Listeners from './utils/listeners'; import EventsDispatcher from './utils/events'; +import { EditorEventMap } from './events'; /** * The type of the Module generic. @@ -42,7 +43,7 @@ export default class Module> /** * Editor event dispatcher class */ - protected eventsDispatcher: EventsDispatcher; + protected eventsDispatcher: EventsDispatcher; /** * Util for bind/unbind DOM event listeners diff --git a/src/components/block-tunes/block-tune-delete.ts b/src/components/block-tunes/block-tune-delete.ts index 92264178d..346651f24 100644 --- a/src/components/block-tunes/block-tune-delete.ts +++ b/src/components/block-tunes/block-tune-delete.ts @@ -3,10 +3,11 @@ * @classdesc Editor's default tune that moves up selected block * @copyright 2018 */ -import { API, BlockTune, PopoverItem } from '../../../types'; -// import { IconCross } from '@codexteam/icons'; + +import { API, BlockTune } from "../../../types"; +import { TunesMenuConfig } from "../../../types/tools"; const IconCross = ` - + `; /** @@ -37,11 +38,11 @@ export default class DeleteTune implements BlockTune { /** * Tune's appearance in block settings menu */ - public render(): PopoverItem { + public render(): TunesMenuConfig { return { icon: IconCross, - label: this.api.i18n.t('Delete'), - name: 'delete', + title: this.api.i18n.t("Delete"), + name: "delete", onActivate: (): void => this.handleClick(), }; } diff --git a/src/components/block-tunes/block-tune-move-down.ts b/src/components/block-tunes/block-tune-move-down.ts index d8c7f3ab2..ccecd8b22 100644 --- a/src/components/block-tunes/block-tune-move-down.ts +++ b/src/components/block-tunes/block-tune-move-down.ts @@ -4,14 +4,14 @@ * @copyright 2018 */ -import { API, BlockTune, PopoverItem } from '../../../types'; -import Popover from '../utils/popover'; +import { API, BlockTune, PopoverItem } from "../../../types"; +import Popover from "../utils/popover"; +import { TunesMenuConfig } from "../../../types/tools"; // import { IconChevronDown } from '@codexteam/icons'; const IconChevronDown = ` - + `; - /** * */ @@ -32,7 +32,7 @@ export default class MoveDownTune implements BlockTune { * Styles */ private CSS = { - animation: 'wobble', + animation: "wobble", }; /** @@ -47,38 +47,25 @@ export default class MoveDownTune implements BlockTune { /** * Tune's appearance in block settings menu */ - public render(): PopoverItem { + public render(): TunesMenuConfig { return { icon: IconChevronDown, - label: this.api.i18n.t('Move down'), - onActivate: (item, event): void => this.handleClick(event), - name: 'move-down', + title: this.api.i18n.t("Move down"), + onActivate: (): void => this.handleClick(), + name: "move-down", }; } /** * Handle clicks on 'move down' button - * - * @param event - click event */ - public handleClick(event: MouseEvent): void { + public handleClick(): void { const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); const nextBlock = this.api.blocks.getBlockByIndex(currentBlockIndex + 1); // If Block is last do nothing if (!nextBlock) { - const button = (event.target as HTMLElement) - .closest('.' + Popover.CSS.item) - .querySelector('.' + Popover.CSS.itemIcon); - - button.classList.add(this.CSS.animation); - - window.setTimeout(() => { - button.classList.remove(this.CSS.animation); - // eslint-disable-next-line @typescript-eslint/no-magic-numbers - }, 500); - - return; + throw new Error("Unable to move Block down since it is already the last"); } const nextBlockElement = nextBlock.holder; diff --git a/src/components/block-tunes/block-tune-move-up.ts b/src/components/block-tunes/block-tune-move-up.ts index a43bc5130..35a3dd993 100644 --- a/src/components/block-tunes/block-tune-move-up.ts +++ b/src/components/block-tunes/block-tune-move-up.ts @@ -3,11 +3,12 @@ * @classdesc Editor's default tune that moves up selected block * @copyright 2018 */ -import { API, BlockTune, PopoverItem } from '../../../types'; -import Popover from '../../components/utils/popover'; +import { API, BlockTune, PopoverItem } from "../../../types"; +import Popover from "../../components/utils/popover"; +import { TunesMenuConfig } from "../../../types/tools"; // import { IconChevronUp } from '@codexteam/icons'; const IconChevronUp = ` - + `; /** @@ -30,7 +31,7 @@ export default class MoveUpTune implements BlockTune { * Styles */ private CSS = { - animation: 'wobble', + animation: "wobble", }; /** @@ -45,21 +46,19 @@ export default class MoveUpTune implements BlockTune { /** * Tune's appearance in block settings menu */ - public render(): PopoverItem { + public render(): TunesMenuConfig { return { icon: IconChevronUp, - label: this.api.i18n.t('Move up'), - onActivate: (item, e): void => this.handleClick(e), - name: 'move-up', + title: this.api.i18n.t("Move up"), + onActivate: (): void => this.handleClick(), + name: "move-up", }; } /** * Move current block up - * - * @param {MouseEvent} event - click event */ - public handleClick(event: MouseEvent): void { + public handleClick(): void { const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); const previousBlock = this.api.blocks.getBlockByIndex( @@ -67,18 +66,7 @@ export default class MoveUpTune implements BlockTune { ); if (currentBlockIndex === 0 || !currentBlock || !previousBlock) { - const button = (event.target as HTMLElement) - .closest('.' + Popover.CSS.item) - .querySelector('.' + Popover.CSS.itemIcon); - - button.classList.add(this.CSS.animation); - - window.setTimeout(() => { - button.classList.remove(this.CSS.animation); - // eslint-disable-next-line @typescript-eslint/no-magic-numbers - }, 500); - - return; + throw new Error("Unable to move Block up since it is already the first"); } const currentBlockElement = currentBlock.holder; @@ -93,7 +81,7 @@ export default class MoveUpTune implements BlockTune { * than we scroll window to the difference between this offsets. */ const currentBlockCoords = currentBlockElement.getBoundingClientRect(), - previousBlockCoords = previousBlockElement.getBoundingClientRect(); + previousBlockCoords = previousBlockElement.getBoundingClientRect(); let scrollUpOffset; @@ -102,9 +90,7 @@ export default class MoveUpTune implements BlockTune { Math.abs(currentBlockCoords.top) - Math.abs(previousBlockCoords.top); } else { scrollUpOffset = - window.innerHeight - - Math.abs(currentBlockCoords.top) + - Math.abs(previousBlockCoords.top); + Math.abs(currentBlockCoords.top) + previousBlockCoords.height; } window.scrollBy(0, -1 * scrollUpOffset); diff --git a/src/components/block/index.ts b/src/components/block/index.ts index 3d81c2dc6..b47fe7811 100644 --- a/src/components/block/index.ts +++ b/src/components/block/index.ts @@ -21,6 +21,11 @@ import BlockTune from '../tools/tune'; import { BlockTuneData } from '../../../types/block-tunes/block-tune-data'; import ToolsCollection from '../tools/collection'; import EventsDispatcher from '../utils/events'; +import { TunesMenuConfigItem } from '../../../types/tools'; +import { isMutationBelongsToElement } from '../utils/mutations'; +import { EditorEventMap, FakeCursorAboutToBeToggled, FakeCursorHaveBeenSet, RedactorDomChanged } from '../events'; +import { RedactorDomChangedPayload } from '../events/RedactorDomChanged'; +import { convertBlockDataToString } from '../utils/blocks'; /** * Interface describes Block class constructor argument @@ -83,9 +88,11 @@ export enum BlockToolAPI { } /** - * Names of events supported by Block class + * Names of events used in Block */ -type BlockEvents = 'didMutated'; +interface BlockEvents { + 'didMutated': Block, +} /** * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance @@ -152,6 +159,11 @@ export default class Block extends EventsDispatcher { */ private cachedInputs: HTMLElement[] = []; + /** + * We'll store a reference to the tool's rendered element to access it later + */ + private toolRenderedElement: HTMLElement | null = null; + /** * Tool class instance */ @@ -186,53 +198,14 @@ export default class Block extends EventsDispatcher { private inputIndex = 0; /** - * Mutation observer to handle DOM mutations - * - * @type {MutationObserver} + * Common editor event bus */ - private mutationObserver: MutationObserver; + private readonly editorEventBus: EventsDispatcher | null = null; /** - * Debounce Timer - * - * @type {number} + * Link to editor dom change callback. Used to remove listener on remove */ - private readonly modificationDebounceTimer = 450; - - /** - * Is fired when DOM mutation has been happened - */ - private didMutated = _.debounce((mutationsOrInputEvent: MutationRecord[] | InputEvent = []): void => { - const shouldFireUpdate = mutationsOrInputEvent instanceof InputEvent || - !mutationsOrInputEvent.some(({ - addedNodes = [], - removedNodes, - }) => { - return [...Array.from(addedNodes), ...Array.from(removedNodes)] - .some(node => $.isElement(node) && (node as HTMLElement).dataset.mutationFree === 'true'); - }); - - /** - * In case some mutation free elements are added or removed, do not trigger didMutated event - */ - if (!shouldFireUpdate) { - return; - } - - /** - * Drop cache - */ - this.cachedInputs = []; - - /** - * Update current input - */ - this.updateCurrentInput(); - - this.call(BlockToolAPI.UPDATED); - - this.emit('didMutated', this); - }, this.modificationDebounceTimer); + private redactorDomChangedCallback: (payload: RedactorDomChangedPayload) => void; /** * Current block API interface @@ -240,12 +213,13 @@ export default class Block extends EventsDispatcher { private readonly blockAPI: BlockAPIInterface; /** - * @param {object} options - block constructor options - * @param {string} [options.id] - block's id. Will be generated if omitted. - * @param {BlockToolData} options.data - Tool's initial data - * @param {BlockTool} options.tool — block's tool + * @param options - block constructor options + * @param [options.id] - block's id. Will be generated if omitted. + * @param options.data - Tool's initial data + * @param options.tool — block's tool * @param options.api - Editor API module for pass it to the Block Tunes - * @param {boolean} options.readOnly - Read-Only flag + * @param options.readOnly - Read-Only flag + * @param [eventBus] - Editor common event bus. Allows to subscribe on some Editor events. Could be omitted when "virtual" Block is created. See BlocksAPI@composeBlockData. */ constructor({ id = _.generateBlockId(), @@ -254,7 +228,7 @@ export default class Block extends EventsDispatcher { api, readOnly, tunesData, - }: BlockConstructorOptions) { + }: BlockConstructorOptions, eventBus?: EventsDispatcher) { super(); this.name = tool.name; @@ -262,10 +236,9 @@ export default class Block extends EventsDispatcher { this.settings = tool.settings; this.config = tool.settings.config || {}; this.api = api; + this.editorEventBus = eventBus || null; this.blockAPI = new BlockAPI(this); - this.mutationObserver = new MutationObserver(this.didMutated); - this.tool = tool; this.toolInstance = tool.create(data, this.blockAPI, readOnly); @@ -277,6 +250,22 @@ export default class Block extends EventsDispatcher { this.composeTunes(tunesData); this.holder = this.compose(); + + /** + * Bind block events in RIC for optimizing of constructing process time + */ + window.requestIdleCallback(() => { + /** + * Start watching block mutations + */ + this.watchBlockMutations(); + + /** + * Mutation observer doesn't track changes in "" and "