trilium/libraries/ckeditor/ckeditor.js

6 lines
933 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"%0 of %1":"%0 of %1","Align cell text to the bottom":"Align cell text to the bottom","Align cell text to the center":"Align cell text to the center","Align cell text to the left":"Align cell text to the left","Align cell text to the middle":"Align cell text to the middle","Align cell text to the right":"Align cell text to the right","Align cell text to the top":"Align cell text to the top","Align table to the left":"Align table to the left","Align table to the right":"Align table to the right",Alignment:"Alignment",Aquamarine:"Aquamarine",Background:"Background",Big:"Big",Black:"Black","Block quote":"Block quote",Blue:"Blue",Bold:"Bold",Border:"Border","Break text":"Break text","Bulleted List":"Bulleted List","Bulleted list styles toolbar":"Bulleted list styles toolbar",Cancel:"Cancel","Cannot upload file:":"Cannot upload file:","Cell properties":"Cell properties","Center table":"Center table","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Choose heading":"Choose heading",Circle:"Circle",Code:"Code",Color:"Color","Color picker":"Color picker",Column:"Column",Dashed:"Dashed",Decimal:"Decimal","Decimal with leading zero":"Decimal with leading zero","Decrease indent":"Decrease indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"Dimensions",Disc:"Disc","Document colors":"Document colors",Dotted:"Dotted",Double:"Double",Downloadable:"Downloadable","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Editor toolbar":"Editor toolbar","Enter image caption":"Enter image caption","Enter table caption":"Enter table caption",Find:"Find","Find and replace":"Find and replace","Find in text…":"Find in text…","Font Background Color":"Font Background Color","Font Color":"Font Color","Font Family":"Font Family","Font Size":"Font Size","Full size image":"Full size image",Green:"Green",Grey:"Grey",Groove:"Groove","Header column":"Header column","Header row":"Header row",Heading:"Heading","Heading 1":"Heading 1","Heading 2":"Heading 2","Heading 3":"Heading 3","Heading 4":"Heading 4","Heading 5":"Heading 5","Heading 6":"Heading 6",Height:"Height","Horizontal line":"Horizontal line","Horizontal text alignment toolbar":"Horizontal text alignment toolbar",Huge:"Huge","Image resize list":"Image resize list","Image toolbar":"Image toolbar","image widget":"image widget","In line":"In line","Increase indent":"Increase indent","Insert code block":"Insert code block","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert image":"Insert image","Insert paragraph after block":"Insert paragraph after block","Insert paragraph before block":"Insert paragraph before block","Insert row above":"Insert row above","Insert row below":"Insert row below","Insert table":"Insert table",Inset:"Inset",Italic:"Italic","Justify cell text":"Justify cell text","Left aligned image":"Left aligned image","Light blue":"Light blue","Light green":"Light green","Light grey":"Light grey",Link:"Link","Link URL":"Link URL","Lower-latin":"Lower-latin","Lowerroman":"Lowerroman","Match case":"Match case","Merge cell down":"Merge cell down","Merge cell left":"Merge cell left","Merge cell right":"Merge cell right","Merge cell up":"Merge cell up","Merge cells":"Merge cells",Next:"Next","Next result":"Next result",None:"None","Numbered List":"Numbered List","Numbered list styles toolbar":"Numbered list styles toolbar","Open in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab",Orange:"Orange",Original:"Original",Outset:"Outset",Padding:"Padding",Paragraph:"Paragraph","Plain text":"Plain text",Previous:"Previous","Previous result":"Previous result",Purple:"Purple",Red:"Red",Redo:"Redo","Remove color":"Remove color","Remove Format":"Remove Format",Replace:"Replace","Replace all":"Replace all","Replace with…":"Replace with…","Resize image":"Resize image","Resize image to %0":"Resize image to %0","Resize image to the original size":"Resize image to the original size","Restore default":"Restore default","Rich Text Editor":"Rich Text Editor","Rich Text Editor, %0":"Rich Text Editor, %0",Ridge:"Ridge","Right aligned image":"Right aligned image",Row:"Row",Save:"Save","Select all":"Select all","Select column":"Select column","Select row":"Select row","Show more items":"Show more items","Show options":"Show options","Side image":"Side image",Small:"Small",Solid:"Solid","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",Square:"Square",Strikethrough:"Strikethrough",Style:"Style",Subscript:"Subscript",Superscript:"Superscript","Table alignment toolbar":"Table alignment toolbar","Table cell text alignment":"Table cell text alignment","Table properties":"Table properties","Table toolbar":"Table toolbar","Text alternative":"Text alternative","Text to find must not be empty.":"Text to find must not be empty.",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".','The value is invalid. Try "10px" or "2em" or simply "2".':'The value is invalid. Try "10px" or "2em" or simply "2".',"This link has no URL":"This link has no URL",Tiny:"Tiny","Tip: Find some text first in order to replace it.":"Tip: Find some text first in order to replace it.","To-do List":"To-do List","Toggle caption off":"Toggle caption off","Toggle caption on":"Toggle caption on","Toggle the circle list style":"Toggle the circle list style","Toggle the decimal list style":"Toggle the decimal list style","Toggle the decimal with leading zero list style":"Toggle the decimal with leading zero list style","Toggle the disc list style":"Toggle the disc list style","Toggle the lowerlatin list style":"Toggle the lowerlatin list style","Toggle the lowerroman list style":"Toggle the lowerroman list style","Toggle the square list style":"Toggle the square list style","Toggle the upperlatin list style":"Toggle the upperlatin list style","Toggle the upperroman list style":"Toggle the upperroman list style",Turquoise:"Turquoise",Underline:"Underline",Undo:"Undo",Unlink:"Unlink","Upload failed":"Upload failed","Upload in progress":"Upload in progress","Upper-latin":"Upper-latin","Upper-roman":"Upper-roman","Vertical text alignment toolbar":"Vertical text alignment toolbar",White:"White","Whole words only":"Whole words only","Widget toolbar":"Widget toolbar",Width:"Width","Wrap text":"Wrap text",Yellow:"Yellow"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BalloonEditor=t():e.BalloonEditor=t()}(window,(function(){return function(e){var t={};function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(t){return e[t]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=142)}([function(e,t,i){"use strict";i.d(t,"a",(function(){return o})),i.d(t,"b",(function(){return n}));class o extends Error{constructor(e,t,i){super(`${e}${i?" "+JSON.stringify(i):""}${r(e)}`),this.name="CKEditorError",this.context=t,this.data=i}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const i=new o(e.message,t);throw i.stack=e.stack,i}}function n(e,t){console.warn(...s(e,t))}function r(e){return"\nRead more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-"+e}function s(e,t){const i=r(e);return t?[e,t,i]:[e,i]}},function(e,t,i){"use strict";var o,n=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),s=[];function a(e){for(var t=-1,i=0;i<s.length;i++)if(s[i].identifier===e){t=i;break}return t}function l(e,t){for(var i={},o=[],n=0;n<e.length;n++){var r=e[n],l=t.base?r[0]+t.base:r[0],c=i[l]||0,d="".concat(l," ").concat(c);i[l]=c+1;var h=a(d),u={css:r[1],media:r[2],sourceMap:r[3]};-1!==h?(s[h].references++,s[h].updater(u)):s.push({identifier:d,updater:p(u,t),references:1}),o.push(d)}return o}function c(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var n=i.nc;n&&(o.nonce=n)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var s=r(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var d,h=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function u(e,t,i,o){var n=i?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=h(t,n);else{var r=document.createTextNode(n),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function g(e,t,i){var o=i.css,n=i.media,r=i.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var m=null,f=0;function p(e,t){var i,o,n;if(t.singleton){var r=f++;i=m||(m=c(t)),o=u.bind(null,i,r,!1),n=u.bind(null,i,r,!0)}else i=c(t),o=g.bind(null,i,t),n=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};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 n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());var i=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<i.length;o++){var n=a(i[o]);s[n].references--}for(var r=l(e,t),c=0;c<i.length;c++){var d=a(i[c]);0===s[d].references&&(s[d].updater(),s.splice(d,1))}i=r}}}},,function(e,t,i){"use strict";var o=i(8),n="object"==typeof self&&self&&self.Object===Object&&self,r=o.a||n||Function("return this")();t.a=r},function(e,t,i){"use strict";(function(e){var o=i(3),n=i(17),r="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=r&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===r?o.a.Buffer:void 0,l=(a?a.isBuffer:void 0)||n.a;t.a=l}).call(this,i(10)(e))},function(e,t,i){"use strict";(function(e){var o=i(8),n="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=n&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===n&&o.a.process,a=function(){try{var e=r&&r.require&&r.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();t.a=a}).call(this,i(10)(e))},function(e,t,i){"use strict";(function(e){var t=i(0);const o="object"==typeof window?window:e;if(o.CKEDITOR_VERSION)throw new t.a("ckeditor-duplicated-modules",null);o.CKEDITOR_VERSION="30.0.0"}).call(this,i(12))},function(e,t,i){var o=i(1),n=i(64);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){"use strict";(function(e){var i="object"==typeof e&&e&&e.Object===Object&&e;t.a=i}).call(this,i(12))},function(e,t,i){"use strict";(function(e){var o=i(3),n="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=n&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===n?o.a.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.a=function(e,t){if(t)return e.slice();var i=e.length,o=a?a(i):new e.constructor(i);return e.copy(o),o}}).call(this,i(10)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,i){var o=i(1),n=i(83);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){var o=i(1),n=i(69);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){var o=i(1),n=i(72);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){var o=i(1),n=i(118);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){var o=i(1),n=i(119);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){"use strict";t.a=function(){return!1}},function(e,t,i){var o=i(1),n=i(19);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-hidden{display:none!important}.ck.ck-reset,.ck.ck-reset_all,.ck.ck-reset_all *{box-sizing:border-box;width:auto;height:auto;position:static}:root{--ck-z-default:1;--ck-z-modal:calc(var(--ck-z-default) + 999)}.ck-transitions-disabled,.ck-transitions-disabled *{transition:none!important}:root{--ck-color-base-foreground:#fafafa;--ck-color-base-background:#fff;--ck-color-base-border:#c4c4c4;--ck-color-base-action:#61b045;--ck-color-base-focus:#6cb5f9;--ck-color-base-text:#333;--ck-color-base-active:#198cf0;--ck-color-base-active-focus:#0e7fe1;--ck-color-base-error:#db3700;--ck-color-focus-border-coordinates:208,79%,51%;--ck-color-focus-border:hsl(var(--ck-color-focus-border-coordinates));--ck-color-focus-outer-shadow:#bcdefb;--ck-color-focus-disabled-shadow:rgba(119,186,248,0.3);--ck-color-focus-error-shadow:rgba(255,64,31,0.3);--ck-color-text:var(--ck-color-base-text);--ck-color-shadow-drop:rgba(0,0,0,0.15);--ck-color-shadow-drop-active:rgba(0,0,0,0.2);--ck-color-shadow-inner:rgba(0,0,0,0.1);--ck-color-button-default-background:transparent;--ck-color-button-default-hover-background:#e6e6e6;--ck-color-button-default-active-background:#d9d9d9;--ck-color-button-default-active-shadow:#bfbfbf;--ck-color-button-default-disabled-background:transparent;--ck-color-button-on-background:#dedede;--ck-color-button-on-hover-background:#c4c4c4;--ck-color-button-on-active-background:#bababa;--ck-color-button-on-active-shadow:#a1a1a1;--ck-color-button-on-disabled-background:#dedede;--ck-color-button-action-background:var(--ck-color-base-action);--ck-color-button-action-hover-background:#579e3d;--ck-color-button-action-active-background:#53973b;--ck-color-button-action-active-shadow:#498433;--ck-color-button-action-disabled-background:#7ec365;--ck-color-button-action-text:var(--ck-color-base-background);--ck-color-button-save:#008a00;--ck-color-button-cancel:#db3700;--ck-color-switch-button-off-background:#b0b0b0;--ck-color-switch-button-off-hover-background:#a3a3a3;--ck-color-switch-button-on-background:var(--ck-color-button-action-background);--ck-color-switch-button-on-hover-background:#579e3d;--ck-color-switch-button-inner-background:var(--ck-color-base-background);--ck-color-switch-button-inner-shadow:rgba(0,0,0,0.1);--ck-color-dropdown-panel-background:var(--ck-color-base-background);--ck-color-dropdown-panel-border:var(--ck-color-base-border);--ck-color-input-background:var(--ck-color-base-background);--ck-color-input-border:#c7c7c7;--ck-color-input-error-border:var(--ck-color-base-error);--ck-color-input-text:var(--ck-color-base-text);--ck-color-input-disabled-background:#f2f2f2;--ck-color-input-disabled-border:#c7c7c7;--ck-color-input-disabled-text:#757575;--ck-color-list-background:var(--ck-color-base-background);--ck-color-list-button-hover-background:var(--ck-color-button-default-hover-background);--ck-color-list-button-on-background:var(--ck-color-base-active);--ck-color-list-button-on-background-focus:var(--ck-color-base-active-focus);--ck-color-list-button-on-text:var(--ck-color-base-background);--ck-color-panel-background:var(--ck-color-base-background);--ck-color-panel-border:var(--ck-color-base-border);--ck-color-toolbar-background:var(--ck-color-base-foreground);--ck-color-toolbar-border:var(--ck-color-base-border);--ck-color-tooltip-background:var(--ck-color-base-text);--ck-color-tooltip-text:var(--ck-color-base-background);--ck-color-engine-placeholder-text:#707070;--ck-color-upload-bar-background:#6cb5f9;--ck-color-link-default:#0000f0;--ck-color-link-selected-background:rgba(31,177,255,0.1);--ck-color-link-fake-selection:rgba(31,177,255,0.3);--ck-disabled-opacity:.5;--ck-focus-outer-shadow-geometry:0 0 0 3px;--ck-focus-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-outer-shadow);--ck-focus-disabled-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-disabled-shadow);--ck-focus-error-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-error-shadow);--ck-focus-ring:1px solid var(--ck-color-focus-border);--ck-font-size-base:13px;--ck-line-height-base:1.84615;--ck-font-face:Helvetica,Arial,Tahoma,Verdana,Sans-Serif;--ck-font-size-tiny:0.7em;--ck-font-size-small:0.75em;--ck-font-size-normal:1em;--ck-font-size-big:1.4em;--ck-font-size-large:1.8em;--ck-ui-component-min-height:2.3em}.ck.ck-reset,.ck.ck-reset_all,.ck.ck-reset_all *{margin:0;padding:0;border:0;background:transparent;text-decoration:none;vertical-align:middle;transition:none;word-wrap:break-word}.ck.ck-reset_all,.ck.ck-reset_all *{border-collapse:collapse;font:normal normal normal var(--ck-font-size-base)/var(--ck-line-height-base) var(--ck-font-face);color:var(--ck-color-text);text-align:left;white-space:nowrap;cursor:auto;float:none}.ck.ck-reset_all .ck-rtl *{text-align:right}.ck.ck-reset_all iframe{vertical-align:inherit}.ck.ck-reset_all textarea{white-space:pre-wrap}.ck.ck-reset_all input[type=password],.ck.ck-reset_all input[type=text],.ck.ck-reset_all textarea{cursor:text}.ck.ck-reset_all input[type=password][disabled],.ck.ck-reset_all input[type=text][disabled],.ck.ck-reset_all textarea[disabled]{cursor:default}.ck.ck-reset_all fieldset{padding:10px;border:2px groove #dfdee3}.ck.ck-reset_all button::-moz-focus-inner{padding:0;border:0}.ck[dir=rtl],.ck[dir=rtl] .ck{text-align:right}:root{--ck-border-radius:2px;--ck-inner-shadow:2px 2px 3px var(--ck-color-shadow-inner) inset;--ck-drop-shadow:0 1px 2px 1px var(--ck-color-shadow-drop);--ck-drop-shadow-active:0 3px 6px 1px var(--ck-color-shadow-drop-active);--ck-spacing-unit:0.6em;--ck-spacing-large:calc(var(--ck-spacing-unit)*1.5);--ck-spacing-standard:var(--ck-spacing-unit);--ck-spacing-medium:calc(var(--ck-spacing-unit)*0.8);--ck-spacing-small:calc(var(--ck-spacing-unit)*0.5);--ck-spacing-tiny:calc(var(--ck-spacing-unit)*0.3);--ck-spacing-extra-tiny:calc(var(--ck-spacing-unit)*0.16)}"},function(e,t,i){var o=i(1),n=i(21);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-icon{vertical-align:middle}:root{--ck-icon-size:calc(var(--ck-line-height-base)*var(--ck-font-size-normal))}.ck.ck-icon{width:var(--ck-icon-size);height:var(--ck-icon-size);font-size:.8333350694em;will-change:transform}.ck.ck-icon,.ck.ck-icon *{color:inherit;cursor:inherit}.ck.ck-icon :not([fill]){fill:currentColor}"},function(e,t,i){var o=i(1),n=i(23);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck.ck-tooltip,.ck.ck-tooltip .ck-tooltip__text:after{position:absolute;pointer-events:none;-webkit-backface-visibility:hidden}.ck.ck-tooltip{visibility:hidden;opacity:0;display:none;z-index:var(--ck-z-modal)}.ck.ck-tooltip .ck-tooltip__text{display:inline-block}.ck.ck-tooltip .ck-tooltip__text:after{content:"";width:0;height:0}:root{--ck-tooltip-arrow-size:5px}.ck.ck-tooltip{left:50%;top:0;transition:opacity .2s ease-in-out .2s}.ck.ck-tooltip .ck-tooltip__text{border-radius:0}.ck-rounded-corners .ck.ck-tooltip .ck-tooltip__text,.ck.ck-tooltip .ck-tooltip__text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-tooltip .ck-tooltip__text{font-size:.9em;line-height:1.5;color:var(--ck-color-tooltip-text);padding:var(--ck-spacing-small) var(--ck-spacing-medium);background:var(--ck-color-tooltip-background);position:relative;left:-50%}.ck.ck-tooltip .ck-tooltip__text:after{transition:opacity .2s ease-in-out .2s;border-style:solid;left:50%}.ck.ck-tooltip.ck-tooltip_s,.ck.ck-tooltip.ck-tooltip_se,.ck.ck-tooltip.ck-tooltip_sw{bottom:calc(var(--ck-tooltip-arrow-size)*-1);transform:translateY(100%)}.ck.ck-tooltip.ck-tooltip_s .ck-tooltip__text:after,.ck.ck-tooltip.ck-tooltip_se .ck-tooltip__text:after,.ck.ck-tooltip.ck-tooltip_sw .ck-tooltip__text:after{top:calc(var(--ck-tooltip-arrow-size)*-1 + 1px);transform:translateX(-50%);border-left-color:transparent;border-bottom-color:var(--ck-color-tooltip-background);border-right-color:transparent;border-top-color:transparent;border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:var(--ck-tooltip-arrow-size);border-right-width:var(--ck-tooltip-arrow-size);border-top-width:0}.ck.ck-tooltip.ck-tooltip_sw{right:50%;left:auto}.ck.ck-tooltip.ck-tooltip_sw .ck-tooltip__text{left:auto;right:calc(var(--ck-tooltip-arrow-size)*-2)}.ck.ck-tooltip.ck-tooltip_sw .ck-tooltip__text:after{left:auto;right:0}.ck.ck-tooltip.ck-tooltip_se{left:50%;right:auto}.ck.ck-tooltip.ck-tooltip_se .ck-tooltip__text{right:auto;left:calc(var(--ck-tooltip-arrow-size)*-2)}.ck.ck-tooltip.ck-tooltip_se .ck-tooltip__text:after{right:auto;left:0;transform:translateX(50%)}.ck.ck-tooltip.ck-tooltip_n{top:calc(var(--ck-tooltip-arrow-size)*-1);transform:translateY(-100%)}.ck.ck-tooltip.ck-tooltip_n .ck-tooltip__text:after{bottom:calc(var(--ck-tooltip-arrow-size)*-1);transform:translateX(-50%);border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;border-top-color:var(--ck-color-tooltip-background);border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:0;border-right-width:var(--ck-tooltip-arrow-size);border-top-width:var(--ck-tooltip-arrow-size)}.ck.ck-tooltip.ck-tooltip_e{left:calc(100% + var(--ck-tooltip-arrow-size));top:50%}.ck.ck-tooltip.ck-tooltip_e .ck-tooltip__text{left:0;transform:translateY(-50%)}.ck.ck-tooltip.ck-tooltip_e .ck-tooltip__text:after{left:calc(var(--ck-tooltip-arrow-size)*-1);top:calc(50% - var(--ck-tooltip-arrow-size)*1);border-left-color:transparent;border-bottom-color:transparent;border-right-color:var(--ck-color-tooltip-background);border-top-color:transparent;border-left-width:0;border-bottom-width:var(--ck-tooltip-arrow-size);border-right-width:var(--ck-tooltip-arrow-size);border-top-width:var(--ck-tooltip-arrow-size)}.ck.ck-tooltip.ck-tooltip_w{right:calc(100% + var(--ck-tooltip-arrow-size));left:auto;top:50%}.ck.ck-tooltip.ck-tooltip_w .ck-tooltip__text{left:0;transform:translateY(-50%)}.ck.ck-tooltip.ck-tooltip_w .ck-tooltip__text:after{left:100%;top:calc(50% - var(--ck-tooltip-arrow-size)*1);border-left-color:var(--ck-color-tooltip-background);border-bottom-color:transparent;border-right-color:transparent;border-top-color:transparent;border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:var(--ck-tooltip-arrow-size);border-right-width:0;border-top-width:var(--ck-tooltip-arrow-size)}'},function(e,t,i){var o=i(1),n=i(25);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-button,a.ck.ck-button{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:block}@media (hover:none){.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:none}}.ck.ck-button,a.ck.ck-button{position:relative;display:inline-flex;align-items:center;justify-content:left}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{display:none}.ck.ck-button.ck-button_with-text .ck-button__label,a.ck.ck-button.ck-button_with-text .ck-button__label{display:inline-block}.ck.ck-button:not(.ck-button_with-text),a.ck.ck-button:not(.ck-button_with-text){justify-content:center}.ck.ck-button:hover .ck-tooltip,a.ck.ck-button:hover .ck-tooltip{visibility:visible;opacity:1}.ck.ck-button:focus:not(:hover) .ck-tooltip,a.ck.ck-button:focus:not(:hover) .ck-tooltip{display:none}.ck.ck-button,a.ck.ck-button{background:var(--ck-color-button-default-background)}.ck.ck-button:not(.ck-disabled):hover,a.ck.ck-button:not(.ck-disabled):hover{background:var(--ck-color-button-default-hover-background)}.ck.ck-button:not(.ck-disabled):active,a.ck.ck-button:not(.ck-disabled):active{background:var(--ck-color-button-default-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-default-active-shadow)}.ck.ck-button.ck-disabled,a.ck.ck-button.ck-disabled{background:var(--ck-color-button-default-disabled-background)}.ck.ck-button,a.ck.ck-button{border-radius:0}.ck-rounded-corners .ck.ck-button,.ck-rounded-corners a.ck.ck-button,.ck.ck-button.ck-rounded-corners,a.ck.ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-button,a.ck.ck-button{white-space:nowrap;cursor:default;vertical-align:middle;padding:var(--ck-spacing-tiny);text-align:center;min-width:var(--ck-ui-component-min-height);min-height:var(--ck-ui-component-min-height);line-height:1;font-size:inherit;border:1px solid transparent;transition:box-shadow .2s ease-in-out,border .2s ease-in-out;-webkit-appearance:none}.ck.ck-button:active,.ck.ck-button:focus,a.ck.ck-button:active,a.ck.ck-button:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-button .ck-button__icon use,.ck.ck-button .ck-button__icon use *,a.ck.ck-button .ck-button__icon use,a.ck.ck-button .ck-button__icon use *{color:inherit}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{font-size:inherit;font-weight:inherit;color:inherit;cursor:inherit;vertical-align:middle}[dir=ltr] .ck.ck-button .ck-button__label,[dir=ltr] a.ck.ck-button .ck-button__label{text-align:left}[dir=rtl] .ck.ck-button .ck-button__label,[dir=rtl] a.ck.ck-button .ck-button__label{text-align:right}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{color:inherit}[dir=ltr] .ck.ck-button .ck-button__keystroke,[dir=ltr] a.ck.ck-button .ck-button__keystroke{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-button .ck-button__keystroke,[dir=rtl] a.ck.ck-button .ck-button__keystroke{margin-right:var(--ck-spacing-large)}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{font-weight:700;opacity:.7}.ck.ck-button.ck-disabled:active,.ck.ck-button.ck-disabled:focus,a.ck.ck-button.ck-disabled:active,a.ck.ck-button.ck-disabled:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-button.ck-disabled .ck-button__icon,a.ck.ck-button.ck-disabled .ck-button__icon{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__label,a.ck.ck-button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__keystroke,a.ck.ck-button.ck-disabled .ck-button__keystroke{opacity:.3}.ck.ck-button.ck-button_with-text,a.ck.ck-button.ck-button_with-text{padding:var(--ck-spacing-tiny) var(--ck-spacing-standard)}[dir=ltr] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=ltr] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-left:calc(var(--ck-spacing-small)*-1);margin-right:var(--ck-spacing-small)}[dir=rtl] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=rtl] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-right:calc(var(--ck-spacing-small)*-1);margin-left:var(--ck-spacing-small)}.ck.ck-button.ck-button_with-keystroke .ck-button__label,a.ck.ck-button.ck-button_with-keystroke .ck-button__label{flex-grow:1}.ck.ck-button.ck-on,a.ck.ck-button.ck-on{background:var(--ck-color-button-on-background)}.ck.ck-button.ck-on:not(.ck-disabled):hover,a.ck.ck-button.ck-on:not(.ck-disabled):hover{background:var(--ck-color-button-on-hover-background)}.ck.ck-button.ck-on:not(.ck-disabled):active,a.ck.ck-button.ck-on:not(.ck-disabled):active{background:var(--ck-color-button-on-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-on-active-shadow)}.ck.ck-button.ck-on.ck-disabled,a.ck.ck-button.ck-on.ck-disabled{background:var(--ck-color-button-on-disabled-background)}.ck.ck-button.ck-button-save,a.ck.ck-button.ck-button-save{color:var(--ck-color-button-save)}.ck.ck-button.ck-button-cancel,a.ck.ck-button.ck-button-cancel{color:var(--ck-color-button-cancel)}.ck.ck-button-action,a.ck.ck-button-action{background:var(--ck-color-button-action-background)}.ck.ck-button-action:not(.ck-disabled):hover,a.ck.ck-button-action:not(.ck-disabled):hover{background:var(--ck-color-button-action-hover-background)}.ck.ck-button-action:not(.ck-disabled):active,a.ck.ck-button-action:not(.ck-disabled):active{background:var(--ck-color-button-action-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-action-active-shadow)}.ck.ck-button-action.ck-disabled,a.ck.ck-button-action.ck-disabled{background:var(--ck-color-button-action-disabled-background)}.ck.ck-button-action,a.ck.ck-button-action{color:var(--ck-color-button-action-text)}.ck.ck-button-bold,a.ck.ck-button-bold{font-weight:700}"},function(e,t,i){var o=i(1),n=i(27);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{display:block}:root{--ck-switch-button-toggle-width:2.6153846154em;--ck-switch-button-toggle-inner-size:1.0769230769em;--ck-switch-button-toggle-spacing:1px;--ck-switch-button-translation:calc(var(--ck-switch-button-toggle-width) - var(--ck-switch-button-toggle-inner-size) - var(--ck-switch-button-toggle-spacing)*2)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__label{margin-right:calc(var(--ck-spacing-large)*2)}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__label{margin-left:calc(var(--ck-spacing-large)*2)}.ck.ck-button.ck-switchbutton .ck-button__toggle{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle.ck-rounded-corners{border-radius:var(--ck-border-radius)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-left:auto}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-right:auto}.ck.ck-button.ck-switchbutton .ck-button__toggle{transition:background .4s ease;width:var(--ck-switch-button-toggle-width);background:var(--ck-color-switch-button-off-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:calc(var(--ck-border-radius)*0.5)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{margin:var(--ck-switch-button-toggle-spacing);width:var(--ck-switch-button-toggle-inner-size);height:var(--ck-switch-button-toggle-inner-size);background:var(--ck-color-switch-button-inner-background);transition:all .3s ease}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover{background:var(--ck-color-switch-button-off-hover-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover .ck-button__toggle__inner{box-shadow:0 0 0 5px var(--ck-color-switch-button-inner-shadow)}.ck.ck-button.ck-switchbutton.ck-disabled .ck-button__toggle{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle{background:var(--ck-color-switch-button-on-background)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle:hover{background:var(--ck-color-switch-button-on-hover-background)}[dir=ltr] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(var(--ck-switch-button-translation))}[dir=rtl] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(calc(var(--ck-switch-button-translation)*-1))}"},function(e,t,i){var o=i(1),n=i(29);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-color-grid{display:grid}:root{--ck-color-grid-tile-size:24px;--ck-color-color-grid-check-icon:#000}.ck.ck-color-grid{grid-gap:5px;padding:8px}.ck.ck-color-grid__tile{width:var(--ck-color-grid-tile-size);height:var(--ck-color-grid-tile-size);min-width:var(--ck-color-grid-tile-size);min-height:var(--ck-color-grid-tile-size);padding:0;transition:box-shadow .2s ease;border:0}.ck.ck-color-grid__tile.ck-disabled{cursor:unset;transition:unset}.ck.ck-color-grid__tile.ck-color-table__color-tile_bordered{box-shadow:0 0 0 1px var(--ck-color-base-border)}.ck.ck-color-grid__tile .ck.ck-icon{display:none;color:var(--ck-color-color-grid-check-icon)}.ck.ck-color-grid__tile.ck-on{box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-base-text)}.ck.ck-color-grid__tile.ck-on .ck.ck-icon{display:block}.ck.ck-color-grid__tile.ck-on,.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){border:0}.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-focus-border)}.ck.ck-color-grid__label{padding:0 var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(31);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck.ck-splitbutton{font-size:inherit}.ck.ck-splitbutton .ck-splitbutton__action:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button .ck-tooltip{display:none}:root{--ck-color-split-button-hover-background:#ebebeb;--ck-color-split-button-hover-border:#b3b3b3}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__action{border-top-right-radius:unset;border-bottom-right-radius:unset}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__action{border-top-left-radius:unset;border-bottom-left-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow{min-width:unset}[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-top-left-radius:unset;border-bottom-left-radius:unset}[dir=rtl] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-top-right-radius:unset;border-bottom-right-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow svg{width:var(--ck-dropdown-arrow-size)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover),.ck.ck-splitbutton:hover>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover){background:var(--ck-color-split-button-hover-background)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled):after{content:"";position:absolute;width:1px;height:100%;background-color:var(--ck-color-split-button-hover-border)}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled):after{left:-1px}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled):after{right:-1px}.ck.ck-splitbutton.ck-splitbutton_open{border-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__action{border-bottom-left-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__arrow{border-bottom-right-radius:0}'},function(e,t,i){var o=i(1),n=i(33);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-dropdown-max-width:75vw}.ck.ck-dropdown{display:inline-block;position:relative}.ck.ck-dropdown .ck-dropdown__arrow{pointer-events:none;z-index:var(--ck-z-default)}.ck.ck-dropdown .ck-button.ck-dropdown__button{width:100%}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on .ck-tooltip{display:none}.ck.ck-dropdown .ck-dropdown__panel{-webkit-backface-visibility:hidden;display:none;z-index:var(--ck-z-modal);max-width:var(--ck-dropdown-max-width);position:absolute}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel-visible{display:inline-block}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_n,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nme,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nmw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw{bottom:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_s,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sme,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_smw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{top:100%;bottom:auto}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se{left:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{right:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_n,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_s{left:50%;transform:translateX(-50%)}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nmw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_smw{left:75%;transform:translateX(-75%)}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nme,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sme{left:25%;transform:translateX(-25%)}.ck.ck-toolbar .ck-dropdown__panel{z-index:calc(var(--ck-z-modal) + 1)}:root{--ck-dropdown-arrow-size:calc(var(--ck-icon-size)*0.5)}.ck.ck-dropdown{font-size:inherit}.ck.ck-dropdown .ck-dropdown__arrow{width:var(--ck-dropdown-arrow-size)}[dir=ltr] .ck.ck-dropdown .ck-dropdown__arrow{right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-dropdown .ck-dropdown__arrow{left:var(--ck-spacing-standard);margin-right:var(--ck-spacing-small)}.ck.ck-dropdown.ck-disabled .ck-dropdown__arrow{opacity:var(--ck-disabled-opacity)}[dir=ltr] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-left:var(--ck-spacing-small)}[dir=rtl] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-right:var(--ck-spacing-small)}.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{width:7em;overflow:hidden;text-overflow:ellipsis}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on{border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-dropdown__button_label-width_auto .ck-button__label{width:auto}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-off:active,.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on:active{box-shadow:none}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-off:active:focus,.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on:active:focus{box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-dropdown__panel{border-radius:0}.ck-rounded-corners .ck.ck-dropdown__panel,.ck.ck-dropdown__panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-dropdown__panel{box-shadow:var(--ck-drop-shadow),0 0;background:var(--ck-color-dropdown-panel-background);border:1px solid var(--ck-color-dropdown-panel-border);bottom:0;min-width:100%}.ck.ck-dropdown__panel.ck-dropdown__panel_se{border-top-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_sw{border-top-right-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_ne{border-bottom-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_nw{border-bottom-right-radius:0}"},function(e,t,i){var o=i(1),n=i(35);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-toolbar{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-flow:row nowrap;align-items:center}.ck.ck-toolbar>.ck-toolbar__items{display:flex;flex-flow:row wrap;align-items:center;flex-grow:1}.ck.ck-toolbar .ck.ck-toolbar__separator{display:inline-block}.ck.ck-toolbar .ck.ck-toolbar__separator:first-child,.ck.ck-toolbar .ck.ck-toolbar__separator:last-child{display:none}.ck.ck-toolbar .ck-toolbar__line-break{flex-basis:100%}.ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items{flex-direction:column}.ck.ck-toolbar.ck-toolbar_floating>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck-dropdown__button .ck-dropdown__arrow{display:none}.ck.ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-toolbar,.ck.ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-toolbar{background:var(--ck-color-toolbar-background);padding:0 var(--ck-spacing-small);border:1px solid var(--ck-color-toolbar-border)}.ck.ck-toolbar .ck.ck-toolbar__separator{align-self:stretch;width:1px;min-width:1px;background:var(--ck-color-toolbar-border);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar .ck-toolbar__line-break{height:0}.ck.ck-toolbar>.ck-toolbar__items>:not(.ck-toolbar__line-break){margin-right:var(--ck-spacing-small)}.ck.ck-toolbar>.ck-toolbar__items:empty+.ck.ck-toolbar__separator{display:none}.ck.ck-toolbar>.ck-toolbar__items>:not(.ck-toolbar__line-break),.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar.ck-toolbar_vertical{padding:0}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items>.ck{width:100%;margin:0;border-radius:0;border:0}.ck.ck-toolbar.ck-toolbar_compact{padding:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>*{margin:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>:not(:first-child):not(:last-child){border-radius:0}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck.ck-button.ck-dropdown__button{padding-left:var(--ck-spacing-tiny)}.ck-toolbar-container .ck.ck-toolbar{border:0}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck{margin-right:0}.ck.ck-toolbar[dir=rtl]:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-left:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__separator,[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=rtl] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr]>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-right:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=ltr]>.ck.ck-toolbar__separator,[dir=ltr] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-right:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=ltr] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-right:var(--ck-spacing-small)}"},function(e,t,i){var o=i(1),n=i(37);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-list{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column}.ck.ck-list .ck-list__item,.ck.ck-list .ck-list__separator{display:block}.ck.ck-list .ck-list__item>:focus{position:relative;z-index:var(--ck-z-default)}.ck.ck-list{border-radius:0}.ck-rounded-corners .ck.ck-list,.ck.ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-list{list-style-type:none;background:var(--ck-color-list-background)}.ck.ck-list__item{cursor:default;min-width:12em}.ck.ck-list__item .ck-button{min-height:unset;width:100%;text-align:left;border-radius:0;padding:calc(var(--ck-line-height-base)*0.2*var(--ck-font-size-base)) calc(var(--ck-line-height-base)*0.4*var(--ck-font-size-base))}.ck.ck-list__item .ck-button .ck-button__label{line-height:calc(var(--ck-line-height-base)*1.2*var(--ck-font-size-base))}.ck.ck-list__item .ck-button:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on{background:var(--ck-color-list-button-on-background);color:var(--ck-color-list-button-on-text)}.ck.ck-list__item .ck-button.ck-on:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-on-background-focus)}.ck.ck-list__item .ck-button.ck-on:focus:not(.ck-disabled){border-color:var(--ck-color-base-background)}.ck.ck-list__item .ck-button:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background)}.ck.ck-list__item .ck-switchbutton.ck-on{background:var(--ck-color-list-background);color:inherit}.ck.ck-list__item .ck-switchbutton.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background);color:inherit}.ck.ck-list__separator{height:1px;width:100%;background:var(--ck-color-base-border)}"},function(e,t,i){var o=i(1),n=i(39);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-toolbar-dropdown-max-width:60vw}.ck.ck-toolbar-dropdown>.ck-dropdown__panel{width:max-content;max-width:var(--ck-toolbar-dropdown-max-width)}.ck.ck-toolbar-dropdown>.ck-dropdown__panel .ck-button:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-toolbar-dropdown .ck-toolbar{border:0}"},function(e,t,i){var o=i(1),n=i(41);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-dropdown .ck-dropdown__panel .ck-list{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list,.ck.ck-dropdown .ck-dropdown__panel .ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}"},function(e,t,i){var o=i(1),n=i(43);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-editable-blur-selection:#d9d9d9}.ck.ck-editor__editable:not(.ck-editor__nested-editable){border-radius:0}.ck-rounded-corners .ck.ck-editor__editable:not(.ck-editor__nested-editable),.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-focused{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0}.ck.ck-editor__editable_inline{overflow:auto;padding:0 var(--ck-spacing-standard);border:1px solid transparent}.ck.ck-editor__editable_inline[dir=ltr]{text-align:left}.ck.ck-editor__editable_inline[dir=rtl]{text-align:right}.ck.ck-editor__editable_inline>:first-child{margin-top:var(--ck-spacing-large)}.ck.ck-editor__editable_inline>:last-child{margin-bottom:var(--ck-spacing-large)}.ck.ck-editor__editable_inline.ck-blurred ::selection{background:var(--ck-color-editable-blur-selection)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_n]:after{border-bottom-color:var(--ck-color-base-foreground)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_s]:after{border-top-color:var(--ck-color-base-foreground)}"},function(e,t,i){var o=i(1),n=i(45);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-label{display:block}.ck.ck-voice-label{display:none}.ck.ck-label{font-weight:700}"},function(e,t,i){var o=i(1),n=i(47);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-form__header{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:space-between}:root{--ck-form-header-height:38px}.ck.ck-form__header{padding:var(--ck-spacing-small) var(--ck-spacing-large);height:var(--ck-form-header-height);line-height:var(--ck-form-header-height);border-bottom:1px solid var(--ck-color-base-border)}.ck.ck-form__header .ck-form__header__label{font-weight:700}"},function(e,t,i){var o=i(1),n=i(49);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-input-text-width:18em}.ck.ck-input-text{border-radius:0}.ck-rounded-corners .ck.ck-input-text,.ck.ck-input-text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-text{background:var(--ck-color-input-background);border:1px solid var(--ck-color-input-border);padding:var(--ck-spacing-extra-tiny) var(--ck-spacing-medium);min-width:var(--ck-input-text-width);min-height:var(--ck-ui-component-min-height);transition:box-shadow .1s ease-in-out,border .1s ease-in-out}.ck.ck-input-text:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-input-text[readonly]{border:1px solid var(--ck-color-input-disabled-border);background:var(--ck-color-input-disabled-background);color:var(--ck-color-input-disabled-text)}.ck.ck-input-text[readonly]:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-input-text.ck-error{border-color:var(--ck-color-input-error-border);animation:ck-text-input-shake .3s ease both}.ck.ck-input-text.ck-error:focus{box-shadow:var(--ck-focus-error-outer-shadow),0 0}@keyframes ck-text-input-shake{20%{transform:translateX(-2px)}40%{transform:translateX(2px)}60%{transform:translateX(-1px)}80%{transform:translateX(1px)}}"},function(e,t,i){var o=i(1),n=i(51);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper{display:flex;position:relative}.ck.ck-labeled-field-view .ck.ck-label{display:block;position:absolute}:root{--ck-labeled-field-view-transition:.1s cubic-bezier(0,0,0.24,0.95);--ck-labeled-field-empty-unfocused-max-width:100% - 2 * var(--ck-spacing-medium);--ck-color-labeled-field-label-background:var(--ck-color-base-background)}.ck.ck-labeled-field-view{border-radius:0}.ck-rounded-corners .ck.ck-labeled-field-view,.ck.ck-labeled-field-view.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper{width:100%}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{top:0}[dir=ltr] .ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{left:0}[dir=rtl] .ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{right:0}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{pointer-events:none;transform-origin:0 0;transform:translate(var(--ck-spacing-medium),-6px) scale(.75);background:var(--ck-color-labeled-field-label-background);padding:0 calc(var(--ck-font-size-tiny)*0.5);line-height:normal;font-weight:400;text-overflow:ellipsis;overflow:hidden;max-width:100%;transition:transform var(--ck-labeled-field-view-transition),padding var(--ck-labeled-field-view-transition),background var(--ck-labeled-field-view-transition)}.ck.ck-labeled-field-view.ck-error .ck-input:not([readonly])+.ck.ck-label,.ck.ck-labeled-field-view.ck-error>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view .ck-labeled-field-view__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-field-view .ck-labeled-field-view__status.ck-labeled-field-view__status_error{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view.ck-disabled>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{color:var(--ck-color-input-disabled-text)}[dir=ltr] .ck.ck-labeled-field-view.ck-disabled.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,[dir=ltr] .ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{transform:translate(var(--ck-spacing-medium),calc(var(--ck-font-size-base)*0.6)) scale(1)}[dir=rtl] .ck.ck-labeled-field-view.ck-disabled.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,[dir=rtl] .ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{transform:translate(calc(var(--ck-spacing-medium)*-1),calc(var(--ck-font-size-base)*0.6)) scale(1)}.ck.ck-labeled-field-view.ck-disabled.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{max-width:calc(var(--ck-labeled-field-empty-unfocused-max-width));background:transparent;padding:0}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown>.ck.ck-button{background:transparent}.ck.ck-labeled-field-view.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown>.ck-button>.ck-button__label{opacity:0}.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown+.ck-label{max-width:calc(var(--ck-labeled-field-empty-unfocused-max-width) - var(--ck-dropdown-arrow-size) - var(--ck-spacing-standard))}"},function(e,t,i){var o=i(1),n=i(53);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=':root{--ck-balloon-panel-arrow-z-index:calc(var(--ck-z-default) - 3)}.ck.ck-balloon-panel{display:none;position:absolute;z-index:var(--ck-z-modal)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{content:"";position:absolute}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_n]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_n]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_s]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_s]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel.ck-balloon-panel_visible{display:block}:root{--ck-balloon-arrow-offset:2px;--ck-balloon-arrow-height:10px;--ck-balloon-arrow-half-width:8px;--ck-balloon-arrow-drop-shadow:0 2px 2px var(--ck-color-shadow-drop)}.ck.ck-balloon-panel{border-radius:0}.ck-rounded-corners .ck.ck-balloon-panel,.ck.ck-balloon-panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-balloon-panel{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{width:0;height:0;border-style:solid}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:var(--ck-balloon-arrow-height);border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:0}.ck.ck-balloon-panel[class*=arrow_n]:before{border-bottom-color:var(--ck-color-panel-border)}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-color:transparent;border-right-color:transparent;border-top-color:transparent}.ck.ck-balloon-panel[class*=arrow_n]:after{border-bottom-color:var(--ck-color-panel-background);margin-top:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:0;border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:var(--ck-balloon-arrow-height)}.ck.ck-balloon-panel[class*=arrow_s]:before{border-top-color:var(--ck-color-panel-border);filter:drop-shadow(var(--ck-balloon-arrow-drop-shadow))}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent}.ck.ck-balloon-panel[class*=arrow_s]:after{border-top-color:var(--ck-color-panel-background);margin-bottom:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:before{left:50%;margin-left:calc(var(--ck-balloon-arrow-half-width)*-1);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:before{left:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:before{right:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:before{left:50%;margin-left:calc(var(--ck-balloon-arrow-half-width)*-1);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:before{left:calc(var(--ck-balloon-arrow-half-width)*2);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:before{right:calc(var(--ck-balloon-arrow-half-width)*2);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:before{right:25%;margin-right:calc(var(--ck-balloon-arrow-half-width)*2);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:before{left:25%;margin-left:calc(var(--ck-balloon-arrow-half-width)*2);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:before{right:25%;margin-right:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:before{left:25%;margin-left:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}'},function(e,t,i){var o=i(1),n=i(55);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-balloon-rotator__navigation{display:flex;align-items:center;justify-content:center}.ck .ck-balloon-rotator__content .ck-toolbar{justify-content:center}.ck .ck-balloon-rotator__navigation{background:var(--ck-color-toolbar-background);border-bottom:1px solid var(--ck-color-toolbar-border);padding:0 var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation>*{margin-right:var(--ck-spacing-small);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation .ck-balloon-rotator__counter{margin-right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-small)}.ck .ck-balloon-rotator__content .ck.ck-annotation-wrapper{box-shadow:none}"},function(e,t,i){var o=i(1),n=i(57);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-fake-panel{position:absolute;z-index:calc(var(--ck-z-modal) - 1)}.ck .ck-fake-panel div{position:absolute}.ck .ck-fake-panel div:first-child{z-index:2}.ck .ck-fake-panel div:nth-child(2){z-index:1}:root{--ck-balloon-fake-panel-offset-horizontal:6px;--ck-balloon-fake-panel-offset-vertical:6px}.ck .ck-fake-panel div{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border);border-radius:var(--ck-border-radius);width:100%;height:100%}.ck .ck-fake-panel div:first-child{margin-left:var(--ck-balloon-fake-panel-offset-horizontal);margin-top:var(--ck-balloon-fake-panel-offset-vertical)}.ck .ck-fake-panel div:nth-child(2){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*2);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*2)}.ck .ck-fake-panel div:nth-child(3){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*3);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*3)}.ck .ck-balloon-panel_arrow_s+.ck-fake-panel,.ck .ck-balloon-panel_arrow_se+.ck-fake-panel,.ck .ck-balloon-panel_arrow_sw+.ck-fake-panel{--ck-balloon-fake-panel-offset-vertical:-6px}"},function(e,t,i){var o=i(1),n=i(59);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-sticky-panel .ck-sticky-panel__content_sticky{z-index:var(--ck-z-modal);position:fixed;top:0}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky_bottom-limit{top:auto;position:absolute}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky{box-shadow:var(--ck-drop-shadow),0 0;border-width:0 1px 1px;border-top-left-radius:0;border-top-right-radius:0}"},function(e,t,i){var o=i(1),n=i(61);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-block-toolbar-button{position:absolute;z-index:var(--ck-z-default)}:root{--ck-color-block-toolbar-button:var(--ck-color-text);--ck-block-toolbar-button-size:var(--ck-font-size-normal)}.ck.ck-block-toolbar-button{color:var(--ck-color-block-toolbar-button);font-size:var(--ck-block-toolbar-size)}"},function(e,t,i){var o=i(1),n=i(63);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-placeholder,.ck .ck-placeholder{position:relative}.ck.ck-placeholder:before,.ck .ck-placeholder:before{position:absolute;left:0;right:0;content:attr(data-placeholder);pointer-events:none}.ck.ck-read-only .ck-placeholder:before{display:none}.ck.ck-placeholder:before,.ck .ck-placeholder:before{cursor:text;color:var(--ck-color-engine-placeholder-text)}"},function(e,t){e.exports='.ck-vertical-form .ck-button:after{content:"";width:0;position:absolute;right:-1px;top:var(--ck-spacing-small);bottom:var(--ck-spacing-small);z-index:1}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{content:"";width:0;position:absolute;right:-1px;top:var(--ck-spacing-small);bottom:var(--ck-spacing-small);z-index:1}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}[dir=ltr] .ck.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-responsive-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-text-width)*0.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-large);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-responsive-form>.ck-button:last-child,[dir=ltr] .ck.ck-responsive-form>.ck-button:nth-last-child(2),[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2){margin-left:0}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after,[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child:last-of-type,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2):last-of-type{border-right:1px solid var(--ck-color-base-border)}}'},function(e,t,i){var o=i(1),n=i(66);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-find-and-replace-form{max-width:100%}.ck.ck-find-and-replace-form fieldset{display:flex}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-results-counter{position:absolute}.ck.ck-find-and-replace-form{width:400px}.ck.ck-find-and-replace-form:focus{outline:none}.ck.ck-find-and-replace-form fieldset{flex-direction:row;flex-wrap:nowrap;align-items:center;align-content:stretch;padding:var(--ck-spacing-large);border:0;margin:0}.ck.ck-find-and-replace-form fieldset>.ck-button{flex:0 0 auto}[dir=ltr] .ck.ck-find-and-replace-form fieldset>*+*{margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form fieldset>*+*{margin-right:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form fieldset .ck-labeled-field-view{flex:1 1 auto}.ck.ck-find-and-replace-form fieldset .ck-labeled-field-view .ck-input{width:100%;min-width:50px}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find{align-items:flex-start}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button-find{font-weight:700}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button-find .ck-button__label{padding-left:var(--ck-spacing-large);padding-right:var(--ck-spacing-large)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button-prev>.ck-icon{transform:rotate(90deg)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button-next>.ck-icon{transform:rotate(-90deg)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-results-counter{top:50%;transform:translateY(-50%)}[dir=ltr] .ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-results-counter{right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-results-counter{left:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-results-counter{color:var(--ck-color-base-border)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace{flex-wrap:wrap;justify-content:flex-end;margin-top:calc(var(--ck-spacing-large)*-1)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-labeled-field-view{margin-bottom:var(--ck-spacing-large)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-options-dropdown{margin-right:auto;margin-left:0}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-labeled-field-view,.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-labeled-field-view .ck-input{width:100%}@media screen and (max-width:600px){.ck.ck-find-and-replace-form{width:300px}.ck.ck-find-and-replace-form fieldset{flex-wrap:wrap}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-labeled-field-view{flex:1 0 auto;width:100%;margin-bottom:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button{text-align:center}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button:first-of-type .ck-button__label{width:100%;text-align:center}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>:not(.ck-labeled-field-view){flex:1 1 auto}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>:not(.ck-labeled-field-view).ck-dropdown{flex-grow:0}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>:not(.ck-labeled-field-view).ck-button>.ck-button__label{width:100%;text-align:center}}"},function(e,t,i){var o=i(1),n=i(68);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-find-result{background:#ff0;color:var(--ck-color-text)}.ck-find-result_selected{background:#ff9633}"},function(e,t){e.exports=".ck-content code{background-color:hsla(0,0%,78%,.3);padding:.15em;border-radius:2px}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}"},function(e,t,i){var o=i(1),n=i(71);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content blockquote{overflow:hidden;padding-right:1.5em;padding-left:1.5em;margin-left:0;margin-right:0;font-style:italic;border-left:5px solid #ccc}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}"},function(e,t){e.exports=".ck.ck-heading_heading1{font-size:20px}.ck.ck-heading_heading2{font-size:17px}.ck.ck-heading_heading3{font-size:14px}.ck[class*=ck-heading_heading]{font-weight:700}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__button .ck-button__label{width:8em}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__panel .ck-list__item{min-width:18em}"},function(e,t,i){var o=i(1),n=i(74);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck .ck-widget .ck-widget__type-around__button{display:block;position:absolute;overflow:hidden;z-index:var(--ck-z-default)}.ck .ck-widget .ck-widget__type-around__button svg{position:absolute;top:50%;left:50%;z-index:calc(var(--ck-z-default) + 2)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_before{top:calc(var(--ck-widget-outline-thickness)*-0.5);left:min(10%,30px);transform:translateY(-50%)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_after{bottom:calc(var(--ck-widget-outline-thickness)*-0.5);right:min(10%,30px);transform:translateY(50%)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{content:"";display:block;position:absolute;top:1px;left:1px;z-index:calc(var(--ck-z-default) + 1)}.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__fake-caret{display:none;position:absolute;left:0;right:0}.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__fake-caret{left:calc(var(--ck-widget-outline-thickness)*-1);right:calc(var(--ck-widget-outline-thickness)*-1)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__fake-caret{top:calc(var(--ck-widget-outline-thickness)*-1 - 1px);display:block}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__fake-caret{bottom:calc(var(--ck-widget-outline-thickness)*-1 - 1px);display:block}.ck.ck-editor__editable.ck-read-only .ck-widget__type-around,.ck.ck-editor__editable.ck-restricted-editing_mode_restricted .ck-widget__type-around,.ck.ck-editor__editable.ck-widget__type-around_disabled .ck-widget__type-around{display:none}:root{--ck-widget-type-around-button-size:20px;--ck-color-widget-type-around-button-active:var(--ck-color-focus-border);--ck-color-widget-type-around-button-hover:var(--ck-color-widget-hover-border);--ck-color-widget-type-around-button-blurred-editable:var(--ck-color-widget-blurred-border);--ck-color-widget-type-around-button-radar-start-alpha:0;--ck-color-widget-type-around-button-radar-end-alpha:.3;--ck-color-widget-type-around-button-icon:var(--ck-color-base-background)}.ck .ck-widget .ck-widget__type-around__button{width:var(--ck-widget-type-around-button-size);height:var(--ck-widget-type-around-button-size);background:var(--ck-color-widget-type-around-button);border-radius:100px;transition:opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);opacity:0;pointer-events:none}.ck .ck-widget .ck-widget__type-around__button svg{width:10px;height:8px;transform:translate(-50%,-50%);transition:transform .5s ease;margin-top:1px}.ck .ck-widget .ck-widget__type-around__button svg *{stroke-dasharray:10;stroke-dashoffset:0;fill:none;stroke:var(--ck-color-widget-type-around-button-icon);stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round}.ck .ck-widget .ck-widget__type-around__button svg line{stroke-dasharray:7}.ck .ck-widget .ck-widget__type-around__button:hover{animation:ck-widget-type-around-button-sonar 1s ease infinite}.ck .ck-widget .ck-widget__type-around__button:hover svg polyline{animation:ck-widget-type-around-arrow-dash 2s linear}.ck .ck-widget .ck-widget__type-around__button:hover svg line{animation:ck-widget-type-around-arrow-tip-dash 2s linear}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:1;pointer-events:auto}.ck .ck-widget:not(.ck-widget_selected)>.ck-widget__type-around>.ck-widget__type-around__button{background:var(--ck-color-widget-type-around-button-hover)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover{background:var(--ck-color-widget-type-around-button-active)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{width:calc(var(--ck-widget-type-around-button-size) - 2px);height:calc(var(--ck-widget-type-around-button-size) - 2px);border-radius:100px;background:linear-gradient(135deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3))}.ck .ck-widget.ck-widget_with-selection-handle>.ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:20px}.ck .ck-widget .ck-widget__type-around__fake-caret{pointer-events:none;height:1px;animation:ck-widget-type-around-fake-caret-pulse 1s linear infinite normal forwards;outline:1px solid hsla(0,0%,100%,.5);background:var(--ck-color-base-text)}.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_after,.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_before{outline-color:transparent}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected:hover,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle{opacity:0}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer{opacity:0}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:0;margin-right:20px}.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover){background:var(--ck-color-widget-type-around-button-blurred-editable)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover) svg *{stroke:#999}@keyframes ck-widget-type-around-arrow-dash{0%{stroke-dashoffset:10}20%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-arrow-tip-dash{0%,20%{stroke-dashoffset:7}40%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-button-sonar{0%{box-shadow:0 0 0 0 hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}50%{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-end-alpha))}to{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}}@keyframes ck-widget-type-around-fake-caret-pulse{0%{opacity:1}49%{opacity:1}50%{opacity:0}99%{opacity:0}to{opacity:1}}'},function(e,t,i){var o=i(1),n=i(76);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-resizer:var(--ck-color-focus-border);--ck-color-resizer-tooltip-background:#262626;--ck-color-resizer-tooltip-text:#f2f2f2;--ck-resizer-border-radius:var(--ck-border-radius);--ck-resizer-tooltip-offset:10px;--ck-resizer-tooltip-height:calc(var(--ck-spacing-small)*2 + 10px)}.ck .ck-widget,.ck .ck-widget.ck-widget_with-selection-handle{position:relative}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{position:absolute}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{display:block}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle:hover>.ck-widget__selection-handle{visibility:visible}.ck .ck-size-view{background:var(--ck-color-resizer-tooltip-background);color:var(--ck-color-resizer-tooltip-text);border:1px solid var(--ck-color-resizer-tooltip-text);border-radius:var(--ck-resizer-border-radius);font-size:var(--ck-font-size-tiny);display:block;padding:0 var(--ck-spacing-small);height:var(--ck-resizer-tooltip-height);line-height:var(--ck-resizer-tooltip-height)}.ck .ck-size-view.ck-orientation-above-center,.ck .ck-size-view.ck-orientation-bottom-left,.ck .ck-size-view.ck-orientation-bottom-right,.ck .ck-size-view.ck-orientation-top-left,.ck .ck-size-view.ck-orientation-top-right{position:absolute}.ck .ck-size-view.ck-orientation-top-left{top:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-top-right{top:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-right{bottom:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-left{bottom:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-above-center{top:calc(var(--ck-resizer-tooltip-height)*-1);left:50%;transform:translate(-50%)}:root{--ck-widget-outline-thickness:3px;--ck-widget-handler-icon-size:16px;--ck-widget-handler-animation-duration:200ms;--ck-widget-handler-animation-curve:ease;--ck-color-widget-blurred-border:#dedede;--ck-color-widget-hover-border:#ffc83d;--ck-color-widget-editable-focus-background:var(--ck-color-base-background);--ck-color-widget-drag-handler-icon-color:var(--ck-color-base-background)}.ck .ck-widget{outline-width:var(--ck-widget-outline-thickness);outline-style:solid;outline-color:transparent;transition:outline-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_selected,.ck .ck-widget.ck-widget_selected:hover{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-focus-border)}.ck .ck-widget:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-editor__nested-editable{border:1px solid transparent}.ck .ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck .ck-editor__nested-editable:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;background-color:var(--ck-color-widget-editable-focus-background)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{padding:4px;box-sizing:border-box;background-color:transparent;opacity:0;transition:background-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),visibility var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);border-radius:var(--ck-border-radius) var(--ck-border-radius) 0 0;transform:translateY(-100%);left:calc(0px - var(--ck-widget-outline-thickness));top:0}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{width:var(--ck-widget-handler-icon-size);height:var(--ck-widget-handler-icon-size);color:var(--ck-color-widget-drag-handler-icon-color)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:0;transition:opacity .3s var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover .ck-icon .ck-icon__selected-indicator{opacity:1}.ck .ck-widget.ck-widget_with-selection-handle:hover>.ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-focus-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:1}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{left:auto;right:calc(0px - var(--ck-widget-outline-thickness))}.ck.ck-editor__editable.ck-read-only .ck-widget{transition:none}.ck.ck-editor__editable.ck-read-only .ck-widget:not(.ck-widget_selected){--ck-widget-outline-thickness:0px}.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{outline-color:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle>.ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle>.ck-widget__selection-handle:hover,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle>.ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle>.ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable>.ck-widget.ck-widget_with-selection-handle:first-child,.ck.ck-editor__editable blockquote>.ck-widget.ck-widget_with-selection-handle:first-child{margin-top:calc(1em + var(--ck-widget-handler-icon-size))}"},function(e,t,i){var o=i(1),n=i(78);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-widget_with-resizer{position:relative}.ck .ck-widget__resizer{display:none;position:absolute;pointer-events:none;left:0;top:0}.ck-focused .ck-widget_with-resizer.ck-widget_selected>.ck-widget__resizer{display:block}.ck .ck-widget__resizer__handle{position:absolute;pointer-events:all}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-right,.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-left{cursor:nwse-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-left,.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-right{cursor:nesw-resize}:root{--ck-resizer-size:10px;--ck-resizer-offset:calc(var(--ck-resizer-size)/-2 - 2px);--ck-resizer-border-width:1px}.ck .ck-widget__resizer{outline:1px solid var(--ck-color-resizer)}.ck .ck-widget__resizer__handle{width:var(--ck-resizer-size);height:var(--ck-resizer-size);background:var(--ck-color-focus-border);border:var(--ck-resizer-border-width) solid #fff;border-radius:var(--ck-resizer-border-radius)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-left{top:var(--ck-resizer-offset);left:var(--ck-resizer-offset)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-right{top:var(--ck-resizer-offset);right:var(--ck-resizer-offset)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-right{bottom:var(--ck-resizer-offset);right:var(--ck-resizer-offset)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-left{bottom:var(--ck-resizer-offset);left:var(--ck-resizer-offset)}"},function(e,t,i){var o=i(1),n=i(80);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-text-alternative-form{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-text-alternative-form .ck-labeled-field-view{display:inline-block}.ck.ck-text-alternative-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-text-alternative-form{flex-wrap:wrap}.ck.ck-text-alternative-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-text-alternative-form .ck-button{flex-basis:50%}}"},function(e,t,i){var o=i(1),n=i(82);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position{display:inline;position:relative;pointer-events:none}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{position:absolute;width:0}.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__selection-handle,.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__type-around{display:none}:root{--ck-clipboard-drop-target-dot-width:12px;--ck-clipboard-drop-target-dot-height:8px;--ck-clipboard-drop-target-color:var(--ck-color-focus-border)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{bottom:calc(var(--ck-clipboard-drop-target-dot-height)*-0.5);top:calc(var(--ck-clipboard-drop-target-dot-height)*-0.5);border:1px solid var(--ck-clipboard-drop-target-color);background:var(--ck-clipboard-drop-target-color);margin-left:-1px}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span:after{content:"";width:0;height:0;display:block;position:absolute;left:50%;top:calc(var(--ck-clipboard-drop-target-dot-height)*-0.5);transform:translateX(-50%);border-left:calc(var(--ck-clipboard-drop-target-dot-width)*0.5) solid transparent;border-bottom:0 solid transparent;border-right:calc(var(--ck-clipboard-drop-target-dot-width)*0.5) solid transparent;border-top:calc(var(--ck-clipboard-drop-target-dot-height)) solid var(--ck-clipboard-drop-target-color)}.ck.ck-editor__editable .ck-widget.ck-clipboard-drop-target-range{outline:var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color)!important}.ck.ck-editor__editable .ck-widget:-webkit-drag{zoom:.6;outline:none!important}'},function(e,t){e.exports=".ck-content .image{display:table;clear:both;text-align:center;margin:.9em auto;min-width:50px}.ck-content .image img{display:block;margin:0 auto;max-width:100%;min-width:100%}.ck-content .image-inline{display:inline-flex;max-width:100%;align-items:flex-start}.ck-content .image-inline picture{display:flex}.ck-content .image-inline img,.ck-content .image-inline picture{flex-grow:1;flex-shrink:1;max-width:100%}.ck.ck-editor__editable .image>figcaption.ck-placeholder:before{padding-left:inherit;padding-right:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ck.ck-editor__editable .image-inline.ck-widget_selected,.ck.ck-editor__editable .image.ck-widget_selected{z-index:1}.ck.ck-editor__editable .image-inline.ck-widget_selected ::selection{display:none}.ck.ck-editor__editable td .image-inline img,.ck.ck-editor__editable th .image-inline img{max-width:none}"},function(e,t,i){var o=i(1),n=i(85);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-image-caption-background:#f7f7f7;--ck-color-image-caption-text:#333;--ck-color-image-caption-highligted-background:#fd0}.ck-content .image>figcaption{display:table-caption;caption-side:bottom;word-break:break-word;color:var(--ck-color-image-caption-text);background-color:var(--ck-color-image-caption-background);padding:.6em;font-size:.75em;outline-offset:-1px}.ck.ck-editor__editable .image>figcaption.image__caption_highlighted{animation:ck-image-caption-highlight .6s ease-out}@keyframes ck-image-caption-highlight{0%{background-color:var(--ck-color-image-caption-highligted-background)}to{background-color:var(--ck-color-image-caption-background)}}"},function(e,t,i){var o=i(1),n=i(87);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-image-style-spacing:1.5em;--ck-inline-image-style-spacing:calc(var(--ck-image-style-spacing)/2)}.ck-content .image-style-block-align-left,.ck-content .image-style-block-align-right{max-width:calc(100% - var(--ck-image-style-spacing))}.ck-content .image-style-align-left,.ck-content .image-style-align-right{clear:none}.ck-content .image-style-side{float:right;margin-left:var(--ck-image-style-spacing);max-width:50%}.ck-content .image-style-align-left{float:left;margin-right:var(--ck-image-style-spacing)}.ck-content .image-style-align-center{margin-left:auto;margin-right:auto}.ck-content .image-style-align-right{float:right;margin-left:var(--ck-image-style-spacing)}.ck-content .image-style-block-align-right{margin-right:0;margin-left:auto}.ck-content .image-style-block-align-left{margin-left:0;margin-right:auto}.ck-content p+.image-style-align-left,.ck-content p+.image-style-align-right,.ck-content p+.image-style-side{margin-top:0}.ck-content .image-inline.image-style-align-left,.ck-content .image-inline.image-style-align-right{margin-top:var(--ck-inline-image-style-spacing);margin-bottom:var(--ck-inline-image-style-spacing)}.ck-content .image-inline.image-style-align-left{margin-right:var(--ck-inline-image-style-spacing)}.ck-content .image-inline.image-style-align-right{margin-left:var(--ck-inline-image-style-spacing)}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover){background-color:var(--ck-color-button-on-background)}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__action:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__action:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover):after{display:none}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover){background-color:var(--ck-color-button-on-hover-background)}"},function(e,t,i){var o=i(1),n=i(89);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-editor__editable .image,.ck.ck-editor__editable .image-inline{position:relative}.ck.ck-editor__editable .image-inline .ck-progress-bar,.ck.ck-editor__editable .image .ck-progress-bar{position:absolute;top:0;left:0}.ck.ck-editor__editable .image-inline.ck-appear,.ck.ck-editor__editable .image.ck-appear{animation:fadeIn .7s}.ck.ck-editor__editable .image-inline .ck-progress-bar,.ck.ck-editor__editable .image .ck-progress-bar{height:2px;width:0;background:var(--ck-color-upload-bar-background);transition:width .1s}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}"},function(e,t,i){var o=i(1),n=i(91);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck-image-upload-complete-icon{display:block;position:absolute;top:min(var(--ck-spacing-medium),6%);right:min(var(--ck-spacing-medium),6%);border-radius:50%;z-index:1}.ck-image-upload-complete-icon:after{content:"";position:absolute}:root{--ck-color-image-upload-icon:#fff;--ck-color-image-upload-icon-background:#008a00;--ck-image-upload-icon-size:20;--ck-image-upload-icon-width:2px;--ck-image-upload-icon-is-visible:clamp(0px,100% - 50px,1px)}.ck-image-upload-complete-icon{opacity:0;background:var(--ck-color-image-upload-icon-background);animation-name:ck-upload-complete-icon-show,ck-upload-complete-icon-hide;animation-fill-mode:forwards,forwards;animation-duration:.5s,.5s;font-size:calc(1px*var(--ck-image-upload-icon-size));animation-delay:0ms,3s;overflow:hidden;width:calc(var(--ck-image-upload-icon-is-visible)*var(--ck-image-upload-icon-size));height:calc(var(--ck-image-upload-icon-is-visible)*var(--ck-image-upload-icon-size))}.ck-image-upload-complete-icon:after{left:25%;top:50%;opacity:0;height:0;width:0;transform:scaleX(-1) rotate(135deg);transform-origin:left top;border-top:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);border-right:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);animation-name:ck-upload-complete-icon-check;animation-duration:.5s;animation-delay:.5s;animation-fill-mode:forwards;box-sizing:border-box}@keyframes ck-upload-complete-icon-show{0%{opacity:0}to{opacity:1}}@keyframes ck-upload-complete-icon-hide{0%{opacity:1}to{opacity:0}}@keyframes ck-upload-complete-icon-check{0%{opacity:1;width:0;height:0}33%{width:.3em;height:0}to{opacity:1;width:.3em;height:.45em}}'},function(e,t,i){var o=i(1),n=i(93);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck .ck-upload-placeholder-loader{position:absolute;display:flex;align-items:center;justify-content:center;top:0;left:0}.ck .ck-upload-placeholder-loader:before{content:"";position:relative}:root{--ck-color-upload-placeholder-loader:#b3b3b3;--ck-upload-placeholder-loader-size:32px}.ck .ck-image-upload-placeholder{width:100%;margin:0}.ck .ck-upload-placeholder-loader{width:100%;height:100%}.ck .ck-upload-placeholder-loader:before{width:var(--ck-upload-placeholder-loader-size);height:var(--ck-upload-placeholder-loader-size);border-radius:50%;border-top:3px solid var(--ck-color-upload-placeholder-loader);border-right:2px solid transparent;animation:ck-upload-placeholder-loader 1s linear infinite}@keyframes ck-upload-placeholder-loader{to{transform:rotate(1turn)}}'},function(e,t,i){var o=i(1),n=i(95);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .image.image_resized{max-width:100%;display:block;box-sizing:border-box}.ck-content .image.image_resized img{width:100%}.ck-content .image.image_resized>figcaption{display:block}.ck.ck-editor__editable td .image-inline.image_resized img,.ck.ck-editor__editable th .image-inline.image_resized img{max-width:100%}[dir=ltr] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-left:var(--ck-spacing-standard)}.ck.ck-dropdown .ck-button.ck-resize-image-button .ck-button__label{width:4em}"},function(e,t,i){var o=i(1),n=i(97);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}.ck .ck-link_selected span.image-inline{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-link-selected-background)}.ck .ck-fake-link-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-link-selection_collapsed{height:100%;border-right:1px solid var(--ck-color-base-text);margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}"},function(e,t,i){var o=i(1),n=i(99);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-link-form{display:flex}.ck.ck-link-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-link-form{flex-wrap:wrap}.ck.ck-link-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form_layout-vertical{display:block}.ck.ck-link-form_layout-vertical .ck-button.ck-button-cancel,.ck.ck-link-form_layout-vertical .ck-button.ck-button-save{margin-top:var(--ck-spacing-medium)}.ck.ck-link-form_layout-vertical{padding:0;min-width:var(--ck-input-text-width)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form_layout-vertical .ck-button{padding:var(--ck-spacing-standard);margin:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border);width:50%}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button,[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}.ck.ck-link-form_layout-vertical .ck.ck-list{margin:var(--ck-spacing-standard) var(--ck-spacing-large)}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{border:0;padding:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}"},function(e,t,i){var o=i(1),n=i(101);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-link-actions{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-link-actions .ck-link-actions__preview{display:inline-block}.ck.ck-link-actions .ck-link-actions__preview .ck-button__label{overflow:hidden}@media screen and (max-width:600px){.ck.ck-link-actions{flex-wrap:wrap}.ck.ck-link-actions .ck-link-actions__preview{flex-basis:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){flex-basis:50%}}.ck.ck-link-actions .ck-button.ck-link-actions__preview{padding-left:0;padding-right:0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{padding:0 var(--ck-spacing-medium);color:var(--ck-color-link-default);text-overflow:ellipsis;cursor:pointer;max-width:var(--ck-input-text-width);min-width:3em;text-align:center}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview,.ck.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}[dir=ltr] .ck.ck-link-actions .ck-button:not(:first-child),[dir=rtl] .ck.ck-link-actions .ck-button:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-actions .ck-button.ck-link-actions__preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{min-width:0;max-width:100%}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview),[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}}"},function(e,t,i){var o=i(1),n=i(103);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar>.ck-toolbar__items{display:grid}:root{--ck-list-style-button-size:44px}.ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar{background:none;padding:0}.ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar>.ck-toolbar__items{grid-template-columns:repeat(3,auto);row-gap:var(--ck-spacing-medium);column-gap:var(--ck-spacing-medium);padding:var(--ck-spacing-medium)}.ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar>.ck-toolbar__items .ck-button{width:var(--ck-list-style-button-size);height:var(--ck-list-style-button-size);padding:0;margin:0;box-sizing:content-box}.ck.ck-list-styles-dropdown>.ck-dropdown__panel>.ck-toolbar>.ck-toolbar__items .ck-button .ck-icon{width:var(--ck-list-style-button-size);height:var(--ck-list-style-button-size)}"},function(e,t,i){var o=i(1),n=i(105);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=':root{--ck-todo-list-checkmark-size:16px}.ck-content .todo-list{list-style:none}.ck-content .todo-list li{margin-bottom:5px}.ck-content .todo-list li .todo-list{margin-top:5px}.ck-content .todo-list .todo-list__label>input{-webkit-appearance:none;display:inline-block;position:relative;width:var(--ck-todo-list-checkmark-size);height:var(--ck-todo-list-checkmark-size);vertical-align:middle;border:0;left:-25px;margin-right:-15px;right:0;margin-left:0}.ck-content .todo-list .todo-list__label>input:before{display:block;position:absolute;box-sizing:border-box;content:"";width:100%;height:100%;border:1px solid #333;border-radius:2px;transition:box-shadow .25s ease-in-out,background .25s ease-in-out,border .25s ease-in-out}.ck-content .todo-list .todo-list__label>input:after{display:block;position:absolute;box-sizing:content-box;pointer-events:none;content:"";left:calc(var(--ck-todo-list-checkmark-size)/3);top:calc(var(--ck-todo-list-checkmark-size)/5.3);width:calc(var(--ck-todo-list-checkmark-size)/5.3);height:calc(var(--ck-todo-list-checkmark-size)/2.6);border-left:0 solid transparent;border-bottom:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-right:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-top:0 solid transparent;transform:rotate(45deg)}.ck-content .todo-list .todo-list__label>input[checked]:before{background:#26ab33;border-color:#26ab33}.ck-content .todo-list .todo-list__label>input[checked]:after{border-color:#fff}.ck-content .todo-list .todo-list__label .todo-list__label__description{vertical-align:middle}[dir=rtl] .todo-list .todo-list__label>input{left:0;margin-right:0;right:-25px;margin-left:-15px}.ck-editor__editable .todo-list .todo-list__label>input{cursor:pointer}.ck-editor__editable .todo-list .todo-list__label>input:hover:before{box-shadow:0 0 0 5px rgba(0,0,0,.1)}'},function(e,t,i){var o=i(1),n=i(107);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-table-focused-cell-background:rgba(158,207,250,0.3)}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table td.ck-editor__nested-editable:focus,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table th.ck-editor__nested-editable:focus{background:var(--ck-color-table-focused-cell-background);border-style:none;outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}"},function(e,t,i){var o=i(1),n=i(109);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap}:root{--ck-insert-table-dropdown-padding:10px;--ck-insert-table-dropdown-box-height:11px;--ck-insert-table-dropdown-box-width:12px;--ck-insert-table-dropdown-box-margin:1px}.ck .ck-insert-table-dropdown__grid{width:calc(var(--ck-insert-table-dropdown-box-width)*10 + var(--ck-insert-table-dropdown-box-margin)*20 + var(--ck-insert-table-dropdown-padding)*2);padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0}.ck .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{width:var(--ck-insert-table-dropdown-box-width);height:var(--ck-insert-table-dropdown-box-height);margin:var(--ck-insert-table-dropdown-box-margin);border:1px solid var(--ck-color-base-border);border-radius:1px}.ck .ck-insert-table-dropdown-grid-box.ck-on{border-color:var(--ck-color-focus-border);background:var(--ck-color-focus-outer-shadow)}"},function(e,t,i){var o=i(1),n=i(111);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=':root{--ck-table-selected-cell-background:rgba(158,207,250,0.3)}.ck.ck-editor__editable .table table td.ck-editor__editable_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected{position:relative;caret-color:transparent;outline:unset;box-shadow:unset}.ck.ck-editor__editable .table table td.ck-editor__editable_selected:after,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:after{content:"";pointer-events:none;background-color:var(--ck-table-selected-cell-background);position:absolute;top:0;left:0;right:0;bottom:0}.ck.ck-editor__editable .table table td.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table td.ck-editor__editable_selected:focus,.ck.ck-editor__editable .table table th.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:focus{background-color:transparent}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget_selected{outline:unset}'},function(e,t,i){var o=i(1),n=i(113);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .table{margin:.9em auto;display:table}.ck-content .table table{border-collapse:collapse;border-spacing:0;width:100%;height:100%;border:1px double #b3b3b3}.ck-content .table table td,.ck-content .table table th{min-width:2em;padding:.4em;border:1px solid #bfbfbf}.ck-content .table table th{font-weight:700;background:hsla(0,0%,0%,5%)}.ck-content[dir=rtl] .table th{text-align:right}.ck-content[dir=ltr] .table th{text-align:left}.ck-editor__editable .ck-table-bogus-paragraph{display:inline-block;width:100%}"},function(e,t,i){var o=i(1),n=i(115);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-input-color{width:100%;display:flex;flex-direction:row-reverse}.ck.ck-input-color>input.ck.ck-input-text{min-width:auto;flex-grow:1}.ck.ck-input-color>div.ck.ck-dropdown{min-width:auto}.ck.ck-input-color>div.ck.ck-dropdown>.ck-input-color__button .ck-dropdown__arrow{display:none}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview{position:relative;overflow:hidden}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{position:absolute;display:block}[dir=ltr] .ck.ck-input-color>.ck.ck-input-text{border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-input-text{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{padding:0}[dir=ltr] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{border-left-width:0;border-top-left-radius:0;border-bottom-left-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{border-right-width:0;border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button.ck-disabled{background:var(--ck-color-input-disabled-background)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview{border-radius:0}.ck-rounded-corners .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview,.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview{width:20px;height:20px;border:1px solid var(--ck-color-input-border)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{top:-30%;left:50%;height:150%;width:8%;background:red;border-radius:2px;transform:rotate(45deg);transform-origin:50%}.ck.ck-input-color .ck.ck-input-color__remove-color{width:100%;border-bottom:1px solid var(--ck-color-input-border);padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}[dir=ltr] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-right-radius:0}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-left-radius:0}.ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:0;margin-left:var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(117);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-form__row{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.ck.ck-form__row>:not(.ck-label){flex-grow:1}.ck.ck-form__row.ck-table-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-table-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row{padding:var(--ck-spacing-standard) var(--ck-spacing-large) 0}[dir=ltr] .ck.ck-form__row>:not(.ck-label)+*{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-form__row>:not(.ck-label)+*{margin-right:var(--ck-spacing-large)}.ck.ck-form__row>.ck-label{width:100%;min-width:100%}.ck.ck-form__row.ck-table-form__action-row{margin-top:var(--ck-spacing-large)}.ck.ck-form__row.ck-table-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}"},function(e,t){e.exports=".ck.ck-form{padding:0 0 var(--ck-spacing-large)}.ck.ck-form:focus{outline:none}.ck.ck-form .ck.ck-input-text{min-width:100%;width:0}.ck.ck-form .ck.ck-dropdown{min-width:100%}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button .ck-button__label{width:100%}"},function(e,t){e.exports='.ck.ck-table-form .ck-form__row.ck-table-form__background-row,.ck.ck-table-form .ck-form__row.ck-table-form__border-row{flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{flex-wrap:wrap;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view{display:flex;flex-direction:column-reverse;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{flex-grow:0}.ck.ck-table-form .ck.ck-labeled-field-view{position:relative}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{position:absolute;left:50%;bottom:calc(var(--ck-table-properties-error-arrow-size)*-1);transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{content:"";position:absolute;top:calc(var(--ck-table-properties-error-arrow-size)*-1);left:50%;transform:translateX(-50%)}:root{--ck-table-properties-error-arrow-size:6px;--ck-table-properties-min-error-width:150px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view>.ck-label{font-size:var(--ck-font-size-tiny);text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{width:80px;min-width:80px;max-width:80px}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{padding:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__height,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__width{margin:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{align-self:flex-end;display:inline-block;height:var(--ck-ui-component-min-height);line-height:var(--ck-ui-component-min-height);margin:0 var(--ck-spacing-small)}.ck.ck-table-form .ck.ck-labeled-field-view{padding-top:var(--ck-spacing-standard)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{border-radius:0}.ck-rounded-corners .ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status,.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{background:var(--ck-color-base-error);color:var(--ck-color-base-background);padding:var(--ck-spacing-small) var(--ck-spacing-medium);min-width:var(--ck-table-properties-min-error-width);text-align:center}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{border-left:var(--ck-table-properties-error-arrow-size) solid transparent;border-bottom:var(--ck-table-properties-error-arrow-size) solid var(--ck-color-base-error);border-right:var(--ck-table-properties-error-arrow-size) solid transparent;border-top:0 solid transparent}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:ck-table-form-labeled-view-status-appear .15s ease both}.ck.ck-table-form .ck.ck-labeled-field-view .ck-input.ck-error:not(:focus)+.ck.ck-labeled-field-view__status{display:none}@keyframes ck-table-form-labeled-view-status-appear{0%{opacity:0}to{opacity:1}}'},function(e,t,i){var o=i(1),n=i(121);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{flex-wrap:wrap;flex-basis:0;align-content:baseline}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items{flex-wrap:nowrap}.ck.ck-table-properties-form{width:320px}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-self:flex-end;padding:0}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items>*{width:40px}"},function(e,t,i){var o=i(1),n=i(123);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row{flex-wrap:wrap}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar:first-of-type{flex-grow:0.57}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar:last-of-type{flex-grow:0.43}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar .ck-button{flex-grow:1}.ck.ck-table-cell-properties-form{width:320px}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__padding-row{align-self:flex-end;padding:0;width:25%}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(125);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-table-caption-background:#f7f7f7;--ck-color-table-caption-text:#333;--ck-color-table-caption-highlighted-background:#fd0}.ck-content .table>figcaption{display:table-caption;caption-side:top;word-break:break-word;text-align:center;color:var(--ck-color-table-caption-text);background-color:var(--ck-color-table-caption-background);padding:.6em;font-size:.75em;outline-offset:-1px}.ck.ck-editor__editable .table>figcaption.table__caption_highlighted{animation:ck-table-caption-highlight .6s ease-out}.ck.ck-editor__editable .table>figcaption.ck-placeholder:before{padding-left:inherit;padding-right:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes ck-table-caption-highlight{0%{background-color:var(--ck-color-table-caption-highlighted-background)}to{background-color:var(--ck-color-table-caption-background)}}"},function(e,t,i){var o=i(1),n=i(127);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-button.ck-color-table__remove-color{display:flex;align-items:center;width:100%}label.ck.ck-color-grid__label{font-weight:unset}.ck .ck-button.ck-color-table__remove-color{padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck .ck-button.ck-color-table__remove-color:not(:focus){border-bottom:1px solid var(--ck-color-base-border)}[dir=ltr] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-left:var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(129);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .text-tiny{font-size:.7em}.ck-content .text-small{font-size:.85em}.ck-content .text-big{font-size:1.4em}.ck-content .text-huge{font-size:1.8em}"},function(e,t,i){var o=i(1),n=i(131);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content pre{padding:1em;color:#353535;background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;text-align:left;direction:ltr;tab-size:4;white-space:pre-wrap;font-style:normal;min-width:200px}.ck-content pre code{background:unset;padding:0;border-radius:0}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{top:-1px;right:10px;background:var(--ck-color-code-block-label-background);font-size:10px;font-family:var(--ck-font-face);line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);color:#fff;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-y:auto;overflow-x:hidden}"},function(e,t,i){var o=i(1),n=i(133);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-mention-list-max-height:300px}.ck.ck-mentions{max-height:var(--ck-mention-list-max-height);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.ck.ck-mentions>.ck-list__item{overflow:hidden;flex-shrink:0}"},function(e,t,i){var o=i(1),n=i(135);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-mention-background:rgba(153,0,48,0.1);--ck-color-mention-text:#990030}.ck-content .mention{background:var(--ck-color-mention-background);color:var(--ck-color-mention-text)}"},function(e,t,i){var o=i(1),n=i(137);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-editor__editable .ck-horizontal-line{display:flow-root}.ck-content hr{margin:15px 0;height:4px;background:#dedede;border:0}"},function(e,t,i){var o=i(1),n=i(139);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-labeled-input .ck-labeled-input__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-input .ck-labeled-input__status_error{color:var(--ck-color-base-error)}"},function(e,t,i){var o=i(1),n=i(141);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-math-form{display:flex;align-items:flex-start;flex-direction:row;flex-wrap:nowrap}@media screen and (max-width:600px){.ck.ck-math-form{flex-wrap:wrap}.ck.ck-math-form .ck-math-view,.ck.ck-math-form .ck-math-view .ck-label,.ck.ck-math-form .ck-math-view .ck-labeled-input{flex-basis:100%}.ck.ck-math-form .ck-button{flex-basis:50%}}.ck-math-tex.ck-placeholder:before{display:none!important}.ck.ck-toolbar-container{z-index:calc(var(--ck-z-modal) + 2)}"},function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return dx}));var o=function(){return function e(){e.called=!0}};class n{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=o(),this.off=o()}}const r=new Array(256).fill().map((e,t)=>("0"+t.toString(16)).slice(-2));function s(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,i=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0;return"e"+r[e>>0&255]+r[e>>8&255]+r[e>>16&255]+r[e>>24&255]+r[t>>0&255]+r[t>>8&255]+r[t>>16&255]+r[t>>24&255]+r[i>>0&255]+r[i>>8&255]+r[i>>16&255]+r[i>>24&255]+r[o>>0&255]+r[o>>8&255]+r[o>>16&255]+r[o>>24&255]}var a={get(e){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5},l=(i(6),i(0));const c=Symbol("listeningTo"),d=Symbol("emitterId");var h={on(e,t,i={}){this.listenTo(this,e,t,i)},once(e,t,i){let o=!1;this.listenTo(this,e,(function(e,...i){o||(o=!0,e.off(),t.call(this,e,...i))}),i)},off(e,t){this.stopListening(this,e,t)},listenTo(e,t,i,o={}){let n,r;this[c]||(this[c]={});const s=this[c];g(e)||u(e);const a=g(e);(n=s[a])||(n=s[a]={emitter:e,callbacks:{}}),(r=n.callbacks[t])||(r=n.callbacks[t]=[]),r.push(i),function(e,t,i,o,n){t._addEventListener?t._addEventListener(i,o,n):e._addEventListener.call(t,i,o,n)}(this,e,t,i,o)},stopListening(e,t,i){const o=this[c];let n=e&&g(e);const r=o&&n&&o[n],s=r&&t&&r.callbacks[t];if(!(!o||e&&!r||t&&!s))if(i){b(this,e,t,i);-1!==s.indexOf(i)&&(1===s.length?delete r.callbacks[t]:b(this,e,t,i))}else if(s){for(;i=s.pop();)b(this,e,t,i);delete r.callbacks[t]}else if(r){for(t in r.callbacks)this.stopListening(e,t);delete o[n]}else{for(n in o)this.stopListening(o[n].emitter);delete this[c]}},fire(e,...t){try{const i=e instanceof n?e:new n(this,e),o=i.name;let r=function e(t,i){let o;if(!t._events||!(o=t._events[i])||!o.callbacks.length)return i.indexOf(":")>-1?e(t,i.substr(0,i.lastIndexOf(":"))):null;return o.callbacks}(this,o);if(i.path.push(this),r){const e=[i,...t];r=Array.from(r);for(let t=0;t<r.length&&(r[t].callback.apply(this,e),i.off.called&&(delete i.off.called,this._removeEventListener(o,r[t].callback)),!i.stop.called);t++);}if(this._delegations){const e=this._delegations.get(o),n=this._delegations.get("*");e&&p(e,i,t),n&&p(n,i,t)}return i.return}catch(e){l.a.rethrowUnexpectedError(e,this)}},delegate(...e){return{to:(t,i)=>{this._delegations||(this._delegations=new Map),e.forEach(e=>{const o=this._delegations.get(e);o?o.set(t,i):this._delegations.set(e,new Map([[t,i]]))})}}},stopDelegating(e,t){if(this._delegations)if(e)if(t){const i=this._delegations.get(e);i&&i.delete(t)}else this._delegations.delete(e);else this._delegations.clear()},_addEventListener(e,t,i){!function(e,t){const i=m(e);if(i[t])return;let o=t,n=null;const r=[];for(;""!==o&&!i[o];)i[o]={callbacks:[],childEvents:[]},r.push(i[o]),n&&i[o].childEvents.push(n),n=o,o=o.substr(0,o.lastIndexOf(":"));if(""!==o){for(const e of r)e.callbacks=i[o].callbacks.slice();i[o].childEvents.push(n)}}(this,e);const o=f(this,e),n=a.get(i.priority),r={callback:t,priority:n};for(const e of o){let t=!1;for(let i=0;i<e.length;i++)if(e[i].priority<n){e.splice(i,0,r),t=!0;break}t||e.push(r)}},_removeEventListener(e,t){const i=f(this,e);for(const e of i)for(let i=0;i<e.length;i++)e[i].callback==t&&(e.splice(i,1),i--)}};function u(e,t){e[d]||(e[d]=t||s())}function g(e){return e[d]}function m(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function f(e,t){const i=m(e)[t];if(!i)return[];let o=[i.callbacks];for(let t=0;t<i.childEvents.length;t++){const n=f(e,i.childEvents[t]);o=o.concat(n)}return o}function p(e,t,i){for(let[o,r]of e){r?"function"==typeof r&&(r=r(t.name)):r=t.name;const e=new n(t.source,r);e.path=[...t.path],o.fire(e,...i)}}function b(e,t,i,o){t._removeEventListener?t._removeEventListener(i,o):e._removeEventListener.call(t,i,o)}var w=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},k=i(3),_=k.a.Symbol,v=Object.prototype,y=v.hasOwnProperty,x=v.toString,C=_?_.toStringTag:void 0;var A=function(e){var t=y.call(e,C),i=e[C];try{e[C]=void 0;var o=!0}catch(e){}var n=x.call(e);return o&&(t?e[C]=i:delete e[C]),n},T=Object.prototype.toString;var E=function(e){return T.call(e)},P=_?_.toStringTag:void 0;var S=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":P&&P in Object(e)?A(e):E(e)};var I,R=function(e){if(!w(e))return!1;var t=S(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},V=k.a["__core-js_shared__"],O=(I=/[^.]+$/.exec(V&&V.keys&&V.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var z=function(e){return!!O&&O in e},M=Function.prototype.toString;var B=function(e){if(null!=e){try{return M.call(e)}catch(e){}try{return e+""}catch(e){}}return""},N=/^\[object .+?Constructor\]$/,F=Function.prototype,D=Object.prototype,L=F.toString,H=D.hasOwnProperty,j=RegExp("^"+L.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var W=function(e){return!(!w(e)||z(e))&&(R(e)?j:N).test(B(e))};var q=function(e,t){return null==e?void 0:e[t]};var U=function(e,t){var i=q(e,t);return W(i)?i:void 0},K=function(){try{var e=U(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var G=function(e,t,i){"__proto__"==t&&K?K(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i};var J=function(e,t){return e===t||e!=e&&t!=t},Y=Object.prototype.hasOwnProperty;var Q=function(e,t,i){var o=e[t];Y.call(e,t)&&J(o,i)&&(void 0!==i||t in e)||G(e,t,i)};var X=function(e,t,i,o){var n=!i;i||(i={});for(var r=-1,s=t.length;++r<s;){var a=t[r],l=o?o(i[a],e[a],a,i,e):void 0;void 0===l&&(l=e[a]),n?G(i,a,l):Q(i,a,l)}return i};var Z=function(e){return e};var ee=function(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)},te=Math.max;var ie=function(e,t,i){return t=te(void 0===t?e.length-1:t,0),function(){for(var o=arguments,n=-1,r=te(o.length-t,0),s=Array(r);++n<r;)s[n]=o[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=o[n];return a[t]=i(s),ee(e,this,a)}};var oe=function(e){return function(){return e}},ne=K?function(e,t){return K(e,"toString",{configurable:!0,enumerable:!1,value:oe(t),writable:!0})}:Z,re=Date.now;var se=function(e){var t=0,i=0;return function(){var o=re(),n=16-(o-i);if(i=o,n>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(ne);var ae=function(e,t){return se(ie(e,t,Z),e+"")};var le=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ce=function(e){return null!=e&&le(e.length)&&!R(e)},de=/^(?:0|[1-9]\d*)$/;var he=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&de.test(e))&&e>-1&&e%1==0&&e<t};var ue=function(e,t,i){if(!w(i))return!1;var o=typeof t;return!!("number"==o?ce(i)&&he(t,i.length):"string"==o&&t in i)&&J(i[t],e)};var ge=function(e){return ae((function(t,i){var o=-1,n=i.length,r=n>1?i[n-1]:void 0,s=n>2?i[2]:void 0;for(r=e.length>3&&"function"==typeof r?(n--,r):void 0,s&&ue(i[0],i[1],s)&&(r=n<3?void 0:r,n=1),t=Object(t);++o<n;){var a=i[o];a&&e(t,a,o,r)}return t}))};var me=function(e,t){for(var i=-1,o=Array(e);++i<e;)o[i]=t(i);return o};var fe=function(e){return null!=e&&"object"==typeof e};var pe=function(e){return fe(e)&&"[object Arguments]"==S(e)},be=Object.prototype,we=be.hasOwnProperty,ke=be.propertyIsEnumerable,_e=pe(function(){return arguments}())?pe:function(e){return fe(e)&&we.call(e,"callee")&&!ke.call(e,"callee")},ve=Array.isArray,ye=i(4),xe={};xe["[object Float32Array]"]=xe["[object Float64Array]"]=xe["[object Int8Array]"]=xe["[object Int16Array]"]=xe["[object Int32Array]"]=xe["[object Uint8Array]"]=xe["[object Uint8ClampedArray]"]=xe["[object Uint16Array]"]=xe["[object Uint32Array]"]=!0,xe["[object Arguments]"]=xe["[object Array]"]=xe["[object ArrayBuffer]"]=xe["[object Boolean]"]=xe["[object DataView]"]=xe["[object Date]"]=xe["[object Error]"]=xe["[object Function]"]=xe["[object Map]"]=xe["[object Number]"]=xe["[object Object]"]=xe["[object RegExp]"]=xe["[object Set]"]=xe["[object String]"]=xe["[object WeakMap]"]=!1;var Ce=function(e){return fe(e)&&le(e.length)&&!!xe[S(e)]};var Ae=function(e){return function(t){return e(t)}},Te=i(5),Ee=Te.a&&Te.a.isTypedArray,Pe=Ee?Ae(Ee):Ce,Se=Object.prototype.hasOwnProperty;var Ie=function(e,t){var i=ve(e),o=!i&&_e(e),n=!i&&!o&&Object(ye.a)(e),r=!i&&!o&&!n&&Pe(e),s=i||o||n||r,a=s?me(e.length,String):[],l=a.length;for(var c in e)!t&&!Se.call(e,c)||s&&("length"==c||n&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||he(c,l))||a.push(c);return a},Re=Object.prototype;var Ve=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Re)};var Oe=function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t},ze=Object.prototype.hasOwnProperty;var Me=function(e){if(!w(e))return Oe(e);var t=Ve(e),i=[];for(var o in e)("constructor"!=o||!t&&ze.call(e,o))&&i.push(o);return i};var Be=function(e){return ce(e)?Ie(e,!0):Me(e)},Ne=ge((function(e,t){X(t,Be(t),e)}));const Fe=Symbol("observableProperties"),De=Symbol("boundObservables"),Le=Symbol("boundProperties"),He=Symbol("decoratedMethods"),je=Symbol("decoratedOriginal"),We={set(e,t){if(w(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t])},this);$e(this);const i=this[Fe];if(e in this&&!i.has(e))throw new l.a("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>i.get(e),set(t){const o=i.get(e);let n=this.fire("set:"+e,e,t,o);void 0===n&&(n=t),o===n&&i.has(e)||(i.set(e,n),this.fire("change:"+e,e,n,o))}}),this[e]=t},bind(...e){if(!e.length||!Ge(e))throw new l.a("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new l.a("observable-bind-duplicate-properties",this);$e(this);const t=this[Le];e.forEach(e=>{if(t.has(e))throw new l.a("observable-bind-rebind",this)});const i=new Map;return e.forEach(e=>{const o={property:e,to:[]};t.set(e,o),i.set(e,o)}),{to:Ue,toMany:Ke,_observable:this,_bindProperties:e,_to:[],_bindings:i}},unbind(...e){if(!this[Fe])return;const t=this[Le],i=this[De];if(e.length){if(!Ge(e))throw new l.a("observable-unbind-wrong-properties",this);e.forEach(e=>{const o=t.get(e);if(!o)return;let n,r,s,a;o.to.forEach(e=>{n=e[0],r=e[1],s=i.get(n),a=s[r],a.delete(o),a.size||delete s[r],Object.keys(s).length||(i.delete(n),this.stopListening(n,"change"))}),t.delete(e)})}else i.forEach((e,t)=>{this.stopListening(t,"change")}),i.clear(),t.clear()},decorate(e){const t=this[e];if(!t)throw new l.a("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,(e,i)=>{e.return=t.apply(this,i)}),this[e]=function(...t){return this.fire(e,t)},this[e][je]=t,this[He]||(this[He]=[]),this[He].push(e)}};Ne(We,h),We.stopListening=function(e,t,i){if(!e&&this[He]){for(const e of this[He])this[e]=this[e][je];delete this[He]}h.stopListening.call(this,e,t,i)};var qe=We;function $e(e){e[Fe]||(Object.defineProperty(e,Fe,{value:new Map}),Object.defineProperty(e,De,{value:new Map}),Object.defineProperty(e,Le,{value:new Map}))}function Ue(...e){const t=function(...e){if(!e.length)throw new l.a("observable-bind-to-parse-error",null);const t={to:[]};let i;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)i.properties.push(e);else{if("object"!=typeof e)throw new l.a("observable-bind-to-parse-error",null);i={observable:e,properties:[]},t.to.push(i)}}),t}(...e),i=Array.from(this._bindings.keys()),o=i.length;if(!t.callback&&t.to.length>1)throw new l.a("observable-bind-to-no-callback",this);if(o>1&&t.callback)throw new l.a("observable-bind-to-extra-callback",this);var n;t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==o)throw new l.a("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(i[0]).callback=t.callback),n=this._observable,this._to.forEach(e=>{const t=n[De];let i;t.get(e.observable)||n.listenTo(e.observable,"change",(o,r)=>{i=t.get(e.observable)[r],i&&i.forEach(e=>{Je(n,e.property)})})}),function(e){let t;e._bindings.forEach((i,o)=>{e._to.forEach(n=>{t=n.properties[i.callback?0:e._bindProperties.indexOf(o)],i.to.push([n.observable,t]),function(e,t,i,o){const n=e[De],r=n.get(i),s=r||{};s[o]||(s[o]=new Set);s[o].add(t),r||n.set(i,s)}(e._observable,i,n.observable,t)})})}(this),this._bindProperties.forEach(e=>{Je(this._observable,e)})}function Ke(e,t,i){if(this._bindings.size>1)throw new l.a("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const i=e.map(e=>[e,t]);return Array.prototype.concat.apply([],i)}(e,t),i)}function Ge(e){return e.every(e=>"string"==typeof e)}function Je(e,t){const i=e[Le].get(t);let o;i.callback?o=i.callback.apply(e,i.to.map(e=>e[0][e[1]])):(o=i.to[0],o=o[0][o[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=o:e.set(t,o)}function Ye(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach(i=>{if(i in e.prototype)return;const o=Object.getOwnPropertyDescriptor(t,i);o.enumerable=!1,Object.defineProperty(e.prototype,i,o)})})}class Qe{constructor(e){this.editor=e,this.set("isEnabled",!0),this._disableStack=new Set}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Xe,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Xe),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function Xe(e){e.return=!1,e.stop()}Ye(Qe,qe);class Ze{constructor(e){this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.on("execute",e=>{this.isEnabled||e.stop()},{priority:"high"}),this.listenTo(e,"change:isReadOnly",(e,t,i)=>{i?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",et,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",et),this.refresh())}execute(){}destroy(){this.stopListening()}}function et(e){e.return=!1,e.stop()}Ye(Ze,qe);class tt extends Ze{constructor(e){super(e),this._childCommands=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return null!=t&&t.execute(e)}registerChildCommand(e){this._childCommands.push(e),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){return this._childCommands.find(e=>e.isEnabled)}}var it=function(e,t){return function(i){return e(t(i))}},ot=it(Object.getPrototypeOf,Object),nt=Function.prototype,rt=Object.prototype,st=nt.toString,at=rt.hasOwnProperty,lt=st.call(Object);var ct=function(e){if(!fe(e)||"[object Object]"!=S(e))return!1;var t=ot(e);if(null===t)return!0;var i=at.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&st.call(i)==lt};var dt=function(){this.__data__=[],this.size=0};var ht=function(e,t){for(var i=e.length;i--;)if(J(e[i][0],t))return i;return-1},ut=Array.prototype.splice;var gt=function(e){var t=this.__data__,i=ht(t,e);return!(i<0)&&(i==t.length-1?t.pop():ut.call(t,i,1),--this.size,!0)};var mt=function(e){var t=this.__data__,i=ht(t,e);return i<0?void 0:t[i][1]};var ft=function(e){return ht(this.__data__,e)>-1};var pt=function(e,t){var i=this.__data__,o=ht(i,e);return o<0?(++this.size,i.push([e,t])):i[o][1]=t,this};function bt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}bt.prototype.clear=dt,bt.prototype.delete=gt,bt.prototype.get=mt,bt.prototype.has=ft,bt.prototype.set=pt;var wt=bt;var kt=function(){this.__data__=new wt,this.size=0};var _t=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i};var vt=function(e){return this.__data__.get(e)};var yt=function(e){return this.__data__.has(e)},xt=U(k.a,"Map"),Ct=U(Object,"create");var At=function(){this.__data__=Ct?Ct(null):{},this.size=0};var Tt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Et=Object.prototype.hasOwnProperty;var Pt=function(e){var t=this.__data__;if(Ct){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return Et.call(t,e)?t[e]:void 0},St=Object.prototype.hasOwnProperty;var It=function(e){var t=this.__data__;return Ct?void 0!==t[e]:St.call(t,e)};var Rt=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Ct&&void 0===t?"__lodash_hash_undefined__":t,this};function Vt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}Vt.prototype.clear=At,Vt.prototype.delete=Tt,Vt.prototype.get=Pt,Vt.prototype.has=It,Vt.prototype.set=Rt;var Ot=Vt;var zt=function(){this.size=0,this.__data__={hash:new Ot,map:new(xt||wt),string:new Ot}};var Mt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Bt=function(e,t){var i=e.__data__;return Mt(t)?i["string"==typeof t?"string":"hash"]:i.map};var Nt=function(e){var t=Bt(this,e).delete(e);return this.size-=t?1:0,t};var Ft=function(e){return Bt(this,e).get(e)};var Dt=function(e){return Bt(this,e).has(e)};var Lt=function(e,t){var i=Bt(this,e),o=i.size;return i.set(e,t),this.size+=i.size==o?0:1,this};function Ht(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}Ht.prototype.clear=zt,Ht.prototype.delete=Nt,Ht.prototype.get=Ft,Ht.prototype.has=Dt,Ht.prototype.set=Lt;var jt=Ht;var Wt=function(e,t){var i=this.__data__;if(i instanceof wt){var o=i.__data__;if(!xt||o.length<199)return o.push([e,t]),this.size=++i.size,this;i=this.__data__=new jt(o)}return i.set(e,t),this.size=i.size,this};function qt(e){var t=this.__data__=new wt(e);this.size=t.size}qt.prototype.clear=kt,qt.prototype.delete=_t,qt.prototype.get=vt,qt.prototype.has=yt,qt.prototype.set=Wt;var $t=qt;var Ut=function(e,t){for(var i=-1,o=null==e?0:e.length;++i<o&&!1!==t(e[i],i,e););return e},Kt=it(Object.keys,Object),Gt=Object.prototype.hasOwnProperty;var Jt=function(e){if(!Ve(e))return Kt(e);var t=[];for(var i in Object(e))Gt.call(e,i)&&"constructor"!=i&&t.push(i);return t};var Yt=function(e){return ce(e)?Ie(e):Jt(e)};var Qt=function(e,t){return e&&X(t,Yt(t),e)};var Xt=function(e,t){return e&&X(t,Be(t),e)},Zt=i(9);var ei=function(e,t){var i=-1,o=e.length;for(t||(t=Array(o));++i<o;)t[i]=e[i];return t};var ti=function(e,t){for(var i=-1,o=null==e?0:e.length,n=0,r=[];++i<o;){var s=e[i];t(s,i,e)&&(r[n++]=s)}return r};var ii=function(){return[]},oi=Object.prototype.propertyIsEnumerable,ni=Object.getOwnPropertySymbols,ri=ni?function(e){return null==e?[]:(e=Object(e),ti(ni(e),(function(t){return oi.call(e,t)})))}:ii;var si=function(e,t){return X(e,ri(e),t)};var ai=function(e,t){for(var i=-1,o=t.length,n=e.length;++i<o;)e[n+i]=t[i];return e},li=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ai(t,ri(e)),e=ot(e);return t}:ii;var ci=function(e,t){return X(e,li(e),t)};var di=function(e,t,i){var o=t(e);return ve(e)?o:ai(o,i(e))};var hi=function(e){return di(e,Yt,ri)};var ui=function(e){return di(e,Be,li)},gi=U(k.a,"DataView"),mi=U(k.a,"Promise"),fi=U(k.a,"Set"),pi=U(k.a,"WeakMap"),bi=B(gi),wi=B(xt),ki=B(mi),_i=B(fi),vi=B(pi),yi=S;(gi&&"[object DataView]"!=yi(new gi(new ArrayBuffer(1)))||xt&&"[object Map]"!=yi(new xt)||mi&&"[object Promise]"!=yi(mi.resolve())||fi&&"[object Set]"!=yi(new fi)||pi&&"[object WeakMap]"!=yi(new pi))&&(yi=function(e){var t=S(e),i="[object Object]"==t?e.constructor:void 0,o=i?B(i):"";if(o)switch(o){case bi:return"[object DataView]";case wi:return"[object Map]";case ki:return"[object Promise]";case _i:return"[object Set]";case vi:return"[object WeakMap]"}return t});var xi=yi,Ci=Object.prototype.hasOwnProperty;var Ai=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&Ci.call(e,"index")&&(i.index=e.index,i.input=e.input),i},Ti=k.a.Uint8Array;var Ei=function(e){var t=new e.constructor(e.byteLength);return new Ti(t).set(new Ti(e)),t};var Pi=function(e,t){var i=t?Ei(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)},Si=/\w*$/;var Ii=function(e){var t=new e.constructor(e.source,Si.exec(e));return t.lastIndex=e.lastIndex,t},Ri=_?_.prototype:void 0,Vi=Ri?Ri.valueOf:void 0;var Oi=function(e){return Vi?Object(Vi.call(e)):{}};var zi=function(e,t){var i=t?Ei(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)};var Mi=function(e,t,i){var o=e.constructor;switch(t){case"[object ArrayBuffer]":return Ei(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return Pi(e,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return zi(e,i);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return Ii(e);case"[object Set]":return new o;case"[object Symbol]":return Oi(e)}},Bi=Object.create,Ni=function(){function e(){}return function(t){if(!w(t))return{};if(Bi)return Bi(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}();var Fi=function(e){return"function"!=typeof e.constructor||Ve(e)?{}:Ni(ot(e))};var Di=function(e){return fe(e)&&"[object Map]"==xi(e)},Li=Te.a&&Te.a.isMap,Hi=Li?Ae(Li):Di;var ji=function(e){return fe(e)&&"[object Set]"==xi(e)},Wi=Te.a&&Te.a.isSet,qi=Wi?Ae(Wi):ji,$i={};$i["[object Arguments]"]=$i["[object Array]"]=$i["[object ArrayBuffer]"]=$i["[object DataView]"]=$i["[object Boolean]"]=$i["[object Date]"]=$i["[object Float32Array]"]=$i["[object Float64Array]"]=$i["[object Int8Array]"]=$i["[object Int16Array]"]=$i["[object Int32Array]"]=$i["[object Map]"]=$i["[object Number]"]=$i["[object Object]"]=$i["[object RegExp]"]=$i["[object Set]"]=$i["[object String]"]=$i["[object Symbol]"]=$i["[object Uint8Array]"]=$i["[object Uint8ClampedArray]"]=$i["[object Uint16Array]"]=$i["[object Uint32Array]"]=!0,$i["[object Error]"]=$i["[object Function]"]=$i["[object WeakMap]"]=!1;var Ui=function e(t,i,o,n,r,s){var a,l=1&i,c=2&i,d=4&i;if(o&&(a=r?o(t,n,r,s):o(t)),void 0!==a)return a;if(!w(t))return t;var h=ve(t);if(h){if(a=Ai(t),!l)return ei(t,a)}else{var u=xi(t),g="[object Function]"==u||"[object GeneratorFunction]"==u;if(Object(ye.a)(t))return Object(Zt.a)(t,l);if("[object Object]"==u||"[object Arguments]"==u||g&&!r){if(a=c||g?{}:Fi(t),!l)return c?ci(t,Xt(a,t)):si(t,Qt(a,t))}else{if(!$i[u])return r?t:{};a=Mi(t,u,l)}}s||(s=new $t);var m=s.get(t);if(m)return m;s.set(t,a),qi(t)?t.forEach((function(n){a.add(e(n,i,o,n,t,s))})):Hi(t)&&t.forEach((function(n,r){a.set(r,e(n,i,o,r,t,s))}));var f=h?void 0:(d?c?ui:hi:c?Be:Yt)(t);return Ut(f||t,(function(n,r){f&&(n=t[r=n]),Q(a,r,e(n,i,o,r,t,s))})),a};var Ki=function(e,t){return Ui(e,5,t="function"==typeof t?t:void 0)};var Gi=function(e){return fe(e)&&1===e.nodeType&&!ct(e)};class Ji{constructor(e,t){this._config={},t&&this.define(Yi(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,i,o=!1){if(ct(t))return void this._setObjectToTarget(e,t,o);const n=t.split(".");t=n.pop();for(const t of n)ct(e[t])||(e[t]={}),e=e[t];if(ct(i))return ct(e[t])||(e[t]={}),e=e[t],void this._setObjectToTarget(e,i,o);o&&void 0!==e[t]||(e[t]=i)}_getFromSource(e,t){const i=t.split(".");t=i.pop();for(const t of i){if(!ct(e[t])){e=null;break}e=e[t]}return e?Yi(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach(o=>{this._setToTarget(e,o,t[o],i)})}}function Yi(e){return Ki(e,Qi)}function Qi(e){return Gi(e)?e:void 0}function Xi(e){return!(!e||!e[Symbol.iterator])}class Zi{constructor(e={},t={}){const i=Xi(e);if(i||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],i)for(const t of e)this._items.push(t),this._itemMap.set(this._getItemIdBeforeAdding(t),t)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(void 0===t)t=this._items.length;else if(t>this._items.length||t<0)throw new l.a("collection-add-item-invalid-index",this);for(let i=0;i<e.length;i++){const o=e[i],n=this._getItemIdBeforeAdding(o),r=t+i;this._items.splice(r,0,o),this._itemMap.set(n,o),this.fire("add",o,r)}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if("string"==typeof e)t=this._itemMap.get(e);else{if("number"!=typeof e)throw new l.a("collection-get-invalid-arg",this);t=this._items[e]}return t||null}has(e){if("string"==typeof e)return this._itemMap.has(e);{const t=e[this._idProperty];return this._itemMap.has(t)}}getIndex(e){let t;return t="string"==typeof e?this._itemMap.get(e):e,this._items.indexOf(t)}remove(e){const[t,i]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:i}),t}map(e,t){return this._items.map(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);const e=Array.from(this._items);for(;this.length;)this._remove(0);this.fire("change",{added:[],removed:e,index:0})}bindTo(e){if(this._bindToCollection)throw new l.a("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding(t=>new e(t))},using:e=>{"function"==typeof e?this._setUpBindToBinding(t=>e(t)):this._setUpBindToBinding(t=>t[e])}}}_setUpBindToBinding(e){const t=this._bindToCollection,i=(i,o,n)=>{const r=t._bindToCollection==this,s=t._bindToInternalToExternalMap.get(o);if(r&&s)this._bindToExternalToInternalMap.set(o,s),this._bindToInternalToExternalMap.set(s,o);else{const i=e(o);if(!i)return void this._skippedIndexesFromExternal.push(n);let r=n;for(const e of this._skippedIndexesFromExternal)n>e&&r--;for(const e of t._skippedIndexesFromExternal)r>=e&&r++;this._bindToExternalToInternalMap.set(o,i),this._bindToInternalToExternalMap.set(i,o),this.add(i,r);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)r<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(const e of t)i(0,e,t.getIndex(e));this.listenTo(t,"add",i),this.listenTo(t,"remove",(e,t,i)=>{const o=this._bindToExternalToInternalMap.get(t);o&&this.remove(o),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(i<t&&e.push(t-1),i>t&&e.push(t),e),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let i;if(t in e){if(i=e[t],"string"!=typeof i)throw new l.a("collection-add-invalid-id",this);if(this.get(i))throw new l.a("collection-add-item-already-exists",this)}else e[t]=i=s();return i}_remove(e){let t,i,o,n=!1;const r=this._idProperty;if("string"==typeof e?(i=e,o=this._itemMap.get(i),n=!o,o&&(t=this._items.indexOf(o))):"number"==typeof e?(t=e,o=this._items[t],n=!o,o&&(i=o[r])):(o=e,i=o[r],t=this._items.indexOf(o),n=-1==t||!this._itemMap.get(i)),n)throw new l.a("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);const s=this._bindToInternalToExternalMap.get(o);return this._bindToInternalToExternalMap.delete(o),this._bindToExternalToInternalMap.delete(s),this.fire("remove",o,t),[o,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}Ye(Zi,h);class eo{constructor(e,t=[],i=[]){this._context=e,this._plugins=new Map,this._availablePlugins=new Map;for(const e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(const[e,t]of i)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let t=e;throw"function"==typeof e&&(t=e.pluginName||e.name),new l.a("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}init(e,t=[],i=[]){const o=this,n=this._context;!function e(t,i=new Set){t.forEach(t=>{a(t)&&(i.has(t)||(i.add(t),t.pluginName&&!o._availablePlugins.has(t.pluginName)&&o._availablePlugins.set(t.pluginName,t),t.requires&&e(t.requires,i)))})}(e),u(e);const r=[...function e(t,i=new Set){return t.map(e=>a(e)?e:o._availablePlugins.get(e)).reduce((t,o)=>i.has(o)?t:(i.add(o),o.requires&&(u(o.requires,o),e(o.requires,i).forEach(e=>t.add(e))),t.add(o)),new Set)}(e.filter(e=>!d(e,t)))];!function(e,t){for(const i of t){if("function"!=typeof i)throw new l.a("plugincollection-replace-plugin-invalid-type",null,{pluginItem:i});const t=i.pluginName;if(!t)throw new l.a("plugincollection-replace-plugin-missing-name",null,{pluginItem:i});if(i.requires&&i.requires.length)throw new l.a("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:t});const n=o._availablePlugins.get(t);if(!n)throw new l.a("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:t});const r=e.indexOf(n);if(-1===r){if(o._contextPlugins.has(n))return;throw new l.a("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:t})}if(n.requires&&n.requires.length)throw new l.a("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:t});e.splice(r,1,i),o._availablePlugins.set(t,i)}}(r,i);const s=function(e){return e.map(e=>{const t=o._contextPlugins.get(e)||new e(n);return o._add(e,t),t})}(r);return g(s,"init").then(()=>g(s,"afterInit")).then(()=>s);function a(e){return"function"==typeof e}function c(e){return a(e)&&e.isContextPlugin}function d(e,t){return t.some(t=>t===e||(h(e)===t||h(t)===e))}function h(e){return a(e)?e.pluginName||e.name:e}function u(e,i=null){e.map(e=>a(e)?e:o._availablePlugins.get(e)||e).forEach(e=>{!function(e,t){if(a(e))return;if(t)throw new l.a("plugincollection-soft-required",n,{missingPlugin:e,requiredBy:h(t)});throw new l.a("plugincollection-plugin-not-found",n,{plugin:e})}(e,i),function(e,t){if(!c(t))return;if(c(e))return;throw new l.a("plugincollection-context-required",n,{plugin:h(e),requiredBy:h(t)})}(e,i),function(e,i){if(!i)return;if(!d(e,t))return;throw new l.a("plugincollection-required",n,{plugin:h(e),requiredBy:h(i)})}(e,i)})}function g(e,t){return e.reduce((e,i)=>i[t]?o._contextPlugins.has(i)?e:e.then(i[t].bind(i)):e,Promise.resolve())}}destroy(){const e=[];for(const[,t]of this)"function"!=typeof t.destroy||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new l.a("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}function to(e){return Array.isArray(e)?e:[e]}function io(e,t,i=1){if("number"!=typeof i)throw new l.a("translation-service-quantity-not-a-number",null,{quantity:i});const o=Object.keys(window.CKEDITOR_TRANSLATIONS).length;1===o&&(e=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]);const n=t.id||t.string;if(0===o||!function(e,t){return!!window.CKEDITOR_TRANSLATIONS[e]&&!!window.CKEDITOR_TRANSLATIONS[e].dictionary[t]}(e,n))return 1!==i?t.plural:t.string;const r=window.CKEDITOR_TRANSLATIONS[e].dictionary,s=window.CKEDITOR_TRANSLATIONS[e].getPluralForm||(e=>1===e?0:1);if("string"==typeof r[n])return r[n];const a=Number(s(i));return r[n][a]}Ye(eo,h),window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});const oo=["ar","ara","fa","per","fas","he","heb","ku","kur","ug","uig"];function no(e){return oo.includes(e)?"rtl":"ltr"}class ro{constructor(e={}){this.uiLanguage=e.uiLanguage||"en",this.contentLanguage=e.contentLanguage||this.uiLanguage,this.uiLanguageDirection=no(this.uiLanguage),this.contentLanguageDirection=no(this.contentLanguage),this.t=(e,t)=>this._t(e,t)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=to(t),"string"==typeof e&&(e={string:e});const i=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,(e,i)=>i<t.length?t[i]:e)}(io(this.uiLanguage,e,i),t)}}class so{constructor(e){this.config=new Ji(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new eo(this,t);const i=this.config.get("language")||{};this.locale=new ro({uiLanguage:"string"==typeof i?i:i.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new Zi,this._contextOwner=null}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if("function"!=typeof i)throw new l.a("context-initplugins-constructor-only",null,{Plugin:i});if(!0!==i.isContextPlugin)throw new l.a("context-initplugins-invalid-plugin",null,{Plugin:i})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new l.a("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const i=new this(e);t(i.initPlugins().then(()=>i))})}}class ao{constructor(e){this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}function lo(e,t){const i=Math.min(e.length,t.length);for(let o=0;o<i;o++)if(e[o]!=t[o])return o;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}Ye(ao,qe);var co=function(e){return Ui(e,4)};class ho{constructor(e){this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if(-1==(e=this.parent.getChildIndex(this)))throw new l.a("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),o=e.getAncestors(t);let n=0;for(;i[n]==o[n]&&i[n];)n++;return 0===n?null:i[n-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),o=lo(t,i);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<i[o]}}isAfter(e){return this!=e&&(this.root===e.root&&!this.isBefore(e))}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t){this.fire("change:"+e,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=co(this);return delete e.parent,e}is(e){return"node"===e||"view:node"===e}}Ye(ho,h);class uo extends ho{constructor(e,t){super(e),this._textData=t}is(e){return"$text"===e||"view:$text"===e||"text"===e||"view:text"===e||"node"===e||"view:node"===e}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof uo&&(this===e||this.data===e.data)}_clone(){return new uo(this.document,this.data)}}class go{constructor(e,t,i){if(this.textNode=e,t<0||t>e.data.length)throw new l.a("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new l.a("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}is(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this.textNode:this.parent;for(;null!==i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}}function mo(e){return Xi(e)?new Map(e):function(e){const t=new Map;for(const i in e)t.set(i,e[i]);return t}(e)}class fo{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const i=po(t,e);if(i)return{element:t,pattern:e,match:i}}return null}matchAll(...e){const t=[];for(const i of e)for(const e of this._patterns){const o=po(i,e);o&&t.push({element:i,pattern:e,match:o})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function po(e,t){if("function"==typeof t)return t(e);const i={};return t.name&&(i.name=function(e,t){if(e instanceof RegExp)return!!t.match(e);return e===t}(t.name,e.name),!i.name)||t.attributes&&(i.attributes=function(e,t){const i=new Set(t.getAttributeKeys());ct(e)?(void 0!==e.style&&Object(l.b)("matcher-pattern-deprecated-attributes-style-key",e),void 0!==e.class&&Object(l.b)("matcher-pattern-deprecated-attributes-class-key",e)):(i.delete("style"),i.delete("class"));return bo(e,i,e=>t.getAttribute(e))}(t.attributes,e),!i.attributes)?null:!(t.classes&&(i.classes=function(e,t){return bo(e,t.getClassNames())}(t.classes,e),!i.classes))&&(!(t.styles&&(i.styles=function(e,t){return bo(e,t.getStyleNames(!0),e=>t.getStyle(e))}(t.styles,e),!i.styles))&&i)}function bo(e,t,i){const o=function(e){if(Array.isArray(e))return e.map(e=>ct(e)?(void 0!==e.key&&void 0!==e.value||Object(l.b)("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0]);if(ct(e))return Object.entries(e);return[[e,!0]]}(e),n=Array.from(t),r=[];return o.forEach(([e,t])=>{n.forEach(o=>{(function(e,t){return!0===e||e===t||e instanceof RegExp&&t.match(e)})(e,o)&&function(e,t,i){if(!0===e)return!0;const o=i(t);return e===o||e instanceof RegExp&&!!String(o).match(e)}(t,o,i)&&r.push(o)})}),!o.length||r.length<o.length?null:r}var wo=function(e){return"symbol"==typeof e||fe(e)&&"[object Symbol]"==S(e)},ko=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_o=/^\w*$/;var vo=function(e,t){if(ve(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!wo(e))||(_o.test(e)||!ko.test(e)||null!=t&&e in Object(t))};function yo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var o=arguments,n=t?t.apply(this,o):o[0],r=i.cache;if(r.has(n))return r.get(n);var s=e.apply(this,o);return i.cache=r.set(n,s)||r,s};return i.cache=new(yo.Cache||jt),i}yo.Cache=jt;var xo=yo;var Co=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ao=/\\(\\)?/g,To=function(e){var t=xo(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Co,(function(e,i,o,n){t.push(o?n.replace(Ao,"$1"):i||e)})),t}));var Eo=function(e,t){for(var i=-1,o=null==e?0:e.length,n=Array(o);++i<o;)n[i]=t(e[i],i,e);return n},Po=_?_.prototype:void 0,So=Po?Po.toString:void 0;var Io=function e(t){if("string"==typeof t)return t;if(ve(t))return Eo(t,e)+"";if(wo(t))return So?So.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i};var Ro=function(e){return null==e?"":Io(e)};var Vo=function(e,t){return ve(e)?e:vo(e,t)?[e]:To(Ro(e))};var Oo=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var zo=function(e){if("string"==typeof e||wo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Mo=function(e,t){for(var i=0,o=(t=Vo(t,e)).length;null!=e&&i<o;)e=e[zo(t[i++])];return i&&i==o?e:void 0};var Bo=function(e,t,i){var o=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(i=i>n?n:i)<0&&(i+=n),n=t>i?0:i-t>>>0,t>>>=0;for(var r=Array(n);++o<n;)r[o]=e[o+t];return r};var No=function(e,t){return t.length<2?e:Mo(e,Bo(t,0,-1))};var Fo=function(e,t){return t=Vo(t,e),null==(e=No(e,t))||delete e[zo(Oo(t))]};var Do=function(e,t){return null==e||Fo(e,t)};var Lo=function(e,t,i){var o=null==e?void 0:Mo(e,t);return void 0===o?i:o};var Ho=function(e,t,i){(void 0!==i&&!J(e[t],i)||void 0===i&&!(t in e))&&G(e,t,i)};var jo=function(e){return function(t,i,o){for(var n=-1,r=Object(t),s=o(t),a=s.length;a--;){var l=s[e?a:++n];if(!1===i(r[l],l,r))break}return t}}();var Wo=function(e){return fe(e)&&ce(e)};var qo=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var $o=function(e){return X(e,Be(e))};var Uo=function(e,t,i,o,n,r,s){var a=qo(e,i),l=qo(t,i),c=s.get(l);if(c)Ho(e,i,c);else{var d=r?r(a,l,i+"",e,t,s):void 0,h=void 0===d;if(h){var u=ve(l),g=!u&&Object(ye.a)(l),m=!u&&!g&&Pe(l);d=l,u||g||m?ve(a)?d=a:Wo(a)?d=ei(a):g?(h=!1,d=Object(Zt.a)(l,!0)):m?(h=!1,d=zi(l,!0)):d=[]:ct(l)||_e(l)?(d=a,_e(a)?d=$o(a):w(a)&&!R(a)||(d=Fi(l))):h=!1}h&&(s.set(l,d),n(d,l,o,r,s),s.delete(l)),Ho(e,i,d)}};var Ko=function e(t,i,o,n,r){t!==i&&jo(i,(function(s,a){if(r||(r=new $t),w(s))Uo(t,i,a,o,e,n,r);else{var l=n?n(qo(t,a),s,a+"",t,i,r):void 0;void 0===l&&(l=s),Ho(t,a,l)}}),Be)},Go=ge((function(e,t,i){Ko(e,t,i)}));var Jo=function(e,t,i,o){if(!w(e))return e;for(var n=-1,r=(t=Vo(t,e)).length,s=r-1,a=e;null!=a&&++n<r;){var l=zo(t[n]),c=i;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(n!=s){var d=a[l];void 0===(c=o?o(d,l,a):void 0)&&(c=w(d)?d:he(t[n+1])?[]:{})}Q(a,l,c),a=a[l]}return e};var Yo=function(e,t,i){return null==e?e:Jo(e,t,i)};class Qo{constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){const e=Object.entries(this._styles);return!Array.from(e).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=Array.from(function(e){let t=null,i=0,o=0,n=null;const r=new Map;if(""===e)return r;";"!=e.charAt(e.length-1)&&(e+=";");for(let s=0;s<e.length;s++){const a=e.charAt(s);if(null===t)switch(a){case":":n||(n=e.substr(i,s-i),o=s+1);break;case'"':case"'":t=a;break;case";":{const t=e.substr(o,s-o);n&&r.set(n.trim(),t.trim()),n=null,i=s+1;break}}else a===t&&(t=null)}return r}(e).entries());for(const[e,i]of t)this._styleProcessor.toNormalizedForm(e,i,this._styles)}has(e){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)}set(e,t){if(w(e))for(const[t,i]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,i,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=Zo(e);Do(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this._getStylesEntries().map(e=>e.join(":")).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!w(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)?t[1]:void 0}getStyleNames(e=!1){if(this.isEmpty)return[];if(e)return this._styleProcessor.getStyleNames(this._styles);return this._getStylesEntries().map(([e])=>e)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const i=t.splice(0,t.length-1).join("."),o=Lo(this._styles,i);if(!o)return;!Array.from(Object.keys(o)).length&&this.remove(i)}}class Xo{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if(w(t))en(i,Zo(e),t);else if(this._normalizers.has(e)){const o=this._normalizers.get(e),{path:n,value:r}=o(t);en(i,n,r)}else en(i,e,t)}getNormalized(e,t){if(!e)return Go({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const i=this._extractors.get(e);if("string"==typeof i)return Lo(t,i);const o=i(e,t);if(o)return o}return Lo(t,Zo(e))}getReducedForm(e,t){const i=this.getNormalized(e,t);if(void 0===i)return[];if(this._reducers.has(e)){return this._reducers.get(e)(i)}return[[e,i]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter(t=>{const i=this.getNormalized(t,e);return i&&"object"==typeof i?Object.keys(i).length:i}),i=new Set([...t,...Object.keys(e)]);return Array.from(i.values())}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const i of t)this._mapStyleNames(i,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function Zo(e){return e.replace("-",".")}function en(e,t,i){let o=i;w(i)&&(o=Go({},Lo(e,t),i)),Yo(e,t,o)}class tn extends ho{constructor(e,t,i,o){if(super(e),this.name=t,this._attrs=function(e){e=mo(e);for(const[t,i]of e)null===i?e.delete(t):"string"!=typeof i&&e.set(t,String(i));return e}(i),this._children=[],o&&this._insertChild(0,o),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");on(this._classes,e),this._attrs.delete("class")}this._styles=new Qo(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style")),this._customProperties=new Map,this._isAllowedInsideAttributeElement=!1}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}get isAllowedInsideAttributeElement(){return this._isAllowedInsideAttributeElement}is(e,t=null){return t?t===this.name&&("element"===e||"view:element"===e):"element"===e||"view:element"===e||"node"===e||"view:node"===e}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==e){const e=this._styles.toString();return""==e?void 0:e}return this._attrs.get(e)}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof tn))return!1;if(this===e)return!0;if(this.name!=e.name)return!1;if(this.isAllowedInsideAttributeElement!=e.isAllowedInsideAttributeElement)return!1;if(this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,i]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==i)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e=!1){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new fo(...e);let i=this.parent;for(;i;){if(t.match(i))return i;i=i.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),i=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==i?"":" "+i)}_clone(e=!1){const t=[];if(e)for(const i of this.getChildren())t.push(i._clone(e));const i=new this.constructor(this.document,this.name,this._attrs,t);return i._classes=new Set(this._classes),i._styles.set(this._styles.getNormalized()),i._customProperties=new Map(this._customProperties),i.getFillerOffset=this.getFillerOffset,i._isAllowedInsideAttributeElement=this.isAllowedInsideAttributeElement,i}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){if("string"==typeof t)return[new uo(e,t)];Xi(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new uo(e,t):t instanceof go?new uo(e,t.data):t)}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){t=String(t),this._fireChange("attributes",this),"class"==e?on(this._classes,t):"style"==e?this._styles.setTo(t):this._attrs.set(e,t)}_removeAttribute(e){return this._fireChange("attributes",this),"class"==e?this._classes.size>0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of to(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of to(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of to(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function on(e,t){const i=t.split(/\s+/);e.clear(),i.forEach(t=>e.add(t))}class nn extends tn{constructor(e,t,i,o){super(e,t,i,o),this.getFillerOffset=rn}is(e,t=null){return t?t===this.name&&("containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}}function rn(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}class sn extends nn{constructor(e,t,i,o){super(e,t,i,o),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",t=>t&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}is(e,t=null){return t?t===this.name&&("editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}destroy(){this.stopListening()}}Ye(sn,qe);const an=Symbol("rootName");class ln extends sn{constructor(e,t){super(e,t),this.rootName="main"}is(e,t=null){return t?t===this.name&&("rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}get rootName(){return this.getCustomProperty(an)}set rootName(e){this._setCustomProperty(an,e)}set _name(e){this.name=e}}class cn{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new l.a("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new l.a("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this.position=dn._createAt(e.startPosition):this.position=dn._createAt(e.boundaries["backward"==e.direction?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}skip(e){let t,i,o;do{o=this.position,({done:t,value:i}=this.next())}while(!t&&e(i));t||(this.position=o)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&e.offset===i.childCount)return{done:!0};if(i===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};let o;if(i instanceof uo){if(e.isAtEnd)return this.position=dn._createAfter(i),this._next();o=i.data[e.offset]}else o=i.getChild(e.offset);if(o instanceof tn)return this.shallow?e.offset++:e=new dn(o,0),this.position=e,this._formatReturnValue("elementStart",o,t,e,1);if(o instanceof uo){if(this.singleCharacters)return e=new dn(o,0),this.position=e,this._next();{let i,n=o.data.length;return o==this._boundaryEndParent?(n=this.boundaries.end.offset,i=new go(o,0,n),e=dn._createAfter(i)):(i=new go(o,0,o.data.length),e.offset++),this.position=e,this._formatReturnValue("text",i,t,e,n)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{o=(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset}const n=new go(i,e.offset,o);return e.offset+=o,this.position=e,this._formatReturnValue("text",n,t,e,o)}return e=dn._createAfter(i),this.position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&0===e.offset)return{done:!0};if(i==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0};let o;if(i instanceof uo){if(e.isAtStart)return this.position=dn._createBefore(i),this._previous();o=i.data[e.offset-1]}else o=i.getChild(e.offset-1);if(o instanceof tn)return this.shallow?(e.offset--,this.position=e,this._formatReturnValue("elementStart",o,t,e,1)):(e=new dn(o,o.childCount),this.position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",o,t,e));if(o instanceof uo){if(this.singleCharacters)return e=new dn(o,o.data.length),this.position=e,this._previous();{let i,n=o.data.length;if(o==this._boundaryStartParent){const t=this.boundaries.start.offset;i=new go(o,t,o.data.length-t),n=i.data.length,e=dn._createBefore(i)}else i=new go(o,0,o.data.length),e.offset--;return this.position=e,this._formatReturnValue("text",i,t,e,n)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{const t=i===this._boundaryStartParent?this.boundaries.start.offset:0;o=e.offset-t}e.offset-=o;const n=new go(i,e.offset,o);return this.position=e,this._formatReturnValue("text",n,t,e,o)}return e=dn._createBefore(i),this.position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,o,n){return t instanceof go&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?i=dn._createAfter(t.textNode):(o=dn._createAfter(t.textNode),this.position=o)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?i=dn._createBefore(t.textNode):(o=dn._createBefore(t.textNode),this.position=o))),{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:o,length:n}}}}class dn{constructor(e,t){this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof sn);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=dn._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new cn(t);return i.skip(e),i.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let o=0;for(;t[o]==i[o]&&t[o];)o++;return 0===o?null:t[o-1]}is(e){return"position"===e||"view:position"===e}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],i=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),i.push(e.offset);const o=lo(t,i);switch(o){case"prefix":return"before";case"extension":return"after";default:return t[o]<i[o]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new cn(e)}clone(){return new dn(this.parent,this.offset)}static _createAt(e,t){if(e instanceof dn)return new this(e.parent,e.offset);{const i=e;if("end"==t)t=i.is("$text")?i.data.length:i.childCount;else{if("before"==t)return this._createBefore(i);if("after"==t)return this._createAfter(i);if(0!==t&&!t)throw new l.a("view-createpositionat-offset-required",i)}return new dn(i,t)}}static _createAfter(e){if(e.is("$textProxy"))return new dn(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new l.a("view-position-after-root",e,{root:e});return new dn(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new dn(e.textNode,e.offsetInText);if(!e.parent)throw new l.a("view-position-before-root",e,{root:e});return new dn(e.parent,e.index)}}class hn{constructor(e,t=null){this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new cn({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(un,{direction:"backward"}),t=this.end.getLastMatchingPosition(un);return e.parent.is("$text")&&e.isAtStart&&(e=dn._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=dn._createAfter(t.parent)),new hn(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(un);if(e.isAfter(this.end)||e.isEqual(this.end))return new hn(e,e);let t=this.end.getLastMatchingPosition(un,{direction:"backward"});const i=e.nodeAfter,o=t.nodeBefore;return i&&i.is("$text")&&(e=new dn(i,0)),o&&o.is("$text")&&(t=new dn(o,o.data.length)),new hn(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),o=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&o}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new hn(this.start,e.start)),this.containsPosition(e.end)&&t.push(new hn(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new hn(t,i)}return null}getWalker(e={}){return e.boundaries=this,new cn(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new hn(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new cn(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new cn(e);yield t.position;for(const e of t)yield e.nextPosition}is(e){return"range"===e||"view:range"===e}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,i,o){return new this(new dn(e,t),new dn(i,o))}static _createFromPositionAndShift(e,t){const i=e,o=e.getShiftedBy(t);return t>0?new this(i,o):new this(o,i)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(dn._createBefore(e),t)}}function un(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}function gn(e){let t=0;for(const i of e)t++;return t}class mn{constructor(e=null,t,i){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(e,t,i)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return 1===this.rangeCount&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return!1;if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const o of e._ranges)if(t.isEqual(o)){i=!0;break}if(!i)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=gn(this.getRanges());if(t!=gn(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let i=!1;for(let o of e.getRanges())if(o=o.getTrimmed(),t.start.isEqual(o.start)&&t.end.isEqual(o.end)){i=!0;break}if(!i)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(e,t,i){if(null===e)this._setRanges([]),this._setFakeOptions(t);else if(e instanceof mn||e instanceof fn)this._setRanges(e.getRanges(),e.isBackward),this._setFakeOptions({fake:e.isFake,label:e.fakeSelectionLabel});else if(e instanceof hn)this._setRanges([e],t&&t.backward),this._setFakeOptions(t);else if(e instanceof dn)this._setRanges([new hn(e)]),this._setFakeOptions(t);else if(e instanceof ho){const o=!!i&&!!i.backward;let n;if(void 0===t)throw new l.a("view-selection-setto-required-second-parameter",this);n="in"==t?hn._createIn(e):"on"==t?hn._createOn(e):new hn(dn._createAt(e,t)),this._setRanges([n],o),this._setFakeOptions(i)}else{if(!Xi(e))throw new l.a("view-selection-setto-not-selectable",this);this._setRanges(e,t&&t.backward),this._setFakeOptions(t)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new l.a("view-selection-setfocus-no-ranges",this);const i=dn._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.pop(),"before"==i.compareWith(o)?this._addRange(new hn(i,o),!0):this._addRange(new hn(o,i)),this.fire("change")}is(e){return"selection"===e||"view:selection"===e}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof hn))throw new l.a("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new l.a("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new hn(e.start,e.end))}}Ye(mn,h);class fn{constructor(e=null,t,i){this._selection=new mn,this._selection.delegate("change").to(this),this._selection.setTo(e,t,i)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}is(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e}_setTo(e,t,i){this._selection.setTo(e,t,i)}_setFocus(e,t){this._selection.setFocus(e,t)}}Ye(fn,h);class pn extends n{constructor(e,t,i){super(e,t),this.startRange=i,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const bn=Symbol("bubbling contexts");var wn={fire(e,...t){try{const i=e instanceof n?e:new n(this,e),o=yn(this);if(!o.size)return;if(kn(i,"capturing",this),_n(o,"$capture",i,...t))return i.return;const r=i.startRange||this.selection.getFirstRange(),s=r?r.getContainedElement():null,a=!!s&&Boolean(vn(o,s));let l=s||function(e){if(!e)return null;const t=e.start.parent,i=e.end.parent,o=t.getPath(),n=i.getPath();return o.length>n.length?t:i}(r);if(kn(i,"atTarget",l),!a){if(_n(o,"$text",i,...t))return i.return;kn(i,"bubbling",l)}for(;l;){if(l.is("rootElement")){if(_n(o,"$root",i,...t))return i.return}else if(l.is("element")&&_n(o,l.name,i,...t))return i.return;if(_n(o,l,i,...t))return i.return;l=l.parent,kn(i,"bubbling",l)}return kn(i,"bubbling",this),_n(o,"$document",i,...t),i.return}catch(e){l.a.rethrowUnexpectedError(e,this)}},_addEventListener(e,t,i){const o=to(i.context||"$document"),n=yn(this);for(const r of o){let o=n.get(r);o||(o=Object.create(h),n.set(r,o)),this.listenTo(o,e,t,i)}},_removeEventListener(e,t){const i=yn(this);for(const o of i.values())this.stopListening(o,e,t)}};function kn(e,t,i){e instanceof pn&&(e._eventPhase=t,e._currentTarget=i)}function _n(e,t,i,...o){const n="string"==typeof t?e.get(t):vn(e,t);return!!n&&(n.fire(i,...o),i.stop.called)}function vn(e,t){for(const[i,o]of e)if("function"==typeof i&&i(t))return o;return null}function yn(e){return e[bn]||(e[bn]=new Map),e[bn]}class xn{constructor(e){this.selection=new fn,this.roots=new Zi({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isComposing",!1),this._postFixers=new Set}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.map(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(t=i(e),t)break}while(t)}}Ye(xn,wn),Ye(xn,qe);class Cn extends tn{constructor(e,t,i,o){super(e,t,i,o),this.getFillerOffset=An,this._priority=10,this._id=null,this._clonesGroup=null}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new l.a("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}is(e,t=null){return t?t===this.name&&("attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e):"attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function An(){if(Tn(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(Tn(e)>1)return null;e=e.parent}return!e||Tn(e)>1?null:this.childCount}function Tn(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}Cn.DEFAULT_PRIORITY=10;class En extends tn{constructor(e,t,i,o){super(e,t,i,o),this._isAllowedInsideAttributeElement=!0,this.getFillerOffset=Pn}is(e,t=null){return t?t===this.name&&("emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e):"emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof ho||Array.from(t).length>0))throw new l.a("view-emptyelement-cannot-add",[this,t])}}function Pn(){return null}const Sn=navigator.userAgent.toLowerCase();var In={isMac:function(e){return e.indexOf("macintosh")>-1}(Sn),isGecko:function(e){return!!e.match(/gecko\/\d+/)}(Sn),isSafari:function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(Sn),isAndroid:function(e){return e.indexOf("android")>-1}(Sn),isBlink:function(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}(Sn),features:{isRegExpUnicodePropertySupported:function(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}()}};const Rn={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},Vn={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},On=function(){const e={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let t=65;t<=90;t++){const i=String.fromCharCode(t);e[i.toLowerCase()]=t}for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;for(const t of"`-=[];',./\\")e[t]=t.charCodeAt(0);return e}(),zn=Object.fromEntries(Object.entries(On).map(([e,t])=>[t,e.charAt(0).toUpperCase()+e.slice(1)]));function Mn(e){let t;if("string"==typeof e){if(t=On[e.toLowerCase()],!t)throw new l.a("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?On.alt:0)+(e.ctrlKey?On.ctrl:0)+(e.shiftKey?On.shift:0)+(e.metaKey?On.cmd:0);return t}function Bn(e){return"string"==typeof e&&(e=function(e){return e.split("+").map(e=>e.trim())}(e)),e.map(e=>"string"==typeof e?function(e){if(e.endsWith("!"))return Mn(e.slice(0,-1));const t=Mn(e);return In.isMac&&t==On.ctrl?On.cmd:t}(e):e).reduce((e,t)=>t+e,0)}function Nn(e){let t=Bn(e);return Object.entries(In.isMac?Rn:Vn).reduce((e,[i,o])=>(0!=(t&On[i])&&(t&=~On[i],e+=o),e),"")+(t?zn[t]:"")}function Fn(e,t){const i="ltr"===t;switch(e){case On.arrowleft:return i?"left":"right";case On.arrowright:return i?"right":"left";case On.arrowup:return"up";case On.arrowdown:return"down"}}class Dn extends tn{constructor(e,t,i,o){super(e,t,i,o),this._isAllowedInsideAttributeElement=!0,this.getFillerOffset=Hn}is(e,t=null){return t?t===this.name&&("uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e):"uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof ho||Array.from(t).length>0))throw new l.a("view-uielement-cannot-add",this)}render(e){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}}function Ln(e){e.document.on("arrowKey",(t,i)=>function(e,t,i){if(t.keyCode==On.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),o=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(o||t.shiftKey){const t=e.focusNode,n=e.focusOffset,r=i.domPositionToView(t,n);if(null===r)return;let s=!1;const a=r.getLastMatchingPosition(e=>(e.item.is("uiElement")&&(s=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement"))));if(s){const t=i.viewPositionToDom(a);o?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,i,e.domConverter),{priority:"low"})}function Hn(){return null}class jn extends tn{constructor(e,t,i,o){super(e,t,i,o),this._isAllowedInsideAttributeElement=!0,this.getFillerOffset=Wn}is(e,t=null){return t?t===this.name&&("rawElement"===e||"view:rawElement"===e||"element"===e||"view:element"===e):"rawElement"===e||"view:rawElement"===e||e===this.name||e==="view:"+this.name||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof ho||Array.from(t).length>0))throw new l.a("view-rawelement-cannot-add",[this,t])}}function Wn(){return null}class qn{constructor(e,t){this.document=e,this._children=[],t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"===e||"view:documentFragment"===e}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){if("string"==typeof t)return[new uo(e,t)];Xi(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new uo(e,t):t instanceof go?new uo(e,t.data):t)}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}}Ye(qn,h);class $n{constructor(e){this.document=e,this._cloneGroups=new Map}setSelection(e,t,i){this.document.selection._setTo(e,t,i)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new qn(this.document,e)}createText(e){return new uo(this.document,e)}createAttributeElement(e,t,i={}){const o=new Cn(this.document,e,t);return"number"==typeof i.priority&&(o._priority=i.priority),i.id&&(o._id=i.id),o}createContainerElement(e,t,i={}){const o=new nn(this.document,e,t);return void 0!==i.isAllowedInsideAttributeElement&&(o._isAllowedInsideAttributeElement=i.isAllowedInsideAttributeElement),o}createEditableElement(e,t){const i=new sn(this.document,e,t);return i._document=this.document,i}createEmptyElement(e,t,i={}){const o=new En(this.document,e,t);return void 0!==i.isAllowedInsideAttributeElement&&(o._isAllowedInsideAttributeElement=i.isAllowedInsideAttributeElement),o}createUIElement(e,t,i,o={}){const n=new Dn(this.document,e,t);return i&&(n.render=i),void 0!==o.isAllowedInsideAttributeElement&&(n._isAllowedInsideAttributeElement=o.isAllowedInsideAttributeElement),n}createRawElement(e,t,i,o={}){const n=new jn(this.document,e,t);return n.render=i||(()=>{}),void 0!==o.isAllowedInsideAttributeElement&&(n._isAllowedInsideAttributeElement=o.isAllowedInsideAttributeElement),n}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){ct(e)&&void 0===i&&(i=t),i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof dn?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new l.a("view-writer-break-non-container-element",this.document);if(!t.parent)throw new l.a("view-writer-break-root",this.document);if(e.isAtStart)return dn._createBefore(t);if(!e.isAtEnd){const i=t._clone(!1);this.insert(dn._createAfter(t),i);const o=new hn(e,dn._createAt(t,"end")),n=new dn(i,0);this.move(o,n)}return dn._createAfter(t)}mergeAttributes(e){const t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&0===i.childCount){const e=i.parent,t=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new dn(e,t))}const o=i.getChild(t-1),n=i.getChild(t);if(!o||!n)return e;if(o.is("$text")&&n.is("$text"))return Yn(o,n);if(o.is("attributeElement")&&n.is("attributeElement")&&o.isSimilar(n)){const e=o.childCount;return o._appendChild(n.getChildren()),n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new dn(o,e))}return e}mergeContainers(e){const t=e.nodeBefore,i=e.nodeAfter;if(!(t&&i&&t.is("containerElement")&&i.is("containerElement")))throw new l.a("view-writer-merge-containers-invalid-position",this.document);const o=t.getChild(t.childCount-1),n=o instanceof uo?dn._createAt(o,"end"):dn._createAt(t,"end");return this.move(hn._createIn(i),dn._createAt(t,"end")),this.remove(hn._createOn(i)),n}insert(e,t){(function e(t,i){for(const o of t){if(!Qn.some(e=>o instanceof e))throw new l.a("view-writer-insert-invalid-node-type",i);o.is("$text")||e(o.getChildren(),i)}})(t=Xi(t)?[...t]:[t],this.document);const i=t.reduce((e,t)=>{const i=e[e.length-1],o=!(t.is("uiElement")&&t.isAllowedInsideAttributeElement);return i&&i.breakAttributes==o?i.nodes.push(t):e.push({breakAttributes:o,nodes:[t]}),e},[]);let o=null,n=e;for(const{nodes:e,breakAttributes:t}of i){const i=this._insertNodes(n,e,t);o||(o=i.start),n=i.end}return o?new hn(o,n):new hn(e)}remove(e){const t=e instanceof hn?e:hn._createOn(e);if(Zn(t,this.document),t.isCollapsed)return new qn(this.document);const{start:i,end:o}=this._breakAttributesRange(t,!0),n=i.parent,r=o.offset-i.offset,s=n._removeChildren(i.offset,r);for(const e of s)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(i);return t.start=a,t.end=a.clone(),new qn(this.document,s)}clear(e,t){Zn(e,this.document);const i=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const o of i){const i=o.item;let n;if(i.is("element")&&t.isSimilar(i))n=hn._createOn(i);else if(!o.nextPosition.isAfter(e.start)&&i.is("$textProxy")){const e=i.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(n=hn._createIn(e))}n&&(n.end.isAfter(e.end)&&(n.end=e.end),n.start.isBefore(e.start)&&(n.start=e.start),this.remove(n))}}move(e,t){let i;if(t.isAfter(e.end)){const o=(t=this._breakAttributes(t,!0)).parent,n=o.childCount;e=this._breakAttributesRange(e,!0),i=this.remove(e),t.offset+=o.childCount-n}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof Cn))throw new l.a("view-writer-wrap-invalid-attribute",this.document);if(Zn(e,this.document),e.isCollapsed){let o=e.start;o.parent.is("element")&&(i=o.parent,!Array.from(i.getChildren()).some(e=>!e.is("uiElement")))&&(o=o.getLastMatchingPosition(e=>e.item.is("uiElement"))),o=this._wrapPosition(o,t);const n=this.document.selection;return n.isCollapsed&&n.getFirstPosition().isEqual(e.start)&&this.setSelection(o),new hn(o)}return this._wrapRange(e,t);var i}unwrap(e,t){if(!(t instanceof Cn))throw new l.a("view-writer-unwrap-invalid-attribute",this.document);if(Zn(e,this.document),e.isCollapsed)return e;const{start:i,end:o}=this._breakAttributesRange(e,!0),n=i.parent,r=this._unwrapChildren(n,i.offset,o.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new hn(s,a)}rename(e,t){const i=new nn(this.document,e,t.getAttributes());return this.insert(dn._createAfter(t),i),this.move(hn._createIn(t),dn._createAt(i,0)),this.remove(hn._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return dn._createAt(e,t)}createPositionAfter(e){return dn._createAfter(e)}createPositionBefore(e){return dn._createBefore(e)}createRange(e,t){return new hn(e,t)}createRangeOn(e){return hn._createOn(e)}createRangeIn(e){return hn._createIn(e)}createSelection(e,t,i){return new mn(e,t,i)}_insertNodes(e,t,i){let o,n;if(o=i?Un(e):e.parent.is("$text")?e.parent.parent:e.parent,!o)throw new l.a("view-writer-invalid-position-container",this.document);n=i?this._breakAttributes(e,!0):e.parent.is("$text")?Jn(e):e;const r=o._insertChild(n.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const s=n.getShiftedBy(r),a=this.mergeAttributes(n);a.isEqual(n)||s.offset--;const c=this.mergeAttributes(s);return new hn(a,c)}_wrapChildren(e,t,i,o){let n=t;const r=[];for(;n<i;){const t=e.getChild(n),i=t.is("$text"),s=t.is("attributeElement"),a=t.isAllowedInsideAttributeElement;if(s&&this._wrapAttributeElement(o,t))r.push(new dn(e,n));else if(i||a||s&&Kn(o,t)){const i=o._clone();t._remove(),i._appendChild(t),e._insertChild(n,i),this._addToClonedElementsGroup(i),r.push(new dn(e,n))}else s&&this._wrapChildren(t,0,t.childCount,o);n++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t)continue;this.mergeAttributes(e).isEqual(e)||(s++,i--)}return hn._createFromParentsAndOffsets(e,t,e,i)}_unwrapChildren(e,t,i,o){let n=t;const r=[];for(;n<i;){const t=e.getChild(n);if(t.is("attributeElement"))if(t.isSimilar(o)){const o=t.getChildren(),s=t.childCount;t._remove(),e._insertChild(n,o),this._removeFromClonedElementsGroup(t),r.push(new dn(e,n),new dn(e,n+s)),n+=s,i+=s-1}else this._unwrapAttributeElement(o,t)?(r.push(new dn(e,n),new dn(e,n+1)),n++):(this._unwrapChildren(t,0,t.childCount,o),n++);else n++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t||e.offset==i)continue;this.mergeAttributes(e).isEqual(e)||(s++,i--)}return hn._createFromParentsAndOffsets(e,t,e,i)}_wrapRange(e,t){const{start:i,end:o}=this._breakAttributesRange(e,!0),n=i.parent,r=this._wrapChildren(n,i.offset,o.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new hn(s,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Gn(e.clone());e.parent.is("$text")&&(e=Jn(e));const i=this.createAttributeElement();i._priority=Number.POSITIVE_INFINITY,i.isSimilar=()=>!1,e.parent._insertChild(e.offset,i);const o=new hn(e,e.getShiftedBy(1));this.wrap(o,t);const n=new dn(i.parent,i.index);i._remove();const r=n.nodeBefore,s=n.nodeAfter;return r instanceof uo&&s instanceof uo?Yn(r,s):Gn(n)}_wrapAttributeElement(e,t){if(!er(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&t.hasAttribute(i)&&t.getAttribute(i)!==e.getAttribute(i))return!1;for(const i of e.getStyleNames())if(t.hasStyle(i)&&t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&(t.hasAttribute(i)||this.setAttribute(i,e.getAttribute(i),t));for(const i of e.getStyleNames())t.hasStyle(i)||this.setStyle(i,e.getStyle(i),t);for(const i of e.getClassNames())t.hasClass(i)||this.addClass(i,t);return!0}_unwrapAttributeElement(e,t){if(!er(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&(!t.hasAttribute(i)||t.getAttribute(i)!==e.getAttribute(i)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const i of e.getStyleNames())if(!t.hasStyle(i)||t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&this.removeAttribute(i,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const i=e.start,o=e.end;if(Zn(e,this.document),e.isCollapsed){const i=this._breakAttributes(e.start,t);return new hn(i,i)}const n=this._breakAttributes(o,t),r=n.parent.childCount,s=this._breakAttributes(i,t);return n.offset+=n.parent.childCount-r,new hn(s,n)}_breakAttributes(e,t=!1){const i=e.offset,o=e.parent;if(e.parent.is("emptyElement"))throw new l.a("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new l.a("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new l.a("view-writer-cannot-break-raw-element",this.document);if(!t&&o.is("$text")&&Xn(o.parent))return e.clone();if(Xn(o))return e.clone();if(o.is("$text"))return this._breakAttributes(Jn(e),t);if(i==o.childCount){const e=new dn(o.parent,o.index+1);return this._breakAttributes(e,t)}if(0===i){const e=new dn(o.parent,o.index);return this._breakAttributes(e,t)}{const e=o.index+1,n=o._clone();o.parent._insertChild(e,n),this._addToClonedElementsGroup(n);const r=o.childCount-i,s=o._removeChildren(i,r);n._appendChild(s);const a=new dn(o.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i||(i=new Set,this._cloneGroups.set(t,i)),i.add(e),e._clonesGroup=i}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const i=this._cloneGroups.get(t);i&&i.delete(e)}}function Un(e){let t=e.parent;for(;!Xn(t);){if(!t)return;t=t.parent}return t}function Kn(e,t){return e.priority<t.priority||!(e.priority>t.priority)&&e.getIdentity()<t.getIdentity()}function Gn(e){const t=e.nodeBefore;if(t&&t.is("$text"))return new dn(t,t.data.length);const i=e.nodeAfter;return i&&i.is("$text")?new dn(i,0):e}function Jn(e){if(e.offset==e.parent.data.length)return new dn(e.parent.parent,e.parent.index+1);if(0===e.offset)return new dn(e.parent.parent,e.parent.index);const t=e.parent.data.slice(e.offset);return e.parent._data=e.parent.data.slice(0,e.offset),e.parent.parent._insertChild(e.parent.index+1,new uo(e.root.document,t)),new dn(e.parent.parent,e.parent.index+1)}function Yn(e,t){const i=e.data.length;return e._data+=t.data,t._remove(),new dn(e,i)}const Qn=[uo,Cn,nn,En,jn,Dn];function Xn(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function Zn(e,t){const i=Un(e.start),o=Un(e.end);if(!i||!o||i!==o)throw new l.a("view-writer-invalid-range-container",t)}function er(e,t){return null===e.id&&null===t.id}function tr(e){return"[object Text]"==Object.prototype.toString.call(e)}const ir=e=>e.createTextNode(" "),or=e=>{const t=e.createElement("span");return t.dataset.ckeFiller=!0,t.innerHTML=" ",t},nr=e=>{const t=e.createElement("br");return t.dataset.ckeFiller=!0,t},rr="".repeat(7);function sr(e){return tr(e)&&e.data.substr(0,7)===rr}function ar(e){return 7==e.data.length&&sr(e)}function lr(e){return sr(e)?e.data.slice(7):e.data}function cr(e,t){if(t.keyCode==On.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,i=e.getRangeAt(0).startOffset;sr(t)&&i<=7&&e.collapse(t,0)}}}function dr(e,t,i,o=!1){i=i||function(e,t){return e===t},Array.isArray(e)||(e=Array.prototype.slice.call(e)),Array.isArray(t)||(t=Array.prototype.slice.call(t));const n=function(e,t,i){const o=hr(e,t,i);if(-1===o)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const n=ur(e,o),r=ur(t,o),s=hr(n,r,i),a=e.length-s,l=t.length-s;return{firstIndex:o,lastIndexOld:a,lastIndexNew:l}}(e,t,i);return o?function(e,t){const{firstIndex:i,lastIndexOld:o,lastIndexNew:n}=e;if(-1===i)return Array(t).fill("equal");let r=[];i>0&&(r=r.concat(Array(i).fill("equal")));n-i>0&&(r=r.concat(Array(n-i).fill("insert")));o-i>0&&(r=r.concat(Array(o-i).fill("delete")));n<t&&(r=r.concat(Array(t-n).fill("equal")));return r}(n,t.length):function(e,t){const i=[],{firstIndex:o,lastIndexOld:n,lastIndexNew:r}=t;r-o>0&&i.push({index:o,type:"insert",values:e.slice(o,r)});n-o>0&&i.push({index:o+(r-o),type:"delete",howMany:n-o});return i}(t,n)}function hr(e,t,i){for(let o=0;o<Math.max(e.length,t.length);o++)if(void 0===e[o]||void 0===t[o]||!i(e[o],t[o]))return o;return-1}function ur(e,t){return e.slice(t).reverse()}function gr(e,t,i){i=i||function(e,t){return e===t};const o=e.length,n=t.length;if(o>200||n>200||o+n>300)return gr.fastDiff(e,t,i,!0);let r,s;if(n<o){const i=e;e=t,t=i,r="delete",s="insert"}else r="insert",s="delete";const a=e.length,l=t.length,c=l-a,d={},h={};function u(o){const n=(void 0!==h[o-1]?h[o-1]:-1)+1,c=void 0!==h[o+1]?h[o+1]:-1,u=n>c?-1:1;d[o+u]&&(d[o]=d[o+u].slice(0)),d[o]||(d[o]=[]),d[o].push(n>c?r:s);let g=Math.max(n,c),m=g-o;for(;m<a&&g<l&&i(e[m],t[g]);)m++,g++,d[o].push("equal");return g}let g,m=0;do{for(g=-m;g<c;g++)h[g]=u(g);for(g=c+m;g>c;g--)h[g]=u(g);h[c]=u(c),m++}while(h[c]!==l);return d[c].slice(1)}function mr(e,t,i){e.insertBefore(i,e.childNodes[t]||null)}function fr(e){const t=e.parentNode;t&&t.removeChild(e)}function pr(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}gr.fastDiff=dr;class br{constructor(e,t){this.domDocuments=new Set,this.domConverter=e,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this.selection=t,this.isFocused=!1,this._inlineFiller=null,this._fakeSelectionContainer=null}markToSync(e,t){if("text"===e)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if("attributes"===e)this.markedAttributes.add(t);else{if("children"!==e)throw new l.a("view-renderer-unknown-type",this);this.markedChildren.add(t)}}}render(){let e;for(const e of this.markedChildren)this._updateChildrenMappings(e);this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent));for(const e of this.markedAttributes)this._updateAttrs(e);for(const t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(const t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(e){const t=this.domConverter.viewPositionToDom(e),i=t.parent.ownerDocument;sr(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=wr(i,t.parent,t.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(this.domConverter.mapViewToDom(e).childNodes),o=Array.from(this.domConverter.viewChildrenToDom(e,t.ownerDocument,{withChildren:!1})),n=this._diffNodeLists(i,o),r=this._findReplaceActions(n,i,o);if(-1!==r.indexOf("replace")){const t={equal:0,insert:0,delete:0};for(const n of r)if("replace"===n){const n=t.equal+t.insert,r=t.equal+t.delete,s=e.getChild(n);!s||s.is("uiElement")||s.is("rawElement")||this._updateElementMappings(s,i[r]),fr(o[n]),t.equal++}else t[n]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?dn._createBefore(this.selection.getFirstPosition().parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&tr(t.parent)&&sr(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!sr(e))throw new l.a("view-renderer-filler-was-lost",this);ar(e)?e.parentNode.removeChild(e):e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root))return!1;if(!t.is("element"))return!1;if(!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const t=e.findAncestor(e=>e.hasAttribute("contenteditable"));return!t||"true"==t.getAttribute("contenteditable")}(t))return!1;if(i===t.getFillerOffset())return!1;const o=e.nodeBefore,n=e.nodeAfter;return!(o instanceof uo||n instanceof uo)}_updateText(e,t){const i=this.domConverter.findCorrespondingDomText(e),o=this.domConverter.viewToDom(e,i.ownerDocument),n=i.data;let r=o.data;const s=t.inlineFillerPosition;if(s&&s.parent==e.parent&&s.offset==e.index&&(r=rr+r),n!=r){const e=dr(n,r);for(const t of e)"insert"===t.type?i.insertData(t.index,t.values.join("")):i.deleteData(t.index,t.howMany)}}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.attributes).map(e=>e.name),o=e.getAttributeKeys();for(const i of o)t.setAttribute(i,e.getAttribute(i));for(const o of i)e.hasAttribute(o)||t.removeAttribute(o)}_updateChildren(e,t){const i=this.domConverter.mapViewToDom(e);if(!i)return;const o=t.inlineFillerPosition,n=this.domConverter.mapViewToDom(e).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,i.ownerDocument,{bind:!0,inlineFillerPosition:o}));o&&o.parent===e&&wr(i.ownerDocument,r,o.offset);const s=this._diffNodeLists(n,r);let a=0;const l=new Set;for(const e of s)"delete"===e?(l.add(n[a]),fr(n[a])):"equal"===e&&a++;a=0;for(const e of s)"insert"===e?(mr(i,a,r[a]),a++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[a])),a++);for(const e of l)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return gr(e=function(e,t){const i=Array.from(e);if(0==i.length||!t)return i;i[i.length-1]==t&&i.pop();return i}(e,this._fakeSelectionContainer),t,_r.bind(null,this.domConverter))}_findReplaceActions(e,t,i){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let o=[],n=[],r=[];const s={equal:0,insert:0,delete:0};for(const a of e)"insert"===a?r.push(i[s.equal+s.insert]):"delete"===a?n.push(t[s.equal+s.delete]):(o=o.concat(gr(n,r,kr).map(e=>"equal"===e?"replace":e)),o.push("equal"),n=[],r=[]),s[a]++;return o.concat(gr(n,r,kr).map(e=>"equal"===e?"replace":e))}_markDescendantTextToSync(e){if(e)if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}_updateSelection(){if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):(this._removeFakeSelection(),this._updateDomSelection(e)))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}(t));const i=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(i,this.selection),!this._fakeSelectionNeedsUpdate(e))return;i.parentElement&&i.parentElement==e||e.appendChild(i),i.textContent=this.selection.fakeSelectionLabel||" ";const o=t.getSelection(),n=t.createRange();o.removeAllRanges(),n.selectNodeContents(i),o.addRange(n)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const i=this.domConverter.viewPositionToDom(this.selection.anchor),o=this.domConverter.viewPositionToDom(this.selection.focus);t.collapse(i.parent,i.offset),t.extend(o.parent,o.offset),In.isGecko&&function(e,t){const i=e.parent;if(i.nodeType!=Node.ELEMENT_NODE||e.offset!=i.childNodes.length-1)return;const o=i.childNodes[e.offset];o&&"BR"==o.tagName&&t.addRange(t.getRangeAt(0))}(o,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return(!t||!this.selection.isEqual(t))&&!(!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,i=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(i.anchorNode!==t&&!t.contains(i.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){if(e.getSelection().rangeCount){const t=e.activeElement,i=this.domConverter.mapDomToView(t);t&&i&&e.getSelection().removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function wr(e,t,i){const o=t instanceof Array?t:t.childNodes,n=o[i];if(tr(n))return n.data=rr+n.data,n;{const n=e.createTextNode(rr);return Array.isArray(t)?o.splice(i,0,n):mr(t,i,n),n}}function kr(e,t){return pr(e)&&pr(t)&&!tr(e)&&!tr(t)&&e.nodeType!==Node.COMMENT_NODE&&t.nodeType!==Node.COMMENT_NODE&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function _r(e,t,i){return t===i||(tr(t)&&tr(i)?t.data===i.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(i)))}Ye(br,qe);var vr={window:window,document:document};function yr(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function xr(e){const t=[];for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)t.unshift(e),e=e.parentNode;return t}const Cr=nr(document),Ar=ir(document),Tr=or(document);class Er{constructor(e,t={}){this.document=e,this.blockFillerMode=t.blockFillerMode||"br",this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new fo,this._encounteredRawContentDomNodes=new WeakSet}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new mn(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const t of e.childNodes)this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}viewToDom(e,t,i={}){if(e.is("$text")){const i=this._processDataFromViewText(e);return t.createTextNode(i)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let o;if(e.is("documentFragment"))o=t.createDocumentFragment(),i.bind&&this.bindDocumentFragments(o,e);else{if(e.is("uiElement"))return o="$comment"===e.name?t.createComment(e.getCustomProperty("$rawContent")):e.render(t),i.bind&&this.bindElements(o,e),o;o=e.hasAttribute("xmlns")?t.createElementNS(e.getAttribute("xmlns"),e.name):t.createElement(e.name),e.is("rawElement")&&e.render(o),i.bind&&this.bindElements(o,e);for(const t of e.getAttributeKeys())o.setAttribute(t,e.getAttribute(t))}if(!1!==i.withChildren)for(const n of this.viewChildrenToDom(e,t,i))o.appendChild(n);return o}}*viewChildrenToDom(e,t,i={}){const o=e.getFillerOffset&&e.getFillerOffset();let n=0;for(const r of e.getChildren())o===n&&(yield this._getBlockFiller(t)),yield this.viewToDom(r,t,i),n++;o===n&&(yield this._getBlockFiller(t))}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),i=this.viewPositionToDom(e.end),o=document.createRange();return o.setStart(t.parent,t.offset),o.setEnd(i.parent,i.offset),o}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const i=this.findCorrespondingDomText(t);if(!i)return null;let o=e.offset;return sr(i)&&(o+=7),{parent:i,offset:o}}{let i,o,n;if(0===e.offset){if(i=this.mapViewToDom(t),!i)return null;n=i.childNodes[0]}else{const t=e.nodeBefore;if(o=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(e.nodeBefore),!o)return null;i=o.parentNode,n=o.nextSibling}if(tr(n)&&sr(n))return{parent:n,offset:7};return{parent:i,offset:o?yr(o)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e))return null;const i=this.getHostViewElement(e);if(i)return i;if(this.isComment(e)&&t.skipComments)return null;if(tr(e)){if(ar(e))return null;{const t=this._processDataFromDomText(e);return""===t?null:new uo(this.document,t)}}{if(this.mapDomToView(e))return this.mapDomToView(e);let i;if(this.isDocumentFragment(e))i=new qn(this.document),t.bind&&this.bindDocumentFragments(e,i);else{i=this._createViewElement(e,t),t.bind&&this.bindElements(e,i);const o=e.attributes;if(o)for(let e=o.length-1;e>=0;e--)i._setAttribute(o[e].name,o[e].value);if(this._isViewElementWithRawContent(i,t)||this.isComment(e)){const t=this.isComment(e)?e.data:e.innerHTML;return i._setCustomProperty("$rawContent",t),this._encounteredRawContentDomNodes.add(e),i}}if(!1!==t.withChildren)for(const o of this.domChildrenToView(e,t))i._appendChild(o);return i}}*domChildrenToView(e,t={}){for(let i=0;i<e.childNodes.length;i++){const o=e.childNodes[i],n=this.domToView(o,t);null!==n&&(yield n)}}domSelectionToView(e){if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;tr(t)&&(t=t.parentNode);const i=this.fakeSelectionToView(t);if(i)return i}const t=this.isDomSelectionBackward(e),i=[];for(let t=0;t<e.rangeCount;t++){const o=e.getRangeAt(t),n=this.domRangeToView(o);n&&i.push(n)}return new mn(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new hn(t,i):null}domPositionToView(e,t){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,yr(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return dn._createBefore(i);if(tr(e)){if(ar(e))return this.domPositionToView(e.parentNode,yr(e));const i=this.findCorrespondingViewText(e);let o=t;return i?(sr(e)&&(o-=7,o=o<0?0:o),new dn(i,o)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new dn(t,0)}else{const i=e.childNodes[t-1],o=tr(i)?this.findCorrespondingViewText(i):this.mapDomToView(i);if(o&&o.parent)return new dn(o.parent,o.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(ar(e))return null;const t=this.getHostViewElement(e);if(t)return t;const i=e.previousSibling;if(i){if(!this.isElement(i))return null;const e=this.mapDomToView(i);if(e){return e.nextSibling instanceof uo?e.nextSibling:null}}else{const t=this.mapDomToView(e.parentNode);if(t){const e=t.getChild(0);return e instanceof uo?e:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:e,scrollY:i}=vr.window,o=[];Pr(t,e=>{const{scrollLeft:t,scrollTop:i}=e;o.push([t,i])}),t.focus(),Pr(t,e=>{const[t,i]=o.shift();e.scrollLeft=t,e.scrollTop=i}),vr.window.scrollTo(e,i)}}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isComment(e){return e&&e.nodeType==Node.COMMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(Cr):!("BR"!==e.tagName||!Sr(e,this.blockElements)||1!==e.parentNode.childNodes.length)||(e.isEqualNode(Tr)||function(e,t){return e.isEqualNode(Ar)&&Sr(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements))}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=document.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset);const i=t.collapsed;return t.detach(),i}getHostViewElement(e){const t=xr(e);for(t.pop();t.length;){const e=t.pop(),i=this._domToViewMapping.get(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return i}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}_getBlockFiller(e){switch(this.blockFillerMode){case"nbsp":return ir(e);case"markedNbsp":return or(e);case"br":return nr(e)}}_isDomSelectionPositionCorrect(e,t){if(tr(e)&&sr(e)&&t<7)return!1;if(this.isElement(e)&&sr(e.childNodes[t]))return!1;const i=this.mapDomToView(e);return!i||!i.is("uiElement")&&!i.is("rawElement")}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return t;if(" "==t.charAt(0)){const i=this._getTouchingInlineViewNode(e,!1);!(i&&i.is("$textProxy")&&this._nodeEndsWithSpace(i))&&i||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const i=this._getTouchingInlineViewNode(e,!0),o=i&&i.is("$textProxy")&&" "==i.data.charAt(0);" "!=t.charAt(t.length-2)&&i&&!o||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_processDataFromDomText(e){let t=e.data;if(function(e,t){return xr(e).some(e=>e.tagName&&t.includes(e.tagName.toLowerCase()))}(e,this.preElements))return lr(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const i=this._getTouchingInlineDomNode(e,!1),o=this._getTouchingInlineDomNode(e,!0),n=this._checkShouldLeftTrimDomText(e,i),r=this._checkShouldRightTrimDomText(e,o);n&&(t=t.replace(/^ /,"")),r&&(t=t.replace(/ $/,"")),t=lr(new Text(t)),t=t.replace(/ \u00A0/g," ");const s=o&&this.isElement(o)&&"BR"!=o.tagName,a=o&&tr(o)&&" "==o.data.charAt(0);return(/( |\u00A0)\u00A0$/.test(t)||!o||s||a)&&(t=t.replace(/\u00A0$/," ")),(n||i&&this.isElement(i)&&"BR"!=i.tagName)&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e,t){return!t||(this.isElement(t)?"BR"===t.tagName:!this._encounteredRawContentDomNodes.has(e.previousSibling)&&/[^\S\u00A0]/.test(t.data.charAt(t.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!sr(e)}_getTouchingInlineViewNode(e,t){const i=new cn({startPosition:t?dn._createAfter(e):dn._createBefore(e),direction:t?"forward":"backward"});for(const e of i){if(e.item.is("element")&&this.inlineObjectElements.includes(e.item.name))return e.item;if(e.item.is("containerElement"))return null;if(e.item.is("element","br"))return null;if(e.item.is("$textProxy"))return e.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const i=t?"firstChild":"lastChild",o=t?"nextSibling":"previousSibling";let n=!0;do{if(!n&&e[i]?e=e[i]:e[o]?(e=e[o],n=!1):(e=e.parentNode,n=!0),!e||this._isBlockElement(e))return null}while(!tr(e)&&"BR"!=e.tagName&&!this._isInlineObjectElement(e));return e}_isBlockElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isInlineObjectElement(e){return this.isElement(e)&&this.inlineObjectElements.includes(e.tagName.toLowerCase())}_createViewElement(e,t){if(this.isComment(e))return new Dn(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new tn(this.document,i)}_isViewElementWithRawContent(e,t){return!1!==t.withChildren&&this._rawContentElementMatcher.match(e)}}function Pr(e,t){for(;e&&e!=vr.document;)t(e),e=e.parentNode}function Sr(e,t){const i=e.parentNode;return i&&i.tagName&&t.includes(i.tagName.toLowerCase())}function Ir(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}var Rr=Ne({},h,{listenTo(e,...t){if(pr(e)||Ir(e)){const i=this._getProxyEmitter(e)||new Vr(e);i.attach(...t),e=i}h.listenTo.call(this,e,...t)},stopListening(e,t,i){if(pr(e)||Ir(e)){const t=this._getProxyEmitter(e);if(!t)return;e=t}h.stopListening.call(this,e,t,i),e instanceof Vr&&e.detach(t)},_getProxyEmitter(e){return t=this,i=Or(e),t[c]&&t[c][i]?t[c][i].emitter:null;var t,i}});class Vr{constructor(e){u(this,Or(e)),this._domNode=e}}function Or(e){return e["data-ck-expando"]||(e["data-ck-expando"]=s())}Ne(Vr.prototype,h,{attach(e,t,i={}){if(this._domListeners&&this._domListeners[e])return;const o={capture:!!i.useCapture,passive:!!i.usePassive},n=this._createDomListener(e,o);this._domNode.addEventListener(e,n,o),this._domListeners||(this._domListeners={}),this._domListeners[e]=n},detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()},_createDomListener(e,t){const i=t=>{this.fire(e,t)};return i.removeListener=()=>{this._domNode.removeEventListener(e,i,t),delete this._domListeners[e]},i}});class zr{constructor(e){this.view=e,this.document=e.document,this.isEnabled=!1}enable(){this.isEnabled=!0}disable(){this.isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&3===e.nodeType&&(e=e.parentNode),!(!e||1!==e.nodeType)&&e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}Ye(zr,Rr);var Mr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Br=function(e){return this.__data__.has(e)};function Nr(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new jt;++t<i;)this.add(e[t])}Nr.prototype.add=Nr.prototype.push=Mr,Nr.prototype.has=Br;var Fr=Nr;var Dr=function(e,t){for(var i=-1,o=null==e?0:e.length;++i<o;)if(t(e[i],i,e))return!0;return!1};var Lr=function(e,t){return e.has(t)};var Hr=function(e,t,i,o,n,r){var s=1&i,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=r.get(e),d=r.get(t);if(c&&d)return c==t&&d==e;var h=-1,u=!0,g=2&i?new Fr:void 0;for(r.set(e,t),r.set(t,e);++h<a;){var m=e[h],f=t[h];if(o)var p=s?o(f,m,h,t,e,r):o(m,f,h,e,t,r);if(void 0!==p){if(p)continue;u=!1;break}if(g){if(!Dr(t,(function(e,t){if(!Lr(g,t)&&(m===e||n(m,e,i,o,r)))return g.push(t)}))){u=!1;break}}else if(m!==f&&!n(m,f,i,o,r)){u=!1;break}}return r.delete(e),r.delete(t),u};var jr=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e,o){i[++t]=[o,e]})),i};var Wr=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i},qr=_?_.prototype:void 0,$r=qr?qr.valueOf:void 0;var Ur=function(e,t,i,o,n,r,s){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!r(new Ti(e),new Ti(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return J(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=jr;case"[object Set]":var l=1&o;if(a||(a=Wr),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;o|=2,s.set(e,t);var d=Hr(a(e),a(t),o,n,r,s);return s.delete(e),d;case"[object Symbol]":if($r)return $r.call(e)==$r.call(t)}return!1},Kr=Object.prototype.hasOwnProperty;var Gr=function(e,t,i,o,n,r){var s=1&i,a=hi(e),l=a.length;if(l!=hi(t).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in t:Kr.call(t,d)))return!1}var h=r.get(e),u=r.get(t);if(h&&u)return h==t&&u==e;var g=!0;r.set(e,t),r.set(t,e);for(var m=s;++c<l;){var f=e[d=a[c]],p=t[d];if(o)var b=s?o(p,f,d,t,e,r):o(f,p,d,e,t,r);if(!(void 0===b?f===p||n(f,p,i,o,r):b)){g=!1;break}m||(m="constructor"==d)}if(g&&!m){var w=e.constructor,k=t.constructor;w==k||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof k&&k instanceof k||(g=!1)}return r.delete(e),r.delete(t),g},Jr=Object.prototype.hasOwnProperty;var Yr=function(e,t,i,o,n,r){var s=ve(e),a=ve(t),l=s?"[object Array]":xi(e),c=a?"[object Array]":xi(t),d="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l),h="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),u=l==c;if(u&&Object(ye.a)(e)){if(!Object(ye.a)(t))return!1;s=!0,d=!1}if(u&&!d)return r||(r=new $t),s||Pe(e)?Hr(e,t,i,o,n,r):Ur(e,t,l,i,o,n,r);if(!(1&i)){var g=d&&Jr.call(e,"__wrapped__"),m=h&&Jr.call(t,"__wrapped__");if(g||m){var f=g?e.value():e,p=m?t.value():t;return r||(r=new $t),n(f,p,i,o,r)}}return!!u&&(r||(r=new $t),Gr(e,t,i,o,n,r))};var Qr=function e(t,i,o,n,r){return t===i||(null==t||null==i||!fe(t)&&!fe(i)?t!=t&&i!=i:Yr(t,i,o,n,e,r))};var Xr=function(e,t,i){var o=(i="function"==typeof i?i:void 0)?i(e,t):void 0;return void 0===o?Qr(e,t,void 0,i):!!o};class Zr extends zr{constructor(e){super(e),this._config={childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=[],this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.push(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(0===e.length)return;const t=this.domConverter,i=new Map,o=new Set;for(const i of e)if("childList"===i.type){const e=t.mapDomToView(i.target);if(e&&(e.is("uiElement")||e.is("rawElement")))continue;e&&!this._isBogusBrMutation(i)&&o.add(e)}for(const n of e){const e=t.mapDomToView(n.target);if((!e||!e.is("uiElement")&&!e.is("rawElement"))&&"characterData"===n.type){const e=t.findCorrespondingViewText(n.target);e&&!o.has(e.parent)?i.set(e,{type:"text",oldText:e.data,newText:lr(n.target),node:e}):!e&&sr(n.target)&&o.add(t.mapDomToView(n.target.parentNode))}}const n=[];for(const e of i.values())this.renderer.markToSync("text",e.node),n.push(e);for(const e of o){const i=t.mapViewToDom(e),o=Array.from(e.getChildren()),r=Array.from(t.domChildrenToView(i,{withChildren:!1}));Xr(o,r,a)||(this.renderer.markToSync("children",e),n.push({type:"children",oldChildren:o,newChildren:r,node:e}))}const r=e[0].target.ownerDocument.getSelection();let s=null;if(r&&r.anchorNode){const e=t.domPositionToView(r.anchorNode,r.anchorOffset),i=t.domPositionToView(r.focusNode,r.focusOffset);e&&i&&(s=new mn(e),s.setFocus(i))}function a(e,t){if(!Array.isArray(e))return e===t||!(!e.is("$text")||!t.is("$text"))&&e.data===t.data}n.length&&(this.document.fire("mutations",n,s),this.view.forceRender())}_isBogusBrMutation(e){let t=null;return null===e.nextSibling&&0===e.removedNodes.length&&1==e.addedNodes.length&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}class es{constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Ne(this,i)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class ts extends zr{constructor(e){super(e),this.useCapture=!1}observe(e){("string"==typeof this.domEventType?[this.domEventType]:this.domEventType).forEach(t=>{this.listenTo(e,t,(e,t)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(t.target)&&this.onDomEvent(t)},{useCapture:this.useCapture})})}fire(e,t,i){this.isEnabled&&this.document.fire(e,new es(this.view,t,i))}}class is extends ts{constructor(e){super(e),this.domEventType=["keydown","keyup"]}onDomEvent(e){this.fire(e.type,e,{keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return Mn(this)}})}}var os=function(){return k.a.Date.now()},ns=/\s/;var rs=function(e){for(var t=e.length;t--&&ns.test(e.charAt(t)););return t},ss=/^\s+/;var as=function(e){return e?e.slice(0,rs(e)+1).replace(ss,""):e},ls=/^[-+]0x[0-9a-f]+$/i,cs=/^0b[01]+$/i,ds=/^0o[0-7]+$/i,hs=parseInt;var us=function(e){if("number"==typeof e)return e;if(wo(e))return NaN;if(w(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=w(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=as(e);var i=cs.test(e);return i||ds.test(e)?hs(e.slice(2),i?2:8):ls.test(e)?NaN:+e},gs=Math.max,ms=Math.min;var fs=function(e,t,i){var o,n,r,s,a,l,c=0,d=!1,h=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var i=o,r=n;return o=n=void 0,c=t,s=e.apply(r,i)}function m(e){return c=e,a=setTimeout(p,t),d?g(e):s}function f(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-c>=r}function p(){var e=os();if(f(e))return b(e);a=setTimeout(p,function(e){var i=t-(e-l);return h?ms(i,r-(e-c)):i}(e))}function b(e){return a=void 0,u&&o?g(e):(o=n=void 0,s)}function k(){var e=os(),i=f(e);if(o=arguments,n=this,l=e,i){if(void 0===a)return m(l);if(h)return clearTimeout(a),a=setTimeout(p,t),g(l)}return void 0===a&&(a=setTimeout(p,t)),s}return t=us(t)||0,w(i)&&(d=!!i.leading,r=(h="maxWait"in i)?gs(us(i.maxWait)||0,t):r,u="trailing"in i?!!i.trailing:u),k.cancel=function(){void 0!==a&&clearTimeout(a),c=0,o=l=n=a=void 0},k.flush=function(){return void 0===a?s:b(os())},k};class ps extends zr{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=fs(e=>this.document.fire("selectionChangeDone",e),200)}observe(){const e=this.document;e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&i.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(i.keyCode)},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,i=new mn(t.getRanges(),{backward:t.isBackward,fake:!1});e!=On.arrowleft&&e!=On.arrowup||i.setTo(i.getFirstPosition()),e!=On.arrowright&&e!=On.arrowdown||i.setTo(i.getLastPosition());const o={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}class bs extends zr{constructor(e){super(e),this.mutationObserver=e.getObserver(Zr),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=fs(e=>this.document.fire("selectionChangeDone",e),200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument;this._documents.has(t)||(this.listenTo(t,"selectionchange",(e,i)=>{this._handleSelectionChange(i,t)}),this._documents.add(t))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(e,t){if(!this.isEnabled)return;const i=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(i.anchorNode))return;this.mutationObserver.flush();const o=this.domConverter.domSelectionToView(i);if(0!=o.rangeCount){if(this.view.hasDomSelection=!0,!(this.selection.isEqual(o)&&this.domConverter.isDomSelectionCorrect(i)||++this._loopbackCounter>60))if(this.selection.isSimilar(o))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:o,domSelection:i};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class ws extends ts{constructor(e){super(e),this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{t.isFocused=!0,this._renderTimeoutId=setTimeout(()=>e.change(()=>{}),50)}),t.on("blur",(i,o)=>{const n=t.selection.editableElement;null!==n&&n!==o.target||(t.isFocused=!1,e.change(()=>{}))})}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class ks extends ts{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0}),t.on("compositionend",()=>{t.isComposing=!1})}onDomEvent(e){this.fire(e.type,e)}}class _s extends ts{constructor(e){super(e),this.domEventType=["beforeinput"]}onDomEvent(e){this.fire(e.type,e)}}var vs=function(e){return"string"==typeof e||!ve(e)&&fe(e)&&"[object String]"==S(e)};function ys(e,t,i={},o=[]){const n=i&&i.xmlns,r=n?e.createElementNS(n,t):e.createElement(t);for(const e in i)r.setAttribute(e,i[e]);!vs(o)&&Xi(o)||(o=[o]);for(let t of o)vs(t)&&(t=e.createTextNode(t)),r.appendChild(t);return r}function xs(e){return"[object Range]"==Object.prototype.toString.apply(e)}function Cs(e){const t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}const As=["top","right","bottom","left","width","height"];class Ts{constructor(e){const t=xs(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),Gi(e)||t)if(t){const t=Ts.getDomRangeRects(e);Es(this,Ts.getBoundingRect(t))}else Es(this,e.getBoundingClientRect());else if(Ir(e)){const{innerWidth:t,innerHeight:i}=e;Es(this,{top:0,right:t,bottom:i,left:0,width:t,height:i})}else Es(this,e)}clone(){return new Ts(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left)};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new Ts(t)}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(!Ps(e)){let i=e.parentNode||e.commonAncestorContainer;for(;i&&!Ps(i);){const e=new Ts(i),o=t.getIntersection(e);if(!o)return null;o.getArea()<t.getArea()&&(t=o),i=i.parentNode}}return t}isEqual(e){for(const t of As)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!(!t||!t.isEqual(e))}excludeScrollbarsAndBorders(){const e=this._source;let t,i,o;if(Ir(e))t=e.innerWidth-e.document.documentElement.clientWidth,i=e.innerHeight-e.document.documentElement.clientHeight,o=e.getComputedStyle(e.document.documentElement).direction;else{const n=Cs(this._source);t=e.offsetWidth-e.clientWidth-n.left-n.right,i=e.offsetHeight-e.clientHeight-n.top-n.bottom,o=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=n.left,this.top+=n.top,this.right-=n.right,this.bottom-=n.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,"ltr"===o?this.right-=t:this.left+=t,this.height-=i,this.bottom-=i,this}static getDomRangeRects(e){const t=[],i=Array.from(e.getClientRects());if(i.length)for(const e of i)t.push(new Ts(e));else{let i=e.startContainer;tr(i)&&(i=i.parentNode);const o=new Ts(i.getBoundingClientRect());o.right=o.left,o.width=0,t.push(o)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY};let i=0;for(const o of e)i++,t.left=Math.min(t.left,o.left),t.top=Math.min(t.top,o.top),t.right=Math.max(t.right,o.right),t.bottom=Math.max(t.bottom,o.bottom);return 0==i?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new Ts(t))}}function Es(e,t){for(const i of As)e[i]=t[i]}function Ps(e){return!!Gi(e)&&e===e.ownerDocument.body}class Ss{constructor(e,t){Ss._observerInstance||Ss._createObserver(),this._element=e,this._callback=t,Ss._addElementCallback(e,t),Ss._observerInstance.observe(e)}destroy(){Ss._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){Ss._elementCallbacks||(Ss._elementCallbacks=new Map);let i=Ss._elementCallbacks.get(e);i||(i=new Set,Ss._elementCallbacks.set(e,i)),i.add(t)}static _deleteElementCallback(e,t){const i=Ss._getElementCallbacks(e);i&&(i.delete(t),i.size||(Ss._elementCallbacks.delete(e),Ss._observerInstance.unobserve(e))),Ss._elementCallbacks&&!Ss._elementCallbacks.size&&(Ss._observerInstance=null,Ss._elementCallbacks=null)}static _getElementCallbacks(e){return Ss._elementCallbacks?Ss._elementCallbacks.get(e):null}static _createObserver(){let e;e="function"==typeof vr.window.ResizeObserver?vr.window.ResizeObserver:Is,Ss._observerInstance=new e(e=>{for(const t of e){const e=Ss._getElementCallbacks(t.target);if(e)for(const i of e)i(t)}})}}Ss._observerInstance=null,Ss._elementCallbacks=null;class Is{constructor(e){this._callback=e,this._elements=new Set,this._previousRects=new Map,this._periodicCheckTimeout=null}observe(e){this._elements.add(e),this._checkElementRectsAndExecuteCallback(),1===this._elements.size&&this._startPeriodicCheck()}unobserve(e){this._elements.delete(e),this._previousRects.delete(e),this._elements.size||this._stopPeriodicCheck()}_startPeriodicCheck(){const e=()=>{this._checkElementRectsAndExecuteCallback(),this._periodicCheckTimeout=setTimeout(e,100)};this.listenTo(vr.window,"resize",()=>{this._checkElementRectsAndExecuteCallback()}),this._periodicCheckTimeout=setTimeout(e,100)}_stopPeriodicCheck(){clearTimeout(this._periodicCheckTimeout),this.stopListening(),this._previousRects.clear()}_checkElementRectsAndExecuteCallback(){const e=[];for(const t of this._elements)this._hasRectChanged(t)&&e.push({target:t,contentRect:this._previousRects.get(t)});e.length&&this._callback(e)}_hasRectChanged(e){if(!e.ownerDocument.body.contains(e))return!1;const t=new Ts(e),i=this._previousRects.get(e),o=!i||!i.isEqual(t);return this._previousRects.set(e,t),o}}function Rs(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}function Vs(e){return t=>t+e}function Os(e){const t=e.next();return t.done?null:t.value}Ye(Is,Rr);class zs{constructor(){this.set("isFocused",!1),this.set("focusedElement",null),this._elements=new Set,this._nextEventLoopTimeout=null}add(e){if(this._elements.has(e))throw new l.a("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(e),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}Ye(zs,Rr),Ye(zs,qe);class Ms{constructor(){this._listener=Object.create(Rr)}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+Mn(t),t)})}set(e,t,i={}){const o=Bn(e),n=i.priority;this._listener.listenTo(this._listener,"_keydown:"+o,(e,i)=>{t(i,()=>{i.preventDefault(),i.stopPropagation(),e.stop()}),e.return=!0},{priority:n})}press(e){return!!this._listener.fire("_keydown:"+Mn(e),e)}destroy(){this._listener.stopListening()}}class Bs extends zr{constructor(e){super(e),this.document.on("keydown",(e,t)=>{if(this.isEnabled&&((i=t.keyCode)==On.arrowright||i==On.arrowleft||i==On.arrowup||i==On.arrowdown)){const i=new pn(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(i,t),i.stop.called&&e.stop()}var i})}observe(){}}function Ns({target:e,viewportOffset:t=0}){const i=qs(e);let o=i,n=null;for(;o;){let r;r=$s(o==i?e:n),Ds(r,()=>Us(e,o));const s=Us(e,o);if(Fs(o,s,t),o.parent!=o){if(n=o.frameElement,o=o.parent,!n)return}else o=null}}function Fs(e,t,i){const o=t.clone().moveBy(0,i),n=t.clone().moveBy(0,-i),r=new Ts(e).excludeScrollbarsAndBorders();if(![n,o].every(e=>r.contains(e))){let{scrollX:s,scrollY:a}=e;Hs(n,r)?a-=r.top-t.top+i:Ls(o,r)&&(a+=t.bottom-r.bottom+i),js(t,r)?s-=r.left-t.left+i:Ws(t,r)&&(s+=t.right-r.right+i),e.scrollTo(s,a)}}function Ds(e,t){const i=qs(e);let o,n;for(;e!=i.document.body;)n=t(),o=new Ts(e).excludeScrollbarsAndBorders(),o.contains(n)||(Hs(n,o)?e.scrollTop-=o.top-n.top:Ls(n,o)&&(e.scrollTop+=n.bottom-o.bottom),js(n,o)?e.scrollLeft-=o.left-n.left:Ws(n,o)&&(e.scrollLeft+=n.right-o.right)),e=e.parentNode}function Ls(e,t){return e.bottom>t.bottom}function Hs(e,t){return e.top<t.top}function js(e,t){return e.left<t.left}function Ws(e,t){return e.right>t.right}function qs(e){return xs(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function $s(e){if(xs(e)){let t=e.commonAncestorContainer;return tr(t)&&(t=t.parentNode),t}return e.parentNode}function Us(e,t){const i=qs(e),o=new Ts(e);if(i===t)return o;{let e=i;for(;e!=t;){const t=e.frameElement,i=new Ts(t).excludeScrollbarsAndBorders();o.moveBy(i.left,i.top),e=e.parent}}return o}Object.assign({},{scrollViewportToShowTarget:Ns,scrollAncestorsToShowTarget:function(e){Ds($s(e),()=>new Ts(e))}});class Ks{constructor(e){this.document=new xn(e),this.domConverter=new Er(this.document),this.domRoots=new Map,this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new br(this.domConverter,this.document.selection),this._renderer.bind("isFocused").to(this.document),this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this._writer=new $n(this.document),this.addObserver(Zr),this.addObserver(bs),this.addObserver(ws),this.addObserver(is),this.addObserver(ps),this.addObserver(ks),this.addObserver(Bs),In.isAndroid&&this.addObserver(_s),this.document.on("arrowKey",cr,{priority:"low"}),Ln(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0}),this.listenTo(this.document,"change:isFocused",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(e,t="main"){const i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();const o={};for(const{name:t,value:n}of Array.from(e.attributes))o[t]=n,"class"===t?this._writer.addClass(n.split(" "),i):this._writer.setAttribute(t,n,i);this._initialDomRootAttributes.set(e,o);const n=()=>{this._writer.setAttribute("contenteditable",!i.isReadOnly,i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i)};n(),this.domRoots.set(t,e),this.domConverter.bindElements(e,i),this._renderer.markToSync("children",i),this._renderer.markToSync("attributes",i),this._renderer.domDocuments.add(e.ownerDocument),i.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),i.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),i.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),i.on("change:isReadOnly",()=>this.change(n)),i.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const i of this._observers.values())i.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const i=this._initialDomRootAttributes.get(t);for(const e in i)t.setAttribute(e,i[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[e,i]of this.domRoots)t.observe(i,e);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection(){const e=this.document.selection.getFirstRange();e&&Ns({target:this.domConverter.viewRangeToDom(e),viewportOffset:20})}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new l.a("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(e){l.a.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return dn._createAt(e,t)}createPositionAfter(e){return dn._createAfter(e)}createPositionBefore(e){return dn._createBefore(e)}createRange(e,t){return new hn(e,t)}createRangeOn(e){return hn._createOn(e)}createRangeIn(e){return hn._createIn(e)}createSelection(e,t,i){return new mn(e,t,i)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}Ye(Ks,qe);class Gs{constructor(e){this.parent=null,this._attrs=mo(e)}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new l.a("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new l.a("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),o=e.getAncestors(t);let n=0;for(;i[n]==o[n]&&i[n];)n++;return 0===n?null:i[n-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),o=lo(t,i);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<i[o]}}isAfter(e){return this!=e&&(this.root===e.root&&!this.isBefore(e))}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce((e,t)=>(e[t[0]]=t[1],e),{})),e}is(e){return"node"===e||"model:node"===e}_clone(){return new Gs(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=mo(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}class Js extends Gs{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}is(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new Js(this.data,this.getAttributes())}static fromJSON(e){return new Js(e.data,e.attributes)}}class Ys{constructor(e,t,i){if(this.textNode=e,t<0||t>e.offsetSize)throw new l.a("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new l.a("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}is(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}class Qs{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return-1==t?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return null===t?null:this._nodes.slice(0,t).reduce((e,t)=>e+t.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new l.a("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const i of this._nodes){if(e>=t&&e<t+i.offsetSize)return this.getNodeIndex(i);t+=i.offsetSize}if(t!=e)throw new l.a("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const e of t)if(!(e instanceof Gs))throw new l.a("model-nodelist-insertnodes-not-node",this);this._nodes.splice(e,0,...t)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}class Xs extends Gs{constructor(e,t,i){super(t),this.name=e,this._children=new Qs,i&&this._insertChild(0,i)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}is(e,t=null){return t?t===this.name&&("element"===e||"model:element"===e):"element"===e||"model:element"===e||"node"===e||"model:node"===e}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}findAncestor(e,t={includeSelf:!1}){let i=t.includeSelf?this:this.parent;for(;i;){if(i.name===e)return i;i=i.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(e=>e._clone(!0)):null;return new Xs(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){if("string"==typeof e)return[new Js(e)];Xi(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new Js(e):e instanceof Ys?new Js(e.data,e.getAttributes()):e)}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}static fromJSON(e){let t=null;if(e.children){t=[];for(const i of e.children)i.name?t.push(Xs.fromJSON(i)):t.push(Js.fromJSON(i))}return new Xs(e.name,e.attributes,t)}}class Zs{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new l.a("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new l.a("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this.position=e.startPosition.clone():this.position=ta._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}skip(e){let t,i,o,n;do{o=this.position,n=this._visitedParent,({done:t,value:i}=this.next())}while(!t&&e(i));t||(this.position=o,this._visitedParent=n)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&t.offset===i.maxOffset)return{done:!0};if(i===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};const o=t.parent,n=ia(t,o),r=n||oa(t,o,n);if(r instanceof Xs)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this.position=t,ea("elementStart",r,e,t,1);if(r instanceof Js){let o;if(this.singleCharacters)o=1;else{let e=r.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),o=e-t.offset}const n=t.offset-r.startOffset,s=new Ys(r,n,o);return t.offset+=o,this.position=t,ea("text",s,e,t,o)}return t.path.pop(),t.offset++,this.position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():ea("elementEnd",i,e,t)}_previous(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&0===t.offset)return{done:!0};if(i==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0};const o=t.parent,n=ia(t,o),r=n||na(t,o,n);if(r instanceof Xs)return t.offset--,this.shallow?(this.position=t,ea("elementStart",r,e,t,1)):(t.path.push(r.maxOffset),this.position=t,this._visitedParent=r,this.ignoreElementEnd?this._previous():ea("elementEnd",r,e,t));if(r instanceof Js){let o;if(this.singleCharacters)o=1;else{let e=r.startOffset;this._boundaryStartParent==i&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),o=t.offset-e}const n=t.offset-r.startOffset,s=new Ys(r,n-o,o);return t.offset-=o,this.position=t,ea("text",s,e,t,o)}return t.path.pop(),this.position=t,this._visitedParent=i.parent,ea("elementStart",i,e,t,1)}}function ea(e,t,i,o,n){return{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:o,length:n}}}class ta{constructor(e,t,i="toNone"){if(!e.is("element")&&!e.is("documentFragment"))throw new l.a("model-position-root-invalid",e);if(!(t instanceof Array)||0===t.length)throw new l.a("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=i}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChild(e.offsetToIndex(this.path[t])),!e)throw new l.a("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new l.a("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return ia(this,this.parent)}get nodeAfter(){const e=this.parent;return oa(this,e,ia(this,e))}get nodeBefore(){const e=this.parent;return na(this,e,ia(this,e))}get isAtStart(){return 0===this.offset}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=lo(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new Zs(t);return i.skip(e),i.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=lo(this.path,e.path),i="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,i)}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let o=0;for(;t[o]==i[o]&&t[o];)o++;return 0===o?null:t[o-1]}getShiftedBy(e){const t=this.clone(),i=t.offset+e;return t.offset=i<0?0:i,t}isAfter(e){return"after"==this.compareWith(e)}isBefore(e){return"before"==this.compareWith(e)}isEqual(e){return"same"==this.compareWith(e)}isTouching(e){let t=null,i=null;switch(this.compareWith(e)){case"same":return!0;case"before":t=ta._createAt(this),i=ta._createAt(e);break;case"after":t=ta._createAt(e),i=ta._createAt(this);break;default:return!1}let o=t.parent;for(;t.path.length+i.path.length;){if(t.isEqual(i))return!0;if(t.path.length>i.path.length){if(t.offset!==o.maxOffset)return!1;t.path=t.path.slice(0,-1),o=o.parent,t.offset++}else{if(0!==i.offset)return!1;i.path=i.path.slice(0,-1)}}}is(e){return"position"===e||"model:position"===e}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==lo(this.getParentPath(),e.getParentPath())}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=ta._createAt(this)}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let i;return t.containsPosition(this)||t.start.isEqual(this)?(i=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(i=i._getTransformedByDeletion(e.deletionPosition,1))):i=this.isEqual(e.deletionPosition)?ta._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),i}_getTransformedByDeletion(e,t){const i=ta._createAt(this);if(this.root!=e.root)return i;if("same"==lo(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;i.offset-=t}}else if("prefix"==lo(e.getParentPath(),this.getParentPath())){const o=e.path.length-1;if(e.offset<=this.path[o]){if(e.offset+t>this.path[o])return null;i.path[o]-=t}}return i}_getTransformedByInsertion(e,t){const i=ta._createAt(this);if(this.root!=e.root)return i;if("same"==lo(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(i.offset+=t);else if("prefix"==lo(e.getParentPath(),this.getParentPath())){const o=e.path.length-1;e.offset<=this.path[o]&&(i.path[o]+=t)}return i}_getTransformedByMove(e,t,i){if(t=t._getTransformedByDeletion(e,i),e.isEqual(t))return ta._createAt(this);const o=this._getTransformedByDeletion(e,i);return null===o||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(i).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):o._getTransformedByInsertion(t,i)}_getCombined(e,t){const i=e.path.length-1,o=ta._createAt(t);return o.stickiness=this.stickiness,o.offset=o.offset+this.path[i]-e.offset,o.path=[...o.path,...this.path.slice(i+1)],o}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,i="toNone"){if(e instanceof ta)return new ta(e.root,e.path,e.stickiness);{const o=e;if("end"==t)t=o.maxOffset;else{if("before"==t)return this._createBefore(o,i);if("after"==t)return this._createAfter(o,i);if(0!==t&&!t)throw new l.a("model-createpositionat-offset-required",[this,e])}if(!o.is("element")&&!o.is("documentFragment"))throw new l.a("model-position-parent-incorrect",[this,e]);const n=o.getPath();return n.push(t),new this(o.root,n,i)}}static _createAfter(e,t){if(!e.parent)throw new l.a("model-position-after-root",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new l.a("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if("$graveyard"===e.root){const i=new ta(t.graveyard,e.path);return i.stickiness=e.stickiness,i}if(!t.getRoot(e.root))throw new l.a("model-position-fromjson-no-root",t,{rootName:e.root});return new ta(t.getRoot(e.root),e.path,e.stickiness)}}function ia(e,t){const i=t.getChild(t.offsetToIndex(e.offset));return i&&i.is("$text")&&i.startOffset<e.offset?i:null}function oa(e,t,i){return null!==i?null:t.getChild(t.offsetToIndex(e.offset))}function na(e,t,i){return null!==i?null:t.getChild(t.offsetToIndex(e.offset)-1)}class ra{constructor(e,t=null){this.start=ta._createAt(e),this.end=t?ta._createAt(t):ta._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new Zs({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return"same"==lo(this.start.getParentPath(),this.end.getParentPath())}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),o=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&o}containsItem(e){const t=ta._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}is(e){return"range"===e||"model:range"===e}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new ra(this.start,e.start)),this.containsPosition(e.end)&&t.push(new ra(e.end,this.end))):t.push(new ra(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new ra(t,i)}return null}getJoined(e,t=!1){let i=this.isIntersecting(e);if(i||(i=this.start.isBefore(e.start)?t?this.end.isTouching(e.start):this.end.isEqual(e.start):t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!i)return null;let o=this.start,n=this.end;return e.start.isBefore(o)&&(o=e.start),e.end.isAfter(n)&&(n=e.end),new ra(o,n)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,i=ta._createAt(this.start);let o=i.parent;for(;i.path.length>t+1;){const t=o.maxOffset-i.offset;0!==t&&e.push(new ra(i,i.getShiftedBy(t))),i.path=i.path.slice(0,-1),i.offset++,o=o.parent}for(;i.path.length<=this.end.path.length;){const t=this.end.path[i.path.length-1],o=t-i.offset;0!==o&&e.push(new ra(i,i.getShiftedBy(o))),i.offset=t,i.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new Zs(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Zs(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new Zs(e);yield t.position;for(const e of t)yield e.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new ra(this.start,this.end)]}getTransformedByOperations(e){const t=[new ra(this.start,this.end)];for(const i of e)for(let e=0;e<t.length;e++){const o=t[e].getTransformedByOperation(i);t.splice(e,1,...o),e+=o.length-1}for(let e=0;e<t.length;e++){const i=t[e];for(let o=e+1;o<t.length;o++){const e=t[o];(i.containsRange(e)||e.containsRange(i)||i.isEqual(e))&&t.splice(o,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const i=e.sourcePosition,o=e.howMany,n=e.targetPosition;return this._getTransformedByMove(i,n,o,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let i=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(i=this.end.getShiftedBy(1)),t.root!=i.root&&(i=this.end.getShiftedBy(-1)),new ra(t,i)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new ra(this.start);let t=this.start._getTransformedByMergeOperation(e),i=this.end._getTransformedByMergeOperation(e);return t.root!=i.root&&(i=this.end.getShiftedBy(-1)),t.isAfter(i)?(e.sourcePosition.isBefore(e.targetPosition)?(t=ta._createAt(i),t.offset=0):(e.deletionPosition.isEqual(t)||(i=e.deletionPosition),t=e.targetPosition),new ra(t,i)):new ra(t,i)}_getTransformedByInsertion(e,t,i=!1){if(i&&this.containsPosition(e))return[new ra(this.start,e),new ra(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const i=new ra(this.start,this.end);return i.start=i.start._getTransformedByInsertion(e,t),i.end=i.end._getTransformedByInsertion(e,t),[i]}}_getTransformedByMove(e,t,i,o=!1){if(this.isCollapsed){const o=this.start._getTransformedByMove(e,t,i);return[new ra(o)]}const n=ra._createFromPositionAndShift(e,i),r=t._getTransformedByDeletion(e,i);if(this.containsPosition(t)&&!o&&(n.containsPosition(this.start)||n.containsPosition(this.end))){const o=this.start._getTransformedByMove(e,t,i),n=this.end._getTransformedByMove(e,t,i);return[new ra(o,n)]}let s;const a=this.getDifference(n);let l=null;const c=this.getIntersection(n);if(1==a.length?l=new ra(a[0].start._getTransformedByDeletion(e,i),a[0].end._getTransformedByDeletion(e,i)):2==a.length&&(l=new ra(this.start,this.end._getTransformedByDeletion(e,i))),s=l?l._getTransformedByInsertion(r,i,null!==c||o):[],c){const e=new ra(c.start._getCombined(n.start,r),c.end._getCombined(n.start,r));2==s.length?s.splice(1,0,e):s.push(e)}return s}_getTransformedByDeletion(e,t){let i=this.start._getTransformedByDeletion(e,t),o=this.end._getTransformedByDeletion(e,t);return null==i&&null==o?null:(null==i&&(i=e),null==o&&(o=e),new ra(i,o))}static _createFromPositionAndShift(e,t){const i=e,o=e.getShiftedBy(t);return t>0?new this(i,o):new this(o,i)}static _createIn(e){return new this(ta._createAt(e,0),ta._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(ta._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new l.a("range-create-from-ranges-empty-array",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort((e,t)=>e.start.isAfter(t.start)?1:-1);const i=e.indexOf(t),o=new this(t.start,t.end);if(i>0)for(let t=i-1;e[t].end.isEqual(o.start);t++)o.start=ta._createAt(e[t].start);for(let t=i+1;t<e.length&&e[t].start.isEqual(o.end);t++)o.end=ta._createAt(e[t].end);return o}static fromJSON(e,t){return new this(ta.fromJSON(e.start,t),ta.fromJSON(e.end,t))}}class sa{constructor(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const i=this._modelToViewMapping.get(t.modelPosition.parent);t.viewPosition=this.findPositionIn(i,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const i=this.findMappedViewAncestor(t.viewPosition),o=this._viewToModelMapping.get(i),n=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=ta._createAt(o,n)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e){const t=this.toModelElement(e);if(this._viewToModelMapping.delete(e),this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);this._modelToViewMapping.get(t)==e&&this._modelToViewMapping.delete(t)}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const i=this._markerNameToElements.get(t)||new Set;i.add(e);const o=this._elementToMarkerNames.get(e)||new Set;o.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,o)}unbindElementFromMarkerName(e,t){const i=this._markerNameToElements.get(t);i&&(i.delete(e),0==i.size&&this._markerNameToElements.delete(t));const o=this._elementToMarkerNames.get(e);o&&(o.delete(t),0==o.size&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new ra(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new hn(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={isPhantom:!1}){const i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const i=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())i.add(t);else i.add(e);return i}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,i){if(i!=e){return this._toModelOffset(e.parent,e.index,i)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let o=0;for(let i=0;i<t;i++)o+=this.getModelLength(e.getChild(i));return o}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name)){return this._viewToModelLengthCallbacks.get(e.name)(e)}if(this._viewToModelMapping.has(e))return 1;if(e.is("$text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const i of e.getChildren())t+=this.getModelLength(i);return t}}findPositionIn(e,t){let i,o=0,n=0,r=0;if(e.is("$text"))return new dn(e,t);for(;n<t;)i=e.getChild(r),o=this.getModelLength(i),n+=o,r++;return n==t?this._moveViewPositionToTextNode(new dn(e,r)):this.findPositionIn(i,t-(n-o))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,i=e.nodeAfter;return t instanceof uo?new dn(t,t.data.length):i instanceof uo?new dn(i,0):e}}Ye(sa,h);class aa{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=la(t),e instanceof Ys&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=la(t),e instanceof Ys&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=la(t),e instanceof Ys&&(e=this._getSymbolForTextProxy(e));const i=this._consumable.get(e);if(void 0===i)return null;const o=i.get(t);return void 0===o?null:o}revert(e,t){t=la(t),e instanceof Ys&&(e=this._getSymbolForTextProxy(e));const i=this.test(e,t);return!1===i?(this._consumable.get(e).set(t,!0),!0):!0!==i&&null}_getSymbolForTextProxy(e){let t=null;const i=this._textProxyRegistry.get(e.startOffset);if(i){const o=i.get(e.endOffset);o&&(t=o.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e.startOffset,e.endOffset,e.parent)),t}_addSymbolForTextProxy(e,t,i){const o=Symbol("textProxySymbol");let n,r;return n=this._textProxyRegistry.get(e),n||(n=new Map,this._textProxyRegistry.set(e,n)),r=n.get(t),r||(r=new Map,n.set(t,r)),r.set(i,o),o}}function la(e){const t=e.split(":");return"addMarker"==t[0]||"removeMarker"==t[0]?e:t.length>1?t[0]+":"+t[1]:t[0]}class ca{constructor(e){this.conversionApi=Object.assign({dispatcher:this},e),this._reconversionEventsMapping=new Map}convertChanges(e,t,i){for(const t of e.getMarkersToRemove())this.convertMarkerRemove(t.name,t.range,i);const o=this._mapChangesWithAutomaticReconversion(e);for(const e of o)"insert"===e.type?this.convertInsert(ra._createFromPositionAndShift(e.position,e.length),i):"remove"===e.type?this.convertRemove(e.position,e.length,e.name,i):"reconvert"===e.type?this.reconvertElement(e.element,i):this.convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,i);for(const e of this.conversionApi.mapper.flushUnboundMarkerNames()){const o=t.get(e).getRange();this.convertMarkerRemove(e,o,i),this.convertMarkerAdd(e,o,i)}for(const t of e.getMarkersToAdd())this.convertMarkerAdd(t.name,t.range,i)}convertInsert(e,t){this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(e);for(const t of Array.from(e).map(ha))this._convertInsertWithAttributes(t);this._clearConversionApi()}convertRemove(e,t,i,o){this.conversionApi.writer=o,this.fire("remove:"+i,{position:e,length:t},this.conversionApi),this._clearConversionApi()}convertAttribute(e,t,i,o,n){this.conversionApi.writer=n,this.conversionApi.consumable=this._createConsumableForRange(e,"attribute:"+t);for(const n of e){const e={item:n.item,range:ra._createFromPositionAndShift(n.previousPosition,n.length),attributeKey:t,attributeOldValue:i,attributeNewValue:o};this._testAndFire("attribute:"+t,e)}this._clearConversionApi()}reconvertElement(e,t){const i=ra._createOn(e);this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(i);const o=this.conversionApi.mapper,n=o.toViewElement(e);t.remove(n),this._convertInsertWithAttributes({item:e,range:i});const r=o.toViewElement(e);for(const i of ra._createIn(e)){const{item:e}=i,n=ua(e,o);n?n.root!==r.root&&t.move(t.createRangeOn(n),o.toViewPosition(ta._createBefore(e))):this._convertInsertWithAttributes(ha(i))}o.unbindViewElement(n),this._clearConversionApi()}convertSelection(e,t,i){const o=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this.conversionApi.writer=i,this.conversionApi.consumable=this._createSelectionConsumable(e,o),this.fire("selection",{selection:e},this.conversionApi),e.isCollapsed){for(const t of o){const i=t.getRange();if(!da(e.getFirstPosition(),t,this.conversionApi.mapper))continue;const o={item:e,markerName:t.name,markerRange:i};this.conversionApi.consumable.test(e,"addMarker:"+t.name)&&this.fire("addMarker:"+t.name,o,this.conversionApi)}for(const t of e.getAttributeKeys()){const i={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.conversionApi.consumable.test(e,"attribute:"+i.attributeKey)&&this.fire("attribute:"+i.attributeKey+":$text",i,this.conversionApi)}this._clearConversionApi()}else this._clearConversionApi()}convertMarkerAdd(e,t,i){if("$graveyard"==t.root.rootName)return;this.conversionApi.writer=i;const o="addMarker:"+e,n=new aa;if(n.add(t,o),this.conversionApi.consumable=n,this.fire(o,{markerName:e,markerRange:t},this.conversionApi),n.test(t,o)){this.conversionApi.consumable=this._createConsumableForRange(t,o);for(const i of t.getItems()){if(!this.conversionApi.consumable.test(i,o))continue;const n={item:i,range:ra._createOn(i),markerName:e,markerRange:t};this.fire(o,n,this.conversionApi)}this._clearConversionApi()}else this._clearConversionApi()}convertMarkerRemove(e,t,i){"$graveyard"!=t.root.rootName&&(this.conversionApi.writer=i,this.fire("removeMarker:"+e,{markerName:e,markerRange:t},this.conversionApi),this._clearConversionApi())}_mapReconversionTriggerEvent(e,t){this._reconversionEventsMapping.set(t,e)}_createInsertConsumable(e){const t=new aa;for(const i of e){const e=i.item;t.add(e,"insert");for(const i of e.getAttributeKeys())t.add(e,"attribute:"+i)}return t}_createConsumableForRange(e,t){const i=new aa;for(const o of e.getItems())i.add(o,t);return i}_createSelectionConsumable(e,t){const i=new aa;i.add(e,"selection");for(const o of t)i.add(e,"addMarker:"+o.name);for(const t of e.getAttributeKeys())i.add(e,"attribute:"+t);return i}_testAndFire(e,t){this.conversionApi.consumable.test(t.item,e)&&this.fire(function(e,t){const i=t.item.name||"$text";return`${e}:${i}`}(e,t),t,this.conversionApi)}_clearConversionApi(){delete this.conversionApi.writer,delete this.conversionApi.consumable}_convertInsertWithAttributes(e){this._testAndFire("insert",e);for(const t of e.item.getAttributeKeys())e.attributeKey=t,e.attributeOldValue=null,e.attributeNewValue=e.item.getAttribute(t),this._testAndFire("attribute:"+t,e)}_mapChangesWithAutomaticReconversion(e){const t=new Set,i=[];for(const o of e.getChanges()){const e=o.position||o.range.start,n=e.parent;if(ia(e,n)){i.push(o);continue}const r="attribute"===o.type?oa(e,n,null):n;if(r.is("$text")){i.push(o);continue}let s;if(s="attribute"===o.type?`attribute:${o.attributeKey}:${r.name}`:`${o.type}:${o.name}`,this._isReconvertTriggerEvent(s,r.name)){if(t.has(r))continue;t.add(r),i.push({type:"reconvert",element:r})}else i.push(o)}return i}_isReconvertTriggerEvent(e,t){return this._reconversionEventsMapping.get(e)===t}}function da(e,t,i){const o=t.getRange(),n=Array.from(e.getAncestors());n.shift(),n.reverse();return!n.some(e=>{if(o.containsItem(e)){return!!i.toViewElement(e).getCustomProperty("addHighlight")}})}function ha(e){return{item:e.item,range:ra._createFromPositionAndShift(e.previousPosition,e.length)}}function ua(e,t){if(e.is("textProxy")){const i=t.toViewPosition(ta._createBefore(e)).parent;return i.is("$text")?i:null}return t.toViewElement(e)}Ye(ca,h);class ga{constructor(e,t,i){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,e&&this.setTo(e,t,i)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const o of e._ranges)if(t.isEqual(o)){i=!0;break}if(!i)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new ra(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?new ra(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?new ra(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(e,t,i){if(null===e)this._setRanges([]);else if(e instanceof ga)this._setRanges(e.getRanges(),e.isBackward);else if(e&&"function"==typeof e.getRanges)this._setRanges(e.getRanges(),e.isBackward);else if(e instanceof ra)this._setRanges([e],!!t&&!!t.backward);else if(e instanceof ta)this._setRanges([new ra(e)]);else if(e instanceof Gs){const o=!!i&&!!i.backward;let n;if("in"==t)n=ra._createIn(e);else if("on"==t)n=ra._createOn(e);else{if(void 0===t)throw new l.a("model-selection-setto-required-second-parameter",[this,e]);n=new ra(ta._createAt(e,t))}this._setRanges([n],o)}else{if(!Xi(e))throw new l.a("model-selection-setto-not-selectable",[this,e]);this._setRanges(e,t&&!!t.backward)}}_setRanges(e,t=!1){const i=(e=Array.from(e)).some(t=>{if(!(t instanceof ra))throw new l.a("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});if(e.length!==this._ranges.length||i){this._removeAllRanges();for(const t of e)this._pushRange(t);this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0})}}setFocus(e,t){if(null===this.anchor)throw new l.a("model-selection-setfocus-no-ranges",[this,e]);const i=ta._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.length&&this._popRange(),"before"==i.compareWith(o)?(this._pushRange(new ra(i,o)),this._lastRangeBackward=!0):(this._pushRange(new ra(o,i)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}is(e){return"selection"===e||"model:selection"===e}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const i=pa(t.start,e);i&&ba(i,t)&&(yield i);for(const i of t.getWalker()){const o=i.item;"elementEnd"==i.type&&fa(o,e,t)&&(yield o)}const o=pa(t.end,e);o&&!t.end.isTouching(ta._createAt(o,0))&&ba(o,t)&&(yield o)}}containsEntireContent(e=this.anchor.root){const t=ta._createAt(e,0),i=ta._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&i.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new ra(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new l.a("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function ma(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&e.parent)}function fa(e,t,i){return ma(e,t)&&ba(e,i)}function pa(e,t){const i=e.parent.root.document.model.schema,o=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let n=!1;const r=o.find(e=>!n&&(n=i.isLimit(e),!n&&ma(e,t)));return o.forEach(e=>t.add(e)),r}function ba(e,t){const i=function(e){const t=e.root.document.model.schema;let i=e.parent;for(;i;){if(t.isBlock(i))return i;i=i.parent}}(e);if(!i)return!0;return!t.containsRange(ra._createOn(i),!0)}Ye(ga,h);class wa extends ra{constructor(e,t){super(e,t),ka.call(this)}detach(){this.stopListening()}is(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e}toRange(){return new ra(this.start,this.end)}static fromRange(e){return new wa(e.start,e.end)}}function ka(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&_a.call(this,i)},{priority:"low"})}function _a(e){const t=this.getTransformedByOperation(e),i=ra._createFromRanges(t),o=!i.isEqual(this),n=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let r=null;if(o){"$graveyard"==i.root.rootName&&(r="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=i.start,this.end=i.end,this.fire("change:range",t,{deletionPosition:r})}else n&&this.fire("change:content",this.toRange(),{deletionPosition:r})}Ye(wa,h);class va{constructor(e){this._selection=new ya(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection._updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}is(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(e,t,i){this._selection.setTo(e,t,i)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection._getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return"selection:"+e}static _isStoreAttributeKey(e){return e.startsWith("selection:")}}Ye(va,h);class ya extends ga{constructor(e){super(),this.markers=new Zi({idProperty:"name"}),this._model=e.model,this._document=e,this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this.listenTo(this._model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&"marker"!=i.type&&"rename"!=i.type&&"noop"!=i.type&&(0==this._ranges.length&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))},{priority:"lowest"}),this.on("change:range",()=>{for(const e of this.getRanges())if(!this._document._validateSelectionRange(e))throw new l.a("document-selection-wrong-position",this,{range:e})}),this.listenTo(this._model.markers,"update",(e,t,i,o)=>{this._updateMarker(t,o)}),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const i=e.document.differ;for(const o of i.getChanges()){if("insert"!=o.type)continue;const i=o.position.parent;o.length===i.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(i.getAttributeKeys()).filter(e=>e.startsWith("selection:"));for(const o of t)e.removeAttribute(o,i)})}}(this._model,t)})}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(e,t,i){super.setTo(e,t,i),this._updateAttributes(!0),this._updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this._updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=s();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new l.a("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this._updateMarkers()}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=wa.fromRange(e);return t.on("change:range",(e,i,o)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=o.deletionPosition;const e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}}),t}_updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const t of this._model.markers){const i=t.name.split(":",1)[0];if(!this._observedMarkers.has(i))continue;const o=t.getRange();for(const i of this.getRanges())o.containsRange(i,!i.isCollapsed)&&e.push(t)}const i=Array.from(this.markers);for(const i of e)this.markers.has(i)||(this.markers.add(i),t=!0);for(const i of Array.from(this.markers))e.includes(i)||(this.markers.remove(i),t=!0);t&&this.fire("change:marker",{oldMarkers:i,directChange:!1})}_updateMarker(e,t){const i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let o=!1;const n=Array.from(this.markers),r=this.markers.has(e);if(t){let i=!1;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){i=!0;break}i&&!r?(this.markers.add(e),o=!0):!i&&r&&(this.markers.remove(e),o=!0)}else r&&(this.markers.remove(e),o=!0);o&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateAttributes(e){const t=mo(this._getSurroundingAttributes()),i=mo(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const o=[];for(const[e,t]of this.getAttributes())i.has(e)&&i.get(e)===t||o.push(e);for(const[e]of i)this.hasAttribute(e)||o.push(e);o.length>0&&this.fire("change:attribute",{attributeKeys:o,directChange:!1})}_setAttribute(e,t,i=!0){const o=i?"normal":"low";if("low"==o&&"normal"==this._attributePriority.get(e))return!1;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,o),!0)}_removeAttribute(e,t=!0){const i=t?"normal":"low";return("low"!=i||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,i),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[t,i]of this.getAttributes())e.get(t)!==i&&this._removeAttribute(t,!1);for(const[i,o]of e){this._setAttribute(i,o,!1)&&t.add(i)}return t}*_getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith("selection:")){const i=t.substr("selection:".length);yield[i,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let i=null;if(this.isCollapsed){const o=e.textNode?e.textNode:e.nodeBefore,n=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(i=xa(o)),i||(i=xa(n)),!this.isGravityOverridden&&!i){let e=o;for(;e&&!t.isInline(e)&&!i;)e=e.previousSibling,i=xa(e)}if(!i){let e=n;for(;e&&!t.isInline(e)&&!i;)e=e.nextSibling,i=xa(e)}i||(i=this._getStoredAttributes())}else{const e=this.getFirstRange();for(const o of e){if(o.item.is("element")&&t.isObject(o.item))break;if("text"==o.type){i=o.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function xa(e){return e instanceof Ys||e instanceof Js?e.getAttributes():null}class Ca{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}var Aa=function(e){return Ui(e,5)};class Ta extends Ca{elementToElement(e){return this.add(function(e){return(e=Aa(e)).view=Sa(e.view,"container"),t=>{var i;if(t.on("insert:"+e.model,(i=e.view,(e,t,o)=>{const n=i(t.item,o);if(!n)return;if(!o.consumable.consume(t.item,"insert"))return;const r=o.mapper.toViewPosition(t.range.start);o.mapper.bindElements(t.item,n),o.writer.insert(r,n)}),{priority:e.converterPriority||"normal"}),e.triggerBy){if(e.triggerBy.attributes)for(const i of e.triggerBy.attributes)t._mapReconversionTriggerEvent(e.model,`attribute:${i}:${e.model}`);if(e.triggerBy.children)for(const i of e.triggerBy.children)t._mapReconversionTriggerEvent(e.model,"insert:"+i),t._mapReconversionTriggerEvent(e.model,"remove:"+i)}}}(e))}attributeToElement(e){return this.add(function(e){e=Aa(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=Sa(e.view[t],"attribute");else e.view=Sa(e.view,"attribute");const i=Ia(e);return o=>{o.on(t,function(e){return(t,i,o)=>{const n=e(i.attributeOldValue,o),r=e(i.attributeNewValue,o);if(!n&&!r)return;if(!o.consumable.consume(i.item,t.name))return;const s=o.writer,a=s.document.selection;if(i.item instanceof ga||i.item instanceof va)s.wrap(a.getFirstRange(),r);else{let e=o.mapper.toViewRange(i.range);null!==i.attributeOldValue&&n&&(e=s.unwrap(e,n)),null!==i.attributeNewValue&&r&&s.wrap(e,r)}}}(i),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Aa(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=Ra(e.view[t]);else e.view=Ra(e.view);const i=Ia(e);return o=>{var n;o.on(t,(n=i,(e,t,i)=>{const o=n(t.attributeOldValue,i),r=n(t.attributeNewValue,i);if(!o&&!r)return;if(!i.consumable.consume(t.item,e.name))return;const s=i.mapper.toViewElement(t.item),a=i.writer;if(!s)throw new l.a("conversion-attribute-to-attribute-on-text",[t,i]);if(null!==t.attributeOldValue&&o)if("class"==o.key){const e=to(o.value);for(const t of e)a.removeClass(t,s)}else if("style"==o.key){const e=Object.keys(o.value);for(const t of e)a.removeStyle(t,s)}else a.removeAttribute(o.key,s);if(null!==t.attributeNewValue&&r)if("class"==r.key){const e=to(r.value);for(const t of e)a.addClass(t,s)}else if("style"==r.key){const e=Object.keys(r.value);for(const t of e)a.setStyle(t,r.value[t],s)}else a.setAttribute(r.key,r.value,s)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){return(e=Aa(e)).view=Sa(e.view,"ui"),t=>{var i;t.on("addMarker:"+e.model,(i=e.view,(e,t,o)=>{t.isOpening=!0;const n=i(t,o);t.isOpening=!1;const r=i(t,o);if(!n||!r)return;const s=t.markerRange;if(s.isCollapsed&&!o.consumable.consume(s,e.name))return;for(const t of s)if(!o.consumable.consume(t.item,e.name))return;const a=o.mapper,l=o.writer;l.insert(a.toViewPosition(s.start),n),o.mapper.bindElementToMarker(n,t.markerName),s.isCollapsed||(l.insert(a.toViewPosition(s.end),r),o.mapper.bindElementToMarker(r,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,(e.view,(e,t,i)=>{const o=i.mapper.markerNameToElements(t.markerName);if(o){for(const e of o)i.mapper.unbindElementFromMarkerName(e,t.markerName),i.writer.clear(i.writer.createRangeOn(e),e);i.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var i;t.on("addMarker:"+e.model,(i=e.view,(e,t,o)=>{if(!t.item)return;if(!(t.item instanceof ga||t.item instanceof va||t.item.is("$textProxy")))return;const n=Va(i,t,o);if(!n)return;if(!o.consumable.consume(t.item,e.name))return;const r=o.writer,s=Ea(r,n),a=r.document.selection;if(t.item instanceof ga||t.item instanceof va)r.wrap(a.getFirstRange(),s,a);else{const e=o.mapper.toViewRange(t.range),i=r.wrap(e,s);for(const e of i.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){o.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on("addMarker:"+e.model,function(e){return(t,i,o)=>{if(!i.item)return;if(!(i.item instanceof Xs))return;const n=Va(e,i,o);if(!n)return;if(!o.consumable.test(i.item,t.name))return;const r=o.mapper.toViewElement(i.item);if(r&&r.getCustomProperty("addHighlight")){o.consumable.consume(i.item,t.name);for(const e of ra._createIn(i.item))o.consumable.consume(e.item,t.name);r.getCustomProperty("addHighlight")(r,n,o.writer),o.mapper.bindElementToMarker(r,i.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,function(e){return(t,i,o)=>{if(i.markerRange.isCollapsed)return;const n=Va(e,i,o);if(!n)return;const r=Ea(o.writer,n),s=o.mapper.markerNameToElements(i.markerName);if(s){for(const e of s)o.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("attributeElement")?o.writer.unwrap(o.writer.createRangeOn(e),r):e.getCustomProperty("removeHighlight")(e,n.id,o.writer);o.writer.clearClonedElementsGroup(i.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=Aa(e)).model;e.view||(e.view=i=>({group:t,name:i.substr(e.model.length+1)}));return i=>{var o;i.on("addMarker:"+t,(o=e.view,(e,t,i)=>{const n=o(t.markerName,i);if(!n)return;const r=t.markerRange;i.consumable.consume(r,e.name)&&(Pa(r,!1,i,t,n),Pa(r,!0,i,t,n),e.stop())}),{priority:e.converterPriority||"normal"}),i.on("removeMarker:"+t,function(e){return(t,i,o)=>{const n=e(i.markerName,o);if(!n)return;const r=o.mapper.markerNameToElements(i.markerName);if(r){for(const e of r)o.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("containerElement")?(s(`data-${n.group}-start-before`,e),s(`data-${n.group}-start-after`,e),s(`data-${n.group}-end-before`,e),s(`data-${n.group}-end-after`,e)):o.writer.clear(o.writer.createRangeOn(e),e);o.writer.clearClonedElementsGroup(i.markerName),t.stop()}function s(e,t){if(t.hasAttribute(e)){const i=new Set(t.getAttribute(e).split(","));i.delete(n.name),0==i.size?o.writer.removeAttribute(e,t):o.writer.setAttribute(e,Array.from(i).join(","),t)}}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}}function Ea(e,t){const i=e.createAttributeElement("span",t.attributes);return t.classes&&i._addClass(t.classes),"number"==typeof t.priority&&(i._priority=t.priority),i._id=t.id,i}function Pa(e,t,i,o,n){const r=t?e.start:e.end,s=r.nodeAfter&&r.nodeAfter.is("element")?r.nodeAfter:null,a=r.nodeBefore&&r.nodeBefore.is("element")?r.nodeBefore:null;if(s||a){let e,r;t&&s||!t&&!a?(e=s,r=!0):(e=a,r=!1);const l=i.mapper.toViewElement(e);if(l)return void function(e,t,i,o,n,r){const s=`data-${r.group}-${t?"start":"end"}-${i?"before":"after"}`,a=e.hasAttribute(s)?e.getAttribute(s).split(","):[];a.unshift(r.name),o.writer.setAttribute(s,a.join(","),e),o.mapper.bindElementToMarker(e,n.markerName)}(l,t,r,i,o,n)}!function(e,t,i,o,n){const r=`${n.group}-${t?"start":"end"}`,s=n.name?{name:n.name}:null,a=i.writer.createUIElement(r,s);i.writer.insert(e,a),i.mapper.bindElementToMarker(a,o.markerName)}(i.mapper.toViewPosition(r),t,i,o,n)}function Sa(e,t){return"function"==typeof e?e:(i,o)=>function(e,t,i){"string"==typeof e&&(e={name:e});let o;const n=t.writer,r=Object.assign({},e.attributes);if("container"==i)o=n.createContainerElement(e.name,r);else if("attribute"==i){const t={priority:e.priority||Cn.DEFAULT_PRIORITY};o=n.createAttributeElement(e.name,r,t)}else o=n.createUIElement(e.name,r);if(e.styles){const t=Object.keys(e.styles);for(const i of t)n.setStyle(i,e.styles[i],o)}if(e.classes){const t=e.classes;if("string"==typeof t)n.addClass(t,o);else for(const e of t)n.addClass(e,o)}return o}(e,o,t)}function Ia(e){return e.model.values?(t,i)=>{const o=e.view[t];return o?o(t,i):null}:e.view}function Ra(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function Va(e,t,i){const o="function"==typeof e?e(t,i):e;return o?(o.priority||(o.priority=10),o.id||(o.id=t.markerName),o):null}function Oa(e){const{schema:t,document:i}=e.model;for(const o of i.getRootNames()){const n=i.getRoot(o);if(n.isEmpty&&!t.checkChild(n,"$text")&&t.checkChild(n,"paragraph"))return e.insertElement("paragraph",n),!0}return!1}function za(e,t,i){const o=i.createContext(e);return!!i.checkChild(o,"paragraph")&&!!i.checkChild(o.push("paragraph"),t)}function Ma(e,t){const i=t.createElement("paragraph");return t.insert(i,e),t.createPositionAt(i,0)}class Ba extends Ca{elementToElement(e){return this.add(Na(e))}elementToAttribute(e){return this.add(function(e){La(e=Aa(e));const t=Ha(e,!1),i=Fa(e.view),o=i?"element:"+i:"element";return i=>{i.on(o,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Aa(e);let t=null;("string"==typeof e.view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key;let i;if("class"==t||"style"==t){i={["class"==t?"classes":"styles"]:e.view.value}}else{const o=void 0===e.view.value?/[\s\S]*/:e.view.value;i={attributes:{[t]:o}}}e.view.name&&(i.name=e.view.name);return e.view=i,t}(e));La(e,t);const i=Ha(e,!0);return t=>{t.on("element",i,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(e){return function(e){const t=e.model;e.model=(e,i)=>{const o="string"==typeof t?t:t(e,i);return i.writer.createElement("$marker",{"data-name":o})}}(e=Aa(e)),Na(e)}(e))}dataToMarker(e){return this.add(function(e){(e=Aa(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t=Da(ja(e,"start")),i=Da(ja(e,"end"));return o=>{o.on("element:"+e.view+"-start",t,{priority:e.converterPriority||"normal"}),o.on("element:"+e.view+"-end",i,{priority:e.converterPriority||"normal"});const n=a.get("low"),r=a.get("highest"),s=a.get(e.converterPriority)/r;o.on("element",function(e){return(t,i,o)=>{const n="data-"+e.view;function r(t,n){for(const r of n){const n=e.model(r,o),s=o.writer.createElement("$marker",{"data-name":n});o.writer.insert(s,t),i.modelCursor.isEqual(t)?i.modelCursor=i.modelCursor.getShiftedBy(1):i.modelCursor=i.modelCursor._getTransformedByInsertion(t,1),i.modelRange=i.modelRange._getTransformedByInsertion(t,1)[0]}}(o.consumable.test(i.viewItem,{attributes:n+"-end-after"})||o.consumable.test(i.viewItem,{attributes:n+"-start-after"})||o.consumable.test(i.viewItem,{attributes:n+"-end-before"})||o.consumable.test(i.viewItem,{attributes:n+"-start-before"}))&&(i.modelRange||Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor)),o.consumable.consume(i.viewItem,{attributes:n+"-end-after"})&&r(i.modelRange.end,i.viewItem.getAttribute(n+"-end-after").split(",")),o.consumable.consume(i.viewItem,{attributes:n+"-start-after"})&&r(i.modelRange.end,i.viewItem.getAttribute(n+"-start-after").split(",")),o.consumable.consume(i.viewItem,{attributes:n+"-end-before"})&&r(i.modelRange.start,i.viewItem.getAttribute(n+"-end-before").split(",")),o.consumable.consume(i.viewItem,{attributes:n+"-start-before"})&&r(i.modelRange.start,i.viewItem.getAttribute(n+"-start-before").split(",")))}}(e),{priority:n+s})}}(e))}}function Na(e){const t=Da(e=Aa(e)),i=Fa(e.view),o=i?"element:"+i:"element";return i=>{i.on(o,t,{priority:e.converterPriority||"normal"})}}function Fa(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function Da(e){const t=new fo(e.view);return(i,o,n)=>{const r=t.match(o.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!n.consumable.test(o.viewItem,s))return;const a=function(e,t,i){return e instanceof Function?e(t,i):i.writer.createElement(e)}(e.model,o.viewItem,n);a&&n.safeInsert(a,o.modelCursor)&&(n.consumable.consume(o.viewItem,s),n.convertChildren(o.viewItem,a),n.updateConversionResult(a,o))}}function La(e,t=null){const i=null===t||(e=>e.getAttribute(t)),o="object"!=typeof e.model?e.model:e.model.key,n="object"!=typeof e.model||void 0===e.model.value?i:e.model.value;e.model={key:o,value:n}}function Ha(e,t){const i=new fo(e.view);return(o,n,r)=>{const s=i.match(n.viewItem);if(!s)return;if(!function(e,t){const i="function"==typeof e?e(t):e;if("object"==typeof i&&!Fa(i))return!1;return!i.classes&&!i.attributes&&!i.styles}(e.view,n.viewItem)?delete s.match.name:s.match.name=!0,!r.consumable.test(n.viewItem,s.match))return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(n.viewItem,r):e.model.value;if(null===l)return;n.modelRange||Object.assign(n,r.convertChildren(n.viewItem,n.modelCursor));(function(e,t,i,o){let n=!1;for(const r of Array.from(e.getItems({shallow:i})))o.schema.checkAttribute(r,t.key)&&(n=!0,r.hasAttribute(t.key)||o.writer.setAttribute(t.key,t.value,r));return n})(n.modelRange,{key:a,value:l},t,r)&&r.consumable.consume(n.viewItem,s.match)}}function ja(e,t){const i={};return i.view=e.view+"-"+t,i.model=(t,i)=>{const o=t.getAttribute("name"),n=e.model(o,i);return i.writer.createElement("$marker",{"data-name":n})},i}class Wa{constructor(e,t){this.model=e,this.view=new Ks(t),this.mapper=new sa,this.downcastDispatcher=new ca({mapper:this.mapper,schema:e.schema});const i=this.model.document,o=i.selection,n=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(i,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(i.differ,n,e),this.downcastDispatcher.convertSelection(o,n,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(i,o)=>{const n=o.newSelection,r=[];for(const e of n.getRanges())r.push(t.toModelRange(e));const s=e.createSelection(r,{backward:n.isBackward});s.isEqual(e.document.selection)||e.change(e=>{e.setSelection(s)})}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(e,t,i)=>{if(!i.consumable.consume(t.item,"insert"))return;const o=i.writer,n=i.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(n,r)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,t,i)=>{const o=i.mapper.toViewPosition(t.position),n=t.position.getShiftedBy(t.length),r=i.mapper.toViewPosition(n,{isPhantom:!0}),s=i.writer.createRange(o,r),a=i.writer.remove(s.getTrimmed());for(const e of i.writer.createRangeIn(a).getItems())i.mapper.unbindViewElement(e)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const o=i.writer,n=o.document.selection;for(const e of n.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&i.writer.mergeAttributes(e.start);o.setSelection(null)},{priority:"high"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const o=t.selection;if(o.isCollapsed)return;if(!i.consumable.consume(o,"selection"))return;const n=[];for(const e of o.getRanges()){const t=i.mapper.toViewRange(e);n.push(t)}i.writer.setSelection(n,{backward:o.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const o=t.selection;if(!o.isCollapsed)return;if(!i.consumable.consume(o,"selection"))return;const n=i.writer,r=o.getFirstPosition(),s=i.mapper.toViewPosition(r),a=n.breakAttributes(s);n.setSelection(a)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if("$graveyard"==e.rootName)return null;const t=new ln(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}}Ye(Wa,qe);class qa{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new l.a("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class $a{constructor(){this._consumables=new Map}add(e,t){let i;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?i=this._consumables.get(e):(i=new Ua(e),this._consumables.set(e,i)),i.add(t))}test(e,t){const i=this._consumables.get(e);return void 0===i?null:e.is("$text")||e.is("documentFragment")?i:i.test(t)}consume(e,t){return!!this.test(e,t)&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0)}revert(e,t){const i=this._consumables.get(e);void 0!==i&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):i.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},i=e.getAttributeKeys();for(const e of i)"style"!=e&&"class"!=e&&t.attributes.push(e);const o=e.getClassNames();for(const e of o)t.classes.push(e);const n=e.getStyleNames();for(const e of n)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new $a(e)),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,$a.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const i of e.getChildren())t=$a.createFrom(i,t);return t}}class Ua{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t in this._consumables)if(t in e){const i=this._test(t,e[t]);if(!0!==i)return i}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t in this._consumables)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._revert(t,e[t])}_add(e,t){const i=ve(t)?t:[t],o=this._consumables[e];for(const t of i){if("attributes"===e&&("class"===t||"style"===t))throw new l.a("viewconsumable-invalid-attribute",this);if(o.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!0)}}_test(e,t){const i=ve(t)?t:[t],o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){const e=o.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",i=this._test(e,[...this._consumables[e].keys()]);if(!0!==i)return i}return!0}_consume(e,t){const i=ve(t)?t:[t],o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){if(o.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const i=ve(t)?t:[t],o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){!1===o.get(t)&&o.set(t,!0)}else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class Ka{constructor(){this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new Ga(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new Ga(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new l.a("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new l.a("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return t="string"==typeof e?e:e.is&&(e.is("$text")||e.is("$textProxy"))?"$text":e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!(!t||!t.isBlock)}isLimit(e){const t=this.getDefinition(e);return!!t&&!(!t.isLimit&&!t.isObject)}isObject(e){const t=this.getDefinition(e);return!!t&&!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent)}isInline(e){const t=this.getDefinition(e);return!(!t||!t.isInline)}isSelectable(e){const t=this.getDefinition(e);return!!t&&!(!t.isSelectable&&!t.isObject)}isContent(e){const t=this.getDefinition(e);return!!t&&!(!t.isContent&&!t.isObject)}checkChild(e,t){return!!t&&this._checkContextMatch(t,e)}checkAttribute(e,t){const i=this.getDefinition(e.last);return!!i&&i.allowAttributes.includes(t)}checkMerge(e,t=null){if(e instanceof ta){const t=e.nodeBefore,i=e.nodeAfter;if(!(t instanceof Xs))throw new l.a("schema-check-merge-no-element-before",this);if(!(i instanceof Xs))throw new l.a("schema-check-merge-no-element-after",this);return this.checkMerge(t,i)}for(const i of t.getChildren())if(!this.checkChild(e,i))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[i,o])=>{if(!o)return;const n=e(i,o);"boolean"==typeof n&&(t.stop(),t.return=n)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[i,o])=>{const n=e(i,o);"boolean"==typeof n&&(t.stop(),t.return=n)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;if(e instanceof ta)t=e.parent;else{t=(e instanceof ra?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const i=t.getCommonAncestor();return e?e.getCommonAncestor(i,{includeSelf:!0}):i},null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const i=[...e.getFirstPosition().getAncestors(),new Js("",e.getAttributes())];return this.checkAttribute(i,t)}{const i=e.getRanges();for(const e of i)for(const i of e)if(this.checkAttribute(i.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const i of e)yield*this._getValidRangesForRange(i,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new ra(e);let i,o;const n=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(i=new Zs({boundaries:ra._createIn(n),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(o=new Zs({boundaries:ra._createIn(n),startPosition:e}));for(const e of function*(e,t){let i=!1;for(;!i;){if(i=!0,e){const t=e.next();t.done||(i=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(i=!1,yield{walker:t,value:e.value})}}}(i,o)){const t=e.walker==i?"elementEnd":"elementStart",o=e.value;if(o.type==t&&this.isObject(o.item))return ra._createOn(o.item);if(this.checkChild(o.nextPosition,"$text"))return new ra(o.nextPosition)}return null}findAllowedParent(e,t){let i=e.parent;for(;i;){if(this.checkChild(i,t))return i;if(this.isLimit(i))return null;i=i.parent}return null}removeDisallowedAttributes(e,t){for(const i of e)if(i.is("$text"))al(this,i,t);else{const e=ra._createIn(i).getPositions();for(const i of e){al(this,i.nodeBefore||i.parent,t)}}}createContext(e){return new Ga(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,i=Object.keys(t);for(const o of i)e[o]=Ja(t[o],o);for(const t of i)Ya(e,t);for(const t of i)Qa(e,t);for(const t of i)Xa(e,t);for(const t of i)Za(e,t),el(e,t);for(const t of i)tl(e,t),il(e,t),ol(e,t);this._compiledDefinitions=e}_checkContextMatch(e,t,i=t.length-1){const o=t.getItem(i);if(e.allowIn.includes(o.name)){if(0==i)return!0;{const e=this.getDefinition(o);return this._checkContextMatch(e,t,i-1)}}return!1}*_getValidRangesForRange(e,t){let i=e.start,o=e.start;for(const n of e.getItems({shallow:!0}))n.is("element")&&(yield*this._getValidRangesForRange(ra._createIn(n),t)),this.checkAttribute(n,t)||(i.isEqual(o)||(yield new ra(i,o)),i=ta._createAfter(n)),o=ta._createAfter(n);i.isEqual(o)||(yield new ra(i,o))}}Ye(Ka,qe);class Ga{constructor(e){if(e instanceof Ga)return e;"string"==typeof e?e=[e]:Array.isArray(e)||(e=e.getAncestors({includeSelf:!0})),this._items=e.map(sl)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new Ga([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function Ja(e,t){const i={name:t,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return function(e,t){for(const i of e){const e=Object.keys(i).filter(e=>e.startsWith("is"));for(const o of e)t[o]=i[o]}}(e,i),nl(e,i,"allowIn"),nl(e,i,"allowContentOf"),nl(e,i,"allowWhere"),nl(e,i,"allowAttributes"),nl(e,i,"allowAttributesOf"),nl(e,i,"allowChildren"),nl(e,i,"inheritTypesFrom"),function(e,t){for(const i of e){const e=i.inheritAllFrom;e&&(t.allowContentOf.push(e),t.allowWhere.push(e),t.allowAttributesOf.push(e),t.inheritTypesFrom.push(e))}}(e,i),i}function Ya(e,t){const i=e[t];for(const o of i.allowChildren){const i=e[o];i&&i.allowIn.push(t)}i.allowChildren.length=0}function Qa(e,t){for(const i of e[t].allowContentOf)if(e[i]){rl(e,i).forEach(e=>{e.allowIn.push(t)})}delete e[t].allowContentOf}function Xa(e,t){for(const i of e[t].allowWhere){const o=e[i];if(o){const i=o.allowIn;e[t].allowIn.push(...i)}}delete e[t].allowWhere}function Za(e,t){for(const i of e[t].allowAttributesOf){const o=e[i];if(o){const i=o.allowAttributes;e[t].allowAttributes.push(...i)}}delete e[t].allowAttributesOf}function el(e,t){const i=e[t];for(const t of i.inheritTypesFrom){const o=e[t];if(o){const e=Object.keys(o).filter(e=>e.startsWith("is"));for(const t of e)t in i||(i[t]=o[t])}}delete i.inheritTypesFrom}function tl(e,t){const i=e[t],o=i.allowIn.filter(t=>e[t]);i.allowIn=Array.from(new Set(o))}function il(e,t){const i=e[t];for(const o of i.allowIn){e[o].allowChildren.push(t)}}function ol(e,t){const i=e[t];i.allowAttributes=Array.from(new Set(i.allowAttributes))}function nl(e,t,i){for(const o of e)"string"==typeof o[i]?t[i].push(o[i]):Array.isArray(o[i])&&t[i].push(...o[i])}function rl(e,t){const i=e[t];return(o=e,Object.keys(o).map(e=>o[e])).filter(e=>e.allowIn.includes(i.name));var o}function sl(e){return"string"==typeof e||e.is("documentFragment")?{name:"string"==typeof e?e:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function al(e,t,i){for(const o of t.getAttributeKeys())e.checkAttribute(t,o)||i.removeAttribute(o,t)}class ll{constructor(e={}){this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this.conversionApi=Object.assign({},e),this.conversionApi.convertItem=this._convertItem.bind(this),this.conversionApi.convertChildren=this._convertChildren.bind(this),this.conversionApi.safeInsert=this._safeInsert.bind(this),this.conversionApi.updateConversionResult=this._updateConversionResult.bind(this),this.conversionApi.splitToAllowedParent=this._splitToAllowedParent.bind(this),this.conversionApi.getSplitParts=this._getSplitParts.bind(this)}convert(e,t,i=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let i;for(const o of new Ga(e)){const e={};for(const t of o.getAttributeKeys())e[t]=o.getAttribute(t);const n=t.createElement(o.name,e);i&&t.append(n,i),i=ta._createAt(n,0)}return i}(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=$a.createFrom(e),this.conversionApi.store={};const{modelRange:o}=this._convertItem(e,this._modelCursor),n=t.createDocumentFragment();if(o){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,n);n.markers=function(e,t){const i=new Set,o=new Map,n=ra._createIn(e).getItems();for(const e of n)"$marker"==e.name&&i.add(e);for(const e of i){const i=e.getAttribute("data-name"),n=t.createPositionBefore(e);o.has(i)?o.get(i).end=n.clone():o.set(i,new ra(n.clone())),t.remove(e)}return o}(n,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,n}_convertItem(e,t){const i=Object.assign({viewItem:e,modelCursor:t,modelRange:null});if(e.is("element")?this.fire("element:"+e.name,i,this.conversionApi):e.is("$text")?this.fire("text",i,this.conversionApi):this.fire("documentFragment",i,this.conversionApi),i.modelRange&&!(i.modelRange instanceof ra))throw new l.a("view-conversion-dispatcher-incorrect-result",this);return{modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:ta._createAt(t,0);const o=new ra(i);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,i);e.modelRange instanceof ra&&(o.end=e.modelRange.end,i=e.modelCursor)}return{modelRange:o,modelCursor:i}}_safeInsert(e,t){const i=this._splitToAllowedParent(e,t);return!!i&&(this.conversionApi.writer.insert(e,i.position),!0)}_updateConversionResult(e,t){const i=this._getSplitParts(e),o=this.conversionApi.writer;t.modelRange||(t.modelRange=o.createRange(o.createPositionBefore(e),o.createPositionAfter(i[i.length-1])));const n=this._cursorParents.get(e);t.modelCursor=n?o.createPositionAt(n,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:i,writer:o}=this.conversionApi;let n=i.findAllowedParent(t,e);if(n){if(n===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(n)&&(n=null)}if(!n)return za(t,e,i)?{position:Ma(t,o)}:null;const r=this.conversionApi.writer.split(t,n),s=[];for(const e of r.range.getWalker())if("elementEnd"==e.type)s.push(e.item);else{const t=s.pop(),i=e.item;this._registerSplitPair(t,i)}const a=r.range.end.parent;return this._cursorParents.set(e,a),{position:r.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const i=this._splitParts.get(e);this._splitParts.set(t,i),i.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}Ye(ll,h);class cl{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class dl{constructor(e){this._domParser=new DOMParser,this._domConverter=new Er(e,{blockFillerMode:"nbsp"}),this._htmlWriter=new cl}toData(e){const t=this._domConverter.viewToDom(e,document);return this._htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this._domConverter.domToView(t)}registerRawContentMatcher(e){this._domConverter.registerRawContentMatcher(e)}useFillerType(e){this._domConverter.blockFillerMode="marked"==e?"markedNbsp":"nbsp"}_toDom(e){const t=this._domParser.parseFromString(e,"text/html"),i=t.createDocumentFragment();let o=t.firstChild;for(;!o.isSameNode(t.documentElement);){const e=o;o=o.nextSibling,e.nodeType==Node.COMMENT_NODE&&i.appendChild(e)}const n=t.body.childNodes;for(;n.length>0;)i.appendChild(n[0]);return i}}class hl{constructor(e,t){this.model=e,this.mapper=new sa,this.downcastDispatcher=new ca({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(e,t,i)=>{if(!i.consumable.consume(t.item,"insert"))return;const o=i.writer,n=i.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(n,r)},{priority:"lowest"}),this.upcastDispatcher=new ll({schema:e.schema}),this.viewDocument=new xn(t),this.stylesProcessor=t,this.htmlProcessor=new dl(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new $n(this.viewDocument),this.upcastDispatcher.on("text",(e,t,{schema:i,consumable:o,writer:n})=>{let r=t.modelCursor;if(!o.test(t.viewItem))return;if(!i.checkChild(r,"$text")){if(!za(r,"$text",i))return;r=Ma(r,n)}o.consume(t.viewItem);const s=n.createText(t.viewItem.data);n.insert(s,r),t.modelRange=n.createRange(r,r.getShiftedBy(s.offsetSize)),t.modelCursor=t.modelRange.end},{priority:"lowest"}),this.upcastDispatcher.on("element",(e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.decorate("init"),this.decorate("set"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange("transparent",Oa)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new l.a("datacontroller-get-non-existent-root",this);const o=this.model.document.getRoot(t);return"empty"!==i||this.model.hasContent(o,{ignoreWhitespaces:!0})?this.stringify(o,e):""}stringify(e,t={}){const i=this.toView(e,t);return this.processor.toData(i)}toView(e,t={}){const i=this.viewDocument,o=this._viewWriter;this.mapper.clearBindings();const n=ra._createIn(e),r=new qn(i);this.mapper.bindElements(e,r),this.downcastDispatcher.conversionApi.options=t,this.downcastDispatcher.convertInsert(n,o);const s=e.is("documentFragment")?Array.from(e.markers):function(e){const t=[],i=e.root.document;if(!i)return[];const o=ra._createIn(e);for(const e of i.model.markers){const i=e.getRange(),n=i.isCollapsed,r=i.start.isEqual(o.start)||i.end.isEqual(o.end);if(n&&r)t.push([e.name,i]);else{const n=o.getIntersection(i);n&&t.push([e.name,n])}}return t}(e);for(const[e,t]of s)this.downcastDispatcher.convertMarkerAdd(e,t,o);return delete this.downcastDispatcher.conversionApi.options,r}init(e){if(this.model.document.version)throw new l.a("datacontroller-init-document-not-empty",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new l.a("datacontroller-init-non-existent-root",this);return this.model.enqueueChange("transparent",e=>{for(const i of Object.keys(t)){const o=this.model.document.getRoot(i);e.insert(this.parse(t[i],o),o,0)}}),Promise.resolve()}set(e,t={}){let i={};if("string"==typeof e?i.main=e:i=e,!this._checkIfRootsExists(Object.keys(i)))throw new l.a("datacontroller-set-non-existent-root",this);const o=t.batchType||"default";this.model.enqueueChange(o,e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const t of Object.keys(i)){const o=this.model.document.getRoot(t);e.remove(e.createRangeIn(o)),e.insert(this.parse(i[t],o),o,0)}})}parse(e,t="$root"){const i=this.processor.toView(e);return this.toModel(i,t)}toModel(e,t="$root"){return this.model.change(i=>this.upcastDispatcher.convert(e,i,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRootNames().includes(t))return!1;return!0}}Ye(hl,qe);class ul{constructor(e,t){this._helpers=new Map,this._downcast=to(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=to(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new l.a("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i})}for(e){if(!this._helpers.has(e))throw new l.a("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:i}of gl(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:i}of gl(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:i}of gl(e))this.for("upcast").attributeToAttribute({view:i,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new l.a("conversion-group-exists",this);const o=i?new Ta(t):new Ba(t);this._helpers.set(e,o)}}function*gl(e){if(e.model.values)for(const t of e.model.values){const i={key:e.model.key,value:t},o=e.view[t],n=e.upcastAlso?e.upcastAlso[t]:void 0;yield*ml(i,o,n)}else yield*ml(e.model,e.view,e.upcastAlso)}function*ml(e,t,i){if(yield{model:e,view:t},i)for(const t of to(i))yield{model:e,view:t}}class fl{constructor(e="default"){this.operations=[],this.type=e}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}class pl{constructor(e){this.baseVersion=e,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e){return new this(e.baseVersion)}}class bl{constructor(e){this.markers=new Map,this._children=new Qs,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"===e||"model:documentFragment"===e}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const i of e)i.name?t.push(Xs.fromJSON(i)):t.push(Js.fromJSON(i));return new bl(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){if("string"==typeof e)return[new Js(e)];Xi(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new Js(e):e instanceof Ys?new Js(e.data,e.getAttributes()):e)}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}}function wl(e,t){const i=(t=vl(t)).reduce((e,t)=>e+t.offsetSize,0),o=e.parent;xl(e);const n=e.index;return o._insertChild(n,t),yl(o,n+t.length),yl(o,n),new ra(e,e.getShiftedBy(i))}function kl(e){if(!e.isFlat)throw new l.a("operation-utils-remove-range-not-flat",this);const t=e.start.parent;xl(e.start),xl(e.end);const i=t._removeChildren(e.start.index,e.end.index-e.start.index);return yl(t,e.start.index),i}function _l(e,t){if(!e.isFlat)throw new l.a("operation-utils-move-range-not-flat",this);const i=kl(e);return wl(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),i)}function vl(e){const t=[];e instanceof Array||(e=[e]);for(let i=0;i<e.length;i++)if("string"==typeof e[i])t.push(new Js(e[i]));else if(e[i]instanceof Ys)t.push(new Js(e[i].data,e[i].getAttributes()));else if(e[i]instanceof bl||e[i]instanceof Qs)for(const o of e[i])t.push(o);else e[i]instanceof Gs&&t.push(e[i]);for(let e=1;e<t.length;e++){const i=t[e],o=t[e-1];i instanceof Js&&o instanceof Js&&Cl(i,o)&&(t.splice(e-1,2,new Js(o.data+i.data,o.getAttributes())),e--)}return t}function yl(e,t){const i=e.getChild(t-1),o=e.getChild(t);if(i&&o&&i.is("$text")&&o.is("$text")&&Cl(i,o)){const n=new Js(i.data+o.data,i.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,n)}}function xl(e){const t=e.textNode,i=e.parent;if(t){const o=e.offset-t.startOffset,n=t.index;i._removeChildren(n,1);const r=new Js(t.data.substr(0,o),t.getAttributes()),s=new Js(t.data.substr(o),t.getAttributes());i._insertChild(n,[r,s])}}function Cl(e,t){const i=e.getAttributes(),o=t.getAttributes();for(const e of i){if(e[1]!==t.getAttribute(e[0]))return!1;o.next()}return o.next().done}var Al=function(e,t){return Qr(e,t)};class Tl extends pl{constructor(e,t,i,o,n){super(n),this.range=e.clone(),this.key=t,this.oldValue=void 0===i?null:i,this.newValue=void 0===o?null:o}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}clone(){return new Tl(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Tl(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new l.a("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(null!==this.oldValue&&!Al(e.getAttribute(this.key),this.oldValue))throw new l.a("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(null===this.oldValue&&null!==this.newValue&&e.hasAttribute(this.key))throw new l.a("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){Al(this.oldValue,this.newValue)||function(e,t,i){xl(e.start),xl(e.end);for(const o of e.getItems({shallow:!0})){const e=o.is("$textProxy")?o.textNode:o;null!==i?e._setAttribute(t,i):e._removeAttribute(t),yl(e.parent,e.index)}yl(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new Tl(ra.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class El extends pl{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new l.a("detach-operation-on-document-node",this)}_execute(){kl(ra._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class Pl extends pl{constructor(e,t,i,o){super(o),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNone"}get type(){return"$graveyard"==this.targetPosition.root.rootName?"remove":"$graveyard"==this.sourcePosition.root.rootName?"reinsert":"move"}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new this.constructor(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,i=this.sourcePosition.offset,o=this.targetPosition.offset;if(i+this.howMany>e.maxOffset)throw new l.a("move-operation-nodes-do-not-exist",this);if(e===t&&i<o&&o<i+this.howMany)throw new l.a("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==lo(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=i&&this.targetPosition.path[e]<i+this.howMany)throw new l.a("move-operation-node-into-itself",this)}}_execute(){_l(ra._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const i=ta.fromJSON(e.sourcePosition,t),o=ta.fromJSON(e.targetPosition,t);return new this(i,e.howMany,o,e.baseVersion)}}class Sl extends pl{constructor(e,t,i){super(i),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new Qs(vl(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}clone(){const e=new Qs([...this.nodes].map(e=>e._clone(!0))),t=new Sl(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new ta(e,[0]);return new Pl(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new l.a("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new Qs([...e].map(e=>e._clone(!0))),wl(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const i=[];for(const t of e.nodes)t.name?i.push(Xs.fromJSON(t)):i.push(Js.fromJSON(t));const o=new Sl(ta.fromJSON(e.position,t),i,e.baseVersion);return o.shouldReceiveAttributes=e.shouldReceiveAttributes,o}}class Il extends pl{constructor(e,t,i,o,n,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=i?i.clone():null,this.affectsData=n,this._markers=o}get type(){return"marker"}clone(){return new Il(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Il(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){const e=this.newRange?"_set":"_remove";this._markers[e](this.name,this.newRange,!0,this.affectsData)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Il(e.name,e.oldRange?ra.fromJSON(e.oldRange,t):null,e.newRange?ra.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class Rl extends pl{constructor(e,t,i,o){super(o),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=i}get type(){return"rename"}clone(){return new Rl(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Rl(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof Xs))throw new l.a("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new l.a("rename-operation-wrong-name",this)}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new Rl(ta.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class Vl extends pl{constructor(e,t,i,o,n){super(n),this.root=e,this.key=t,this.oldValue=i,this.newValue=o}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Vl(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Vl(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new l.a("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new l.a("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new l.a("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new l.a("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new Vl(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class Ol extends pl{constructor(e,t,i,o,n){super(n),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=o.clone()}get type(){return"merge"}get deletionPosition(){return new ta(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new ra(this.sourcePosition,e)}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),i=new ta(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new zl(e,this.howMany,i,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new l.a("merge-operation-source-position-invalid",this);if(!t.parent)throw new l.a("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new l.a("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;_l(ra._createIn(e),this.targetPosition),_l(ra._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const i=ta.fromJSON(e.sourcePosition,t),o=ta.fromJSON(e.targetPosition,t),n=ta.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,o,n,e.baseVersion)}}class zl extends pl{constructor(e,t,i,o,n){super(n),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=i,this.graveyardPosition=o?o.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new ta(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new ra(this.splitPosition,e)}clone(){return new this.constructor(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new ta(e,[0]);return new Ol(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new l.a("split-operation-position-invalid",this);if(!e.parent)throw new l.a("split-operation-split-in-root",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new l.a("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new l.a("split-operation-graveyard-position-invalid",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)_l(ra._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();wl(this.insertionPosition,t)}_l(new ra(ta._createAt(e,this.splitPosition.offset),ta._createAt(e,e.maxOffset)),this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new ta(e.root,t,"toPrevious")}static fromJSON(e,t){const i=ta.fromJSON(e.splitPosition,t),o=ta.fromJSON(e.insertionPosition,t),n=e.graveyardPosition?ta.fromJSON(e.graveyardPosition,t):null;return new this(i,e.howMany,o,n,e.baseVersion)}}class Ml extends Xs{constructor(e,t,i="main"){super(t),this._document=e,this.rootName=i}get document(){return this._document}is(e,t){return t?t===this.name&&("rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e):"rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e||"node"===e||"model:node"===e}toJSON(){return this.rootName}}class Bl{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new Js(e,t)}createElement(e,t){return new Xs(e,t)}createDocumentFragment(){return new bl}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof Js&&""==e.data)return;const o=ta._createAt(t,i);if(e.parent){if(Hl(e.root,o.root))return void this.move(ra._createOn(e),o);if(e.root.document)throw new l.a("model-writer-insert-forbidden-move",this);this.remove(e)}const n=o.root.document?o.root.document.version:null,r=new Sl(o,e,n);if(e instanceof Js&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof bl)for(const[t,i]of e.markers){const e=ta._createAt(i.root,0),n={range:new ra(i.start._getCombined(e,o),i.end._getCombined(e,o)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,n):this.addMarker(t,n)}}insertText(e,t,i,o){t instanceof bl||t instanceof Xs||t instanceof ta?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,o)}insertElement(e,t,i,o){t instanceof bl||t instanceof Xs||t instanceof ta?this.insert(this.createElement(e),t,i):this.insert(this.createElement(e,t),i,o)}append(e,t){this.insert(e,t,"end")}appendText(e,t,i){t instanceof bl||t instanceof Xs?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end")}appendElement(e,t,i){t instanceof bl||t instanceof Xs?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),i,"end")}setAttribute(e,t,i){if(this._assertWriterUsedCorrectly(),i instanceof ra){const o=i.getMinimalFlatRanges();for(const i of o)Nl(this,e,t,i)}else Fl(this,e,t,i)}setAttributes(e,t){for(const[i,o]of mo(e))this.setAttribute(i,o,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof ra){const i=t.getMinimalFlatRanges();for(const t of i)Nl(this,e,null,t)}else Fl(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof ra)for(const i of e.getItems())t(i);else t(e)}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof ra))throw new l.a("writer-move-invalid-range",this);if(!e.isFlat)throw new l.a("writer-move-range-not-flat",this);const o=ta._createAt(t,i);if(o.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!Hl(e.root,o.root))throw new l.a("writer-move-different-document",this);const n=e.root.document?e.root.document.version:null,r=new Pl(e.start,e.end.offset-e.start.offset,o,n);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof ra?e:ra._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),Ll(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof Xs))throw new l.a("writer-merge-no-element-before",this);if(!(i instanceof Xs))throw new l.a("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,i){return this.model.createPositionFromPath(e,t,i)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(e,t,i){return this.model.createSelection(e,t,i)}_mergeDetached(e){const t=e.nodeBefore,i=e.nodeAfter;this.move(ra._createIn(i),ta._createAt(t,"end")),this.remove(i)}_merge(e){const t=ta._createAt(e.nodeBefore,"end"),i=ta._createAt(e.nodeAfter,0),o=e.root.document.graveyard,n=new ta(o,[0]),r=e.root.document.version,s=new Ol(i,e.nodeAfter.maxOffset,t,n,r);this.batch.addOperation(s),this.model.applyOperation(s)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof Xs))throw new l.a("writer-rename-not-element-instance",this);const i=e.root.document?e.root.document.version:null,o=new Rl(ta._createBefore(e),e.name,t,i);this.batch.addOperation(o),this.model.applyOperation(o)}split(e,t){this._assertWriterUsedCorrectly();let i,o,n=e.parent;if(!n.parent)throw new l.a("writer-split-element-no-parent",this);if(t||(t=n.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new l.a("writer-split-invalid-limit-element",this);do{const t=n.root.document?n.root.document.version:null,r=n.maxOffset-e.offset,s=zl.getInsertionPosition(e),a=new zl(e,r,s,null,t);this.batch.addOperation(a),this.model.applyOperation(a),i||o||(i=n,o=e.parent.nextSibling),n=(e=this.createPositionAfter(e.parent)).parent}while(n!==t);return{position:e,range:new ra(ta._createAt(i,"end"),ta._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new l.a("writer-wrap-range-not-flat",this);const i=t instanceof Xs?t:new Xs(t);if(i.childCount>0)throw new l.a("writer-wrap-element-not-empty",this);if(null!==i.parent)throw new l.a("writer-wrap-element-attached",this);this.insert(i,e.start);const o=new ra(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(o,ta._createAt(i,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new l.a("writer-unwrap-element-no-parent",this);this.move(ra._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new l.a("writer-addmarker-no-usingoperation",this);const i=t.usingOperation,o=t.range,n=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new l.a("writer-addmarker-marker-exists",this);if(!o)throw new l.a("writer-addmarker-no-range",this);return i?(Dl(this,e,null,o,n),this.model.markers.get(e)):this.model.markers._set(e,o,i,n)}updateMarker(e,t){this._assertWriterUsedCorrectly();const i="string"==typeof e?e:e.name,o=this.model.markers.get(i);if(!o)throw new l.a("writer-updatemarker-marker-not-exists",this);if(!t)return void this.model.markers._refresh(o);const n="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,s=r?t.affectsData:o.affectsData;if(!n&&!t.range&&!r)throw new l.a("writer-updatemarker-wrong-options",this);const a=o.getRange(),c=t.range?t.range:a;n&&t.usingOperation!==o.managedUsingOperations?t.usingOperation?Dl(this,i,null,c,s):(Dl(this,i,a,null,s),this.model.markers._set(i,c,void 0,s)):o.managedUsingOperations?Dl(this,i,a,c,s):this.model.markers._set(i,c,void 0,s)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new l.a("writer-removemarker-no-marker",this);const i=this.model.markers.get(t);if(!i.managedUsingOperations)return void this.model.markers._remove(t);Dl(this,t,i.getRange(),null,i.affectsData)}setSelection(e,t,i){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(e,t,i)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,t);else for(const[t,i]of mo(e))this._setSelectionAttribute(t,i)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){const o=va._getStoreAttributeKey(e);this.setAttribute(o,t,i.anchor.parent)}i._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const i=va._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new l.a("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const i of this.model.markers){if(!i.managedUsingOperations)continue;const o=i.getRange();let n=!1;if("move"===e)n=t.containsPosition(o.start)||t.start.isEqual(o.start)||t.containsPosition(o.end)||t.end.isEqual(o.end);else{const e=t.nodeBefore,i=t.nodeAfter,r=o.start.parent==e&&o.start.isAtEnd,s=o.end.parent==i&&0==o.end.offset,a=o.end.nodeAfter==i,l=o.start.nodeAfter==i;n=r||s||a||l}n&&this.updateMarker(i.name,{range:o})}}}function Nl(e,t,i,o){const n=e.model,r=n.document;let s,a,l,c=o.start;for(const e of o.getWalker({shallow:!0}))l=e.item.getAttribute(t),s&&a!=l&&(a!=i&&d(),c=s),s=e.nextPosition,a=l;function d(){const o=new ra(c,s),l=o.root.document?r.version:null,d=new Tl(o,t,a,i,l);e.batch.addOperation(d),n.applyOperation(d)}s instanceof ta&&s!=c&&a!=i&&d()}function Fl(e,t,i,o){const n=e.model,r=n.document,s=o.getAttribute(t);let a,l;if(s!=i){if(o.root===o){const e=o.document?r.version:null;l=new Vl(o,t,s,i,e)}else{a=new ra(ta._createBefore(o),e.createPositionAfter(o));const n=a.root.document?r.version:null;l=new Tl(a,t,s,i,n)}e.batch.addOperation(l),n.applyOperation(l)}}function Dl(e,t,i,o,n){const r=e.model,s=r.document,a=new Il(t,i,o,r.markers,n,s.version);e.batch.addOperation(a),r.applyOperation(a)}function Ll(e,t,i,o){let n;if(e.root.document){const i=o.document,r=new ta(i.graveyard,[0]);n=new Pl(e,t,r,i.version)}else n=new El(e,t);i.addOperation(n),o.applyOperation(n)}function Hl(e,t){return e===t||e instanceof Ml&&t instanceof Ml}class jl{constructor(e){this._markerCollection=e,this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size}refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize);const t=ra._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}this._cachedChanges=null}bufferOperation(e){switch(e.type){case"insert":if(this._isInInsertedElement(e.position.parent))return;this._markInsert(e.position.parent,e.position.offset,e.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const t of e.range.getItems({shallow:!0}))this._isInInsertedElement(t.parent)||this._markAttribute(t);break;case"remove":case"move":case"reinsert":{if(e.sourcePosition.isEqual(e.targetPosition)||e.sourcePosition.getShiftedBy(e.howMany).isEqual(e.targetPosition))return;const t=this._isInInsertedElement(e.sourcePosition.parent),i=this._isInInsertedElement(e.targetPosition.parent);t||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),i||this._markInsert(e.targetPosition.parent,e.getMovedRangeStart().offset,e.howMany);break}case"rename":{if(this._isInInsertedElement(e.position.parent))return;this._markRemove(e.position.parent,e.position.offset,1),this._markInsert(e.position.parent,e.position.offset,1);const t=ra._createFromPositionAndShift(e.position,1);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}break}case"split":{const t=e.splitPosition.parent;this._isInInsertedElement(t)||this._markRemove(t,e.splitPosition.offset,e.howMany),this._isInInsertedElement(e.insertionPosition.parent)||this._markInsert(e.insertionPosition.parent,e.insertionPosition.offset,1),e.graveyardPosition&&this._markRemove(e.graveyardPosition.parent,e.graveyardPosition.offset,1);break}case"merge":{const t=e.sourcePosition.parent;this._isInInsertedElement(t.parent)||this._markRemove(t.parent,t.startOffset,1);const i=e.graveyardPosition.parent;this._markInsert(i,e.graveyardPosition.offset,1);const o=e.targetPosition.parent;this._isInInsertedElement(o)||this._markInsert(o,e.targetPosition.offset,t.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(e,t,i,o){const n=this._changedMarkers.get(e);n?(n.newRange=i,n.affectsData=o,null==n.oldRange&&null==n.newRange&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{oldRange:t,newRange:i,affectsData:o})}getMarkersToRemove(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.oldRange&&e.push({name:t,range:i.oldRange});return e}getMarkersToAdd(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.newRange&&e.push({name:t,range:i.newRange});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(e=>({name:e[0],data:{oldRange:e[1].oldRange,newRange:e[1].newRange}}))}hasDataChanges(){for(const[,e]of this._changedMarkers)if(e.affectsData)return!0;return this._changesInElement.size>0}getChanges(e={includeChangesInGraveyard:!1}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const e of this._changesInElement.keys()){const i=this._changesInElement.get(e).sort((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offset<t.offset?-1:1),o=this._elementSnapshots.get(e),n=Wl(e.getChildren()),r=ql(o.length,i);let s=0,a=0;for(const i of r)if("i"===i)t.push(this._getInsertDiff(e,s,n[s].name)),s++;else if("r"===i)t.push(this._getRemoveDiff(e,s,o[a].name)),a++;else if("a"===i){const i=n[s].attributes,r=o[a].attributes;let l;if("$text"==n[s].name)l=new ra(ta._createAt(e,s),ta._createAt(e,s+1));else{const t=e.offsetToIndex(s);l=new ra(ta._createAt(e,s),ta._createAt(e.getChild(t),0))}t.push(...this._getAttributesDiff(l,r,i)),s++,a++}else s++,a++}t.sort((e,t)=>e.position.root!=t.position.root?e.position.root.rootName<t.position.root.rootName?-1:1:e.position.isEqual(t.position)?e.changeCount-t.changeCount:e.position.isBefore(t.position)?-1:1);for(let e=1,i=0;e<t.length;e++){const o=t[i],n=t[e],r="remove"==o.type&&"remove"==n.type&&"$text"==o.name&&"$text"==n.name&&o.position.isEqual(n.position),s="insert"==o.type&&"insert"==n.type&&"$text"==o.name&&"$text"==n.name&&o.position.parent==n.position.parent&&o.position.offset+o.length==n.position.offset,a="attribute"==o.type&&"attribute"==n.type&&o.position.parent==n.position.parent&&o.range.isFlat&&n.range.isFlat&&o.position.offset+o.length==n.position.offset&&o.attributeKey==n.attributeKey&&o.attributeOldValue==n.attributeOldValue&&o.attributeNewValue==n.attributeNewValue;r||s||a?(o.length++,a&&(o.range.end=o.range.end.getShiftedBy(1)),t[e]=null):i=e}t=t.filter(e=>e);for(const e of t)delete e.changeCount,"attribute"==e.type&&(delete e.position,delete e.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t.slice(),this._cachedChanges=t.filter($l),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard:this._cachedChanges}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._cachedChanges=null}_markInsert(e,t,i){const o={type:"insert",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,o)}_markRemove(e,t,i){const o={type:"remove",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,o),this._removeAllNestedChanges(e,t,i)}_markAttribute(e){const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshot(e);const i=this._getChangesForElement(e);this._handleChange(t,i),i.push(t);for(let e=0;e<i.length;e++)i[e].howMany<1&&(i.splice(e,1),e--)}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshot(e){this._elementSnapshots.has(e)||this._elementSnapshots.set(e,Wl(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const i of t){const o=e.offset+e.howMany,n=i.offset+i.howMany;if("insert"==e.type&&("insert"==i.type&&(e.offset<=i.offset?i.offset+=e.howMany:e.offset<n&&(i.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==i.type&&e.offset<i.offset&&(i.offset+=e.howMany),"attribute"==i.type))if(e.offset<=i.offset)i.offset+=e.howMany;else if(e.offset<n){const n=i.howMany;i.howMany=e.offset-i.offset,t.unshift({type:"attribute",offset:o,howMany:n-i.howMany,count:this._changeCount++})}if("remove"==e.type){if("insert"==i.type)if(o<=i.offset)i.offset-=e.howMany;else if(o<=n)if(e.offset<i.offset){const t=o-i.offset;i.offset=e.offset,i.howMany-=t,e.nodesToHandle-=t}else i.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=i.offset)e.nodesToHandle-=i.howMany,i.howMany=0;else if(e.offset<n){const t=n-e.offset;i.howMany-=t,e.nodesToHandle-=t}if("remove"==i.type&&(o<=i.offset?i.offset-=e.howMany:e.offset<i.offset&&(e.nodesToHandle+=i.howMany,i.howMany=0)),"attribute"==i.type)if(o<=i.offset)i.offset-=e.howMany;else if(e.offset<i.offset){const t=o-i.offset;i.offset=e.offset,i.howMany-=t}else if(e.offset<n)if(o<=n){const o=i.howMany;i.howMany=e.offset-i.offset;const n=o-i.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:n,count:this._changeCount++})}else i.howMany-=n-e.offset}if("attribute"==e.type){if("insert"==i.type)if(e.offset<i.offset&&o>i.offset){if(o>n){const e={type:"attribute",offset:n,howMany:o-n,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=i.offset&&e.offset<n&&(o>n?(e.nodesToHandle=o-n,e.offset=n):e.nodesToHandle=0);if("remove"==i.type&&e.offset<i.offset&&o>i.offset){const n={type:"attribute",offset:i.offset,howMany:o-i.offset,count:this._changeCount++};this._handleChange(n,t),t.push(n),e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==i.type&&(e.offset>=i.offset&&o<=n?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=i.offset&&o>=n&&(i.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,i){return{type:"insert",position:ta._createAt(e,t),name:i,length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,i){return{type:"remove",position:ta._createAt(e,t),name:i,length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,i){const o=[];i=new Map(i);for(const[n,r]of t){const t=i.has(n)?i.get(n):null;t!==r&&o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:n,attributeOldValue:r,attributeNewValue:t,changeCount:this._changeCount++}),i.delete(n)}for(const[t,n]of i)o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:n,changeCount:this._changeCount++});return o}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const i=this._changesInElement.get(t),o=e.startOffset;if(i)for(const e of i)if("insert"==e.type&&o>=e.offset&&o<e.offset+e.howMany)return!0;return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,i){const o=new ra(ta._createAt(e,t),ta._createAt(e,t+i));for(const e of o.getItems({shallow:!0}))e.is("element")&&(this._elementSnapshots.delete(e),this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset))}}function Wl(e){const t=[];for(const i of e)if(i.is("$text"))for(let e=0;e<i.data.length;e++)t.push({name:"$text",attributes:new Map(i.getAttributes())});else t.push({name:i.name,attributes:new Map(i.getAttributes())});return t}function ql(e,t){const i=[];let o=0,n=0;for(const e of t){if(e.offset>o){for(let t=0;t<e.offset-o;t++)i.push("e");n+=e.offset-o}if("insert"==e.type){for(let t=0;t<e.howMany;t++)i.push("i");o=e.offset+e.howMany}else if("remove"==e.type){for(let t=0;t<e.howMany;t++)i.push("r");o=e.offset,n+=e.howMany}else i.push(..."a".repeat(e.howMany).split("")),o=e.offset+e.howMany,n+=e.howMany}if(n<e)for(let t=0;t<e-n-o;t++)i.push("e");return i}function $l(e){const t=e.position&&"$graveyard"==e.position.root.rootName,i=e.range&&"$graveyard"==e.range.root.rootName;return!t&&!i}class Ul{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set}addOperation(e){this._operations.includes(e)||this._operations.push(e)}getOperations(e=Number.NEGATIVE_INFINITY,t=Number.POSITIVE_INFINITY){const i=[];for(const o of this._operations)o.baseVersion>=e&&o.baseVersion<t&&i.push(o);return i}getOperation(e){for(const t of this._operations)if(t.baseVersion==e)return t}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}}function Kl(e,t){return!!(i=e.charAt(t-1))&&1==i.length&&/[\ud800-\udbff]/.test(i)&&function(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}(e.charAt(t));var i}function Gl(e,t){return!!(i=e.charAt(t))&&1==i.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(i);var i}class Jl{constructor(e){this.model=e,this.version=0,this.history=new Ul(this),this.selection=new va(this),this.roots=new Zi({idProperty:"rootName"}),this.differ=new jl(e.markers),this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root","$graveyard"),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];if(i.isDocumentOperation&&i.baseVersion!==this.version)throw new l.a("model-document-applyoperation-wrong-version",this,{operation:i})},{priority:"highest"}),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&this.differ.bufferOperation(i)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&(this.version++,this.history.addOperation(i))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,t,i,o)=>{this.differ.bufferMarkerChange(t.name,i,o,t.affectsData),null===i&&t.on("change",(e,i)=>{this.differ.bufferMarkerChange(t.name,i,t.getRange(),t.affectsData)})})}get graveyard(){return this.getRoot("$graveyard")}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new l.a("model-document-createroot-name-exists",this,{name:t});const i=new Ml(this,e,t);return this.roots.add(i),i}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(){return Array.from(this.roots,e=>e.rootName).filter(e=>"$graveyard"!=e)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=co(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){for(const e of this.roots)if(e!==this.graveyard)return e;return this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,i=t.schema,o=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(o)||t.createRange(o)}_validateSelectionRange(e){return Yl(e.start)&&Yl(e.end)}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break}while(t)}}function Yl(e){const t=e.textNode;if(t){const i=t.data,o=e.offset-t.startOffset;return!Kl(i,o)&&!Gl(i,o)}return!0}Ye(Jl,h);class Ql{constructor(){this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Xl?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,i=!1,o=!1){const n=e instanceof Xl?e.name:e;if(n.includes(","))throw new l.a("markercollection-incorrect-marker-name",this);const r=this._markers.get(n);if(r){const e=r.getRange();let s=!1;return e.isEqual(t)||(r._attachLiveRange(wa.fromRange(t)),s=!0),i!=r.managedUsingOperations&&(r._managedUsingOperations=i,s=!0),"boolean"==typeof o&&o!=r.affectsData&&(r._affectsData=o,s=!0),s&&this.fire("update:"+n,r,e,t),r}const s=wa.fromRange(t),a=new Xl(n,s,i,o);return this._markers.set(n,a),this.fire("update:"+n,a,null,t),a}_remove(e){const t=e instanceof Xl?e.name:e,i=this._markers.get(t);return!!i&&(this._markers.delete(t),this.fire("update:"+t,i,i.getRange(),null),this._destroyMarker(i),!0)}_refresh(e){const t=e instanceof Xl?e.name:e,i=this._markers.get(t);if(!i)throw new l.a("markercollection-refresh-marker-not-exists",this);const o=i.getRange();this.fire("update:"+t,i,o,o,i.managedUsingOperations,i.affectsData)}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)null!==t.getRange().getIntersection(e)&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}Ye(Ql,h);class Xl{constructor(e,t,i,o){this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=i,this._affectsData=o}get managedUsingOperations(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._affectsData}getStart(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._liveRange.toRange()}is(e){return"marker"===e||"model:marker"===e}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Ye(Xl,h);class Zl extends pl{get type(){return"noop"}clone(){return new Zl(this.baseVersion)}getReversed(){return new Zl(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const ec={};ec[Tl.className]=Tl,ec[Sl.className]=Sl,ec[Il.className]=Il,ec[Pl.className]=Pl,ec[Zl.className]=Zl,ec[pl.className]=pl,ec[Rl.className]=Rl,ec[Vl.className]=Vl,ec[zl.className]=zl,ec[Ol.className]=Ol;class tc extends ta{constructor(e,t,i="toNone"){if(super(e,t,i),!this.root.is("rootElement"))throw new l.a("model-liveposition-root-not-rootelement",e);ic.call(this)}detach(){this.stopListening()}is(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e}toPosition(){return new ta(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function ic(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&oc.call(this,i)},{priority:"low"})}function oc(e){const t=this.getTransformedByOperation(e);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}Ye(tc,h);class nc{constructor(e,t,i){this.model=e,this.writer=t,this.position=i,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0),this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),i=this.writer.createPositionAfter(e);if(i.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new l.a("insertcontent-invalid-insertion-position",this);this.position=i,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this.nodeToSelect?ra._createOn(this.nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new ra(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){if(this.schema.isObject(e))return void this._handleObject(e);let t=this._checkAndAutoParagraphToAllowedPosition(e);t||(t=this._checkAndSplitToAllowedPosition(e),t)?(this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e):this._handleDisallowedNode(e)}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=tc.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleObject(e){this._checkAndSplitToAllowedPosition(e)?this._appendToFragment(e):this._tryAutoparagraphing(e)}_handleDisallowedNode(e){e.is("element")?this.handleNodes(e.getChildren()):this._tryAutoparagraphing(e)}_appendToFragment(e){if(!this.schema.checkChild(this.position,e))throw new l.a("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this.nodeToSelect=e:this.nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=tc.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=tc.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof Xs))return;if(!this._canMergeLeft(e))return;const t=tc._createBefore(e);t.stickiness="toNext";const i=tc.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=tc._createAt(t.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=tc._createAt(t.nodeBefore,"end","toNext")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof Xs))return;if(!this._canMergeRight(e))return;const t=tc._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new l.a("insertcontent-invalid-insertion-position",this);this.position=ta._createAt(t.nodeBefore,"end");const i=tc.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=tc._createAt(t.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=tc._createAt(t.nodeBefore,0,"toPrevious")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof Xs&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof Xs&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_tryAutoparagraphing(e){const t=this.writer.createElement("paragraph");this._getAllowedIn(this.position.parent,t)&&this.schema.checkChild(t,e)&&(t._appendChild(e),this._handleNode(t))}_checkAndAutoParagraphToAllowedPosition(e){if(this.schema.checkChild(this.position.parent,e))return!0;if(!this.schema.checkChild(this.position.parent,"paragraph")||!this.schema.checkChild("paragraph",e))return!1;this._insertPartialFragment();const t=this.writer.createElement("paragraph");return this.writer.insert(t,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=t,this.position=this.writer.createPositionAt(t,0),!0}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const e=this.position.parent;this.position=this.writer.createPositionBefore(e),e.isEmpty&&e.parent===t&&this.writer.remove(e)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const e=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=e,this.canMergeWith.add(this.position.nodeAfter)}return!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}function rc(e,t,i={}){if(t.isCollapsed)return;const o=t.getFirstRange();if("$graveyard"==o.root.rootName)return;const n=e.schema;e.change(e=>{if(!i.doNotResetEntireContent&&function(e,t){const i=e.getLimitElement(t);if(!t.containsEntireContent(i))return!1;const o=t.getFirstRange();if(o.start.parent==o.end.parent)return!1;return e.checkChild(i,"paragraph")}(n,t))return void function(e,t){const i=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(i)),ac(e,e.createPositionAt(i,0),t)}(e,t);const[r,s]=function(e){const t=e.root.document.model,i=e.start;let o=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const i=function(e){const t=e.parent,i=t.root.document.model.schema,o=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of o){if(i.isLimit(e))return null;if(i.isBlock(e))return e}}(o);if(i&&o.isTouching(t.createPositionAt(i,0))){const i=t.createSelection(e);t.modifySelection(i,{direction:"backward"});const n=i.getLastPosition(),r=t.createRange(n,o);t.hasContent(r,{ignoreMarkers:!0})||(o=n)}}return[tc.fromPosition(i,"toPrevious"),tc.fromPosition(o,"toNext")]}(o);r.isTouching(s)||e.remove(e.createRange(r,s)),i.leaveUnmerged||(!function(e,t,i){const o=e.model;if(!sc(e.model.schema,t,i))return;const[n,r]=function(e,t){const i=e.getAncestors(),o=t.getAncestors();let n=0;for(;i[n]&&i[n]==o[n];)n++;return[i[n],o[n]]}(t,i);if(!n||!r)return;!o.hasContent(n,{ignoreMarkers:!0})&&o.hasContent(r,{ignoreMarkers:!0})?function e(t,i,o,n){const r=i.parent,s=o.parent;if(r==n||s==n)return;i=t.createPositionAfter(r),(o=t.createPositionBefore(s)).isEqual(i)||t.insert(r,o);for(;i.parent.isEmpty;){const e=i.parent;i=t.createPositionBefore(e),t.remove(e)}if(o=t.createPositionBefore(s),function(e,t){const i=t.nodeBefore,o=t.nodeAfter;i.name!=o.name&&e.rename(i,o.name);e.clearAttributes(i),e.setAttributes(Object.fromEntries(o.getAttributes()),i),e.merge(t)}(t,o),!sc(t.model.schema,i,o))return;e(t,i,o,n)}(e,t,i,n.parent):function e(t,i,o,n){const r=i.parent,s=o.parent;if(r==n||s==n)return;i=t.createPositionAfter(r),(o=t.createPositionBefore(s)).isEqual(i)||t.insert(s,i);t.merge(i);for(;o.parent.isEmpty;){const e=o.parent;o=t.createPositionBefore(e),t.remove(e)}if(!sc(t.model.schema,i,o))return;e(t,i,o,n)}(e,t,i,n.parent)}(e,r,s),n.removeDisallowedAttributes(r.parent.getChildren(),e)),lc(e,t,r),!i.doNotAutoparagraph&&function(e,t){const i=e.checkChild(t,"$text"),o=e.checkChild(t,"paragraph");return!i&&o}(n,r)&&ac(e,r,t),r.detach(),s.detach()})}function sc(e,t,i){const o=t.parent,n=i.parent;return o!=n&&(!e.isLimit(o)&&!e.isLimit(n)&&function(e,t,i){const o=new ra(e,t);for(const e of o.getWalker())if(i.isLimit(e.item))return!1;return!0}(t,i,e))}function ac(e,t,i){const o=e.createElement("paragraph");e.insert(o,t),lc(e,i,e.createPositionAt(o,0))}function lc(e,t,i){t instanceof va?e.setSelection(i):t.setTo(i)}function cc(e,t){const{isForward:i,walker:o,unit:n,schema:r}=e,{type:s,item:a,nextPosition:l}=t;if("text"==s)return"word"===e.unit?function(e,t){let i=e.position.textNode;if(i){let o=e.position.offset-i.startOffset;for(;!hc(i.data,o,t)&&!uc(i,o,t);){e.next();const n=t?e.position.nodeAfter:e.position.nodeBefore;if(n&&n.is("$text")){const o=n.data.charAt(t?0:n.data.length-1);' ,.?!:;"-()'.includes(o)||(e.next(),i=e.position.textNode)}o=e.position.offset-i.startOffset}}return e.position}(o,i):function(e,t){const i=e.position.textNode;if(i){const o=i.data;let n=e.position.offset-i.startOffset;for(;Kl(o,n)||"character"==t&&Gl(o,n);)e.next(),n=e.position.offset-i.startOffset}return e.position}(o,n);if(s==(i?"elementStart":"elementEnd")){if(r.isSelectable(a))return ta._createAt(a,i?"after":"before");if(r.checkChild(l,"$text"))return l}else{if(r.isLimit(a))return void o.skip(()=>!0);if(r.checkChild(l,"$text"))return l}}function dc(e,t){const i=e.root,o=ta._createAt(i,t?"end":0);return t?new ra(e,o):new ra(o,e)}function hc(e,t,i){const o=t+(i?0:-1);return' ,.?!:;"-()'.includes(e.charAt(o))}function uc(e,t,i){return t===(i?e.endOffset:0)}function gc(e,t){const i=[];Array.from(e.getItems({direction:"backward"})).map(e=>t.createRangeOn(e)).filter(t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end))).forEach(e=>{i.push(e.start.parent),t.remove(e)}),i.forEach(e=>{let i=e;for(;i.parent&&i.isEmpty;){const e=t.createRangeOn(i);i=i.parent,t.remove(e)}})}function mc(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.selection,o=t.schema,n=[];let r=!1;for(const e of i.getRanges()){const t=fc(e,o);t&&!t.isEqual(e)?(n.push(t),r=!0):n.push(e)}r&&e.setSelection(function(e){const t=[];t.push(e.shift());for(const i of e){const e=t.pop();if(i.isEqual(e))t.push(e);else if(i.isIntersecting(e)){const o=e.start.isAfter(i.start)?i.start:e.start,n=e.end.isAfter(i.end)?e.end:i.end,r=new ra(o,n);t.push(r)}else t.push(e),t.push(i)}return t}(n),{backward:i.isBackward})}(t,e))}function fc(e,t){return e.isCollapsed?function(e,t){const i=e.start,o=t.getNearestSelectionRange(i);if(!o)return null;if(!o.isCollapsed)return o;const n=o.start;if(i.isEqual(n))return null;return new ra(n)}(e,t):function(e,t){const{start:i,end:o}=e,n=t.checkChild(i,"$text"),r=t.checkChild(o,"$text"),s=t.getLimitElement(i),a=t.getLimitElement(o);if(s===a){if(n&&r)return null;if(function(e,t,i){const o=e.nodeAfter&&!i.isLimit(e.nodeAfter)||i.checkChild(e,"$text"),n=t.nodeBefore&&!i.isLimit(t.nodeBefore)||i.checkChild(t,"$text");return o||n}(i,o,t)){const e=i.nodeAfter&&t.isSelectable(i.nodeAfter)?null:t.getNearestSelectionRange(i,"forward"),n=o.nodeBefore&&t.isSelectable(o.nodeBefore)?null:t.getNearestSelectionRange(o,"backward"),r=e?e.start:i,s=n?n.end:o;return new ra(r,s)}}const l=s&&!s.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=i.nodeAfter&&o.nodeBefore&&i.nodeAfter.parent===o.nodeBefore.parent,n=l&&(!e||!bc(i.nodeAfter,t)),r=c&&(!e||!bc(o.nodeBefore,t));let d=i,h=o;return n&&(d=ta._createBefore(pc(s,t))),r&&(h=ta._createAfter(pc(a,t))),new ra(d,h)}return null}(e,t)}function pc(e,t){let i=e,o=i;for(;t.isLimit(o)&&o.parent;)i=o,o=o.parent;return i}function bc(e,t){return e&&t.isSelectable(e)}class wc{constructor(){this.markers=new Ql,this.document=new Jl(this),this.schema=new Ka,this._pendingChanges=[],this._currentWriter=null,["insertContent","deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$block",{allowIn:"$root",isBlock:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if("$marker"===t.name)return!0}),mc(this),this.document.registerPostFixer(Oa)}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new fl,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){l.a.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{"string"==typeof e?e=new fl(e):"function"==typeof e&&(t=e,e=new fl),this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){l.a.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,i){return function(e,t,i,o){return e.change(n=>{let r;r=i?i instanceof ga||i instanceof va?i:n.createSelection(i,o):e.document.selection,r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const s=new nc(e,n,r.anchor);let a;a=t.is("documentFragment")?t.getChildren():[t],s.handleNodes(a);const l=s.getSelectionRange();l&&(r instanceof va?n.setSelection(l):r.setTo(l));const c=s.getAffectedRange()||e.createRange(r.anchor);return s.destroy(),c})}(this,e,t,i)}deleteContent(e,t){rc(this,e,t)}modifySelection(e,t){!function(e,t,i={}){const o=e.schema,n="backward"!=i.direction,r=i.unit?i.unit:"character",s=t.focus,a=new Zs({boundaries:dc(s,n),singleCharacters:!0,direction:n?"forward":"backward"}),l={walker:a,schema:o,isForward:n,unit:r};let c;for(;c=a.next();){if(c.done)return;const i=cc(l,c.value);if(i)return void(t instanceof va?e.change(e=>{e.setSelectionFocus(i)}):t.setFocus(i))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change(e=>{const i=e.createDocumentFragment(),o=t.getFirstRange();if(!o||o.isCollapsed)return i;const n=o.start.root,r=o.start.getCommonPath(o.end),s=n.getNodeByPath(r);let a;a=o.start.parent==o.end.parent?o:e.createRange(e.createPositionAt(s,o.start.path[r.length]),e.createPositionAt(s,o.end.path[r.length]+1));const l=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),i):e.append(e.cloneElement(t,!0),i);if(a!=o){const t=o._getTransformedByMove(a.start,e.createPositionAt(i,0),l)[0],n=e.createRange(e.createPositionAt(i,0),t.start);gc(e.createRange(t.end,e.createPositionAt(i,"end")),e),gc(n,e)}return i})}(this,e)}hasContent(e,t={}){const i=e instanceof Xs?ra._createIn(e):e;if(i.isCollapsed)return!1;const{ignoreWhitespaces:o=!1,ignoreMarkers:n=!1}=t;if(!n)for(const e of this.markers.getMarkersIntersectingRange(i))if(e.affectsData)return!0;for(const e of i.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!o)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}createPositionFromPath(e,t,i){return new ta(e,t,i)}createPositionAt(e,t){return ta._createAt(e,t)}createPositionAfter(e){return ta._createAfter(e)}createPositionBefore(e){return ta._createBefore(e)}createRange(e,t){return new ra(e,t)}createRangeIn(e){return ra._createIn(e)}createRangeOn(e){return ra._createOn(e)}createSelection(e,t,i){return new ga(e,t,i)}createBatch(e){return new fl(e)}createOperationFromJSON(e){return class{static fromJSON(e,t){return ec[e.__className].fromJSON(e,t)}}.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];for(this.fire("_beforeChanges");this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new Bl(this,t);const i=this._pendingChanges[0].callback(this._currentWriter);e.push(i),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),e}}Ye(wc,qe);class kc extends Ms{constructor(e){super(),this.editor=e}set(e,t,i={}){if("string"==typeof t){const e=t;t=(t,i)=>{this.editor.execute(e),i()}}super.set(e,t,i)}}class _c{constructor(e={}){this._context=e.context||new so({language:e.language}),this._context._addEditor(this,!e.context);const t=Array.from(this.constructor.builtinPlugins||[]);this.config=new Ji(e,this.constructor.defaultConfig),this.config.define("plugins",t),this.config.define(this._context._getEditorConfig()),this.plugins=new eo(this,t,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this.commands=new qa,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.set("isReadOnly",!1),this.model=new wc;const i=new Xo;this.data=new hl(this.model,i),this.editing=new Wa(this.model,i),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new ul([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new kc(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],o=e.get("extraPlugins")||[],n=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(o),i,n)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise(e=>this.once("ready",e))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(...e){try{return this.commands.execute(...e)}catch(e){l.a.rethrowUnexpectedError(e,this)}}focus(){this.editing.view.focus()}}Ye(_c,qe);class vc{constructor(e){this.editor=e,this._components=new Map}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(yc(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new l.a("componentfactory-item-missing",this,{name:e});return this._components.get(yc(e)).callback(this.editor.locale)}has(e){return this._components.has(yc(e))}}function yc(e){return String(e).toLowerCase()}class xc{constructor(e){this.editor=e,this.componentFactory=new vc(e),this.focusTracker=new zs,this.set("viewportOffset",this._readViewportOffsetFromConfig()),this._editableElementsMap=new Map,this.listenTo(e.editing.view.document,"layoutChanged",()=>this.update())}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null;this._editableElementsMap=new Map}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const i=e.config.get("toolbar.viewportTopOffset");return i?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:i}):{top:0}}}Ye(xc,qe);var Cc={setData(e){this.data.set(e)},getData(e){return this.data.get(e)}};var Ac={updateSourceElement(){if(!this.sourceElement)throw new l.a("editor-missing-sourceelement",this);Rs(this.sourceElement,this.data.get())}};class Tc extends ao{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new Zi({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new l.a("pendingactions-add-invalid-message",this);const t=Object.create(qe);return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}var Ec='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',Pc='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',Sc='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',Ic='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>';const Rc={cancel:Ec,caption:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z"/><path d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z" fill-opacity=".6"/></svg>',check:Pc,cog:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.333 2 .19 2.263a5.899 5.899 0 0 1 1.458.604L14.714 3.4 16.6 5.286l-1.467 1.733c.263.452.468.942.605 1.46L18 8.666v2.666l-2.263.19a5.899 5.899 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a5.899 5.899 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a5.899 5.899 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a5.899 5.899 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a5.899 5.899 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a5.899 5.899 0 0 1 1.46-.605L8.666 2h2.666zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466z"/></svg>',eraser:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',lowVision:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z"/></svg>',image:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.91 10.54c.26-.23.64-.21.88.03l3.36 3.14 2.23-2.06a.64.64 0 0 1 .87 0l2.52 2.97V4.5H3.2v10.12l3.71-4.08zm10.27-7.51c.6 0 1.09.47 1.09 1.05v11.84c0 .59-.49 1.06-1.09 1.06H2.79c-.6 0-1.09-.47-1.09-1.06V4.08c0-.58.49-1.05 1.1-1.05h14.38zm-5.22 5.56a1.96 1.96 0 1 1 3.4-1.96 1.96 1.96 0 0 1-3.4 1.96z"/></svg>',alignBottom:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>',alignMiddle:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',alignTop:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',alignLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',alignCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',alignRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',alignJustify:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',objectLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z"/></svg>',objectRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectFullWidth:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z"/></svg>',objectInline:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectSizeFull:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2zm0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.489.489 0 0 1-.476-.5V4c0-.276.213-.5.476-.5h16.19z"/></svg>',objectSizeLarge:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M13 6H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5V8a.5.5 0 0 1 .5-.5h11z"/></svg>',objectSizeSmall:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M7 10H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5h5z"/></svg>',objectSizeMedium:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M10 8H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6a.5.5 0 0 1 .5-.5h8z"/></svg>',pencil:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',pilcrow:Sc,quote:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',threeVerticalDots:Ic};function Vc({emitter:e,activator:t,callback:i,contextElements:o}){e.listenTo(document,"mousedown",(e,n)=>{if(!t())return;const r="function"==typeof n.composedPath?n.composedPath():[];for(const e of o)if(e.contains(n.target)||r.includes(e))return;i()})}function Oc(e){e.set("_isCssTransitionsDisabled",!1),e.disableCssTransitions=()=>{e._isCssTransitionsDisabled=!0},e.enableCssTransitions=()=>{e._isCssTransitionsDisabled=!1},e.extendTemplate({attributes:{class:[e.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}function zc({view:e}){e.listenTo(e.element,"submit",(t,i)=>{i.preventDefault(),e.fire("submit")},{useCapture:!0})}class Mc extends Zi{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(e,t,i)=>{this._renderViewIntoCollectionParent(t,i)}),this.on("remove",(e,t)=>{t.element&&this._parentElement&&t.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const e of this)this._renderViewIntoCollectionParent(e)}delegate(...e){if(!e.length||!e.every(e=>"string"==typeof e))throw new l.a("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const i of this)for(const o of e)i.delegate(o).to(t);this.on("add",(i,o)=>{for(const i of e)o.delegate(i).to(t)}),this.on("remove",(i,o)=>{for(const i of e)o.stopDelegating(i,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}}i(18);class Bc{constructor(e){this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Zi,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,i)=>{i.locale=e}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Nc.bind(this,this)}createCollection(e){const t=new Mc(e);return this._viewCollections.add(t),t}registerChild(e){Xi(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){Xi(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Nc(e)}extendTemplate(e){Nc.extend(this.template,e)}render(){if(this.isRendered)throw new l.a("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}}Ye(Bc,Rr),Ye(Bc,qe);class Nc{constructor(e){Object.assign(this,Kc(Uc(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new l.a("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const i of t.children)Xc(i)?yield i:Zc(i)&&(yield*e(i))}(this)}static bind(e,t){return{to:(i,o)=>new Dc({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:o}),if:(i,o,n)=>new Lc({observable:e,emitter:t,attribute:i,valueIfTrue:o,callback:n})}}static extend(e,t){if(e._isRendered)throw new l.a("template-extend-render",[this,e]);!function e(t,i){i.attributes&&(t.attributes||(t.attributes={}),Yc(t.attributes,i.attributes));i.eventListeners&&(t.eventListeners||(t.eventListeners={}),Yc(t.eventListeners,i.eventListeners));i.text&&t.text.push(...i.text);if(i.children&&i.children.length){if(t.children.length!=i.children.length)throw new l.a("ui-template-extend-children-mismatch",t);let o=0;for(const n of i.children)e(t.children[o++],n)}}(e,Kc(Uc(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new l.a("ui-template-wrong-syntax",this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),t}_renderText(e){let t=e.node;return t?e.revertData.text=t.textContent:t=e.node=document.createTextNode(""),Hc(this.text)?this._bindToObservable({schema:this.text,updater:Wc(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){let t,i,o,n;if(!this.attributes)return;const r=e.node,s=e.revertData;for(t in this.attributes)if(o=r.getAttribute(t),i=this.attributes[t],s&&(s.attributes[t]=o),n=w(i[0])&&i[0].ns?i[0].ns:null,Hc(i)){const a=n?i[0].value:i;s&&td(t)&&a.unshift(o),this._bindToObservable({schema:a,updater:qc(r,t,n),data:e})}else"style"==t&&"string"!=typeof i[0]?this._renderStyleAttribute(i[0],e):(s&&o&&td(t)&&i.unshift(o),i=i.map(e=>e&&e.value||e).reduce((e,t)=>e.concat(t),[]).reduce(Jc,""),Qc(i)||r.setAttributeNS(n,t,i))}_renderStyleAttribute(e,t){const i=t.node;for(const o in e){const n=e[o];Hc(n)?this._bindToObservable({schema:[n],updater:$c(i,o),data:t}):i.style[o]=n}}_renderElementChildren(e){const t=e.node,i=e.intoFragment?document.createDocumentFragment():t,o=e.isApplying;let n=0;for(const r of this.children)if(ed(r)){if(!o){r.setParent(t);for(const e of r)i.appendChild(e.element)}}else if(Xc(r))o||(r.isRendered||r.render(),i.appendChild(r.element));else if(pr(r))i.appendChild(r);else if(o){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({node:i.childNodes[n++],isApplying:!0,revertData:t})}else i.appendChild(r.render());e.intoFragment&&t.appendChild(i)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const i=this.eventListeners[t].map(i=>{const[o,n]=t.split("@");return i.activateDomEventListener(o,n,e)});e.revertData&&e.revertData.bindings.push(i)}}_bindToObservable({schema:e,updater:t,data:i}){const o=i.revertData;jc(e,t,i);const n=e.filter(e=>!Qc(e)).filter(e=>e.observable).map(o=>o.activateAttributeListener(e,t,i));o&&o.bindings.push(n)}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)e.textContent=t.text;else{for(const i in t.attributes){const o=t.attributes[i];null===o?e.removeAttribute(i):e.setAttribute(i,o)}for(let i=0;i<t.children.length;++i)this._revertTemplateFromNode(e.childNodes[i],t.children[i])}}}Ye(Nc,h);class Fc{constructor(e){Object.assign(this,e)}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,i){const o=()=>jc(e,t,i);return this.emitter.listenTo(this.observable,"change:"+this.attribute,o),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,o)}}}class Dc extends Fc{activateDomEventListener(e,t,i){const o=(e,i)=>{t&&!i.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(i):this.observable.fire(this.eventNameOrFunction,i))};return this.emitter.listenTo(i.node,e,o),()=>{this.emitter.stopListening(i.node,e,o)}}}class Lc extends Fc{getValue(e){return!Qc(super.getValue(e))&&(this.valueIfTrue||!0)}}function Hc(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(Hc):e instanceof Fc)}function jc(e,t,{node:i}){let o=function(e,t){return e.map(e=>e instanceof Fc?e.getValue(t):e)}(e,i);o=1==e.length&&e[0]instanceof Lc?o[0]:o.reduce(Jc,""),Qc(o)?t.remove():t.set(o)}function Wc(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function qc(e,t,i){return{set(o){e.setAttributeNS(i,t,o)},remove(){e.removeAttributeNS(i,t)}}}function $c(e,t){return{set(i){e.style[t]=i},remove(){e.style[t]=null}}}function Uc(e){return Ki(e,e=>{if(e&&(e instanceof Fc||Zc(e)||Xc(e)||ed(e)))return e})}function Kc(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){e.text=to(e.text)}(e),e.on&&(e.eventListeners=function(e){for(const t in e)Gc(e,t);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const t in e)e[t].value&&(e[t].value=to(e[t].value)),Gc(e,t)}(e.attributes);const t=[];if(e.children)if(ed(e.children))t.push(e.children);else for(const i of e.children)Zc(i)||Xc(i)||pr(i)?t.push(i):t.push(new Nc(i));e.children=t}return e}function Gc(e,t){e[t]=to(e[t])}function Jc(e,t){return Qc(t)?e:Qc(e)?t:`${e} ${t}`}function Yc(e,t){for(const i in t)e[i]?e[i].push(...t[i]):e[i]=t[i]}function Qc(e){return!e&&0!==e}function Xc(e){return e instanceof Bc}function Zc(e){return e instanceof Nc}function ed(e){return e instanceof Mc}function td(e){return"class"==e||"style"==e}class id extends Mc{constructor(e,t=[]){super(t),this.locale=e}attachToDom(){this._bodyCollectionContainer=new Nc({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=ys(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&0==e.childElementCount&&e.remove()}}i(20);class od extends Bc{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon"],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),t=e.getAttribute("viewBox");for(t&&(this.viewBox=t),this.element.innerHTML="";e.childNodes.length>0;)this.element.appendChild(e.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(e=>{e.style.fill=this.fillColor})}}i(22);class nd extends Bc{constructor(e){super(e),this.set("text",""),this.set("position","s");const t=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip",t.to("position",e=>"ck-tooltip_"+e),t.if("text","ck-hidden",e=>!e.trim())]},children:[{tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:t.to("text")}]}]})}}i(24);class rd extends Bc{constructor(e){super(e);const t=this.bindTemplate,i=s();this.set("class"),this.set("labelStyle"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.tooltipView=this._createTooltipView(),this.labelView=this._createLabelView(i),this.iconView=new od,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this)),this.setTemplate({tag:"button",attributes:{class:["ck","ck-button",t.to("class"),t.if("isEnabled","ck-disabled",e=>!e),t.if("isVisible","ck-hidden",e=>!e),t.to("isOn",e=>e?"ck-on":"ck-off"),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],type:t.to("type",e=>e||"button"),tabindex:t.to("tabindex"),"aria-labelledby":"ck-editor__aria-label_"+i,"aria-disabled":t.if("isEnabled",!0,e=>!e),"aria-pressed":t.to("isOn",e=>!!this.isToggleable&&String(e))},children:this.children,on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(e=>{this.isEnabled?this.fire("execute"):e.preventDefault()})}})}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.tooltipView),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}_createTooltipView(){const e=new nd;return e.bind("text").to(this,"_tooltipString"),e.bind("position").to(this,"tooltipPosition"),e}_createLabelView(e){const t=new Bc,i=this.bindTemplate;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:i.to("labelStyle"),id:"ck-editor__aria-label_"+e},children:[{text:this.bindTemplate.to("label")}]}),t}_createKeystrokeView(){const e=new Bc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>Nn(e))}]}),e}_getTooltipString(e,t,i){return e?"string"==typeof e?e:(i&&(i=Nn(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}}i(26);class sd extends rd{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new Bc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}function ad(e,t){const i=e.t,o={Black:i("Black"),"Dim grey":i("Dim grey"),Grey:i("Grey"),"Light grey":i("Light grey"),White:i("White"),Red:i("Red"),Orange:i("Orange"),Yellow:i("Yellow"),"Light green":i("Light green"),Green:i("Green"),Aquamarine:i("Aquamarine"),Turquoise:i("Turquoise"),"Light blue":i("Light blue"),Blue:i("Blue"),Purple:i("Purple")};return t.map(e=>{const t=o[e.label];return t&&t!=e.label&&(e.label=t),e})}function ld(e){return e.map(cd).filter(e=>!!e)}function cd(e){return"string"==typeof e?{model:e,label:e,hasBorder:!1,view:{name:"span",styles:{color:e}}}:{model:e.color,label:e.label||e.color,hasBorder:void 0!==e.hasBorder&&e.hasBorder,view:{name:"span",styles:{color:""+e.color}}}}class dd extends rd{constructor(e){super(e);const t=this.bindTemplate;this.set("color"),this.set("hasBorder"),this.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>',this.extendTemplate({attributes:{style:{backgroundColor:t.to("color")},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-table__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}class hd{constructor(e){if(Object.assign(this,e),e.actions&&e.keystrokeHandler)for(const t in e.actions){let i=e.actions[t];"string"==typeof i&&(i=[i]);for(const o of i)e.keystrokeHandler.set(o,(e,i)=>{this[t](),i()})}}get first(){return this.focusables.find(ud)||null}get last(){return this.focusables.filter(ud).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find((t,i)=>{const o=t.element===this.focusTracker.focusedElement;return o&&(e=i),o}),e)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(e){e&&e.focus()}_getFocusableItem(e){const t=this.current,i=this.focusables.length;if(!i)return null;if(null===t)return this[1===e?"first":"last"];let o=(t+i+e)%i;do{const t=this.focusables.get(o);if(ud(t))return t;o=(o+i+e)%i}while(o!==t);return null}}function ud(e){return!(!e.focus||"none"==vr.window.getComputedStyle(e.element).display)}i(28);class gd extends Bc{constructor(e,t){super(e);const i=t&&t.colorDefinitions||[],o={};t&&t.columns&&(o.gridTemplateColumns=`repeat( ${t.columns}, 1fr)`),this.set("selectedColor"),this.items=this.createCollection(),this.focusTracker=new zs,this.keystrokes=new Ms,this._focusCycler=new hd({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowleft",focusNext:"arrowright"}}),this.items.on("add",(e,t)=>{t.isOn=t.color===this.selectedColor}),i.forEach(e=>{const t=new dd;t.set({color:e.color,label:e.label,tooltip:!0,hasBorder:e.options.hasBorder}),t.on("execute",()=>{this.fire("execute",{value:e.color,hasBorder:e.options.hasBorder,label:e.label})}),this.items.add(t)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:o}}),this.on("change:selectedColor",(e,t,i)=>{for(const e of this.items)e.isOn=e.color===i})}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element)}}var md='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';class fd extends rd{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new od;return e.content=md,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}i(30);class pd extends Bc{constructor(e){super(e);const t=this.bindTemplate;this.set("class"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(),this.arrowView=this._createArrowView(),this.keystrokes=new Ms,this.focusTracker=new zs,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",t.to("class"),t.if("isVisible","ck-hidden",e=>!e),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())}),this.keystrokes.set("arrowleft",(e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())})}focus(){this.actionView.focus()}_createActionView(){const e=new rd;return e.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),e.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),e.delegate("execute").to(this),e}_createArrowView(){const e=new rd,t=e.bindTemplate;return e.icon=md,e.extendTemplate({attributes:{class:"ck-splitbutton__arrow","aria-haspopup":!0,"aria-expanded":t.to("isOn",e=>String(e))}}),e.bind("isEnabled").to(this),e.delegate("execute").to(this,"open"),e}}class bd extends Bc{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",e=>"ck-dropdown__panel_"+e),t.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:t.to(e=>e.preventDefault())}})}focus(){this.children.length&&this.children.first.focus()}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}i(32);function wd({element:e,target:t,positions:i,limiter:o,fitInViewport:n,viewportOffsetConfig:r}){R(t)&&(t=t()),R(o)&&(o=o());const s=function(e){return e&&e.parentNode?e.offsetParent===vr.document.body?null:e.offsetParent:null}(e),a=new Ts(e);let l;const c={targetRect:new Ts(t),elementRect:a,positionedElementAncestor:s};if(o||n){const e=o&&new Ts(o).getVisible(),t=n&&function(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);const t=new Ts(vr.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t}(r);Object.assign(c,{limiterRect:e,viewportRect:t}),l=function(e,t){const{elementRect:i}=t,o=i.getArea(),n=e.map(e=>new _d(e,t)).filter(e=>!!e.name);let r=0,s=null;for(const e of n){const{_limiterIntersectionArea:t,_viewportIntersectionArea:i}=e;if(t===o)return e;const n=i**2+t**2;n>r&&(r=n,s=e)}return s}(i,c)||new _d(i[0],c)}else l=new _d(i[0],c);return l}function kd(e){const{scrollX:t,scrollY:i}=vr.window;return e.clone().moveBy(t,i)}class _d{constructor(e,t){const i=e(t.targetRect,t.elementRect,t.viewportRect);if(!i)return;const{left:o,top:n,name:r,config:s}=i;Object.assign(this,{name:r,config:s}),this._positioningFunctionCorrdinates={left:o,top:n},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get _limiterIntersectionArea(){const e=this._options.limiterRect;if(e){const t=this._options.viewportRect;if(!t)return e.getIntersectionArea(this._rect);{const i=e.getIntersection(t);if(i)return i.getIntersectionArea(this._rect)}}return 0}get _viewportIntersectionArea(){const e=this._options.viewportRect;return e?e.getIntersectionArea(this._rect):0}get _rect(){return this._cachedRect||(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCorrdinates.left,this._positioningFunctionCorrdinates.top)),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||(this._cachedAbsoluteRect=kd(this._rect),this._options.positionedElementAncestor&&function(e,t){const i=kd(new Ts(t)),o=Cs(t);let n=0,r=0;n-=i.left,r-=i.top,n+=t.scrollLeft,r+=t.scrollTop,n-=o.left,r-=o.top,e.moveBy(n,r)}(this._cachedAbsoluteRect,this._options.positionedElementAncestor)),this._cachedAbsoluteRect}}class vd extends Bc{constructor(e,t,i){super(e);const o=this.bindTemplate;this.buttonView=t,this.panelView=i,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("id"),this.set("panelPosition","auto"),this.keystrokes=new Ms,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",o.to("class"),o.if("isEnabled","ck-disabled",e=>!e)],id:o.to("id"),"aria-describedby":o.to("ariaDescribedById")},children:[t,i]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"]}})}render(){super.render(),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",()=>{this.isOpen&&("auto"===this.panelPosition?this.panelView.position=vd._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions}).name:this.panelView.position=this.panelPosition)}),this.keystrokes.listenTo(this.element);const e=(e,t)=>{this.isOpen&&(this.buttonView.focus(),this.isOpen=!1,t())};this.keystrokes.set("arrowdown",(e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())}),this.keystrokes.set("arrowright",(e,t)=>{this.isOpen&&t()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:i,southWest:o,northEast:n,northWest:r,southMiddleEast:s,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=vd.defaultPanelPositions;return"rtl"!==this.locale.uiLanguageDirection?[i,o,s,a,e,n,r,l,c,t]:[o,i,a,s,e,r,n,c,l,t]}}vd.defaultPanelPositions={south:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/2,name:"s"}),southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),southMiddleEast:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/4,name:"sme"}),southMiddleWest:(e,t)=>({top:e.bottom,left:e.left-3*(t.width-e.width)/4,name:"smw"}),north:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/2,name:"n"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),northMiddleEast:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/4,name:"nme"}),northMiddleWest:(e,t)=>({top:e.top-t.height,left:e.left-3*(t.width-e.width)/4,name:"nmw"})},vd._getOptimalPosition=wd;class yd extends Bc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class xd extends Bc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function Cd(e){return Array.isArray(e)?{items:e,removeItems:[]}:e?Object.assign({items:[],removeItems:[]},e):{items:[],removeItems:[]}}i(34);class Ad extends Bc{constructor(e,t){super(e);const i=this.bindTemplate,o=this.t;this.options=t||{},this.set("ariaLabel",o("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new zs,this.keystrokes=new Ms,this.set("class"),this.set("isCompact",!1),this.itemsView=new Td(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const n="rtl"===e.uiLanguageDirection;this._focusCycler=new hd({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[n?"arrowright":"arrowleft","arrowup"],focusNext:[n?"arrowleft":"arrowright","arrowdown"]}});const r=["ck","ck-toolbar",i.to("class"),i.if("isCompact","ck-toolbar_compact")];var s;this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:"toolbar","aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")}},children:this.children,on:{mousedown:(s=this,s.bindTemplate.to(e=>{e.target===s.element&&e.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new Pd(this):new Ed(this)}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t){const i=Cd(e),o=i.items.filter((e,o,n)=>"|"===e||-1===i.removeItems.indexOf(e)&&("-"===e?!this.options.shouldGroupWhenFull||(Object(l.b)("toolbarview-line-break-ignored-when-grouping-items",n),!1):!!t.has(e)||(Object(l.b)("toolbarview-item-unavailable",{name:e}),!1))),n=this._cleanSeparators(o).map(e=>"|"===e?new yd:"-"===e?new xd:t.create(e));this.items.addMany(n)}_cleanSeparators(e){const t=e=>"-"!==e&&"|"!==e,i=e.length,o=e.findIndex(t),n=i-e.slice().reverse().findIndex(t);return e.slice(o,n).filter((e,i,o)=>{if(t(e))return!0;return!(i>0&&o[i-1]===e)})}}class Td extends Bc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Ed{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(e=>e),e.focusables.bindTo(e.items).using(e=>e),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Pd{constructor(e){this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,e.itemsView.children.bindTo(this.ungroupedItems).using(e=>e),this.ungroupedItems.on("add",this._updateFocusCycleableItems.bind(this)),this.ungroupedItems.on("remove",this._updateFocusCycleableItems.bind(this)),e.children.on("add",this._updateFocusCycleableItems.bind(this)),e.children.on("remove",this._updateFocusCycleableItems.bind(this)),e.items.on("change",(e,t)=>{const i=t.index;for(const e of t.removed)i>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=i;e<i+t.added.length;e++){const o=t.added[e-i];e>this.ungroupedItems.length?this.groupedItems.add(o,e-this.ungroupedItems.length):this.ungroupedItems.add(o,e)}this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!this.viewElement.offsetParent)return void(this.shouldUpdateGroupingOnNextResize=!0);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,i=new Ts(e.lastChild),o=new Ts(e);if(!this.cachedPadding){const i=vr.window.getComputedStyle(e),o="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(i[o])}return"ltr"===t?i.right>o.right-this.cachedPadding:i.left<o.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new Ss(this.viewElement,t=>{e&&e===t.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new yd),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,i=Vd(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",Od(i,[]),i.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:"rtl"===e.uiLanguageDirection?"se":"sw",icon:Ic}),i.toolbarView.items.bindTo(this.groupedItems).using(e=>e),i}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}i(36);class Sd extends Bc{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new zs,this.keystrokes=new Ms,this._focusCycler=new hd({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"]},children:this.items})}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class Id extends Bc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item"]},children:this.children})}focus(){this.children.first.focus()}}class Rd extends Bc{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}i(38),i(40);function Vd(e,t=fd){const i=new t(e),o=new bd(e),n=new vd(e,i,o);return i.bind("isEnabled").to(n),i instanceof fd?i.bind("isOn").to(n,"isOpen"):i.arrowView.bind("isOn").to(n,"isOpen"),function(e){(function(e){e.on("render",()=>{Vc({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})})})(e),function(e){e.on("execute",t=>{t.source instanceof sd||(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(t,i)=>{e.isOpen&&(e.panelView.focus(),i())}),e.keystrokes.set("arrowup",(t,i)=>{e.isOpen&&(e.panelView.focusLast(),i())})}(e)}(n),n}function Od(e,t){const i=e.locale,o=i.t,n=e.toolbarView=new Ad(i);n.set("ariaLabel",o("Dropdown toolbar")),e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),t.map(e=>n.items.add(e)),e.panelView.children.add(n),n.items.delegate("execute").to(e)}function zd(e,t){const i=e.locale,o=e.listView=new Sd(i);o.items.bindTo(t).using(({type:e,model:t})=>{if("separator"===e)return new Rd(i);if("button"===e||"switchbutton"===e){const o=new Id(i);let n;return n="button"===e?new rd(i):new sd(i),n.bind(...Object.keys(t)).to(t),n.delegate("execute").to(o),o.children.add(n),o}}),e.panelView.children.add(o),o.items.delegate("execute").to(e)}i(42);class Md extends Bc{constructor(e){super(e),this.body=new id(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}i(44);class Bd extends Bc{constructor(e){super(e),this.set("text"),this.set("for"),this.id="ck-editor__label_"+s();const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}class Nd extends Bc{constructor(e,t,i){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.name=null,this.set("isFocused",!1),this._editableElement=i,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change(i=>{const o=e.document.getRoot(t.name);i.addClass(t.isFocused?"ck-focused":"ck-blurred",o),i.removeClass(t.isFocused?"ck-blurred":"ck-focused",o)})}e.isRenderingInProgress?function i(o){e.once("change:isRenderingInProgress",(e,n,r)=>{r?i(o):t(o)})}(this):t(this)}}class Fd extends Nd{constructor(e,t,i){super(e,t,i),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView,t=this.t;e.change(i=>{const o=e.document.getRoot(this.name);i.setAttribute("aria-label",t("Rich Text Editor, %0",this.name),o)})}}i(46);class Dd extends Bc{constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("label",t.label||""),this.set("class",t.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",i.to("class")]},children:this.children});const o=new Bc(e);o.setTemplate({tag:"span",attributes:{class:["ck","ck-form__header__label"]},children:[{text:i.to("label")}]}),this.children.add(o)}}i(48);class Ld extends Bc{constructor(e){super(e),this.set("value"),this.set("id"),this.set("placeholder"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById"),this.focusTracker=new zs,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{type:"text",class:["ck","ck-input","ck-input-text",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},on:{input:t.to("input"),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",(e,t,i)=>{this._setDomElementValue(i),this._updateIsEmpty()})}select(){this.element.select()}focus(){this.element.focus()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||0===e?e:""}}i(50);class Hd extends Bc{constructor(e,t){super(e);const i="ck-labeled-field-view-"+s(),o="ck-labeled-field-view-status-"+s();this.fieldView=t(this,i,o),this.set("label"),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class"),this.set("placeholder"),this.labelView=this._createLabelView(i),this.statusView=this._createStatusView(o),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,t)=>e||t);const n=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",n.to("class"),n.if("isEnabled","ck-disabled",e=>!e),n.if("isEmpty","ck-labeled-field-view_empty"),n.if("isFocused","ck-labeled-field-view_focused"),n.if("placeholder","ck-labeled-field-view_placeholder"),n.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:[this.fieldView,this.labelView]},this.statusView]})}_createLabelView(e){const t=new Bd(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new Bc(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",i.if("errorText","ck-labeled-field-view__status_error"),i.if("_statusText","ck-hidden",e=>!e)],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}function jd(e,t,i){const o=new Ld(e.locale);return o.set({id:t,ariaDescribedById:i}),o.bind("isReadOnly").to(e,"isEnabled",e=>!e),o.bind("hasError").to(e,"errorText",e=>!!e),o.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused","placeholder").to(o),o}function Wd(e,t,i){const o=Vd(e.locale);return o.set({id:t,ariaDescribedById:i}),o.bind("isEnabled").to(e),o}class qd extends ao{static get pluginName(){return"Notification"}init(){this.on("show:warning",(e,t)=>{window.alert(t.message)},{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t="show:"+e.type+(e.namespace?":"+e.namespace:"");this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}class $d{constructor(e,t){t&&Ne(this,t),e&&this.set(e)}}Ye($d,qe);i(52);const Ud=Vs("px"),Kd=vr.document.body;class Gd extends Bc{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class"),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",e=>"ck-balloon-panel_"+e),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",Ud),left:t.to("left",Ud)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=Gd.defaultPositions,i=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast,t.viewportStickyNorth],limiter:Kd,fitInViewport:!0},e),o=Gd._getOptimalPosition(i),n=parseInt(o.left),r=parseInt(o.top),{name:s,config:a={}}=o,{withArrow:l=!0}=a;Object.assign(this,{top:r,left:n,position:s,withArrow:l})}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){this.attachTo(e);const t=Jd(e.target),i=e.limiter?Jd(e.limiter):Kd;this.listenTo(vr.document,"scroll",(o,n)=>{const r=n.target,s=t&&r.contains(t),a=i&&r.contains(i);!s&&!a&&t&&i||this.attachTo(e)},{useCapture:!0}),this.listenTo(vr.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(vr.document,"scroll"),this.stopListening(vr.window,"resize")}}function Jd(e){return Gi(e)?e:xs(e)?e.commonAncestorContainer:"function"==typeof e?Jd(e()):null}function Yd(e,t){return e.top-t.height-Gd.arrowVerticalOffset}function Qd(e){return e.bottom+Gd.arrowVerticalOffset}Gd.arrowHorizontalOffset=25,Gd.arrowVerticalOffset=10,Gd.stickyVerticalOffset=20,Gd._getOptimalPosition=wd,Gd.defaultPositions={northWestArrowSouthWest:(e,t)=>({top:Yd(e,t),left:e.left-Gd.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthMiddleWest:(e,t)=>({top:Yd(e,t),left:e.left-.25*t.width-Gd.arrowHorizontalOffset,name:"arrow_smw"}),northWestArrowSouth:(e,t)=>({top:Yd(e,t),left:e.left-t.width/2,name:"arrow_s"}),northWestArrowSouthMiddleEast:(e,t)=>({top:Yd(e,t),left:e.left-.75*t.width+Gd.arrowHorizontalOffset,name:"arrow_sme"}),northWestArrowSouthEast:(e,t)=>({top:Yd(e,t),left:e.left-t.width+Gd.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-Gd.arrowHorizontalOffset,name:"arrow_sw"}),northArrowSouthMiddleWest:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-.25*t.width-Gd.arrowHorizontalOffset,name:"arrow_smw"}),northArrowSouth:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s"}),northArrowSouthMiddleEast:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-.75*t.width+Gd.arrowHorizontalOffset,name:"arrow_sme"}),northArrowSouthEast:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-t.width+Gd.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(e,t)=>({top:Yd(e,t),left:e.right-Gd.arrowHorizontalOffset,name:"arrow_sw"}),northEastArrowSouthMiddleWest:(e,t)=>({top:Yd(e,t),left:e.right-.25*t.width-Gd.arrowHorizontalOffset,name:"arrow_smw"}),northEastArrowSouth:(e,t)=>({top:Yd(e,t),left:e.right-t.width/2,name:"arrow_s"}),northEastArrowSouthMiddleEast:(e,t)=>({top:Yd(e,t),left:e.right-.75*t.width+Gd.arrowHorizontalOffset,name:"arrow_sme"}),northEastArrowSouthEast:(e,t)=>({top:Yd(e,t),left:e.right-t.width+Gd.arrowHorizontalOffset,name:"arrow_se"}),southWestArrowNorthWest:(e,t)=>({top:Qd(e),left:e.left-Gd.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthMiddleWest:(e,t)=>({top:Qd(e),left:e.left-.25*t.width-Gd.arrowHorizontalOffset,name:"arrow_nmw"}),southWestArrowNorth:(e,t)=>({top:Qd(e),left:e.left-t.width/2,name:"arrow_n"}),southWestArrowNorthMiddleEast:(e,t)=>({top:Qd(e),left:e.left-.75*t.width+Gd.arrowHorizontalOffset,name:"arrow_nme"}),southWestArrowNorthEast:(e,t)=>({top:Qd(e),left:e.left-t.width+Gd.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(e,t)=>({top:Qd(e),left:e.left+e.width/2-Gd.arrowHorizontalOffset,name:"arrow_nw"}),southArrowNorthMiddleWest:(e,t)=>({top:Qd(e),left:e.left+e.width/2-.25*t.width-Gd.arrowHorizontalOffset,name:"arrow_nmw"}),southArrowNorth:(e,t)=>({top:Qd(e),left:e.left+e.width/2-t.width/2,name:"arrow_n"}),southArrowNorthMiddleEast:(e,t)=>({top:Qd(e),left:e.left+e.width/2-.75*t.width+Gd.arrowHorizontalOffset,name:"arrow_nme"}),southArrowNorthEast:(e,t)=>({top:Qd(e),left:e.left+e.width/2-t.width+Gd.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(e,t)=>({top:Qd(e),left:e.right-Gd.arrowHorizontalOffset,name:"arrow_nw"}),southEastArrowNorthMiddleWest:(e,t)=>({top:Qd(e),left:e.right-.25*t.width-Gd.arrowHorizontalOffset,name:"arrow_nmw"}),southEastArrowNorth:(e,t)=>({top:Qd(e),left:e.right-t.width/2,name:"arrow_n"}),southEastArrowNorthMiddleEast:(e,t)=>({top:Qd(e),left:e.right-.75*t.width+Gd.arrowHorizontalOffset,name:"arrow_nme"}),southEastArrowNorthEast:(e,t)=>({top:Qd(e),left:e.right-t.width+Gd.arrowHorizontalOffset,name:"arrow_ne"}),viewportStickyNorth:(e,t,i)=>e.getIntersection(i)?{top:i.top+Gd.stickyVerticalOffset,left:e.left+e.width/2-t.width/2,name:"arrowless",config:{withArrow:!1}}:null};var Xd='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>';i(54),i(56);const Zd=Vs("px");class eh extends Qe{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.set("visibleView",null),this.view=new Gd(e.locale),e.ui.view.body.add(this.view),e.ui.focusTracker.add(this.view.element),this._viewToStack=new Map,this._idToStack=new Map,this.set("_numberOfStacks",0),this.set("_singleViewMode",!1),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this.hasView(e.view))throw new l.a("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t))return this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(t));const i=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),i.set(e.view,e),this._viewToStack.set(e.view,i),i===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new l.a("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===t.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),1===t.size?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new l.a("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(t=>t[1]===e)[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new th(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(e,i)=>{if(i<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[o,i])}),e.buttonNextView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),e.buttonPrevView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),e}_createFakePanelsView(){const e=new ih(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>=2?Math.min(e-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:i=!0,singleViewMode:o=!1}){this.view.class=t,this.view.withArrow=i,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),o&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.config.get("ui.viewportOffset")})),e}}class th extends Bc{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new zs,this.buttonPrevView=this._createButtonView(t("Previous"),Xd),this.buttonNextView=this._createButtonView(t("Next"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>'),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",i.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:i.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const i=new rd(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i}}class ih extends Bc{constructor(e,t){super(e);const i=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",i.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:i.to("top",Zd),left:i.to("left",Zd),width:i.to("width",Zd),height:i.to("height",Zd)}},children:this.content}),this.on("change:numberOfPanels",(e,t,i,o)=>{i>o?this._addPanels(i-o):this._removePanels(o-i),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new Bc;e.setTemplate({tag:"div"}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){const e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:i,height:o}=new Ts(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:o})}}}i(58);Vs("px");const oh=Vs("px");class nh extends Qe{static get pluginName(){return"BalloonToolbar"}static get requires(){return[eh]}constructor(e){super(e),this._balloonConfig=Cd(e.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new zs,e.ui.once("ready",()=>{this.focusTracker.add(e.ui.getEditableElement()),this.focusTracker.add(this.toolbarView.element)}),this._resizeObserver=null,this._balloon=e.plugins.get(eh),this._fireSelectionChangeDebounced=fs(()=>this.fire("_selectionChangeDebounced"),200),this.decorate("show")}init(){const e=this.editor,t=e.model.document.selection;this.listenTo(this.focusTracker,"change:isFocused",(e,t,i)=>{const o=this._balloon.visibleView===this.toolbarView;!i&&o?this.hide():i&&this.show()}),this.listenTo(t,"change:range",(e,i)=>{(i.directChange||t.isCollapsed)&&this.hide(),this._fireSelectionChangeDebounced()}),this.listenTo(this,"_selectionChangeDebounced",()=>{this.editor.editing.view.document.isFocused&&this.show()}),this._balloonConfig.shouldNotGroupWhenFull||this.listenTo(e,"ready",()=>{const t=e.ui.view.editable.element;this._resizeObserver=new Ss(t,()=>{this.toolbarView.maxWidth=oh(.9*new Ts(t).width)})}),this.listenTo(this.toolbarView,"groupedItemsUpdate",()=>{this._updatePosition()})}afterInit(){const e=this.editor.ui.componentFactory;this.toolbarView.fillFromConfig(this._balloonConfig,e)}_createToolbarView(){const e=!this._balloonConfig.shouldNotGroupWhenFull,t=new Ad(this.editor.locale,{shouldGroupWhenFull:e,isFloating:!0});return t.render(),t}show(){const e=this.editor,t=e.model.document.selection,i=e.model.schema;this._balloon.hasView(this.toolbarView)||t.isCollapsed||function(e,t){if(1===e.rangeCount)return!1;return[...e.getRanges()].every(e=>{const i=e.getContainedElement();return i&&t.isSelectable(i)})}(t,i)||Array.from(this.toolbarView.items).every(e=>void 0!==e.isEnabled&&!e.isEnabled)||(this.listenTo(this.editor.ui,"update",()=>{this._updatePosition()}),this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"}))}hide(){this._balloon.hasView(this.toolbarView)&&(this.stopListening(this.editor.ui,"update"),this._balloon.remove(this.toolbarView))}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document,i=t.selection,o=t.selection.isBackward;return{target:()=>{const t=o?i.getFirstRange():i.getLastRange(),n=Ts.getDomRangeRects(e.domConverter.viewRangeToDom(t));return o?n[0]:(n.length>1&&0===n[n.length-1].width&&n.pop(),n[n.length-1])},positions:rh(o)}}_updatePosition(){this._balloon.updatePosition(this._getBalloonPositionData())}destroy(){super.destroy(),this.stopListening(),this._fireSelectionChangeDebounced.cancel(),this.toolbarView.destroy(),this.focusTracker.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}}function rh(e){const t=Gd.defaultPositions;return e?[t.northWestArrowSouth,t.northWestArrowSouthWest,t.northWestArrowSouthEast,t.northWestArrowSouthMiddleEast,t.northWestArrowSouthMiddleWest,t.southWestArrowNorth,t.southWestArrowNorthWest,t.southWestArrowNorthEast,t.southWestArrowNorthMiddleWest,t.southWestArrowNorthMiddleEast]:[t.southEastArrowNorth,t.southEastArrowNorthEast,t.southEastArrowNorthWest,t.southEastArrowNorthMiddleEast,t.southEastArrowNorthMiddleWest,t.northEastArrowSouth,t.northEastArrowSouthEast,t.northEastArrowSouthWest,t.northEastArrowSouthMiddleEast,t.northEastArrowSouthMiddleWest]}i(60);const sh=Vs("px");class ah extends rd{constructor(e){super(e);const t=this.bindTemplate;this.isVisible=!1,this.isToggleable=!0,this.set("top",0),this.set("left",0),this.extendTemplate({attributes:{class:"ck-block-toolbar-button",style:{top:t.to("top",e=>sh(e)),left:t.to("left",e=>sh(e))}}})}}const lh=Vs("px");i(62);const ch=new WeakMap;function dh(e){const{view:t,element:i,text:o,isDirectHost:n=!0,keepOnFocus:r=!1}=e,s=t.document;ch.has(s)||(ch.set(s,new Map),s.registerPostFixer(e=>uh(s,e))),ch.get(s).set(i,{text:o,isDirectHost:n,keepOnFocus:r,hostElement:n?i:null}),t.change(e=>uh(s,e))}function hh(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function uh(e,t){const i=ch.get(e),o=[];let n=!1;for(const[e,r]of i)r.isDirectHost&&(o.push(e),gh(t,e,r)&&(n=!0));for(const[e,r]of i){if(r.isDirectHost)continue;const i=mh(e);i&&(o.includes(i)||(r.hostElement=i,gh(t,e,r)&&(n=!0)))}return n}function gh(e,t,i){const{text:o,isDirectHost:n,hostElement:r}=i;let s=!1;r.getAttribute("data-placeholder")!==o&&(e.setAttribute("data-placeholder",o,r),s=!0);return(n||1==t.childCount)&&function(e,t){if(!e.isAttached())return!1;if(Array.from(e.getChildren()).some(e=>!e.is("uiElement")))return!1;if(t)return!0;const i=e.document;if(!i.isFocused)return!0;const o=i.selection.anchor;return o&&o.parent!==e}(r,i.keepOnFocus)?function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,r)&&(s=!0):hh(e,r)&&(s=!0),s}function mh(e){if(e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement"))return t}return null}const fh=new Map;function ph(e,t,i){let o=fh.get(e);o||(o=new Map,fh.set(e,o)),o.set(t,i)}function bh(e){return[e]}function wh(e,t,i={}){const o=function(e,t){const i=fh.get(e);return i&&i.has(t)?i.get(t):bh}(e.constructor,t.constructor);try{return o(e=e.clone(),t,i)}catch(e){throw e}}function kh(e,t,i){e=e.slice(),t=t.slice();const o=new _h(i.document,i.useRelations,i.forceWeakRemove);o.setOriginalOperations(e),o.setOriginalOperations(t);const n=o.originalOperations;if(0==e.length||0==t.length)return{operationsA:e,operationsB:t,originalOperations:n};const r=new WeakMap;for(const t of e)r.set(t,0);const s={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:t.length};let a=0;for(;a<e.length;){const i=e[a],n=r.get(i);if(n==t.length){a++;continue}const s=t[n],l=wh(i,s,o.getContext(i,s,!0)),c=wh(s,i,o.getContext(s,i,!1));o.updateRelation(i,s),o.setOriginalOperations(l,i),o.setOriginalOperations(c,s);for(const e of l)r.set(e,n+c.length);e.splice(a,1,...l),t.splice(n,1,...c)}if(i.padWithNoOps){const i=e.length-s.originalOperationsACount,o=t.length-s.originalOperationsBCount;yh(e,o-i),yh(t,i-o)}return vh(e,s.nextBaseVersionB),vh(t,s.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:n}}class _h{constructor(e,t,i=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!i,this._relations=new Map}setOriginalOperations(e,t=null){const i=t?this.originalOperations.get(t):null;for(const t of e)this.originalOperations.set(t,i||t)}updateRelation(e,t){switch(e.constructor){case Pl:switch(t.constructor){case Ol:e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter");break;case Pl:e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter")}break;case zl:switch(t.constructor){case Ol:e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");break;case Pl:if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const i=ra._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const o=i.end.offset-e.splitPosition.offset,n=e.splitPosition.offset-i.start.offset;this._setRelation(e,t,{howMany:o,offset:n})}}}break;case Ol:switch(t.constructor){case Ol:e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement");break;case zl:e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource")}break;case Il:{const i=e.newRange;if(!i)return;switch(t.constructor){case Pl:{const o=ra._createFromPositionAndShift(t.sourcePosition,t.howMany),n=o.containsPosition(i.start)||o.start.isEqual(i.start),r=o.containsPosition(i.end)||o.end.isEqual(i.end);!n&&!r||o.containsRange(i)||this._setRelation(e,t,{side:n?"left":"right",path:n?i.start.path.slice():i.end.path.slice()});break}case Ol:{const o=i.start.isEqual(t.targetPosition),n=i.start.isEqual(t.deletionPosition),r=i.end.isEqual(t.deletionPosition),s=i.end.isEqual(t.sourcePosition);(o||n||r||s)&&this._setRelation(e,t,{wasInLeftElement:o,wasStartBeforeMergedElement:n,wasEndBeforeMergedElement:r,wasInRightElement:s});break}}break}}}getContext(e,t,i){return{aIsStrong:i,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const i=this.originalOperations.get(t),o=this._history.getUndoneOperation(i);if(!o)return null;const n=this.originalOperations.get(e),r=this._relations.get(n);return r&&r.get(o)||null}_setRelation(e,t,i){const o=this.originalOperations.get(e),n=this.originalOperations.get(t);let r=this._relations.get(o);r||(r=new Map,this._relations.set(o,r)),r.set(n,i)}}function vh(e,t){for(const i of e)i.baseVersion=t++}function yh(e,t){for(let i=0;i<t;i++)e.push(new Zl(0))}function xh(e,t,i){const o=e.nodes.getNode(0).getAttribute(t);if(o==i)return null;const n=new ra(e.position,e.position.getShiftedBy(e.howMany));return new Tl(n,t,o,i,0)}function Ch(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function Ah(e,t){const i=[];for(let o=0;o<e.length;o++){const n=e[o],r=new Pl(n.start,n.end.offset-n.start.offset,t,0);i.push(r);for(let t=o+1;t<e.length;t++)e[t]=e[t]._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)[0];t=t._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)}return i}ph(Tl,Tl,(e,t,i)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const o=e.range.getDifference(t.range).map(t=>new Tl(t,e.key,e.oldValue,e.newValue,0)),n=e.range.getIntersection(t.range);return n&&i.aIsStrong&&o.push(new Tl(n,t.key,t.newValue,e.newValue,0)),0==o.length?[new Zl(0)]:o}return[e]}),ph(Tl,Sl,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const i=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(t=>new Tl(t,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){const o=xh(t,e.key,e.oldValue);o&&i.unshift(o)}return i}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]}),ph(Tl,Ol,(e,t)=>{const i=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&i.push(ra._createFromPositionAndShift(t.graveyardPosition,1));const o=e.range._getTransformedByMergeOperation(t);return o.isCollapsed||i.push(o),i.map(t=>new Tl(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),ph(Tl,Pl,(e,t)=>function(e,t){const i=ra._createFromPositionAndShift(t.sourcePosition,t.howMany);let o=null,n=[];i.containsRange(e,!0)?o=e:e.start.hasSameParentAs(i.start)?(n=e.getDifference(i),o=e.getIntersection(i)):n=[e];const r=[];for(let e of n){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const i=t.getMovedRangeStart(),o=e.start.hasSameParentAs(i);e=e._getTransformedByInsertion(i,t.howMany,o),r.push(...e)}o&&r.push(o._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]);return r}(e.range,t).map(t=>new Tl(t,e.key,e.oldValue,e.newValue,e.baseVersion))),ph(Tl,zl,(e,t)=>{if(e.range.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.range.end.offset++,[e];if(e.range.start.hasSameParentAs(t.splitPosition)&&e.range.containsPosition(t.splitPosition)){const i=e.clone();return i.range=new ra(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,i]}return e.range=e.range._getTransformedBySplitOperation(t),[e]}),ph(Sl,Tl,(e,t)=>{const i=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const o=xh(e,t.key,t.newValue);o&&i.push(o)}return i}),ph(Sl,Sl,(e,t,i)=>(e.position.isEqual(t.position)&&i.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e])),ph(Sl,Pl,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),ph(Sl,zl,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e])),ph(Sl,Ol,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e])),ph(Il,Sl,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e])),ph(Il,Il,(e,t,i)=>{if(e.name==t.name){if(!i.aIsStrong)return[new Zl(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]}),ph(Il,Ol,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e])),ph(Il,Pl,(e,t,i)=>{if(e.oldRange&&(e.oldRange=ra._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){if(i.abRelation){const o=ra._createFromRanges(e.newRange._getTransformedByMoveOperation(t));if("left"==i.abRelation.side&&t.targetPosition.isEqual(e.newRange.start))return e.newRange.start.path=i.abRelation.path,e.newRange.end=o.end,[e];if("right"==i.abRelation.side&&t.targetPosition.isEqual(e.newRange.end))return e.newRange.start=o.start,e.newRange.end.path=i.abRelation.path,[e]}e.newRange=ra._createFromRanges(e.newRange._getTransformedByMoveOperation(t))}return[e]}),ph(Il,zl,(e,t,i)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(i.abRelation){const o=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&i.abRelation.wasStartBeforeMergedElement?e.newRange.start=ta._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!i.abRelation.wasInLeftElement&&(e.newRange.start=ta._createAt(t.moveTargetPosition)),e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasInRightElement?e.newRange.end=ta._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasEndBeforeMergedElement?e.newRange.end=ta._createAt(t.insertionPosition):e.newRange.end=o.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]}),ph(Ol,Sl,(e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e])),ph(Ol,Ol,(e,t,i)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(i.bWasUndone){const i=t.graveyardPosition.path.slice();return i.push(0),e.sourcePosition=new ta(t.graveyardPosition.root,i),e.howMany=0,[e]}return[new Zl(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!i.bWasUndone&&"splitAtSource"!=i.abRelation){const o="$graveyard"==e.targetPosition.root.rootName,n="$graveyard"==t.targetPosition.root.rootName,r=o&&!n;if(n&&!o||!r&&i.aIsStrong){const i=t.targetPosition._getTransformedByMergeOperation(t),o=e.targetPosition._getTransformedByMergeOperation(t);return[new Pl(i,e.howMany,o,0)]}return[new Zl(0)]}return e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(t),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),e.graveyardPosition.isEqual(t.graveyardPosition)&&i.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),ph(Ol,Pl,(e,t,i)=>{const o=ra._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!i.bWasUndone&&!i.forceWeakRemove&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&o.containsPosition(e.sourcePosition)?[new Zl(0)]:(e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition.hasSameParentAs(t.sourcePosition)&&(e.howMany-=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMoveOperation(t),e.targetPosition=e.targetPosition._getTransformedByMoveOperation(t),e.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])}),ph(Ol,zl,(e,t,i)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)){const o=0!=t.howMany,n=t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition);if(o||n||"mergeTargetNotMoved"==i.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==i.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==i.abRelation||e.sourcePosition.offset>0)return e.sourcePosition=t.moveTargetPosition.clone(),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}return e.sourcePosition.hasSameParentAs(t.splitPosition)&&(e.howMany=t.splitPosition.offset),e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}),ph(Pl,Sl,(e,t)=>{const i=ra._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]}),ph(Pl,Pl,(e,t,i)=>{const o=ra._createFromPositionAndShift(e.sourcePosition,e.howMany),n=ra._createFromPositionAndShift(t.sourcePosition,t.howMany);let r,s=i.aIsStrong,a=!i.aIsStrong;if("insertBefore"==i.abRelation||"insertAfter"==i.baRelation?a=!0:"insertAfter"!=i.abRelation&&"insertBefore"!=i.baRelation||(a=!1),r=e.targetPosition.isEqual(t.targetPosition)&&a?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Ch(e,t)&&Ch(t,e))return[t.getReversed()];if(o.containsPosition(t.targetPosition)&&o.containsRange(n,!0))return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Ah([o],r);if(n.containsPosition(e.targetPosition)&&n.containsRange(o,!0))return o.start=o.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),o.end=o.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),Ah([o],r);const l=lo(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==l||"extension"==l)return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Ah([o],r);"remove"!=e.type||"remove"==t.type||i.aWasUndone||i.forceWeakRemove?"remove"==e.type||"remove"!=t.type||i.bWasUndone||i.forceWeakRemove||(s=!1):s=!0;const c=[],d=o.getDifference(n);for(const e of d){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const i="same"==lo(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),o=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,i);c.push(...o)}const h=o.getIntersection(n);return null!==h&&s&&(h.start=h.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),h.end=h.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===c.length?c.push(h):1==c.length?n.start.isBefore(o.start)||n.start.isEqual(o.start)?c.unshift(h):c.push(h):c.splice(1,0,h)),0===c.length?[new Zl(e.baseVersion)]:Ah(c,r)}),ph(Pl,zl,(e,t,i)=>{let o=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=i.abRelation||(o=e.targetPosition._getTransformedBySplitOperation(t));const n=ra._createFromPositionAndShift(e.sourcePosition,e.howMany);if(n.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=o,[e];if(n.start.hasSameParentAs(t.splitPosition)&&n.containsPosition(t.splitPosition)){let e=new ra(t.splitPosition,n.end);e=e._getTransformedBySplitOperation(t);return Ah([new ra(n.start,t.splitPosition),e],o)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==i.abRelation&&(o=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==i.abRelation&&(o=e.targetPosition);const r=[n._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const o=n.start.isEqual(t.graveyardPosition)||n.containsPosition(t.graveyardPosition);e.howMany>1&&o&&!i.aWasUndone&&r.push(ra._createFromPositionAndShift(t.insertionPosition,1))}return Ah(r,o)}),ph(Pl,Ol,(e,t,i)=>{const o=ra._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&o.containsPosition(t.sourcePosition))if("remove"!=e.type||i.forceWeakRemove){if(1==e.howMany)return i.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new Zl(0)]}else if(!i.aWasUndone){const i=[];let o=t.graveyardPosition.clone(),n=t.targetPosition._getTransformedByMergeOperation(t);e.howMany>1&&(i.push(new Pl(e.sourcePosition,e.howMany-1,e.targetPosition,0)),o=o._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1),n=n._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1));const r=t.deletionPosition._getCombined(e.sourcePosition,e.targetPosition),s=new Pl(o,1,r,0),a=s.getMovedRangeStart().path.slice();a.push(0);const l=new ta(s.targetPosition.root,a);n=n._getTransformedByMove(o,r,1);const c=new Pl(n,t.howMany,l,0);return i.push(s),i.push(c),i}const n=ra._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=n.start,e.howMany=n.end.offset-n.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]}),ph(Rl,Sl,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e])),ph(Rl,Ol,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e])),ph(Rl,Pl,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),ph(Rl,Rl,(e,t,i)=>{if(e.position.isEqual(t.position)){if(!i.aIsStrong)return[new Zl(0)];e.oldName=t.newName}return[e]}),ph(Rl,zl,(e,t)=>{if("same"==lo(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new Rl(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]}),ph(Vl,Vl,(e,t,i)=>{if(e.root===t.root&&e.key===t.key){if(!i.aIsStrong||e.newValue===t.newValue)return[new Zl(0)];e.oldValue=t.newValue}return[e]}),ph(zl,Sl,(e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset<t.position.offset&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByInsertOperation(t),e.insertionPosition=e.insertionPosition._getTransformedByInsertOperation(t),[e])),ph(zl,Ol,(e,t,i)=>{if(!e.graveyardPosition&&!i.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const i=t.graveyardPosition.path.slice();i.push(0);const o=new ta(t.graveyardPosition.root,i),n=zl.getInsertionPosition(new ta(t.graveyardPosition.root,i)),r=new zl(o,0,n,null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=zl.getInsertionPosition(e.splitPosition),e.graveyardPosition=r.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[r,e]}return e.splitPosition.hasSameParentAs(t.deletionPosition)&&!e.splitPosition.isAfter(t.deletionPosition)&&e.howMany--,e.splitPosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=zl.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),ph(zl,Pl,(e,t,i)=>{const o=ra._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const n=o.start.isEqual(e.graveyardPosition)||o.containsPosition(e.graveyardPosition);if(!i.bWasUndone&&n){const i=e.splitPosition._getTransformedByMoveOperation(t),o=e.graveyardPosition._getTransformedByMoveOperation(t),n=o.path.slice();n.push(0);const r=new ta(o.root,n);return[new Pl(i,e.howMany,r,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}const n=e.splitPosition.isEqual(t.targetPosition);if(n&&("insertAtSource"==i.baRelation||"splitBefore"==i.abRelation))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=zl.getInsertionPosition(e.splitPosition),[e];if(n&&i.abRelation&&i.abRelation.howMany){const{howMany:t,offset:o}=i.abRelation;return e.howMany+=t,e.splitPosition=e.splitPosition.getShiftedBy(o),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&o.containsPosition(e.splitPosition)){const i=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=i,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=zl.getInsertionPosition(e.splitPosition),[e]}return t.sourcePosition.isEqual(t.targetPosition)||(e.splitPosition.hasSameParentAs(t.sourcePosition)&&e.splitPosition.offset<=t.sourcePosition.offset&&(e.howMany-=t.howMany),e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany)),e.splitPosition.stickiness="toNone",e.splitPosition=e.splitPosition._getTransformedByMoveOperation(t),e.splitPosition.stickiness="toNext",e.graveyardPosition?e.insertionPosition=e.insertionPosition._getTransformedByMoveOperation(t):e.insertionPosition=zl.getInsertionPosition(e.splitPosition),[e]}),ph(zl,zl,(e,t,i)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new Zl(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new Zl(0)];if("splitBefore"==i.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const o="$graveyard"==e.splitPosition.root.rootName,n="$graveyard"==t.splitPosition.root.rootName,r=o&&!n;if(n&&!o||!r&&i.aIsStrong){const i=[];return t.howMany&&i.push(new Pl(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&i.push(new Pl(e.splitPosition,e.howMany,e.moveTargetPosition,0)),i}return[new Zl(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==i.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==i.baRelation){const i=t.insertionPosition.path.slice();i.push(0);const o=new ta(t.insertionPosition.root,i);return[e,new Pl(e.insertionPosition,1,o,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offset<t.splitPosition.offset&&(e.howMany-=t.howMany),e.splitPosition=e.splitPosition._getTransformedBySplitOperation(t),e.insertionPosition=zl.getInsertionPosition(e.splitPosition),[e]});class Th extends ts{constructor(e){super(e),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}class Eh extends ts{constructor(e){super(e),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}class Ph{constructor(e){this.document=e}createDocumentFragment(e){return new qn(this.document,e)}createElement(e,t,i){return new tn(this.document,e,t,i)}createText(e){return new uo(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const i=e.parent;if(i){const o=i.getChildIndex(e);return this.removeChildren(o,1,i),this.insertChild(o,t,i),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e),this.insertChild(i,e.getChildren(),t)}}rename(e,t){const i=new tn(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){ct(e)&&void 0===i&&(i=t),i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return dn._createAt(e,t)}createPositionAfter(e){return dn._createAfter(e)}createPositionBefore(e){return dn._createBefore(e)}createRange(e,t){return new hn(e,t)}createRangeOn(e){return hn._createOn(e)}createRangeIn(e){return hn._createIn(e)}createSelection(e,t,i){return new mn(e,t,i)}}const Sh=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ih=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,Rh=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Vh=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,Oh=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,zh=new Set(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","orange","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","activeborder","activecaption","appworkspace","background","buttonface","buttonhighlight","buttonshadow","buttontext","captiontext","graytext","highlight","highlighttext","inactiveborder","inactivecaption","inactivecaptiontext","infobackground","infotext","menu","menutext","scrollbar","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","window","windowframe","windowtext","rebeccapurple","currentcolor","transparent"]);function Mh(e){return e.startsWith("#")?Sh.test(e):e.startsWith("rgb")?Ih.test(e)||Rh.test(e):e.startsWith("hsl")?Vh.test(e)||Oh.test(e):zh.has(e.toLowerCase())}const Bh=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function Nh(e){return Bh.includes(e)}const Fh=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Dh(e){return Fh.test(e)}const Lh=/^[+-]?[0-9]*([.][0-9]+)?%$/;function Hh(e){return Lh.test(e)}const jh=["repeat-x","repeat-y","repeat","space","round","no-repeat"];const Wh=["center","top","bottom","left","right"];function qh(e){return Wh.includes(e)}const $h=["fixed","scroll","local"];function Uh(e){return $h.includes(e)}const Kh=/^url\(/;function Gh(e){return Kh.test(e)}function Jh(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=Zh(e),i=t[0],o=t[2]||i,n=t[1]||i;return{top:i,bottom:o,right:n,left:t[3]||n}}function Yh(e){return t=>{const{top:i,right:o,bottom:n,left:r}=t,s=[];return[i,o,r,n].every(e=>!!e)?s.push([e,Qh(t)]):(i&&s.push([e+"-top",i]),o&&s.push([e+"-right",o]),n&&s.push([e+"-bottom",n]),r&&s.push([e+"-left",r])),s}}function Qh({top:e,right:t,bottom:i,left:o}){const n=[];return o!==t?n.push(e,t,i,o):i!==e?n.push(e,t,i):t!==e?n.push(e,t):n.push(e),n.join(" ")}function Xh(e){return t=>({path:e,value:Jh(t)})}function Zh(e){return e.replace(/, /g,",").split(" ").map(e=>e.replace(/,/g,", "))}function eu(e){e.setNormalizer("background",tu),e.setNormalizer("background-color",e=>({path:"background.color",value:e})),e.setReducer("background",e=>{const t=[];return t.push(["background-color",e.color]),t}),e.setStyleRelation("background",["background-color"])}function tu(e){const t={},i=Zh(e);for(const e of i)o=e,jh.includes(o)?(t.repeat=t.repeat||[],t.repeat.push(e)):qh(e)?(t.position=t.position||[],t.position.push(e)):Uh(e)?t.attachment=e:Mh(e)?t.color=e:Gh(e)&&(t.image=e);var o;return{path:"background",value:t}}function iu(e){e.setNormalizer("border",ou),e.setNormalizer("border-top",nu("top")),e.setNormalizer("border-right",nu("right")),e.setNormalizer("border-bottom",nu("bottom")),e.setNormalizer("border-left",nu("left")),e.setNormalizer("border-color",ru("color")),e.setNormalizer("border-width",ru("width")),e.setNormalizer("border-style",ru("style")),e.setNormalizer("border-top-color",au("color","top")),e.setNormalizer("border-top-style",au("style","top")),e.setNormalizer("border-top-width",au("width","top")),e.setNormalizer("border-right-color",au("color","right")),e.setNormalizer("border-right-style",au("style","right")),e.setNormalizer("border-right-width",au("width","right")),e.setNormalizer("border-bottom-color",au("color","bottom")),e.setNormalizer("border-bottom-style",au("style","bottom")),e.setNormalizer("border-bottom-width",au("width","bottom")),e.setNormalizer("border-left-color",au("color","left")),e.setNormalizer("border-left-style",au("style","left")),e.setNormalizer("border-left-width",au("width","left")),e.setExtractor("border-top",lu("top")),e.setExtractor("border-right",lu("right")),e.setExtractor("border-bottom",lu("bottom")),e.setExtractor("border-left",lu("left")),e.setExtractor("border-top-color","border.color.top"),e.setExtractor("border-right-color","border.color.right"),e.setExtractor("border-bottom-color","border.color.bottom"),e.setExtractor("border-left-color","border.color.left"),e.setExtractor("border-top-width","border.width.top"),e.setExtractor("border-right-width","border.width.right"),e.setExtractor("border-bottom-width","border.width.bottom"),e.setExtractor("border-left-width","border.width.left"),e.setExtractor("border-top-style","border.style.top"),e.setExtractor("border-right-style","border.style.right"),e.setExtractor("border-bottom-style","border.style.bottom"),e.setExtractor("border-left-style","border.style.left"),e.setReducer("border-color",Yh("border-color")),e.setReducer("border-style",Yh("border-style")),e.setReducer("border-width",Yh("border-width")),e.setReducer("border-top",hu("top")),e.setReducer("border-right",hu("right")),e.setReducer("border-bottom",hu("bottom")),e.setReducer("border-left",hu("left")),e.setReducer("border",function(){return t=>{const i=cu(t,"top"),o=cu(t,"right"),n=cu(t,"bottom"),r=cu(t,"left"),s=[i,o,n,r],a={width:e(s,"width"),style:e(s,"style"),color:e(s,"color")},l=uu(a,"all");if(l.length)return l;return[...Object.entries(a).reduce((e,[t,i])=>(i&&(e.push(["border-"+t,i]),s.forEach(e=>e[t]=null)),e),[]),...uu(i,"top"),...uu(o,"right"),...uu(n,"bottom"),...uu(r,"left")]};function e(e,t){return e.map(e=>e[t]).reduce((e,t)=>e==t?e:null)}}()),e.setStyleRelation("border",["border-color","border-style","border-width","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-color",["border-top-color","border-right-color","border-bottom-color","border-left-color"]),e.setStyleRelation("border-style",["border-top-style","border-right-style","border-bottom-style","border-left-style"]),e.setStyleRelation("border-width",["border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-top",["border-top-color","border-top-style","border-top-width"]),e.setStyleRelation("border-right",["border-right-color","border-right-style","border-right-width"]),e.setStyleRelation("border-bottom",["border-bottom-color","border-bottom-style","border-bottom-width"]),e.setStyleRelation("border-left",["border-left-color","border-left-style","border-left-width"])}function ou(e){const{color:t,style:i,width:o}=du(e);return{path:"border",value:{color:Jh(t),style:Jh(i),width:Jh(o)}}}function nu(e){return t=>{const{color:i,style:o,width:n}=du(t),r={};return void 0!==i&&(r.color={[e]:i}),void 0!==o&&(r.style={[e]:o}),void 0!==n&&(r.width={[e]:n}),{path:"border",value:r}}}function ru(e){return t=>({path:"border",value:su(t,e)})}function su(e,t){return{[t]:Jh(e)}}function au(e,t){return i=>({path:"border",value:{[e]:{[t]:i}}})}function lu(e){return(t,i)=>{if(i.border)return cu(i.border,e)}}function cu(e,t){const i={};return e.width&&e.width[t]&&(i.width=e.width[t]),e.style&&e.style[t]&&(i.style=e.style[t]),e.color&&e.color[t]&&(i.color=e.color[t]),i}function du(e){const t={},i=Zh(e);for(const e of i)Dh(e)||/thin|medium|thick/.test(e)?t.width=e:Nh(e)?t.style=e:t.color=e;return t}function hu(e){return t=>uu(t,e)}function uu(e,t){const i=[];if(e&&e.width&&i.push("width"),e&&e.style&&i.push("style"),e&&e.color&&i.push("color"),3==i.length){const o=i.map(t=>e[t]).join(" ");return["all"==t?["border",o]:["border-"+t,o]]}return"all"==t?[]:i.map(i=>[`border-${t}-${i}`,e[i]])}function gu(e){e.setNormalizer("margin",Xh("margin")),e.setNormalizer("margin-top",e=>({path:"margin.top",value:e})),e.setNormalizer("margin-right",e=>({path:"margin.right",value:e})),e.setNormalizer("margin-bottom",e=>({path:"margin.bottom",value:e})),e.setNormalizer("margin-left",e=>({path:"margin.left",value:e})),e.setReducer("margin",Yh("margin")),e.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}function mu(e){e.setNormalizer("padding",Xh("padding")),e.setNormalizer("padding-top",e=>({path:"padding.top",value:e})),e.setNormalizer("padding-right",e=>({path:"padding.right",value:e})),e.setNormalizer("padding-bottom",e=>({path:"padding.bottom",value:e})),e.setNormalizer("padding-left",e=>({path:"padding.left",value:e})),e.setReducer("padding",Yh("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}class fu extends xc{constructor(e,t){super(e),this.view=t}get element(){return this.view.editable.element}init(){const e=this.editor,t=this.view,i=e.plugins.get("BalloonToolbar"),o=e.editing.view,n=t.editable,r=o.document.getRoot();n.name=r.rootName,t.render();const s=n.element;this.setEditableElement(n.name,s),this.focusTracker.add(s),n.bind("isFocused").to(this.focusTracker),o.attachDomRoot(s),function({origin:e,originKeystrokeHandler:t,originFocusTracker:i,toolbar:o,beforeFocus:n,afterBlur:r}){i.add(o.element),t.set("Alt+F10",(e,t)=>{i.isFocused&&!o.focusTracker.isFocused&&(n&&n(),o.focus(),t())}),o.keystrokes.set("Esc",(t,i)=>{o.focusTracker.isFocused&&(e.focus(),r&&r(),i())})}({origin:o,originFocusTracker:this.focusTracker,originKeystrokeHandler:e.keystrokes,toolbar:i.toolbarView,beforeFocus(){i.show()},afterBlur(){i.hide()}}),this._initPlaceholder(),this.fire("ready")}destroy(){const e=this.view;this.editor.editing.view.detachDomRoot(e.editable.name),e.destroy(),super.destroy()}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),o=e.sourceElement,n=e.config.get("placeholder")||o&&"textarea"===o.tagName.toLowerCase()&&o.getAttribute("placeholder");n&&dh({view:t,element:i,text:n,isDirectHost:!1,keepOnFocus:!0})}}class pu extends Md{constructor(e,t,i){super(e),this.editable=new Fd(e,t,i)}render(){super.render(),this.registerChild(this.editable)}}class bu extends _c{constructor(e,t){super(t),Gi(e)&&(this.sourceElement=e,function(e){const t=e.sourceElement;if(t){if(t.ckeditorInstance)throw new l.a("editor-source-element-already-used",e);t.ckeditorInstance=e,e.once("destroy",()=>{delete t.ckeditorInstance})}}(this));const i=this.config.get("plugins");i.push(nh),this.config.set("plugins",i),this.config.define("balloonToolbar",this.config.get("toolbar")),this.model.document.createRoot();const o=new pu(this.locale,this.editing.view,this.sourceElement);this.ui=new fu(this,o),function(e){if(!R(e.updateSourceElement))throw new l.a("attachtoform-missing-elementapi-interface",e);const t=e.sourceElement;if(t&&"textarea"===t.tagName.toLowerCase()&&t.form){let i;const o=t.form,n=()=>e.updateSourceElement();R(o.submit)&&(i=o.submit,o.submit=()=>{n(),i.apply(o)}),o.addEventListener("submit",n),e.on("destroy",()=>{o.removeEventListener("submit",n),i&&(o.submit=i)})}}(this)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&Rs(this.sourceElement,e)})}static create(e,t={}){return new Promise(i=>{const o=Gi(e);if(o&&"TEXTAREA"===e.tagName)throw new l.a("editor-wrong-element",null);const n=new this(e,t);i(n.initPlugins().then(()=>{n.ui.init()}).then(()=>{if(!o&&t.initialData)throw new l.a("editor-create-initial-data",null);const i=void 0!==t.initialData?t.initialData:function(e){return Gi(e)?(t=e,t instanceof HTMLTextAreaElement?t.value:t.innerHTML):e;var t}(e);return n.data.init(i)}).then(()=>n.fire("ready")).then(()=>n))})}}Ye(bu,Cc),Ye(bu,Ac);i(7),i(65);class wu extends Bc{constructor(e){super(e);const t=e.t;this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",(e,t)=>e>0&&!t),this._findInputView=this._createInputField(t("Find in text…")),this._replaceInputView=this._createInputField(t("Replace with…")),this._findButtonView=this._createButton({label:t("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._findPrevButtonView=this._createButton({label:t("Previous result"),class:"ck-button-prev",icon:Xd,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:t("Next result"),class:"ck-button-next",icon:Xd,keystroke:"F3",tooltip:!0}),this._optionsDropdown=this._createOptionsDropdown(),this._replaceButtonView=this._createButton({label:t("Replace"),class:"ck-button-replace",withText:!0}),this._replaceAllButtonView=this._createButton({label:t("Replace all"),class:"ck-button-replaceall",withText:!0}),this._findFieldsetView=this._createFindFieldset(),this._replaceFieldsetView=this._createReplaceFieldset(),this._focusTracker=new zs,this._keystrokes=new Ms,this._focusables=new Mc,this._focusCycler=new hd({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:[new Dd(e,{label:t("Find and replace")}),this._findFieldsetView,this._replaceFieldsetView]}),Oc(this)}render(){super.render(),zc({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}focus(){this._focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createFindFieldset(){const e=this.locale,t=new Bc(e);return this._findInputView.fieldView.on("input",()=>{this.isDirty=!0}),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findPrevious:e})=>e),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findNext:e})=>e),this._injectFindResultsCounter(),t.setTemplate({tag:"fieldset",attributes:{class:["ck","ck-find-and-replace-form__find"]},children:[this._findInputView,this._findButtonView,this._findPrevButtonView,this._findNextButtonView]}),t}_onFindButtonExecute(){if(this._textToFind)this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly});else{const e=this.t;this._findInputView.errorText=e("Text to find must not be empty.")}}_injectFindResultsCounter(){const e=this.locale,t=e.t,i=this.bindTemplate,o=new Bc(e);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",(e,i)=>t("%0 of %1",[e,i])),o.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",i.if("isDirty","ck-hidden")]},children:[{text:i.to("_resultsCounterText")}]});const n=()=>{const t=this._findInputView.fieldView.element;if(!t||!t.offsetParent)return;const i=new Ts(o.element).width,n="ltr"===e.uiLanguageDirection?"paddingRight":"paddingLeft";t.style[n]=i?`calc( 2 * var(--ck-spacing-standard) + ${i}px )`:null};this.on("change:_resultsCounterText",n,{priority:"low"}),this.on("change:isDirty",n,{priority:"low"}),this._findInputView.template.children[0].children.push(o)}_createReplaceFieldset(){const e=this.locale,t=e.t,i=new Bc(e);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:e},t)=>e&&t),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replaceAll:e},t)=>e&&t),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:e},t)=>e&&t),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",(e,i)=>e||!i?"":t("Tip: Find some text first in order to replace it.")),this._replaceButtonView.on("execute",()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})}),this._replaceAllButtonView.on("execute",()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()}),i.setTemplate({tag:"fieldset",attributes:{class:["ck","ck-find-and-replace-form__replace"]},children:[this._replaceInputView,this._optionsDropdown,this._replaceButtonView,this._replaceAllButtonView]}),i}_createOptionsDropdown(){const e=this.locale,t=e.t,i=Vd(e);i.class="ck-options-dropdown",i.buttonView.set({withText:!1,label:t("Show options"),icon:Rc.cog,tooltip:!0});const o=new $d({withText:!0,label:t("Match case"),_isMatchCaseSwitch:!0}),n=new $d({withText:!0,label:t("Whole words only")});return o.bind("isOn").to(this,"_matchCase"),n.bind("isOn").to(this,"_wholeWordsOnly"),i.on("execute",e=>{e.source._isMatchCaseSwitch?this._matchCase=!this._matchCase:this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0}),zd(i,new Zi([{type:"switchbutton",model:o},{type:"switchbutton",model:n}])),i}_initFocusCycling(){[this._findInputView,this._findButtonView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._optionsDropdown,this._replaceButtonView,this._replaceAllButtonView].forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}_initKeystrokeHandling(){const e=e=>e.stopPropagation(),t=e=>{e.stopPropagation(),e.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",e=>{t(e),this._findNextButtonView.fire("execute")}),this._keystrokes.set("shift+f3",e=>{t(e),this._findPrevButtonView.fire("execute")}),this._keystrokes.set("enter",e=>{const i=e.target;i===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e)):i===this._replaceInputView.fieldView.element&&(this._replaceButtonView.fire("execute"),t(e))}),this._keystrokes.set("shift+enter",e=>{e.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e))}),this._keystrokes.set("arrowright",e),this._keystrokes.set("arrowleft",e),this._keystrokes.set("arrowup",e),this._keystrokes.set("arrowdown",e),this.listenTo(this._findInputView.element,"selectstart",(e,t)=>{t.stopPropagation()},{priority:"high"}),this.listenTo(this._replaceInputView.element,"selectstart",(e,t)=>{t.stopPropagation()},{priority:"high"})}_createButton(e){const t=new rd(this.locale);return t.set(e),t}_createInputField(e){const t=new Hd(this.locale,jd);return t.label=e,t}}class ku extends Qe{static get pluginName(){return"FindAndReplaceUI"}constructor(e){super(e),this.formView=null}init(){const e=this.editor;e.ui.componentFactory.add("findAndReplace",t=>{const i=Vd(t),o=this.formView=new wu(e.locale);return i.bind("isEnabled").to(e.commands.get("find")),i.panelView.children.add(o),i.on("change:isOpen",(e,t,i)=>{i?(o.disableCssTransitions(),o.reset(),o._findInputView.fieldView.select(),o.focus(),o.enableCssTransitions()):(o.focus(),this.fire("searchReseted"))},{priority:"low"}),this._setupDropdownButton(i),this._setupFormView(o),i})}_setupDropdownButton(e){const t=this.editor.locale.t;e.buttonView.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.87 13.786 1.532-1.286 3.857 4.596a1 1 0 1 1-1.532 1.286l-3.857-4.596z"/><path d="M16.004 8.5a6.5 6.5 0 0 1-9.216 5.905c-1.154-.53-.863-1.415-.663-1.615.194-.194.564-.592 1.635-.141a4.5 4.5 0 0 0 5.89-5.904l-.104-.227 1.332-1.331c.045-.046.196-.041.224.007a6.47 6.47 0 0 1 .902 3.306zm-3.4-5.715c.562.305.742 1.106.354 1.494-.388.388-.995.414-1.476.178a4.5 4.5 0 0 0-6.086 5.882l.114.236-1.348 1.349c-.038.037-.17.022-.198-.023a6.5 6.5 0 0 1 5.54-9.9 6.469 6.469 0 0 1 3.1.784z"/><path d="M4.001 11.93.948 8.877a.2.2 0 0 1 .141-.341h6.106a.2.2 0 0 1 .141.341L4.283 11.93a.2.2 0 0 1-.282 0zm11.083-6.789 3.053 3.053a.2.2 0 0 1-.14.342H11.89a.2.2 0 0 1-.14-.342l3.052-3.053a.2.2 0 0 1 .282 0z"/></svg>',label:t("Find and replace"),tooltip:!0})}_setupFormView(e){const t=this.editor.commands,i=this.editor.plugins.get("FindAndReplaceEditing").state,o={before:-1,same:0,after:1};e.bind("highlightOffset").to(i,"highlightedResult",e=>e?Array.from(i.results).sort((e,t)=>o[e.marker.getStart().compareWith(t.marker.getStart())]).indexOf(e)+1:0),e.listenTo(i.results,"change",()=>{e.matchCount=i.results.length}),e.bind("_areCommandsEnabled").to(t.get("findNext"),"isEnabled",t.get("findPrevious"),"isEnabled",t.get("replace"),"isEnabled",t.get("replaceAll"),"isEnabled",(e,t,i,o)=>({findNext:e,findPrevious:t,replace:i,replaceAll:o})),e.delegate("findNext","findPrevious","replace","replaceAll").to(this),e.on("change:isDirty",(e,t,i)=>{i&&this.fire("searchReseted")})}}var _u=/[\\^$.*+?()[\]{}|]/g,vu=RegExp(_u.source);var yu=function(e){return(e=Ro(e))&&vu.test(e)?e.replace(_u,"\\$&"):e};function xu(e,t,i,o){const n=o||new Zi;return t.change(o=>{[...e].forEach(({type:e,item:r})=>{if("elementStart"===e&&t.schema.checkChild(r,"$text")){const e=i({item:r,text:Cu(t.createRangeIn(r))});if(!e)return;e.forEach(e=>{const t="findResult:"+s(),i=o.addMarker(t,{usingOperation:!1,affectsData:!1,range:o.createRange(o.createPositionAt(r,e.start),o.createPositionAt(r,e.end))}),a=function(e,t){const i=e.find(({marker:e})=>t.getStart().isBefore(e.getStart()));return i?e.getIndex(i):e.length}(n,i);n.add({id:t,label:e.label,marker:i},a)})}})}),n}function Cu(e){return Array.from(e.getItems()).reduce((e,t)=>t.is("text")||t.is("textProxy")?e+t.data:e+"\n","")}function Au(e){const t=e.length-1;let i=e.index;return 3===e.length&&(i+=e[1].length),{label:e[t],start:i,end:i+e[t].length}}function Tu(e,t){let i="gu";t.matchCase||(i+="i");let o=`(${yu(e)})`;if(t.wholeWords){const t="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+t).test(e)||(o=`(^|${t}|_)${o}`),new RegExp(t+"$").test(e)||(o=`${o}(?:_|${t}|$)`)}const n=new RegExp(o,i);return function({text:e}){return[...e.matchAll(n)].map(Au)}}class Eu extends Ze{constructor(e,t){super(e),this.isEnabled=!0,this._state=t,this.listenTo(e,"change:isReadOnly",()=>{this.clearForceDisabled("readOnlyMode")})}execute(e,{matchCase:t,wholeWords:i}={}){const{editor:o}=this,{model:n}=o;let r;"string"==typeof e?(r=Tu(e,{matchCase:t,wholeWords:i}),this._state.searchText=e):r=e;const s=n.document.getRootNames().reduce((e,t)=>xu(n.createRangeIn(n.document.getRoot(t)),n,r,e),null);return this._state.clear(n),this._state.results.addMany(Array.from(s)),this._state.highlightedResult=s.get(0),"string"==typeof e&&(this._state.searchText=e),this._state.matchCase=!!t,this._state.matchWholeWords=!!i,{results:s,findCallback:r}}}class Pu extends Ze{constructor(e,t){super(e),this.isEnabled=!0,this._state=t}execute(e,t){const{model:i}=this.editor;i.change(o=>{const n=t.marker.getRange();let r={};for(const e of n.getItems())if(e.is("$text")||e.is("$textProxy")){r=e.getAttributes();break}i.insertContent(o.createText(e,r),n),this._state.results.has(t)&&this._state.results.remove(t)})}}class Su extends Pu{execute(e,t){const{editor:i}=this,{model:o}=i,n=t instanceof Zi?t:o.document.getRootNames().reduce((e,i)=>xu(o.createRangeIn(o.document.getRoot(i)),o,Tu(t,this._state),e),null);n.length&&o.change(()=>{[...n].forEach(t=>{super.execute(e,t)})})}}class Iu extends Ze{constructor(e,t){super(e),this._state=t,this.isEnabled=!1,this.listenTo(this._state.results,"change",()=>{this.isEnabled=this._state.results.length>1}),this.listenTo(e,"change:isReadOnly",()=>{this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=this._state.results.length>1}execute(){const e=this._state.results,t=e.getIndex(this._state.highlightedResult),i=t+1>=e.length?0:t+1;this._state.highlightedResult=this._state.results.get(i)}}class Ru extends Iu{execute(){const e=this._state.results.getIndex(this._state.highlightedResult),t=e-1<0?this._state.results.length-1:e-1;this._state.highlightedResult=this._state.results.get(t)}}class Vu{constructor(e){this.set("results",new Zi),this.set("highlightedResult",null),this.set("searchText",""),this.set("replaceText",""),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",(t,{removed:i,index:o})=>{if((i=Array.from(i)).length){let t=!1;if(e.change(o=>{for(const n of i)this.highlightedResult===n&&(t=!0),e.markers.has(n.marker.name)&&o.removeMarker(n.marker)}),t){const e=o>=this.results.length?0:o;this.highlightedResult=this.results.get(e)}}})}clear(e){this.searchText="",e.change(t=>{if(this.highlightedResult){const i=this.highlightedResult.marker.name.split(":")[1],o=e.markers.get("findResultHighlighted:"+i);o&&t.removeMarker(o)}[...this.results].forEach(({marker:e})=>{t.removeMarker(e)})}),this.results.clear()}}Ye(Vu,qe);i(67);class Ou extends Qe{static get pluginName(){return"FindAndReplaceEditing"}init(){this._activeResults=null,this.state=new Vu(this.editor.model),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",(e,t,i,o)=>{const{model:n}=this.editor;n.change(e=>{if(o){const t=o.marker.name.split(":")[1],i=n.markers.get("findResultHighlighted:"+t);i&&e.removeMarker(i)}if(i){const t=i.marker.name.split(":")[1];e.addMarker("findResultHighlighted:"+t,{usingOperation:!1,affectsData:!1,range:i.marker.getRange()})}})});const e=fs(function(e,t,i){if(i){const e=this.editor.editing.view.domConverter,t=this.editor.editing.mapper.toViewRange(i.marker.getRange());Ns({target:e.viewRangeToDom(t),viewportOffset:40})}}.bind(this),32);this.listenTo(this.state,"change:highlightedResult",e,{priority:"low"}),this.listenTo(this.editor,"destroy",e.cancel)}find(e){const{editor:t}=this,{model:i}=t,{findCallback:o,results:n}=t.execute("find",e);return this._activeResults=n,this.listenTo(i.document,"change:data",()=>function(e,t,i){const o=new Set,n=new Set;t.document.differ.getChanges().forEach(e=>{"$text"===e.name||t.schema.isInline(e.position.nodeAfter)?(o.add(e.position.parent),[...t.markers.getMarkersAtPosition(e.position)].forEach(e=>{n.add(e.name)})):"insert"===e.type&&o.add(e.position.nodeAfter)}),t.document.differ.getChangedMarkers().forEach(({name:e,data:{newRange:t}})=>{t&&"$graveyard"===t.start.root.rootName&&n.add(e)}),o.forEach(e=>{[...t.markers.getMarkersIntersectingRange(t.createRangeIn(e))].forEach(e=>n.add(e.name))}),t.change(t=>{n.forEach(i=>{e.has(i)&&e.remove(i),t.removeMarker(i)})}),o.forEach(o=>{xu(t.createRangeOn(o),t,i,e)})}(this._activeResults,i,o)),this._activeResults}stop(){this._activeResults&&(this.stopListening(this.editor.model.document),this.state.clear(this.editor.model),this._activeResults=null)}_defineCommands(){this.editor.commands.add("find",new Eu(this.editor,this.state)),this.editor.commands.add("findNext",new Iu(this.editor,this.state)),this.editor.commands.add("findPrevious",new Ru(this.editor,this.state)),this.editor.commands.add("replace",new Pu(this.editor,this.state)),this.editor.commands.add("replaceAll",new Su(this.editor,this.state))}_defineConverters(){const{editor:e}=this;e.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:e})=>{const[,t]=e.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":t}}}}),e.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:e})=>{const[,t]=e.split(":");return{name:"span",classes:["ck-find-result_selected"],attributes:{"data-find-result":t}}}})}}class zu{constructor(){const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=e=>{this.loaded=e.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((i,o)=>{t.onload=()=>{const e=t.result;this._data=e,i(e)},t.onerror=()=>{o("error")},t.onabort=()=>{o("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}Ye(zu,qe);class Mu extends Qe{static get pluginName(){return"FileRepository"}static get requires(){return[Tc]}init(){this.loaders=new Zi,this.loaders.on("add",()=>this._updatePendingAction()),this.loaders.on("remove",()=>this._updatePendingAction()),this._loadersMap=new Map,this._pendingAction=null,this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return Object(l.b)("filerepository-no-upload-adapter"),null;const t=new Bu(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(e=>{this._loadersMap.set(e,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let e=0;for(const t of this.loaders)e+=t.uploaded;this.uploaded=e}),t.on("change:uploadTotal",()=>{let e=0;for(const t of this.loaders)t.uploadTotal&&(e+=t.uploadTotal);this.uploadTotal=e}),t}destroyLoader(e){const t=e instanceof Bu?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((e,i)=>{e===t&&this._loadersMap.delete(i)})}_updatePendingAction(){const e=this.editor.plugins.get(Tc);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i)}}else e.remove(this._pendingAction),this._pendingAction=null}}Ye(Mu,qe);class Bu{constructor(e,t){this.id=s(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new zu,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new l.a("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if("reading"!==this.status)throw this.status;return this.status="idle",e}).catch(e=>{if("aborted"===e)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:e})}upload(){if("idle"!=this.status)throw new l.a("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{if("aborted"===this.status)throw"aborted";throw this.status="error",e})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==e?this._reader.abort():"uploading"==e&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((i,o)=>{t.rejecter=o,t.isFulfilled=!1,e.then(e=>{t.isFulfilled=!0,i(e)}).catch(e=>{t.isFulfilled=!0,o(e)})}),t}}Ye(Bu,qe);class Nu extends Bc{constructor(e){super(e),this.buttonView=new rd(e),this._fileInputView=new Fu(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",()=>{this._fileInputView.open()})}focus(){this.buttonView.focus()}}class Fu extends Bc{constructor(e){super(e),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}function Du(){let e=function(e){e=e.toLowerCase();const t=document.cookie.split(";");for(const i of t){const t=i.split("=");if(decodeURIComponent(t[0].trim().toLowerCase())===e)return decodeURIComponent(t[1])}return null}("ckCsrfToken");var t,i;return e&&40==e.length||(e=function(e){let t="";const i=new Uint8Array(e);window.crypto.getRandomValues(i);for(let e=0;e<i.length;e++){const o="abcdefghijklmnopqrstuvwxyz0123456789".charAt(i[e]%"abcdefghijklmnopqrstuvwxyz0123456789".length);t+=Math.random()>.5?o.toUpperCase():o}return t}(40),t="ckCsrfToken",i=e,document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(i)+";path=/"),e}class Lu{constructor(e,t,i){this.loader=e,this.url=t,this.t=i}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,i){const o=this.xhr,n=this.loader,r=(0,this.t)("Cannot upload file:")+` ${i.name}.`;o.addEventListener("error",()=>t(r)),o.addEventListener("abort",()=>t()),o.addEventListener("load",()=>{const i=o.response;if(!i||!i.uploaded)return t(i&&i.error&&i.error.message?i.error.message:r);e({default:i.url})}),o.upload&&o.upload.addEventListener("progress",e=>{e.lengthComputable&&(n.uploadTotal=e.total,n.uploaded=e.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",Du()),this.xhr.send(t)}}class Hu{constructor(e,t=20){this.model=e,this.size=0,this.limit=t,this.isLocked=!1,this._changeCallback=(e,t)=>{"transparent"!=t.type&&t!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch()),this._batch}input(e){this.size+=e,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e){this.isLocked&&!e||(this._batch=null,this.size=0)}}class ju extends Ze{constructor(e,t){super(e),this._buffer=new Hu(e.model,t),this._batches=new WeakSet}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,o=e.text||"",n=o.length,r=e.range?t.createSelection(e.range):i.selection,s=e.resultRange;t.enqueueChange(this._buffer.batch,e=>{this._buffer.lock(),this._batches.add(this._buffer.batch),t.deleteContent(r),o&&t.insertContent(e.createText(o,i.selection.getAttributes()),r),s?e.setSelection(s):r.is("documentSelection")||e.setSelection(r),this._buffer.unlock(),this._buffer.input(n)})}}const Wu=[Mn("arrowUp"),Mn("arrowRight"),Mn("arrowDown"),Mn("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let e=112;e<=135;e++)Wu.push(e);function qu(e){return!(!e.ctrlKey&&!e.metaKey)||Wu.includes(e.keyCode)}function $u(e){if(e.newChildren.length-e.oldChildren.length!=1)return;const t=function(e,t){const i=[];let o,n=0;return e.forEach(e=>{"equal"==e?(r(),n++):"insert"==e?(s("insert")?o.values.push(t[n]):(r(),o={type:"insert",index:n,values:[t[n]]}),n++):s("delete")?o.howMany++:(r(),o={type:"delete",index:n,howMany:1})}),r(),i;function r(){o&&(i.push(o),o=null)}function s(e){return o&&o.type==e}}(gr(e.oldChildren,e.newChildren,Uu),e.newChildren);if(t.length>1)return;const i=t[0];return i.values[0]&&i.values[0].is("$text")?i:void 0}function Uu(e,t){return e&&e.is("$text")&&t&&t.is("$text")?e.data===t.data:e===t}class Ku{constructor(e){this.editor=e,this.editing=this.editor.editing}handle(e,t){if(function(e){if(0==e.length)return!1;for(const t of e)if("children"===t.type&&!$u(t))return!0;return!1}(e))this._handleContainerChildrenMutations(e,t);else for(const i of e)this._handleTextMutation(i,t),this._handleTextNodeInsertion(i)}_handleContainerChildrenMutations(e,t){const i=function(e){const t=e.map(e=>e.node).reduce((e,t)=>e.getCommonAncestor(t,{includeSelf:!0}));if(!t)return;return t.getAncestors({includeSelf:!0,parentFirst:!0}).find(e=>e.is("containerElement")||e.is("rootElement"))}(e);if(!i)return;const o=this.editor.editing.view.domConverter.mapViewToDom(i),n=new Er(this.editor.editing.view.document),r=this.editor.data.toModel(n.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(i);if(!s)return;const a=Array.from(r.getChildren()),l=Array.from(s.getChildren()),c=a[a.length-1],d=l[l.length-1],h=c&&c.is("element","softBreak"),u=d&&!d.is("element","softBreak");h&&u&&a.pop();const g=this.editor.model.schema;if(!Gu(a,g)||!Gu(l,g))return;const m=a.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," "),f=l.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," ");if(f===m)return;const p=gr(f,m),{firstChangeAt:b,insertions:w,deletions:k}=Ju(p);let _=null;t&&(_=this.editing.mapper.toModelRange(t.getFirstRange()));const v=m.substr(b,w),y=this.editor.model.createRange(this.editor.model.createPositionAt(s,b),this.editor.model.createPositionAt(s,b+k));this.editor.execute("input",{text:v,range:y,resultRange:_})}_handleTextMutation(e,t){if("text"!=e.type)return;const i=e.newText.replace(/\u00A0/g," "),o=e.oldText.replace(/\u00A0/g," ");if(o===i)return;const n=gr(o,i),{firstChangeAt:r,insertions:s,deletions:a}=Ju(n);let l=null;t&&(l=this.editing.mapper.toModelRange(t.getFirstRange()));const c=this.editing.view.createPositionAt(e.node,r),d=this.editing.mapper.toModelPosition(c),h=this.editor.model.createRange(d,d.getShiftedBy(a)),u=i.substr(r,s);this.editor.execute("input",{text:u,range:h,resultRange:l})}_handleTextNodeInsertion(e){if("children"!=e.type)return;const t=$u(e),i=this.editing.view.createPositionAt(e.node,t.index),o=this.editing.mapper.toModelPosition(i),n=t.values[0].data;this.editor.execute("input",{text:n.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function Gu(e,t){return e.every(e=>t.isInline(e))}function Ju(e){let t=null,i=null;for(let o=0;o<e.length;o++){"equal"!=e[o]&&(t=null===t?o:t,i=o)}let o=0,n=0;for(let r=t;r<=i;r++)"insert"!=e[r]&&o++,"delete"!=e[r]&&n++;return{insertions:n,deletions:o,firstChangeAt:t}}class Yu extends Qe{static get pluginName(){return"Input"}init(){const e=this.editor,t=new ju(e,e.config.get("typing.undoStep")||20);e.commands.add("input",t),function(e){let t=null;const i=e.model,o=e.editing.view,n=e.commands.get("input");function r(e){const r=i.document,a=o.document.isComposing,l=t&&t.isEqual(r.selection);t=null,n.isEnabled&&(qu(e)||r.selection.isCollapsed||a&&229===e.keyCode||!a&&229===e.keyCode&&l||s())}function s(){const e=n.buffer;e.lock();const t=e.batch;n._batches.add(t),i.enqueueChange(t,()=>{i.deleteContent(i.document.selection)}),e.unlock()}In.isAndroid?o.document.on("beforeinput",(e,t)=>r(t),{priority:"lowest"}):o.document.on("keydown",(e,t)=>r(t),{priority:"lowest"}),o.document.on("compositionstart",(function(){const e=i.document,t=1!==e.selection.rangeCount||e.selection.getFirstRange().isFlat;if(e.selection.isCollapsed||t)return;s()}),{priority:"lowest"}),o.document.on("compositionend",()=>{t=i.createSelection(i.document.selection)},{priority:"lowest"})}(e),function(e){e.editing.view.document.on("mutations",(t,i,o)=>{new Ku(e).handle(i,o)})}(e)}isInput(e){return this.editor.commands.get("input")._batches.has(e)}}class Qu extends Ze{constructor(e,t){super(e),this.direction=t,this._buffer=new Hu(e.model,e.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,o=>{this._buffer.lock();const n=o.createSelection(e.selection||i.selection),r=e.sequence||1,s=n.isCollapsed;if(n.isCollapsed&&t.modifySelection(n,{direction:this.direction,unit:e.unit}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(o);if(this._shouldReplaceFirstBlockWithParagraph(n,r))return void this.editor.execute("paragraph",{selection:n});if(n.isCollapsed)return;let a=0;n.getFirstRange().getMinimalFlatRanges().forEach(e=>{a+=gn(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(n,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),o.setSelection(n),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,i=t.document.selection,o=t.schema.getLimitElement(i);if(!(i.isCollapsed&&i.containsEntireContent(o)))return!1;if(!t.schema.checkChild(o,"paragraph"))return!1;const n=o.getChild(0);return!n||"paragraph"!==n.name}_replaceEntireContentWithParagraph(e){const t=this.editor.model,i=t.document.selection,o=t.schema.getLimitElement(i),n=e.createElement("paragraph");e.remove(e.createRangeIn(o)),e.insert(n,o),e.setSelection(n,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||"backward"!=this.direction)return!1;if(!e.isCollapsed)return!1;const o=e.getFirstPosition(),n=i.schema.getLimitElement(o),r=n.getChild(0);return o.parent==r&&(!!e.containsEntireContent(r)&&(!!i.schema.checkChild(n,"paragraph")&&"paragraph"!=r.name))}}class Xu extends zr{constructor(e){super(e);const t=e.document;let i=0;function o(e,i,o){const n=new pn(t,"delete",t.selection.getFirstRange());t.fire(n,new es(t,i,o)),n.stop.called&&e.stop()}t.on("keyup",(e,t)=>{t.keyCode!=On.delete&&t.keyCode!=On.backspace||(i=0)}),t.on("keydown",(e,t)=>{const n={};if(t.keyCode==On.delete)n.direction="forward",n.unit="character";else{if(t.keyCode!=On.backspace)return;n.direction="backward",n.unit="codePoint"}const r=In.isMac?t.altKey:t.ctrlKey;n.unit=r?"word":n.unit,n.sequence=++i,o(e,t.domEvent,n)}),In.isAndroid&&t.on("beforeinput",(t,i)=>{if("deleteContentBackward"!=i.domEvent.inputType)return;const n={unit:"codepoint",direction:"backward",sequence:1},r=i.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(n.selectionToRemove=e.domConverter.domSelectionToView(r)),o(t,i.domEvent,n)})}observe(){}}class Zu extends Qe{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,i=t.document,o=e.model.document;t.addObserver(Xu),this._undoOnBackspace=!1;const n=new Qu(e,"forward");if(e.commands.add("deleteForward",n),e.commands.add("forwardDelete",n),e.commands.add("delete",new Qu(e,"backward")),this.listenTo(i,"delete",(i,o)=>{const n={unit:o.unit,sequence:o.sequence};if(o.selectionToRemove){const t=e.model.createSelection(),i=[];for(const t of o.selectionToRemove.getRanges())i.push(e.editing.mapper.toModelRange(t));t.setTo(i),n.selection=t}e.execute("forward"==o.direction?"deleteForward":"delete",n),o.preventDefault(),t.scrollToTheSelection()},{priority:"low"}),In.isAndroid){let e=null;this.listenTo(i,"delete",(t,i)=>{const o=i.domTarget.ownerDocument.defaultView.getSelection();e={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}},{priority:"lowest"}),this.listenTo(i,"keyup",(t,i)=>{if(e){const t=i.domTarget.ownerDocument.defaultView.getSelection();t.collapse(e.anchorNode,e.anchorOffset),t.extend(e.focusNode,e.focusOffset),e=null}})}this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",(t,i)=>{this._undoOnBackspace&&"backward"==i.direction&&1==i.sequence&&"codePoint"==i.unit&&(this._undoOnBackspace=!1,e.execute("undo"),i.preventDefault(),t.stop())},{context:"$capture"}),this.listenTo(o,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}function eg(e,t){let i=e.start;return{text:Array.from(e.getItems()).reduce((e,o)=>o.is("$text")||o.is("$textProxy")?e+o.data:(i=t.createPositionAfter(o),""),""),range:t.createRange(i,e.end)}}class tg{constructor(e,t){this.model=e,this.testCallback=t,this.hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:i})=>{i&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))}),this.listenTo(e,"change:data",(e,t)=>{"transparent"!=t.type&&this._evaluateTextBeforeSelection("data",{batch:t})})}_evaluateTextBeforeSelection(e,t={}){const i=this.model,o=i.document.selection,n=i.createRange(i.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=eg(n,i),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const i=Object.assign(t,{text:r,range:s});"object"==typeof a&&Object.assign(i,a),this.fire("matched:"+e,i)}}}Ye(tg,qe);class ig extends Qe{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,i=e.editing.view,o=e.locale,n=t.document.selection;this.listenTo(i.document,"arrowKey",(e,t)=>{if(!n.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const i=t.keyCode==On.arrowright,r=t.keyCode==On.arrowleft;if(!i&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&i||"rtl"===s&&r?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()},{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(n,"change:range",(e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&sg(n.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model.document.selection,o=i.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!og(i,t))&&(sg(o,t)?(rg(e),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,o=i.document.selection,n=o.getFirstPosition();return this._isGravityOverridden?(rg(e),this._restoreGravity(),ng(i,t,n),!0):n.isAtStart?!!og(o,t)&&(rg(e),ng(i,t,n),!0):function(e,t){return sg(e.getShiftedBy(-1),t)}(n,t)?n.isAtEnd&&!og(o,t)&&sg(n,t)?(rg(e),ng(i,t,n),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):void 0}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.editor.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}}function og(e,t){for(const i of t)if(e.hasAttribute(i))return!0;return!1}function ng(e,t,i){const o=i.nodeBefore;e.change(e=>{o?e.setSelectionAttribute(o.getAttributes()):e.removeSelectionAttribute(t)})}function rg(e){e.preventDefault()}function sg(e,t){const{nodeBefore:i,nodeAfter:o}=e;for(const e of t){const t=i?i.getAttribute(e):void 0;if((o?o.getAttribute(e):void 0)!==t)return!0}return!1}const ag={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:gg('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:gg("'"),to:[null,"",null,""]},quotesPrimaryEnGb:{from:gg("'"),to:[null,"",null,""]},quotesSecondaryEnGb:{from:gg('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:gg('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:gg("'"),to:[null,"",null,""]}},lg={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},cg=["symbols","mathematical","typography","quotes"];function dg(e){return"string"==typeof e?new RegExp(`(${yu(e)})$`):e}function hg(e){return"string"==typeof e?()=>[e]:e instanceof Array?()=>e:e}function ug(e){return(e.textNode?e.textNode:e.nodeAfter).getAttributes()}function gg(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function mg(e,t,i,o){return o.createRange(fg(e,t,i,!0,o),fg(e,t,i,!1,o))}function fg(e,t,i,o,n){let r=e.textNode||(o?e.nodeBefore:e.nodeAfter),s=null;for(;r&&r.getAttribute(t)==i;)s=r,r=o?r.previousSibling:r.nextSibling;return s?n.createPositionAt(s,o?"before":"after"):e}function pg(e,t,i,o){const n=e.editing.view,r=new Set;n.document.registerPostFixer(n=>{const s=e.model.document.selection;let a=!1;if(s.hasAttribute(t)){const l=mg(s.getFirstPosition(),t,s.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",i)&&!e.hasClass(o)&&(n.addClass(o,e),r.add(e),a=!0)}return a}),e.conversion.for("editingDowncast").add(e=>{function t(){n.change(e=>{for(const t of r.values())e.removeClass(o,t),r.delete(t)})}e.on("insert",t,{priority:"highest"}),e.on("remove",t,{priority:"highest"}),e.on("attribute",t,{priority:"highest"}),e.on("selection",t,{priority:"highest"})})}function bg(e,t,i,o){let n,r=null;"function"==typeof o?n=o:(r=e.commands.get(o),n=()=>{e.execute(o)}),e.model.document.on("change:data",(s,a)=>{if(r&&!r.isEnabled||!t.isEnabled)return;const l=Os(e.model.document.selection.getRanges());if(!l.isCollapsed)return;if("transparent"==a.type)return;const c=Array.from(e.model.document.differ.getChanges()),d=c[0];if(1!=c.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const h=d.position.parent;if(h.is("element","codeBlock"))return;if(h.is("element","listItem")&&"function"!=typeof o&&!["numberedList","bulletedList","todoList"].includes(o))return;if(r&&!0===r.value)return;const u=h.getChild(0),g=e.model.createRangeOn(u);if(!g.containsRange(l)&&!l.end.isEqual(g.end))return;const m=i.exec(u.data.substr(0,l.end.offset));m&&e.model.enqueueChange(t=>{const i=t.createPositionAt(h,0),o=t.createPositionAt(h,m[0].length),r=new wa(i,o);if(!1!==n({match:m})){t.remove(r);const i=e.model.document.selection.getFirstRange(),o=t.createRangeIn(h);!h.isEmpty||o.isEqual(i)||o.containsRange(i,!0)||t.remove(h)}r.detach(),e.model.enqueueChange(()=>{e.plugins.get("Delete").requestUndoOnBackspace()})})})}function wg(e,t,i,o){let n,r;i instanceof RegExp?n=i:r=i,r=r||(e=>{let t;const i=[],o=[];for(;null!==(t=n.exec(e))&&!(t&&t.length<4);){let{index:e,1:n,2:r,3:s}=t;const a=n+r+s;e+=t[0].length-a.length;const l=[e,e+n.length],c=[e+n.length+r.length,e+n.length+r.length+s.length];i.push(l),i.push(c),o.push([e+n.length,e+n.length+r.length])}return{remove:i,format:o}}),e.model.document.on("change:data",(i,n)=>{if("transparent"==n.type||!t.isEnabled)return;const s=e.model,a=s.document.selection;if(!a.isCollapsed)return;const l=Array.from(s.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const d=a.focus,h=d.parent,{text:u,range:g}=function(e,t){let i=e.start;return{text:Array.from(e.getItems()).reduce((e,o)=>!o.is("$text")&&!o.is("$textProxy")||o.getAttribute("code")?(i=t.createPositionAfter(o),""):e+o.data,""),range:t.createRange(i,e.end)}}(s.createRange(s.createPositionAt(h,0),d),s),m=r(u),f=kg(g.start,m.format,s),p=kg(g.start,m.remove,s);f.length&&p.length&&s.enqueueChange(t=>{if(!1!==o(t,f)){for(const e of p.reverse())t.remove(e);s.enqueueChange(()=>{e.plugins.get("Delete").requestUndoOnBackspace()})}})})}function kg(e,t,i){return t.filter(e=>void 0!==e[0]&&void 0!==e[1]).map(t=>i.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1])))}class _g extends Qe{static get requires(){return[Zu]}static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats()}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&bg(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&bg(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&bg(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&bg(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")})}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const e=vg(this.editor,"bold");wg(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,e),wg(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,e)}if(e.get("italic")){const e=vg(this.editor,"italic");wg(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,e),wg(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,e)}if(e.get("code")){const e=vg(this.editor,"code");wg(this.editor,this,/(`)([^`]+)(`)$/g,e)}if(e.get("strikethrough")){const e=vg(this.editor,"strikethrough");wg(this.editor,this,/(~~)([^~]+)(~~)$/g,e)}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter(e=>e.match(/^heading[1-6]$/)).forEach(t=>{const i=t[7],o=new RegExp(`^(#{${i}})\\s$`);bg(this.editor,this,o,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&bg(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&bg(e,this,/^```$/,()=>{if(t.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&bg(this.editor,this,/^---$/,"horizontalLine")}}function vg(e,t){return(i,o)=>{if(!e.commands.get(t).isEnabled)return!1;const n=e.model.schema.getValidRanges(o,t);for(const e of n)i.setAttribute(t,!0,e);i.removeSelectionAttribute(t)}}class yg extends Ze{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,o=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(i.isCollapsed)o?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const n=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const t of n)o?e.setAttribute(this.attributeKey,o,t):e.removeAttribute(this.attributeKey,t)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const e of i.getRanges())for(const i of e.getItems())if(t.checkAttribute(i,this.attributeKey))return i.hasAttribute(this.attributeKey);return!1}}class xg extends Qe{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"bold"}),e.model.schema.setAttributeProperties("bold",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"bold",view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t?"bold"==t||Number(t)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),e.commands.add("bold",new yg(e,"bold")),e.keystrokes.set("CTRL+B","bold")}}class Cg extends Qe{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("bold",i=>{const o=e.commands.get("bold"),n=new rd(i);return n.set({label:t("Bold"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("bold"),e.editing.view.focus()}),n})}}class Ag extends Qe{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"italic"}),e.model.schema.setAttributeProperties("italic",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"italic",view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add("italic",new yg(e,"italic")),e.keystrokes.set("CTRL+I","italic")}}class Tg extends Qe{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("italic",i=>{const o=e.commands.get("italic"),n=new rd(i);return n.set({label:t("Italic"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("italic"),e.editing.view.focus()}),n})}}class Eg extends Qe{static get pluginName(){return"SuperscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"superscript"}),e.model.schema.setAttributeProperties("superscript",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"superscript",view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add("superscript",new yg(e,"superscript"))}}class Pg extends Qe{static get pluginName(){return"SuperscriptUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("superscript",i=>{const o=e.commands.get("superscript"),n=new rd(i);return n.set({label:t("Superscript"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.677 8.678h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309zM7.03 10.349l3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82z"/></svg>',tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("superscript"),e.editing.view.focus()}),n})}}class Sg extends Qe{static get pluginName(){return"SubscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"subscript"}),e.model.schema.setAttributeProperties("subscript",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"subscript",view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add("subscript",new yg(e,"subscript"))}}class Ig extends Qe{static get pluginName(){return"SubscriptUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("subscript",i=>{const o=e.commands.get("subscript"),n=new rd(i);return n.set({label:t("Subscript"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82zm8.147 7.829h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309z"/></svg>',tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("subscript"),e.editing.view.focus()}),n})}}class Rg extends Qe{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"underline"}),e.model.schema.setAttributeProperties("underline",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"underline",view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add("underline",new yg(e,"underline")),e.keystrokes.set("CTRL+U","underline")}}class Vg extends Qe{static get pluginName(){return"UnderlineUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("underline",i=>{const o=e.commands.get("underline"),n=new rd(i);return n.set({label:t("Underline"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>',keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("underline"),e.editing.view.focus()}),n})}}class Og extends Qe{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"strikethrough"}),e.model.schema.setAttributeProperties("strikethrough",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"strikethrough",view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add("strikethrough",new yg(e,"strikethrough")),e.keystrokes.set("CTRL+SHIFT+X","strikethrough")}}class zg extends Qe{static get pluginName(){return"StrikethroughUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("strikethrough",i=>{const o=e.commands.get("strikethrough"),n=new rd(i);return n.set({label:t("Strikethrough"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>',keystroke:"CTRL+SHIFT+X",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("strikethrough"),e.editing.view.focus()}),n})}}const Mg="code";class Bg extends Qe{static get pluginName(){return"CodeEditing"}static get requires(){return[ig]}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Mg}),e.model.schema.setAttributeProperties(Mg,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:Mg,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(Mg,new yg(e,Mg)),e.plugins.get(ig).registerAttribute(Mg),pg(e,Mg,"code","ck-code_selected")}}i(13);class Ng extends Qe{static get pluginName(){return"CodeUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("code",i=>{const o=e.commands.get("code"),n=new rd(i);return n.set({label:t("Code"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>',tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("code"),e.editing.view.focus()}),n})}}function*Fg(e,t){for(const i of t)i&&e.getAttributeProperties(i[0]).copyOnEnter&&(yield i)}class Dg extends Ze{execute(){const e=this.editor.model,t=e.document;e.change(i=>{!function(e,t,i,o){const n=i.isCollapsed,r=i.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return void(n||s!=a||e.deleteContent(i));if(n){const e=Fg(t.model.schema,i.getAttributes());Lg(t,r.start),t.setSelectionAttribute(e)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd),n=s==a;e.deleteContent(i,{leaveUnmerged:o}),o&&(n?Lg(t,i.focus):t.setSelection(a,0))}}(this.editor.model,i,t.selection,e.schema),this.fire("afterExecute",{writer:i})})}}function Lg(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}class Hg extends zr{constructor(e){super(e);const t=this.document;t.on("keydown",(e,i)=>{if(this.isEnabled&&i.keyCode==On.enter){const o=new pn(t,"enter",t.selection.getFirstRange());t.fire(o,new es(t,i.domEvent,{isSoft:i.shiftKey})),o.stop.called&&e.stop()}})}observe(){}}class jg extends Qe{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,i=t.document;t.addObserver(Hg),e.commands.add("enter",new Dg(e)),this.listenTo(i,"enter",(i,o)=>{o.preventDefault(),o.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}class Wg extends Ze{execute(){const e=this.editor.model,t=e.document;e.change(i=>{!function(e,t,i){const o=i.isCollapsed,n=i.getFirstRange(),r=n.start.parent,s=n.end.parent,a=r==s;if(o){const o=Fg(e.schema,i.getAttributes());qg(e,t,n.end),t.removeSelectionAttribute(i.getAttributeKeys()),t.setSelectionAttribute(o)}else{const o=!(n.start.isAtStart&&n.end.isAtEnd);e.deleteContent(i,{leaveUnmerged:o}),a?qg(e,t,i.focus):o&&t.setSelection(s,0)}}(e,i,t.selection),this.fire("afterExecute",{writer:i})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const i=t.anchor;if(!i||!e.checkChild(i,"softBreak"))return!1;const o=t.getFirstRange(),n=o.start.parent,r=o.end.parent;if(($g(n,e)||$g(r,e))&&n!==r)return!1;return!0}(e.schema,t.selection)}}function qg(e,t,i){const o=t.createElement("softBreak");e.insertContent(o,i),t.setSelection(o,"after")}function $g(e,t){return!e.is("rootElement")&&(t.isLimit(e)||$g(e.parent,t))}class Ug extends Qe{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,i=e.conversion,o=e.editing.view,n=o.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),o.addObserver(Hg),e.commands.add("shiftEnter",new Wg(e)),this.listenTo(n,"enter",(t,i)=>{i.preventDefault(),i.isSoft&&(e.execute("shiftEnter"),o.scrollToTheSelection())},{priority:"low"})}}class Kg extends Ze{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.schema,o=t.document.selection,n=Array.from(o.getSelectedBlocks()),r=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(r){const t=n.filter(e=>Gg(e)||Yg(i,e));this._applyQuote(e,t)}else this._removeQuote(e,n.filter(Gg))})}_getValue(){const e=Os(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!Gg(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Os(e.getSelectedBlocks());return!!i&&Yg(t,i)}_removeQuote(e,t){Jg(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const i=e.createPositionBefore(t.start.parent);return void e.move(t,i)}t.end.isAtEnd||e.split(t.end);const i=e.createPositionAfter(t.end.parent);e.move(t,i)})}_applyQuote(e,t){const i=[];Jg(e,t).reverse().forEach(t=>{let o=Gg(t.start);o||(o=e.createElement("blockQuote"),e.wrap(t,o)),i.push(o)}),i.reverse().reduce((t,i)=>t.nextSibling==i?(e.merge(e.createPositionAfter(t)),t):i)}}function Gg(e){return"blockQuote"==e.parent.name?e.parent:null}function Jg(e,t){let i,o=0;const n=[];for(;o<t.length;){const r=t[o],s=t[o+1];i||(i=e.createPositionBefore(r)),s&&r.nextSibling==s||(n.push(e.createRange(i,e.createPositionAfter(r))),i=null),o++}return n}function Yg(e,t){const i=e.checkChild(t.parent,"blockQuote"),o=e.checkChild(["$root","blockQuote"],t);return i&&o}class Qg extends Qe{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[jg,Zu]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new Kg(e)),t.register("blockQuote",{allowWhere:"$block",allowContentOf:"$root"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(i=>{const o=e.model.document.differ.getChanges();for(const e of o)if("insert"==e.type){const o=e.position.nodeAfter;if(!o)continue;if(o.is("element","blockQuote")&&o.isEmpty)return i.remove(o),!0;if(o.is("element","blockQuote")&&!t.checkChild(e.position,o))return i.unwrap(o),!0;if(o.is("element")){const e=i.createRangeIn(o);for(const o of e.getItems())if(o.is("element","blockQuote")&&!t.checkChild(i.createPositionBefore(o),o))return i.unwrap(o),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return i.remove(t),!0}return!1});const i=this.editor.editing.view.document,o=e.model.document.selection,n=e.commands.get("blockQuote");this.listenTo(i,"enter",(t,i)=>{if(!o.isCollapsed||!n.value)return;o.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop())},{context:"blockquote"}),this.listenTo(i,"delete",(t,i)=>{if("backward"!=i.direction||!o.isCollapsed||!n.value)return;const r=o.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop())},{context:"blockquote"})}}i(70);class Xg extends Qe{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",i=>{const o=e.commands.get("blockQuote"),n=new rd(i);return n.set({label:t("Block quote"),icon:Rc.quote,tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),n})}}class Zg extends Ze{refresh(){const e=this.editor.model,t=Os(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&em(t,e.schema)}execute(e={}){const t=this.editor.model,i=t.document;t.change(o=>{const n=(e.selection||i.selection).getSelectedBlocks();for(const e of n)!e.is("element","paragraph")&&em(e,t.schema)&&o.rename(e,"paragraph")})}}function em(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class tm extends Ze{execute(e){const t=this.editor.model;let i=e.position;t.change(e=>{const o=e.createElement("paragraph");if(!t.schema.checkChild(i.parent,o)){const n=t.schema.findAllowedParent(i,o);if(!n)return;i=e.split(i,n).position}t.insertContent(o,i),e.setSelection(o,"in")})}}class im extends Qe{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new Zg(e)),e.commands.add("insertParagraph",new tm(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>im.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}im.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class om extends Ze{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=Os(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>nm(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,i=t.document,o=e.value;t.change(e=>{const n=Array.from(i.selection.getSelectedBlocks()).filter(e=>nm(e,o,t.schema));for(const t of n)t.is("element",o)||e.rename(t,o)})}}function nm(e,t,i){return i.checkChild(e.parent,t)&&!i.isObject(e)}class rm extends Qe{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[im]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const o of t)"paragraph"!==o.model&&(e.model.schema.register(o.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(o),i.push(o.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new om(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(t,o)=>{const n=e.model.document.selection.getFirstPosition().parent;i.some(e=>n.is("element",e.model))&&!n.is("element","paragraph")&&0===n.childCount&&o.writer.rename(n,"paragraph")})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:a.get("low")+1})}}function sm(e){const t=e.t,i={Paragraph:t("Paragraph"),"Heading 1":t("Heading 1"),"Heading 2":t("Heading 2"),"Heading 3":t("Heading 3"),"Heading 4":t("Heading 4"),"Heading 5":t("Heading 5"),"Heading 6":t("Heading 6")};return e.config.get("heading.options").map(e=>{const t=i[e.title];return t&&t!=e.title&&(e.title=t),e})}i(14);class am extends Qe{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,i=sm(e),o=t("Choose heading"),n=t("Heading");e.ui.componentFactory.add("heading",t=>{const r={},s=new Zi,a=e.commands.get("heading"),l=e.commands.get("paragraph"),c=[a];for(const e of i){const t={type:"button",model:new $d({label:e.title,class:e.class,withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(l,"value"),t.model.set("commandName","paragraph"),c.push(l)):(t.model.bind("isOn").to(a,"value",t=>t===e.model),t.model.set({commandName:"heading",commandValue:e.model})),s.add(t),r[e.model]=e.title}const d=Vd(t);return zd(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:n}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(c,"isEnabled",(...e)=>e.some(e=>e)),d.buttonView.bind("label").to(a,"value",l,"value",(e,t)=>{const i=e||t&&"paragraph";return r[i]?r[i]:o}),this.listenTo(d,"execute",t=>{e.execute(t.source.commandName,t.source.commandValue?{value:t.source.commandValue}:void 0),e.editing.view.focus()}),d})}}class lm{constructor(){this._stack=[]}add(e,t){const i=this._stack,o=i[0];this._insertDescriptor(e);const n=i[0];o===n||cm(o,n)||this.fire("change:top",{oldDescriptor:o,newDescriptor:n,writer:t})}remove(e,t){const i=this._stack,o=i[0];this._removeDescriptor(e);const n=i[0];o===n||cm(o,n)||this.fire("change:top",{oldDescriptor:o,newDescriptor:n,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex(t=>t.id===e.id);if(cm(e,t[i]))return;i>-1&&t.splice(i,1);let o=0;for(;t[o]&&dm(t[o],e);)o++;t.splice(o,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex(t=>t.id===e);i>-1&&t.splice(i,1)}}function cm(e,t){return e&&t&&e.priority==t.priority&&hm(e.classes)==hm(t.classes)}function dm(e,t){return e.priority>t.priority||!(e.priority<t.priority)&&hm(e.classes)>hm(t.classes)}function hm(e){return Array.isArray(e)?e.sort().join(","):e}Ye(lm,h);function um(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function gm(e,t,i={}){if(!e.is("containerElement"))throw new l.a("widget-to-widget-wrong-element-type",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass("ck-widget",e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=vm,i.label&&function(e,t,i){i.setCustomProperty("widgetLabel",t,e)}(e,i.label,t),i.hasSelectionHandle&&function(e,t){const i=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),i=new od;return i.set("content",'<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>'),i.render(),t.appendChild(i.element),t}));t.insert(t.createPositionAt(e,0),i),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),pm(e,t),e}function mm(e,t,i){if(t.classes&&i.addClass(to(t.classes),e),t.attributes)for(const o in t.attributes)i.setAttribute(o,t.attributes[o],e)}function fm(e,t,i){if(t.classes&&i.removeClass(to(t.classes),e),t.attributes)for(const o in t.attributes)i.removeAttribute(o,e)}function pm(e,t,i=mm,o=fm){const n=new lm;n.on("change:top",(t,n)=>{n.oldDescriptor&&o(e,n.oldDescriptor,n.writer),n.newDescriptor&&i(e,n.newDescriptor,n.writer)}),t.setCustomProperty("addHighlight",(e,t,i)=>n.add(t,i),e),t.setCustomProperty("removeHighlight",(e,t,i)=>n.remove(t,i),e)}function bm(e){const t=e.getCustomProperty("widgetLabel");return t?"function"==typeof t?t():t:""}function wm(e,t){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",(i,o,n)=>{t.setAttribute("contenteditable",n?"false":"true",e)}),e.on("change:isFocused",(i,o,n)=>{n?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)}),pm(e,t),e}function km(e,t){const i=e.getSelectedElement();if(i){const o=xm(e);if(o)return t.createRange(t.createPositionAt(i,o));if(t.schema.isObject(i)&&!t.schema.isInline(i))return t.createRangeOn(i)}const o=e.getSelectedBlocks().next().value;if(o){if(o.isEmpty)return t.createRange(t.createPositionAt(o,0));const i=t.createPositionAfter(o);return e.focus.isTouching(i)?t.createRange(i):t.createRange(t.createPositionBefore(o))}return t.createRange(e.focus)}function _m(e,t){return(i,o)=>{const{mapper:n,viewPosition:r}=o,s=n.findMappedViewAncestor(r);if(!t(s))return;const a=n.toModelElement(s);o.modelPosition=e.createPositionAt(a,r.isAtStart?"before":"after")}}function vm(){return null}function ym(e,t,i){return e&&um(e)&&!i.isInline(t)}function xm(e){return e.getAttribute("widget-type-around")}i(73);const Cm=["before","after"],Am=(new DOMParser).parseFromString('<svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><path d="M9.055.263v3.972h-6.77M1 4.216l2-2.038m-2 2 2 2.038"/></svg>',"image/svg+xml").firstChild;class Tm extends Qe{static get pluginName(){return"WidgetTypeAround"}static get requires(){return[jg,Zu]}constructor(e){super(e),this._currentFakeCaretModelElement=null}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,o,n)=>{t.change(e=>{for(const i of t.document.roots)n?e.removeClass("ck-widget__type-around_disabled",i):e.addClass("ck-widget__type-around_disabled",i)}),n||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableDeleteContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,o=i.editing.view;i.execute("insertParagraph",{position:i.model.createPositionAt(e,t)}),o.focus(),o.scrollToTheSelection()}_listenToIfEnabled(e,t,i,o){this.listenTo(e,t,(...e)=>{this.isEnabled&&i(...e)},o)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=xm(e);if(!t)return!1;const i=e.getSelectedElement();return this._insertParagraph(i,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,o={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(e,i,n)=>{const r=n.mapper.toViewElement(i.item);ym(r,i.item,t)&&function(e,t,i){const o=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const i=this.toDomElement(e);return function(e,t){for(const i of Cm){const o=new Nc({tag:"div",attributes:{class:["ck","ck-widget__type-around__button","ck-widget__type-around__button_"+i],title:t[i]},children:[e.ownerDocument.importNode(Am,!0)]});e.appendChild(o.render())}}(i,t),function(e){const t=new Nc({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(i),i}));e.insert(e.createPositionAt(i,"end"),o)}(n.writer,o,r)},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,o=t.schema,n=e.editing.view;function r(e){return"ck-widget_type-around_show-fake-caret_"+e}this._listenToIfEnabled(n.document,"arrowKey",(e,t)=>{this._handleArrowKeyPress(e,t)},{context:[um,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",(t,i)=>{i.directChange&&e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(t.document,"change:data",()=>{const t=i.getSelectedElement();if(t){if(ym(e.editing.mapper.toViewElement(t),t,o))return}e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(e,t,i)=>{const n=i.writer;if(this._currentFakeCaretModelElement){const e=i.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(n.removeClass(Cm.map(r),e),this._currentFakeCaretModelElement=null)}const s=t.selection.getSelectedElement();if(!s)return;const a=i.mapper.toViewElement(s);if(!ym(a,s,o))return;const l=xm(t.selection);l&&(n.addClass(r(l),a),this._currentFakeCaretModelElement=s)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(t,i,o)=>{o||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})})}_handleArrowKeyPress(e,t){const i=this.editor,o=i.model,n=o.document.selection,r=o.schema,s=i.editing.view,a=function(e,t){const i=Fn(e,t);return"down"===i||"right"===i}(t.keyCode,i.locale.contentLanguageDirection),l=s.document.selection.getSelectedElement();let c;ym(l,i.editing.mapper.toModelElement(l),r)?c=this._handleArrowKeyPressOnSelectedWidget(a):n.isCollapsed?c=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):t.shiftKey||(c=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),c&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,i=xm(t.document.selection);return t.change(t=>{if(!i)return t.setSelectionAttribute("widget-type-around",e?"after":"before"),!0;if(!(i===(e?"after":"before")))return t.removeSelectionAttribute("widget-type-around"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,o=i.schema,n=t.plugins.get("Widget"),r=n._getObjectElementNextToSelection(e);return!!ym(t.editing.mapper.toViewElement(r),r,o)&&(i.change(t=>{n._setSelectionOverElement(r),t.setSelectionAttribute("widget-type-around",e?"before":"after")}),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,i=t.model,o=i.schema,n=t.editing.mapper,r=i.document.selection,s=e?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!ym(n.toViewElement(s),s,o)&&(i.change(t=>{t.setSelection(s,"on"),t.setSelectionAttribute("widget-type-around",e?"after":"before")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,o)=>{const n=o.domTarget.closest(".ck-widget__type-around__button");if(!n)return;const r=function(e){return e.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(n),s=function(e,t){const i=e.closest(".ck-widget");return t.mapDomToView(i)}(n,t.domConverter),a=e.editing.mapper.toModelElement(s);this._insertParagraph(a,r),o.preventDefault(),i.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",(i,o)=>{if("atTarget"!=i.eventPhase)return;const n=t.getSelectedElement(),r=e.editing.mapper.toViewElement(n),s=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:ym(r,n,s)&&(this._insertParagraph(n,o.isSoft?"before":"after"),a=!0),a&&(o.preventDefault(),i.stop())},{context:um})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view,t=[On.enter,On.delete,On.backspace];this._listenToIfEnabled(e.document,"keydown",(e,i)=>{t.includes(i.keyCode)||qu(i)||this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,o=i.schema;this._listenToIfEnabled(t.document,"delete",(t,n)=>{if("atTarget"!=t.eventPhase)return;const r=xm(i.document.selection);if(!r)return;const s=n.direction,a=i.document.selection.getSelectedElement(),l="forward"==s;if("before"===r===l)e.execute("delete",{selection:i.createSelection(a,"on")});else{const t=o.getNearestSelectionRange(i.createPositionAt(a,r),s);if(t)if(t.isCollapsed){const n=i.createSelection(t.start);if(i.modifySelection(n,{direction:s}),n.focus.isEqual(t.start)){const e=function(e,t){let i=t;for(const o of t.getAncestors({parentFirst:!0})){if(o.childCount>1||e.isLimit(o))break;i=o}return i}(o,t.start.parent);i.deleteContent(i.createSelection(e,"on"),{doNotAutoparagraph:!0})}else i.change(i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete")})}else i.change(i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete")})}n.preventDefault(),t.stop()},{context:um})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(e,[o,n])=>{if(n&&!n.is("documentSelection"))return;const r=xm(i);return r?(e.stop(),t.change(e=>{const n=i.getSelectedElement(),s=t.createPositionAt(n,r),a=e.createSelection(s),l=t.insertContent(o,a);return e.setSelection(a),l})):void 0},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(e,[i])=>{if(i&&!i.is("documentSelection"))return;xm(t)&&e.stop()},{priority:"high"})}}function Em(e){const t=e.model;return(i,o)=>{const n=o.keyCode==On.arrowup,r=o.keyCode==On.arrowdown,s=o.shiftKey,a=t.document.selection;if(!n&&!r)return;const l=r;if(s&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(a,l))return;const c=function(e,t,i){const o=e.model;if(i){const e=t.isCollapsed?t.focus:t.getLastPosition(),i=Pm(o,e,"forward");if(!i)return null;const n=o.createRange(e,i),r=Sm(o.schema,n,"backward");return r?o.createRange(e,r):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),i=Pm(o,e,"backward");if(!i)return null;const n=o.createRange(i,e),r=Sm(o.schema,n,"forward");return r?o.createRange(r,e):null}}(e,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(s)return}(c.isCollapsed||function(e,t,i){const o=e.model,n=e.view.domConverter;if(i){const e=o.createSelection(t.start);o.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=o.createRange(e.focus,t.end))}const r=e.mapper.toViewRange(t),s=n.viewRangeToDom(r),a=Ts.getDomRangeRects(s);let l;for(const e of a)if(void 0!==l){if(Math.round(e.top)>=l)return!1;l=Math.max(l,Math.round(e.bottom))}else l=Math.round(e.bottom);return!0}(e,c,l))&&(t.change(e=>{const i=l?c.end:c.start;if(s){const o=t.createSelection(a.anchor);o.setFocus(i),e.setSelection(o)}else e.setSelection(i)}),i.stop(),o.preventDefault(),o.stopPropagation())}}}function Pm(e,t,i){const o=e.schema,n=e.createRangeIn(t.root),r="forward"==i?"elementStart":"elementEnd";for(const{previousPosition:e,item:s,type:a}of n.getWalker({startPosition:t,direction:i})){if(o.isLimit(s)&&!o.isInline(s))return e;if(a==r&&o.isBlock(s))return null}return null}function Sm(e,t,i){const o="backward"==i?t.end:t.start;if(e.checkChild(o,"$text"))return o;for(const{nextPosition:o}of t.getWalker({direction:i}))if(e.checkChild(o,"$text"))return o;return null}i(75);class Im extends Qe{static get pluginName(){return"Widget"}static get requires(){return[Tm,Zu]}init(){const e=this.editor,t=e.editing.view,i=t.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",(t,i,o)=>{const n=o.writer,r=i.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=e.editing.mapper.toViewElement(s);um(a)&&o.consumable.consume(r,"selection")&&n.setSelection(n.createRangeOn(a),{fake:!0,label:bm(a)})}),this.editor.editing.downcastDispatcher.on("selection",(e,t,i)=>{this._clearPreviouslySelectedWidgets(i.writer);const o=i.writer,n=o.document.selection;let r=null;for(const e of n.getRanges())for(const t of e){const e=t.item;um(e)&&!Rm(e,r)&&(o.addClass("ck-widget_selected",e),this._previouslySelected.add(e),r=e)}},{priority:"low"}),t.addObserver(Eh),this.listenTo(i,"mousedown",(...e)=>this._onMousedown(...e)),this.listenTo(i,"arrowKey",(...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)},{context:[um,"$text"]}),this.listenTo(i,"arrowKey",(...e)=>{this._preventDefaultOnArrowKeyPress(...e)},{context:"$root"}),this.listenTo(i,"arrowKey",Em(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",(e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())},{context:"$root"})}_onMousedown(e,t){const i=this.editor,o=i.editing.view,n=o.document;let r=t.target;if(function(e){for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(um(e))return!1;e=e.parent}return!1}(r)){if((In.isSafari||In.isGecko)&&t.domEvent.detail>=3){const e=i.editing.mapper,o=r.is("attributeElement")?r.findAncestor(e=>!e.is("attributeElement")):r,n=e.toModelElement(o);t.preventDefault(),this.editor.model.change(e=>{e.setSelection(n,"in")})}return}if(!um(r)&&(r=r.findAncestor(um),!r))return;In.isAndroid&&t.preventDefault(),n.isFocused||o.focus();const s=i.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,o=this.editor.model,n=o.schema,r=o.document.selection,s=r.getSelectedElement(),a=Fn(i,this.editor.locale.contentLanguageDirection),l="down"==a||"right"==a,c="up"==a||"down"==a;if(s&&n.isObject(s)){const i=l?r.getLastPosition():r.getFirstPosition(),s=n.getNearestSelectionRange(i,l?"forward":"backward");return void(s&&(o.change(e=>{e.setSelection(s)}),t.preventDefault(),e.stop()))}if(!r.isCollapsed&&!t.shiftKey){const i=r.getFirstPosition(),s=r.getLastPosition(),a=i.nodeAfter,c=s.nodeBefore;return void((a&&n.isObject(a)||c&&n.isObject(c))&&(o.change(e=>{e.setSelection(l?s:i)}),t.preventDefault(),e.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(l);if(d&&n.isObject(d)){if(n.isInline(d)&&c)return;this._setSelectionOverElement(d),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,o=i.schema,n=i.document.selection.getSelectedElement();n&&o.isObject(n)&&(t.preventDefault(),e.stop())}_handleDelete(e){if(this.editor.isReadOnly)return;const t=this.editor.model.document.selection;if(!t.isCollapsed)return;const i=this._getObjectElementNextToSelection(e);return i?(this.editor.model.change(e=>{let o=t.anchor.parent;for(;o.isEmpty;){const t=o;o=t.parent,e.remove(t)}this._setSelectionOverElement(i)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,o=t.document.selection,n=t.createSelection(o);if(t.modifySelection(n,{direction:e?"forward":"backward"}),n.isEqual(o))return null;const r=e?n.focus.nodeBefore:n.focus.nodeAfter;return r&&i.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass("ck-widget_selected",t);this._previouslySelected.clear()}}function Rm(e,t){return!!t&&Array.from(e.getAncestors()).includes(t)}class Vm extends Qe{static get requires(){return[eh]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",t=>{(function(e){const t=e.getSelectedElement();return!(!t||!um(t))})(e.editing.view.document.selection)&&t.stop()},{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:o,balloonClassName:n="ck-toolbar-container"}){if(!i.length)return void Object(l.b)("widget-toolbar-no-items",{toolbarId:e});const r=this.editor,s=r.t,a=new Ad(r.locale);if(a.ariaLabel=t||s("Widget toolbar"),this._toolbarDefinitions.has(e))throw new l.a("widget-toolbar-duplicated",this,{toolbarId:e});a.fillFromConfig(i,r.ui.componentFactory),this._toolbarDefinitions.set(e,{view:a,getRelatedElement:o,balloonClassName:n})}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const o of this._toolbarDefinitions.values()){const n=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&n)if(this.editor.ui.focusTracker.isFocused){const r=n.getAncestors().length;r>e&&(e=r,t=n,i=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Om(this.editor,t):this._isToolbarInBalloon(e)||(this._balloon.add({view:e.view,position:zm(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const e of this._toolbarDefinitions.values())if(this._isToolbarVisible(e)){const t=e.getRelatedElement(this.editor.editing.view.document.selection);Om(this.editor,t)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Om(e,t){const i=e.plugins.get("ContextualBalloon"),o=zm(e,t);i.updatePosition(o)}function zm(e,t){const i=e.editing.view,o=Gd.defaultPositions;return{target:i.domConverter.mapViewToDom(t),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast,o.viewportStickyNorth]}}class Mm{constructor(e){this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}begin(e,t,i){const o=new Ts(t);this.activeHandlePosition=function(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)if(e.classList.contains("ck-widget__resizer__handle-"+i))return i}(e),this._referenceCoordinates=function(e,t){const i=new Ts(e),o=t.split("-"),n={x:"right"==o[1]?i.right:i.left,y:"bottom"==o[0]?i.bottom:i.top};return n.x+=e.ownerDocument.defaultView.scrollX,n.y+=e.ownerDocument.defaultView.scrollY,n}(t,function(e){const t=e.split("-"),i={top:"bottom",bottom:"top",left:"right",right:"left"};return`${i[t[0]]}-${i[t[1]]}`}(this.activeHandlePosition)),this.originalWidth=o.width,this.originalHeight=o.height,this.aspectRatio=o.width/o.height;const n=i.style.width;n&&n.match(/^\d+(\.\d*)?%$/)?this.originalWidthPercents=parseFloat(n):this.originalWidthPercents=function(e,t){const i=e.parentElement,o=parseFloat(i.ownerDocument.defaultView.getComputedStyle(i).width);return t.width/o*100}(i,o)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}Ye(Mm,qe);class Bm extends Bc{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("_viewPosition",e=>e?"ck-orientation-"+e:"")],style:{display:e.if("_isVisible","none",e=>!e)}},children:[{text:e.to("_label")}]})}_bindToState(e,t){this.bind("_isVisible").to(t,"proposedWidth",t,"proposedHeight",(e,t)=>null!==e&&null!==t),this.bind("_label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",(t,i,o)=>"px"===e.unit?`${t}×${i}`:o+"%"),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",(e,t,i)=>t<50||i<50?"above-center":e)}_dismiss(){this.unbind(),this._isVisible=!1}}class Nm{constructor(e){this._options=e,this._viewResizerWrapper=null,this.set("isEnabled",!0),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",e=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),e.stop())},{priority:"high"}),this.on("change:isEnabled",()=>{this.isEnabled&&this.redraw()})}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change(i=>{const o=i.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(t){const i=this.toDomElement(t);return e._appendHandles(i),e._appendSizeUI(i),e.on("change:isEnabled",(e,t,o)=>{i.style.display=o?"":"none"}),i.style.display=e.isEnabled?"":"none",i}));i.insert(i.createPositionAt(t,"end"),o),i.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=o})}begin(e){this.state=new Mm(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change(e=>{const i=this._options.unit||"%",o=("%"===i?t.widthPercents:t.width)+i;e.setStyle("width",o,this._options.viewElement)});const i=this._getHandleHost(),o=new Ts(i);t.handleHostWidth=Math.round(o.width),t.handleHostHeight=Math.round(o.height);const n=new Ts(i);t.width=Math.round(n.width),t.height=Math.round(n.height),this.redraw(o),this.state.update(t)}commit(){const e=this._options.unit||"%",t=("%"===e?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change(()=>{this._cleanup(),this._options.onCommit(t)})}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!((i=t)&&i.ownerDocument&&i.ownerDocument.contains(i)))return;var i;const o=t.parentElement,n=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(o.isSameNode(n)){const t=e||new Ts(n);a=[t.width+"px",t.height+"px",void 0,void 0]}else a=[n.offsetWidth+"px",n.offsetHeight+"px",n.offsetLeft+"px",n.offsetTop+"px"];"same"!==lo(s,a)&&this._options.editor.editing.view.change(e=>{e.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)})}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change(e=>{e.setStyle("width",this._initialViewWidth,this._options.viewElement)})}_proposeNewSize(e){const t=this.state,i={x:(o=e).pageX,y:o.pageY};var o;const n=!this._options.isCentered||this._options.isCentered(this),r={x:t._referenceCoordinates.x-(i.x+t.originalWidth),y:i.y-t.originalHeight-t._referenceCoordinates.y};n&&t.activeHandlePosition.endsWith("-right")&&(r.x=i.x-(t._referenceCoordinates.x+t.originalWidth)),n&&(r.x*=2);const s={width:Math.abs(t.originalWidth+r.x),height:Math.abs(t.originalHeight+r.y)};s.dominant=s.width/t.aspectRatio>s.height?"width":"height",s.max=s[s.dominant];const a={width:s.width,height:s.height};return"width"==s.dominant?a.height=a.width/t.aspectRatio:a.width=a.height*t.aspectRatio,{width:Math.round(a.width),height:Math.round(a.height),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*a.width*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const o of t)e.appendChild(new Nc({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(i=o,"ck-widget__resizer__handle-"+i)}}).render());var i}_appendSizeUI(e){this._sizeView=new Bm,this._sizeView.render(),e.appendChild(this._sizeView.element)}}Ye(Nm,qe);var Fm=function(e,t,i){var o=!0,n=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return w(i)&&(o="leading"in i?!!i.leading:o,n="trailing"in i?!!i.trailing:n),fs(e,t,{leading:o,maxWait:t,trailing:n})};i(77);class Dm extends Qe{static get pluginName(){return"WidgetResize"}init(){const e=this.editor.editing,t=vr.window.document;this.set("visibleResizer",null),this.set("_activeResizer",null),this._resizers=new Map,e.view.addObserver(Eh),this._observer=Object.create(Rr),this.listenTo(e.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(t,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(t,"mouseup",this._mouseUpListener.bind(this));const i=()=>{this.visibleResizer&&this.visibleResizer.redraw()};this._redrawFocusedResizerThrottled=Fm(i,200),this.on("change:visibleResizer",i),this.editor.ui.on("update",this._redrawFocusedResizerThrottled),this.editor.model.document.on("change",()=>{for(const[e,t]of this._resizers)e.isAttached()||(this._resizers.delete(e),t.destroy())},{priority:"lowest"}),this._observer.listenTo(vr.window,"resize",this._redrawFocusedResizerThrottled);const o=this.editor.editing.view.document.selection;o.on("change",()=>{const e=o.getSelectedElement();this.visibleResizer=this.getResizerByViewElement(e)||null})}destroy(){this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawFocusedResizerThrottled.cancel()}attachTo(e){const t=new Nm(e),i=this.editor.plugins;if(t.attach(),i.has("WidgetToolbarRepository")){const e=i.get("WidgetToolbarRepository");t.on("begin",()=>{e.forceDisabled("resize")},{priority:"lowest"}),t.on("cancel",()=>{e.clearForceDisabled("resize")},{priority:"highest"}),t.on("commit",()=>{e.clearForceDisabled("resize")},{priority:"highest"})}this._resizers.set(e.viewElement,t);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==t&&(this.visibleResizer=t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const i=t.domTarget;Nm.isResizeHandle(i)&&(this._activeResizer=this._getResizerByHandle(i),this._activeResizer&&(this._activeResizer.begin(i),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}Ye(Dm,qe);class Lm extends Ze{refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),o=t.model,n=i.getClosestSelectedImageElement(o.document.selection);o.change(t=>{t.setAttribute("alt",e.newValue,n)})}}function Hm(e,t){const i=e.createEmptyElement("img"),o="imageBlock"===t?e.createContainerElement("figure",{class:"image"}):e.createContainerElement("span",{class:"image-inline"},{isAllowedInsideAttributeElement:!0});return e.insert(e.createPositionAt(o,0),i),o}function jm(e,t){if(e.plugins.has("ImageInlineEditing")!==e.plugins.has("ImageBlockEditing"))return{name:"img"};const i=e.plugins.get("ImageUtils");return e=>{if(!i.isInlineImageView(e))return null;return(e.findAncestor(i.isBlockImageView)?"imageBlock":"imageInline")!==t?null:{name:!0}}}function Wm(e,t){const i=Os(t.getSelectedBlocks());return!i||e.isObject(i)||i.isEmpty&&"listItem"!=i.name?"imageBlock":"imageInline"}class qm extends Qe{static get pluginName(){return"ImageUtils"}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,i=null){const o=this.editor,n=o.model,r=n.document.selection;i=$m(o,t||r,i),e={...Object.fromEntries(r.getAttributes()),...e};for(const t in e)n.schema.checkAttribute(i,t)||delete e[t];return n.change(o=>{const s=o.createElement(i,e);return t||"imageInline"==i||(t=km(r,n)),n.insertContent(s,t),s.parent?(o.setSelection(s,"on"),s):null})}getClosestSelectedImageWidget(e){const t=e.getSelectedElement();if(t&&this.isImageWidget(t))return t;let i=e.getFirstPosition().parent;for(;i;){if(i.is("element")&&this.isImageWidget(i))return i;i=i.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}isImageAllowed(){const e=this.editor.model.document.selection;return function(e,t){if("imageBlock"==$m(e,t)){const i=function(e,t){const i=km(e,t).start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(t,e.model);if(e.model.schema.checkChild(i,"imageBlock"))return!0}else if(e.model.schema.checkChild(t.focus,"imageInline"))return!0;return!1}(this.editor,e)&&function(e){return[...e.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}(e)}toImageWidget(e,t,i){t.setCustomProperty("image",!0,e);return gm(e,t,{label:()=>{const t=this.findViewImgElement(e).getAttribute("alt");return t?`${t} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&um(e)}isBlockImage(e){return!!e&&e.is("element","imageBlock")}isInlineImage(e){return!!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}}function $m(e,t,i){const o=e.model.schema,n=e.config.get("image.insert.type");return e.plugins.has("ImageBlockEditing")?e.plugins.has("ImageInlineEditing")?i||("inline"===n?"imageInline":"block"===n?"imageBlock":t.is("selection")?Wm(o,t):o.checkChild(t,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class Um extends Qe{static get requires(){return[qm]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new Lm(this.editor))}}i(79);class Km extends Bc{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new zs,this.keystrokes=new Ms,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),Rc.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),Rc.cancel,"ck-button-cancel","cancel"),this._focusables=new Mc,this._focusCycler=new hd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]}),Oc(this)}render(){super.render(),this.keystrokes.listenTo(this.element),zc({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}_createButton(e,t,i,o){const n=new rd(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:i}}),o&&n.delegate("execute").to(this,o),n}_createLabeledInputView(){const e=this.locale.t,t=new Hd(this.locale,jd);return t.label=e("Text alternative"),t}}function Gm(e){const t=e.editing.view,i=Gd.defaultPositions,o=e.plugins.get("ImageUtils");return{target:t.domConverter.viewToDom(o.getClosestSelectedImageWidget(t.document.selection)),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class Jm extends Qe{static get requires(){return[eh]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",i=>{const o=e.commands.get("imageTextAlternative"),n=new rd(i);return n.set({label:t("Change image text alternative"),icon:Rc.lowVision,tooltip:!0}),n.bind("isEnabled").to(o,"isEnabled"),this.listenTo(n,"execute",()=>{this._showForm()}),n})}_createForm(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Km(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(e,t)=>{this._hideForm(!0),t()}),this.listenTo(e.ui,"update",()=>{i.getClosestSelectedImageWidget(t.selection)?this._isVisible&&function(e){const t=e.plugins.get("ContextualBalloon");if(e.plugins.get("ImageUtils").getClosestSelectedImageWidget(e.editing.view.document.selection)){const i=Gm(e);t.updatePosition(i)}}(e):this._hideForm(!0)}),Vc({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:Gm(e)}),i.fieldView.value=i.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class Ym extends Qe{static get requires(){return[Um,Jm]}static get pluginName(){return"ImageTextAlternative"}}class Qm{constructor(e){this.files=function(e){const t=Array.from(e.files||[]),i=Array.from(e.items||[]);if(t.length)return t;return i.filter(e=>"file"===e.kind).map(e=>e.getAsFile())}(e),this._native=e}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}get isCanceled(){return"none"==this._native.dropEffect||!!this._native.mozUserCancelled}}class Xm extends ts{constructor(e){super(e);const t=this.document;function i(e){return(i,o)=>{o.preventDefault();const r=o.dropRange?[o.dropRange]:null,s=new n(t,e);t.fire(s,{dataTransfer:o.dataTransfer,method:i.name,targetRanges:r,target:o.target}),s.stop.called&&o.stopPropagation()}}this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"],this.listenTo(t,"paste",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",i("dragging"),{priority:"low"})}onDomEvent(e){const t={dataTransfer:new Qm(e.clipboardData?e.clipboardData:e.dataTransfer)};"drop"!=e.type&&"dragover"!=e.type||(t.dropRange=function(e,t){const i=t.target.ownerDocument,o=t.clientX,n=t.clientY;let r;i.caretRangeFromPoint&&i.caretRangeFromPoint(o,n)?r=i.caretRangeFromPoint(o,n):t.rangeParent&&(r=i.createRange(),r.setStart(t.rangeParent,t.rangeOffset),r.collapse(!0));if(r)return e.domConverter.domRangeToView(r);return null}(this.view,e)),this.fire(e.type,e,t)}}const Zm=["figcaption","li"];class ef extends Qe{static get pluginName(){return"ClipboardPipeline"}init(){this.editor.editing.view.addObserver(Xm),this._setupPasteDrop(),this._setupCopyCut()}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,o=i.document;this.listenTo(o,"clipboardInput",t=>{e.isReadOnly&&t.stop()},{priority:"highest"}),this.listenTo(o,"clipboardInput",(e,t)=>{const o=t.dataTransfer;let r=t.content||"";var s;r||(o.getData("text/html")?r=function(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1==t.length?" ":t).replace(/<!--[\s\S]*?-->/g,"")}(o.getData("text/html")):o.getData("text/plain")&&(((s=(s=o.getData("text/plain")).replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;")).includes("</p><p>")||s.includes("<br>"))&&(s=`<p>${s}</p>`),r=s),r=this.editor.data.htmlProcessor.toView(r));const a=new n(this,"inputTransformation");this.fire(a,{content:r,dataTransfer:o,targetRanges:t.targetRanges,method:t.method}),a.stop.called&&e.stop(),i.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,i)=>{if(i.content.isEmpty)return;const o=this.editor.data.toModel(i.content,"$clipboardHolder");0!=o.childCount&&(e.stop(),t.change(()=>{this.fire("contentInsertion",{content:o,method:i.method,dataTransfer:i.dataTransfer,targetRanges:i.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(e,i)=>{i.resultRange=t.insertContent(i.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,i=e.editing.view.document;function o(o,n){const r=n.dataTransfer;n.preventDefault();const s=e.data.toView(e.model.getSelectedContent(t.selection));i.fire("clipboardOutput",{dataTransfer:r,content:s,method:o.name})}this.listenTo(i,"copy",o,{priority:"low"}),this.listenTo(i,"cut",(t,i)=>{e.isReadOnly?i.preventDefault():o(t,i)},{priority:"low"}),this.listenTo(i,"clipboardOutput",(i,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",function e(t){let i="";if(t.is("$text")||t.is("$textProxy"))i=t.data;else if(t.is("element","img")&&t.hasAttribute("alt"))i=t.getAttribute("alt");else if(t.is("element","br"))i="\n";else{let o=null;for(const n of t.getChildren()){const t=e(n);o&&(o.is("containerElement")||n.is("containerElement"))&&(Zm.includes(o.name)||Zm.includes(n.name)?i+="\n":i+="\n\n"),i+=t,o=n}}return i}(o.content))),"cut"==o.method&&e.model.deleteContent(t.selection)},{priority:"low"})}}i(81);class tf extends Qe{static get pluginName(){return"DragDrop"}static get requires(){return[ef,Im]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=Fm(e=>this._updateDropMarker(e),40),this._removeDropMarkerDelayed=rf(()=>this._removeDropMarker(),40),this._clearDraggableAttributesDelayed=rf(()=>this._clearDraggableAttributes(),40),t.addObserver(Xm),t.addObserver(Eh),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(e,t,i)=>{i?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(e,t,i)=>{i||this._finalizeDragging(!1)}),In.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,i=t.document,o=e.editing.view,n=o.document;this.listenTo(n,"dragstart",(o,r)=>{const a=i.selection;if(r.target&&r.target.is("editableElement"))return void r.preventDefault();const l=r.target?sf(r.target):null;if(l){const i=e.editing.mapper.toModelElement(l);this._draggedRange=wa.fromRange(t.createRangeOn(i)),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!n.selection.isCollapsed){const e=n.selection.getSelectedElement();e&&um(e)||(this._draggedRange=wa.fromRange(a.getFirstRange()))}if(!this._draggedRange)return void r.preventDefault();this._draggingUid=s(),r.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",r.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const c=t.createSelection(this._draggedRange.toRange()),d=e.data.toView(t.getSelectedContent(c));n.fire("clipboardOutput",{dataTransfer:r.dataTransfer,content:d,method:o.name}),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(n,"dragend",(e,t)=>{this._finalizeDragging(!t.dataTransfer.isCanceled&&"move"==t.dataTransfer.dropEffect)},{priority:"low"}),this.listenTo(n,"dragenter",()=>{this.isEnabled&&o.focus()}),this.listenTo(n,"dragleave",()=>{this._removeDropMarkerDelayed()}),this.listenTo(n,"dragging",(t,i)=>{if(!this.isEnabled)return void(i.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const o=of(e,i.targetRanges,i.target);this._draggedRange||(i.dataTransfer.dropEffect="copy"),In.isGecko||("copy"==i.dataTransfer.effectAllowed?i.dataTransfer.dropEffect="copy":["all","copyMove"].includes(i.dataTransfer.effectAllowed)&&(i.dataTransfer.dropEffect="move")),o&&this._updateDropMarkerThrottled(o)},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"clipboardInput",(t,i)=>{if("drop"!=i.method)return;const o=of(e,i.targetRanges,i.target);if(this._removeDropMarker(),!o)return this._finalizeDragging(!1),void t.stop();this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==nf(i.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(o,!0))return this._finalizeDragging(!1),void t.stop();i.targetRanges=[e.editing.mapper.toViewRange(o)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(ef);e.on("contentInsertion",(e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i=t.targetRanges.map(e=>this.editor.editing.mapper.toModelRange(e));this.editor.model.change(e=>e.setSelection(i))},{priority:"high"}),e.on("contentInsertion",(e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i="move"==nf(t.dataTransfer),o=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(o&&i)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"mousedown",(o,n)=>{if(In.isAndroid||!n)return;this._clearDraggableAttributesDelayed.cancel();let r=sf(n.target);if(In.isBlink&&!e.isReadOnly&&!r&&!i.selection.isCollapsed){const e=i.selection.getSelectedElement();e&&um(e)||(r=i.selection.editableElement)}r&&(t.change(e=>{e.setAttribute("draggable","true",r)}),this._draggableElement=e.editing.mapper.toModelElement(r))}),this.listenTo(i,"mouseup",()=>{In.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_setupDropMarker(){const e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return i.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(e){const t=this.toDomElement(e);return t.innerHTML="&NoBreak;<span></span>&NoBreak;",t}))}})}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change(t=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||t.updateMarker("drop-target",{range:e}):t.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_removeDropMarker(){const e=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),e.markers.has("drop-target")&&e.change(e=>{e.removeMarker("drop-target")})}_finalizeDragging(e){const t=this.editor,i=t.model;this._removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(e&&this.isEnabled&&i.deleteContent(i.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function of(e,t,i){const o=e.model,n=e.editing.mapper;let r=null;const s=t?t[0].start:null;if(i.is("uiElement")&&(i=i.parent),r=function(e,t){const i=e.model,o=e.editing.mapper;if(um(t))return i.createRangeOn(o.toModelElement(t));if(!t.is("editableElement")){const e=t.findAncestor(e=>um(e)||e.is("editableElement"));if(um(e))return i.createRangeOn(o.toModelElement(e))}return null}(e,i),r)return r;const a=function(e,t){const i=e.editing.mapper,o=e.editing.view,n=i.toModelElement(t);if(n)return n;const r=o.createPositionBefore(t),s=i.findMappedViewAncestor(r);return i.toModelElement(s)}(e,i),l=s?n.toModelPosition(s):null;return l?(r=function(e,t,i){const o=e.model;if(!o.schema.checkChild(i,"$block"))return null;const n=o.createPositionAt(i,0),r=t.path.slice(0,n.path.length),s=o.createPositionFromPath(t.root,r).nodeAfter;if(s&&o.schema.isObject(s))return o.createRangeOn(s);return null}(e,l,a),r||(r=o.schema.getNearestSelectionRange(l,In.isGecko?"forward":"backward"),r||function(e,t){const i=e.model;for(;t;){if(i.schema.isObject(t))return i.createRangeOn(t);t=t.parent}}(e,l.parent))):function(e,t){const i=e.model,o=i.schema,n=i.createPositionAt(t,0);return o.getNearestSelectionRange(n,"forward")}(e,a)}function nf(e){return In.isGecko?e.dropEffect:["all","copyMove"].includes(e.effectAllowed)?"move":"copy"}function rf(e,t){let i;function o(...n){o.cancel(),i=setTimeout(()=>e(...n),t)}return o.cancel=()=>{clearTimeout(i)},o}function sf(e){if(e.is("editableElement"))return null;if(e.hasClass("ck-widget__selection-handle"))return e.findAncestor(um);if(um(e))return e;const t=e.findAncestor(e=>um(e)||e.is("editableElement"));return um(t)?t:null}class af extends Qe{static get pluginName(){return"PastePlainText"}static get requires(){return[ef]}init(){const e=this.editor,t=e.model,i=e.editing.view,o=i.document,n=t.document.selection;let r=!1;i.addObserver(Xm),this.listenTo(o,"keydown",(e,t)=>{r=t.shiftKey}),e.plugins.get(ef).on("contentInsertion",(e,i)=>{(r||function(e,t){if(e.childCount>1)return!1;const i=e.getChild(0);if(t.isObject(i))return!1;return 0==[...i.getAttributeKeys()].length}(i.content,t.schema))&&t.change(e=>{const o=Array.from(n.getAttributes()).filter(([e])=>t.schema.getAttributeProperties(e).isFormatting);n.isCollapsed||t.deleteContent(n,{doNotAutoparagraph:!0}),o.push(...n.getAttributes());const r=e.createRangeIn(i.content);for(const t of r.getItems())t.is("$textProxy")&&e.setAttributes(o,t)})})}}class lf extends Qe{static get pluginName(){return"Clipboard"}static get requires(){return[ef,tf,af]}}function cf(e,t){return e=>{e.on("attribute:srcset:"+t,i)};function i(t,i,o){if(!o.consumable.consume(i.item,t.name))return;const n=o.writer,r=o.mapper.toViewElement(i.item),s=e.findViewImgElement(r);if(null===i.attributeNewValue){const e=i.attributeOldValue;e.data&&(n.removeAttribute("srcset",s),n.removeAttribute("sizes",s),e.width&&n.removeAttribute("width",s))}else{const e=i.attributeNewValue;e.data&&(n.setAttribute("srcset",e.data,s),n.setAttribute("sizes","100vw",s),e.width&&n.setAttribute("width",e.width,s))}}}function df(e,t,i){return e=>{e.on(`attribute:${i}:${t}`,o)};function o(t,i,o){if(!o.consumable.consume(i.item,t.name))return;const n=o.writer,r=o.mapper.toViewElement(i.item),s=e.findViewImgElement(r);n.setAttribute(i.attributeKey,i.attributeNewValue||"",s)}}class hf extends zr{observe(e){this.listenTo(e,"load",(e,t)=>{const i=t.target;this.checkShouldIgnoreEventFromTarget(i)||"IMG"==i.tagName&&this._fireEvents(t)},{useCapture:!0})}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}class uf extends Ze{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||"block"===t&&Object(l.b)("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||"inline"===t&&Object(l.b)("image-inline-plugin-required")}refresh(){this.isEnabled=this.editor.plugins.get("ImageUtils").isImageAllowed()}execute(e){const t=to(e.source),i=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),n=Object.fromEntries(i.getAttributes());t.forEach((e,t)=>{const r=i.getSelectedElement();if("string"==typeof e&&(e={src:e}),t&&r&&o.isImage(r)){const t=this.editor.model.createPositionAfter(r);o.insertImage({...e,...n},t)}else o.insertImage({...e,...n})})}}class gf extends Qe{static get requires(){return[qm]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(hf),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:e=>{const t={data:e.getAttribute("srcset")};return e.hasAttribute("width")&&(t.width=e.getAttribute("width")),t}}});const i=new uf(e);e.commands.add("insertImage",i),e.commands.add("imageInsert",i)}}class mf extends Ze{constructor(e,t){super(e),this._modelElementName=t}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t)}execute(){const e=this.editor,t=this.editor.model,i=e.plugins.get("ImageUtils"),o=i.getClosestSelectedImageElement(t.document.selection),n=Object.fromEntries(o.getAttributes());return n.src||n.uploadId?t.change(e=>{const r=Array.from(t.markers).filter(e=>e.getRange().containsItem(o)),s=i.insertImage(n,t.createSelection(o,"on"),this._modelElementName);if(!s)return null;const a=e.createRangeOn(s);for(const t of r){const i=t.getRange(),o="$graveyard"!=i.root.rootName?i.getJoined(a,!0):a;e.updateMarker(t,{range:o})}return{oldElement:o,newElement:s}}):null}}class ff extends Qe{static get requires(){return[gf,qm,ef]}static get pluginName(){return"ImageBlockEditing"}init(){const e=this.editor;e.model.schema.register("imageBlock",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new mf(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,o=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageBlock",view:(e,{writer:t})=>Hm(t,"imageBlock")}),i.for("editingDowncast").elementToElement({model:"imageBlock",view:(e,{writer:i})=>o.toImageWidget(Hm(i,"imageBlock"),i,t("image widget"))}),i.for("downcast").add(df(o,"imageBlock","src")).add(df(o,"imageBlock","alt")).add(cf(o,"imageBlock")),i.for("upcast").elementToElement({view:jm(e,"imageBlock"),model:(e,{writer:t})=>t.createElement("imageBlock",e.hasAttribute("src")?{src:e.getAttribute("src")}:null)}).add(function(e){return e=>{e.on("element:figure",t)};function t(t,i,o){if(!o.consumable.test(i.viewItem,{name:!0,classes:"image"}))return;const n=e.findViewImgElement(i.viewItem);if(!n||!o.consumable.test(n,{name:!0}))return;const r=Os(o.convertItem(n,i.modelCursor).modelRange.getItems());r&&(o.consumable.consume(i.viewItem,{name:!0,classes:"image"}),o.convertChildren(i.viewItem,r),o.updateConversionResult(r,i))}}(o))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,o=e.plugins.get("ImageUtils");this.listenTo(e.plugins.get("ClipboardPipeline"),"inputTransformation",(n,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isInlineImageView))return;a=r.targetRanges?e.editing.mapper.toModelRange(r.targetRanges[0]):t.document.selection.getFirstRange();const l=t.createSelection(a);if("imageBlock"===Wm(t.schema,l)){const e=new Ph(i.document),t=s.map(t=>e.createElement("figure",{class:"image"},t));r.content=e.createDocumentFragment(t)}})}}i(11);class pf extends Qe{static get requires(){return[ff,Im,Ym]}static get pluginName(){return"ImageBlock"}}class bf extends Qe{static get requires(){return[gf,qm,ef]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;t.register("imageInline",{isObject:!0,isInline:!0,allowWhere:"$text",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((e,t)=>{if(e.endsWith("caption")&&"imageInline"===t.name)return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new mf(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,o=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(e,{writer:t})=>t.createEmptyElement("img")}),i.for("editingDowncast").elementToElement({model:"imageInline",view:(e,{writer:i})=>o.toImageWidget(Hm(i,"imageInline"),i,t("image widget"))}),i.for("downcast").add(df(o,"imageInline","src")).add(df(o,"imageInline","alt")).add(cf(o,"imageInline")),i.for("upcast").elementToElement({view:jm(e,"imageInline"),model:(e,{writer:t})=>t.createElement("imageInline",e.hasAttribute("src")?{src:e.getAttribute("src")}:null)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,o=e.plugins.get("ImageUtils");this.listenTo(e.plugins.get("ClipboardPipeline"),"inputTransformation",(n,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isBlockImageView))return;a=r.targetRanges?e.editing.mapper.toModelRange(r.targetRanges[0]):t.document.selection.getFirstRange();const l=t.createSelection(a);if("imageInline"===Wm(t.schema,l)){const e=new Ph(i.document),t=s.map(t=>1===t.childCount?(Array.from(t.getAttributes()).forEach(i=>e.setAttribute(...i,o.findViewImgElement(t))),t.getChild(0)):t);r.content=e.createDocumentFragment(t)}})}}class wf extends Qe{static get requires(){return[bf,Im,Ym]}static get pluginName(){return"ImageInline"}}function kf(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}function _f(e,t){const i=t.getFirstPosition().findAncestor("caption");return i&&e.isBlockImage(i.parent)?i:null}class vf extends Ze{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils");if(!e.plugins.has(ff))return this.isEnabled=!1,void(this.value=!1);const i=e.model.document.selection,o=i.getSelectedElement();if(!o){const e=_f(t,i);return this.isEnabled=!!e,void(this.value=!!e)}this.isEnabled=this.editor.plugins.get("ImageUtils").isImage(o),this.isEnabled?this.value=!!kf(o):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change(e=>{this.value?this._hideImageCaption(e):this._showImageCaption(e,t)})}_showImageCaption(e,t){const i=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing");let n=i.getSelectedElement();const r=o._getSavedCaption(n);this.editor.plugins.get("ImageUtils").isInlineImage(n)&&(this.editor.execute("imageTypeBlock"),n=i.getSelectedElement());const s=r||e.createElement("caption");e.append(s,n),t&&e.setSelection(s,"in")}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,o=t.plugins.get("ImageCaptionEditing"),n=t.plugins.get("ImageUtils");let r,s=i.getSelectedElement();s?r=kf(s):(r=_f(n,i),s=r.parent),o._saveCaption(s,r),e.setSelection(s,"on"),e.remove(r)}}class yf extends Qe{static get requires(){return[qm]}static get pluginName(){return"ImageCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new vf(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration()}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),o=e.t;e.conversion.for("upcast").elementToElement({view:e=>function(e,t){return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}(i,e),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>i.isBlockImage(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:n})=>{if(!i.isBlockImage(e.parent))return null;const r=n.createEditableElement("figcaption");return n.setCustomProperty("imageCaption",!0,r),dh({view:t,element:r,text:o("Enter image caption"),keepOnFocus:!0}),wm(r,n)}}),e.editing.mapper.on("modelToViewPosition",xf(t)),e.data.mapper.on("modelToViewPosition",xf(t))}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.commands.get("imageTypeInline"),o=e.commands.get("imageTypeBlock"),n=e=>{if(!e.return)return;const{oldElement:i,newElement:o}=e.return;if(!i)return;if(t.isBlockImage(i)){const e=kf(i);if(e)return void this._saveCaption(o,e)}const n=this._getSavedCaption(i);n&&this._saveCaption(o,n)};i&&this.listenTo(i,"execute",n,{priority:"low"}),o&&this.listenTo(o,"execute",n,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Xs.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}function xf(e){return(t,i)=>{const o=i.modelPosition,n=o.parent;if(!n.is("element","imageBlock"))return;const r=i.mapper.toViewElement(n);i.viewPosition=e.createPositionAt(r,o.offset+1)}}class Cf extends Qe{static get requires(){return[qm]}static get pluginName(){return"ImageCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),o=e.t;e.ui.componentFactory.add("toggleImageCaption",n=>{const r=e.commands.get("toggleImageCaption"),s=new rd(n);return s.set({icon:Rc.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",e=>o(e?"Toggle caption off":"Toggle caption on")),this.listenTo(s,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const o=_f(i,e.model.document.selection);if(o){const i=e.editing.mapper.toViewElement(o);t.scrollToTheSelection(),t.change(e=>{e.addClass("image__caption_highlighted",i)})}}),s})}}i(84);class Af extends Ze{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(e=>{if(e.isDefault)for(const t of e.modelElements)this._defaultStyles[t]=e.name;return[e.name,e]}))}refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?e.hasAttribute("imageStyle")?this.value=e.getAttribute("imageStyle"):this.value=this._defaultStyles[e.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,o=t.plugins.get("ImageUtils");i.change(t=>{const n=e.value;let r=o.getClosestSelectedImageElement(i.document.selection);n&&this.shouldConvertImageType(n,r)&&(this.editor.execute(o.isBlockImage(r)?"imageTypeInline":"imageTypeBlock"),r=o.getClosestSelectedImageElement(i.document.selection)),!n||this._styles.get(n).isDefault?t.removeAttribute("imageStyle",r):t.setAttribute("imageStyle",n,r)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}const{objectFullWidth:Tf,objectInline:Ef,objectLeft:Pf,objectRight:Sf,objectCenter:If,objectBlockLeft:Rf,objectBlockRight:Vf}=Rc,Of={inline:{name:"inline",title:"In line",icon:Ef,modelElements:["imageInline"],isDefault:!0},alignLeft:{name:"alignLeft",title:"Left aligned image",icon:Pf,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"},alignBlockLeft:{name:"alignBlockLeft",title:"Left aligned image",icon:Rf,modelElements:["imageBlock"],className:"image-style-block-align-left"},alignCenter:{name:"alignCenter",title:"Centered image",icon:If,modelElements:["imageBlock"],className:"image-style-align-center"},alignRight:{name:"alignRight",title:"Right aligned image",icon:Sf,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"},alignBlockRight:{name:"alignBlockRight",title:"Right aligned image",icon:Vf,modelElements:["imageBlock"],className:"image-style-block-align-right"},block:{name:"block",title:"Centered image",icon:If,modelElements:["imageBlock"],isDefault:!0},side:{name:"side",title:"Side image",icon:Sf,modelElements:["imageBlock"],className:"image-style-side"}},zf={full:Tf,left:Rf,right:Vf,center:If,inlineLeft:Pf,inlineRight:Sf,inline:Ef},Mf=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function Bf(e){Object(l.b)("image-style-configuration-definition-invalid",e)}var Nf={normalizeStyles:function(e){return(e.configuredStyles.options||[]).map(e=>function(e){e="string"==typeof e?Of[e]?{...Of[e]}:{name:e}:function(e,t){const i={...t};for(const o in e)Object.prototype.hasOwnProperty.call(t,o)||(i[o]=e[o]);return i}(Of[e.name],e);"string"==typeof e.icon&&(e.icon=zf[e.icon]||e.icon);return e}(e)).filter(t=>function(e,{isBlockPluginLoaded:t,isInlinePluginLoaded:i}){const{modelElements:o,name:n}=e;if(!(o&&o.length&&n))return Bf({style:e}),!1;{const n=[t?"imageBlock":null,i?"imageInline":null];if(!o.some(e=>n.includes(e)))return Object(l.b)("image-style-missing-dependency",{style:e,missingPlugins:o.map(e=>"imageBlock"===e?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}(t,e))},getDefaultStylesConfiguration:function(e,t){return e&&t?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:e?{options:["block","side"]}:t?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(e){return e.has("ImageBlockEditing")&&e.has("ImageInlineEditing")?[...Mf]:[]},warnInvalidStyle:Bf,DEFAULT_OPTIONS:Of,DEFAULT_ICONS:zf,DEFAULT_DROPDOWN_DEFINITIONS:Mf};function Ff(e,t){for(const i of t)if(i.name===e)return i}class Df extends Qe{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[qm]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=Nf,i=this.editor,o=i.plugins.has("ImageBlockEditing"),n=i.plugins.has("ImageInlineEditing");i.config.define("image.styles",t(o,n)),this.normalizedStyles=e({configuredStyles:i.config.get("image.styles"),isBlockPluginLoaded:o,isInlinePluginLoaded:n}),this._setupConversion(o,n),this._setupPostFixer(),i.commands.add("imageStyle",new Af(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,o=i.model.schema,n=(r=this.normalizedStyles,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const o=Ff(t.attributeNewValue,r),n=Ff(t.attributeOldValue,r),s=i.mapper.toViewElement(t.item),a=i.writer;n&&a.removeClass(n.className,s),o&&a.addClass(o.className,s)});var r;const s=function(e){const t={imageInline:e.filter(e=>!e.isDefault&&e.modelElements.includes("imageInline")),imageBlock:e.filter(e=>!e.isDefault&&e.modelElements.includes("imageBlock"))};return(e,i,o)=>{if(!i.modelRange)return;const n=i.viewItem,r=Os(i.modelRange.getItems());if(r&&o.schema.checkAttribute(r,"imageStyle"))for(const e of t[r.name])o.consumable.consume(n,{classes:e.className})&&o.writer.setAttribute("imageStyle",e.name,r)}}(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",n),i.data.downcastDispatcher.on("attribute:imageStyle",n),e&&(o.extend("imageBlock",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),t&&(o.extend("imageInline",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get(qm),o=new Map(this.normalizedStyles.map(e=>[e.name,e]));t.registerPostFixer(e=>{let n=!1;for(const r of t.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let t="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(t&&t.is("element","paragraph")&&t.childCount>0&&(t=t.getChild(0)),!i.isImage(t))continue;const s=t.getAttribute("imageStyle");if(!s)continue;const a=o.get(s);a&&a.modelElements.includes(t.name)||(e.removeAttribute("imageStyle",t),n=!0)}return n})}}i(86);class Lf extends Qe{static get requires(){return[Df]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=Hf(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const e of i)this._createButton(e);const o=Hf([...t.filter(w),...Nf.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const e of o)this._createDropdown(e,i)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,o=>{let n;const{defaultItem:r,items:s,title:a}=e,l=s.filter(e=>t.find(({name:t})=>jf(t)===e)).map(e=>{const t=i.create(e);return e===r&&(n=t),t});s.length!==l.length&&Nf.warnInvalidStyle({dropdown:e});const c=Vd(o,pd),d=c.buttonView;return Od(c,l),d.set({label:Wf(a,n.label),class:null,tooltip:!0}),d.bind("icon").toMany(l,"isOn",(...e)=>{const t=e.findIndex(Z);return t<0?n.icon:l[t].icon}),d.bind("label").toMany(l,"isOn",(...e)=>{const t=e.findIndex(Z);return Wf(a,t<0?n.label:l[t].label)}),d.bind("isOn").toMany(l,"isOn",(...e)=>e.some(Z)),d.bind("class").toMany(l,"isOn",(...e)=>e.some(Z)?"ck-splitbutton_flatten":null),d.on("execute",()=>{l.some(({isOn:e})=>e)?c.isOpen=!c.isOpen:n.fire("execute")}),c.bind("isEnabled").toMany(l,"isEnabled",(...e)=>e.some(Z)),c})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(jf(t),i=>{const o=this.editor.commands.get("imageStyle"),n=new rd(i);return n.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(o,"isEnabled"),n.bind("isOn").to(o,"value",e=>e===t),n.on("execute",this._executeCommand.bind(this,t)),n})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function Hf(e,t){for(const i of e)t[i.title]&&(i.title=t[i.title]);return e}function jf(e){return"imageStyle:"+e}function Wf(e,t){return(e?e+": ":"")+t}function qf(e){const t=e.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${t.join("|")})$`)}function $f(e){return new Promise((t,i)=>{const o=e.getAttribute("src");fetch(o).then(e=>e.blob()).then(e=>{const i=Uf(e,o),n=i.replace("image/",""),r=new File([e],"image."+n,{type:i});t(r)}).catch(e=>e&&"TypeError"===e.name?function(e){return function(e){return new Promise((t,i)=>{const o=vr.document.createElement("img");o.addEventListener("load",()=>{const e=vr.document.createElement("canvas");e.width=o.width,e.height=o.height;e.getContext("2d").drawImage(o,0,0),e.toBlob(e=>e?t(e):i())}),o.addEventListener("error",()=>i()),o.src=e})}(e).then(t=>{const i=Uf(t,e),o=i.replace("image/","");return new File([t],"image."+o,{type:i})})}(o).then(t).catch(i):i(e))})}function Uf(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class Kf extends Qe{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,i=i=>{const o=new Nu(i),n=e.commands.get("uploadImage"),r=e.config.get("image.upload.types"),s=qf(r);return o.set({acceptedType:r.map(e=>"image/"+e).join(","),allowMultipleFiles:!0}),o.buttonView.set({label:t("Insert image"),icon:Rc.image,tooltip:!0}),o.buttonView.bind("isEnabled").to(n),o.on("done",(t,i)=>{const o=Array.from(i).filter(e=>s.test(e.type));o.length&&e.execute("uploadImage",{file:o})}),o};e.ui.componentFactory.add("uploadImage",i),e.ui.componentFactory.add("imageUpload",i)}}i(88),i(90),i(92);class Gf extends Qe{static get pluginName(){return"ImageUploadProgress"}constructor(e){super(e),this.placeholder="data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 250"><rect rx="4"/></svg>')}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",(...e)=>this.uploadStatusChange(...e)),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",(...e)=>this.uploadStatusChange(...e))}uploadStatusChange(e,t,i){const o=this.editor,n=t.item,r=n.getAttribute("uploadId");if(!i.consumable.consume(t.item,e.name))return;const s=o.plugins.get("ImageUtils"),a=o.plugins.get(Mu),l=r?t.attributeNewValue:null,c=this.placeholder,d=o.editing.mapper.toViewElement(n),h=i.writer;if("reading"==l)return Jf(d,h),void Yf(s,c,d,h);if("uploading"==l){const e=a.loaders.get(r);return Jf(d,h),void(e?(Qf(d,h),function(e,t,i,o){const n=function(e){const t=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",!0,t),t}(t);t.insert(t.createPositionAt(e,"end"),n),i.on("change:uploadedPercent",(e,t,i)=>{o.change(e=>{e.setStyle("width",i+"%",n)})})}(d,h,e,o.editing.view),function(e,t,i,o){if(o.data){const n=e.findViewImgElement(t);i.setAttribute("src",o.data,n)}}(s,d,h,e)):Yf(s,c,d,h))}"complete"==l&&a.loaders.get(r)&&function(e,t,i){const o=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),o),setTimeout(()=>{i.change(e=>e.remove(e.createRangeOn(o)))},3e3)}(d,h,o.editing.view),function(e,t){Zf(e,t,"progressBar")}(d,h),Qf(d,h),function(e,t){t.removeClass("ck-appear",e)}(d,h)}}function Jf(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function Yf(e,t,i,o){i.hasClass("ck-image-upload-placeholder")||o.addClass("ck-image-upload-placeholder",i);const n=e.findViewImgElement(i);n.getAttribute("src")!==t&&o.setAttribute("src",t,n),Xf(i,"placeholder")||o.insert(o.createPositionAfter(n),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(o))}function Qf(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),Zf(e,t,"placeholder")}function Xf(e,t){for(const i of e.getChildren())if(i.getCustomProperty(t))return i}function Zf(e,t,i){const o=Xf(e,i);o&&t.remove(t.createRangeOn(o))}class ep extends Ze{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i)}execute(e){const t=to(e.file),i=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),n=Object.fromEntries(i.getAttributes());t.forEach((e,t)=>{const r=i.getSelectedElement();if(t&&r&&o.isImage(r)){const t=this.editor.model.createPositionAfter(r);this._uploadImage(e,n,t)}else this._uploadImage(e,n)})}_uploadImage(e,t,i){const o=this.editor,n=o.plugins.get(Mu).createLoader(e),r=o.plugins.get("ImageUtils");n&&r.insertImage({...t,uploadId:n.id},i)}}class tp extends Qe{static get requires(){return[Mu,qd,ef,qm]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,i=e.conversion,o=e.plugins.get(Mu),n=e.plugins.get("ImageUtils"),r=qf(e.config.get("image.upload.types")),s=new ep(e);e.commands.add("uploadImage",s),e.commands.add("imageUpload",s),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(t,i)=>{if(o=i.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const n=Array.from(i.dataTransfer.files).filter(e=>!!e&&r.test(e.type));n.length&&(t.stop(),e.model.change(t=>{i.targetRanges&&t.setSelection(i.targetRanges.map(t=>e.editing.mapper.toModelRange(t))),e.model.enqueueChange("default",()=>{e.execute("uploadImage",{file:n})})}))}),this.listenTo(e.plugins.get("ClipboardPipeline"),"inputTransformation",(t,i)=>{const r=Array.from(e.editing.view.createRangeIn(i.content)).filter(e=>function(e,t){return!(!e.isInlineImageView(t)||!t.getAttribute("src"))&&(t.getAttribute("src").match(/^data:image\/\w+;base64,/g)||t.getAttribute("src").match(/^blob:/g))}(n,e.item)&&!e.item.getAttribute("uploadProcessed")).map(e=>({promise:$f(e.item),imageElement:e.item}));if(!r.length)return;const s=new Ph(e.editing.view.document);for(const e of r){s.setAttribute("uploadProcessed",!0,e.imageElement);const t=o.createLoader(e.promise);t&&(s.setAttribute("src","",e.imageElement),s.setAttribute("uploadId",t.id,e.imageElement))}}),e.editing.view.document.on("dragover",(e,t)=>{t.preventDefault()}),t.on("change",()=>{const i=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),n=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name){const i=t.position.nodeAfter,r="$graveyard"==t.position.root.rootName;for(const t of ip(e,i)){const e=t.getAttribute("uploadId");if(!e)continue;const i=o.loaders.get(e);i&&(r?n.has(e)||i.abort():(n.add(e),this._uploadImageElements.set(e,t),"idle"==i.status&&this._readAndUpload(i)))}}}),this.on("uploadComplete",(e,{imageElement:t,data:i})=>{const o=i.urls?i.urls:i;this.editor.model.change(e=>{e.setAttribute("src",o.default,t),this._parseAndSetSrcsetAttributeOnImage(o,t,e)})},{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(e){const t=this.editor,i=t.model,o=t.locale.t,n=t.plugins.get(Mu),r=t.plugins.get(qd),s=t.plugins.get("ImageUtils"),a=this._uploadImageElements;return i.enqueueChange("transparent",t=>{t.setAttribute("uploadStatus","reading",a.get(e.id))}),e.read().then(()=>{const o=e.upload(),n=a.get(e.id);if(In.isSafari){const e=t.editing.mapper.toViewElement(n),i=s.findViewImgElement(e);t.editing.view.once("render",()=>{if(!i.parent)return;const e=t.editing.view.domConverter.mapViewToDom(i.parent);if(!e)return;const o=e.style.display;e.style.display="none",e._ckHack=e.offsetHeight,e.style.display=o})}return i.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","uploading",n)}),o}).then(t=>{i.enqueueChange("transparent",i=>{const o=a.get(e.id);i.setAttribute("uploadStatus","complete",o),this.fire("uploadComplete",{data:t,imageElement:o})}),l()}).catch(t=>{if("error"!==e.status&&"aborted"!==e.status)throw t;"error"==e.status&&t&&r.showWarning(t,{title:o("Upload failed"),namespace:"upload"}),i.enqueueChange("transparent",t=>{t.remove(a.get(e.id))}),l()});function l(){i.enqueueChange("transparent",t=>{const i=a.get(e.id);t.removeAttribute("uploadId",i),t.removeAttribute("uploadStatus",i),a.delete(e.id)}),n.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let o=0;const n=Object.keys(e).filter(e=>{const t=parseInt(e,10);if(!isNaN(t))return o=Math.max(o,t),!0}).map(t=>`${e[t]} ${t}w`).join(", ");""!=n&&i.setAttribute("srcset",{data:n,width:o},t)}}function ip(e,t){const i=e.plugins.get("ImageUtils");return Array.from(e.model.createRangeOn(t)).filter(e=>i.isImage(e.item)).map(e=>e.item)}class op extends Ze{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!t,t&&t.hasAttribute("width")?this.value={width:t.getAttribute("width"),height:null}:this.value=null}execute(e){const t=this.editor,i=t.model,o=t.plugins.get("ImageUtils").getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},o&&i.change(t=>{t.setAttribute("width",e.width,o)})}}class np extends Qe{static get requires(){return[qm]}static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new op(e);this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:"width"}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:"width"})}_registerConverters(e){const t=this.editor;t.conversion.for("downcast").add(t=>t.on("attribute:width:"+e,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const o=i.writer,n=i.mapper.toViewElement(t.item);null!==t.attributeNewValue?(o.setStyle("width",t.attributeNewValue,n),o.addClass("image_resized",n)):(o.removeStyle("width",n),o.removeClass("image_resized",n))})),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{width:/.+/}},model:{key:"width",value:e=>e.getStyle("width")}})}}const rp={small:Rc.objectSizeSmall,medium:Rc.objectSizeMedium,large:Rc.objectSizeLarge,original:Rc.objectSizeFull};class sp extends Qe{static get requires(){return[np]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(const e of t)this._registerImageResizeButton(e);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:i,value:o,icon:n}=e,r=o?o+this._resizeUnit:null;t.ui.componentFactory.add(i,i=>{const o=new rd(i),s=t.commands.get("resizeImage"),a=this._getOptionLabelValue(e,!0);if(!rp[n])throw new l.a("imageresizebuttons-missing-icon",t,e);return o.set({label:a,icon:rp[n],tooltip:a,isToggleable:!0}),o.bind("isEnabled").to(this),o.bind("isOn").to(s,"value",ap(r)),this.listenTo(o,"execute",()=>{t.execute("resizeImage",{width:r})}),o})}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,o=e.find(e=>!e.value),n=n=>{const r=t.commands.get("resizeImage"),s=Vd(n,fd),a=s.buttonView;return a.set({tooltip:i("Resize image"),commandValue:o.value,icon:rp.medium,isToggleable:!0,label:this._getOptionLabelValue(o),withText:!0,class:"ck-resize-image-button"}),a.bind("label").to(r,"value",e=>e&&e.width?e.width:this._getOptionLabelValue(o)),s.bind("isOn").to(r),s.bind("isEnabled").to(this),zd(s,this._getResizeDropdownListItemDefinitions(e,r)),s.listView.ariaLabel=i("Image resize list"),this.listenTo(s,"execute",e=>{t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus()}),s};t.ui.componentFactory.add("resizeImage",n),t.ui.componentFactory.add("imageResize",n)}_getOptionLabelValue(e,t){const i=this.editor.t;return e.label?e.label:t?e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const i=new Zi;return e.map(e=>{const o=e.value?e.value+this._resizeUnit:null,n={type:"button",model:new $d({commandName:"resizeImage",commandValue:o,label:this._getOptionLabelValue(e),withText:!0,icon:null})};n.model.bind("isOn").to(t,"value",ap(o)),i.add(n)}),i}}function ap(e){return t=>null===e&&t===e||t&&t.width===e}const lp=/(image|image-inline)/;class cp extends Qe{static get requires(){return[Dm]}static get pluginName(){return"ImageResizeHandles"}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view;t.addObserver(hf),this.listenTo(t.document,"imageLoaded",(i,o)=>{if(!o.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;const n=e.editing.view.domConverter,r=n.domToView(o.target).findAncestor({classes:lp});let s=this.editor.plugins.get(Dm).getResizerByViewElement(r);if(s)return void s.redraw();const a=e.editing.mapper,l=a.toModelElement(r);s=e.plugins.get(Dm).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:l,viewElement:r,editor:e,getHandleHost:e=>e.querySelector("img"),getResizeHost:()=>n.viewToDom(a.toViewElement(l.parent)),isCentered(){const e=l.getAttribute("imageStyle");return!e||"block"==e||"alignCenter"==e},onCommit(i){t.change(e=>{e.removeClass("image_resized",r)}),e.execute("resizeImage",{width:i})}}),s.on("updateSize",()=>{r.hasClass("image_resized")||t.change(e=>{e.addClass("image_resized",r)})}),s.bind("isEnabled").to(this)})}}i(94);class dp{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(e=>this._definitions.add(e)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(e,t,i)=>{if(!i.consumable.test(t.item,"attribute:linkHref"))return;const o=i.writer,n=o.document.selection;for(const e of this._definitions){const r=o.createAttributeElement("a",e.attributes,{priority:5});e.classes&&o.addClass(e.classes,r);for(const t in e.styles)o.setStyle(t,e.styles[t],r);o.setCustomProperty("link",!0,r),e.callback(t.attributeNewValue)?t.item.is("selection")?o.wrap(n.getFirstRange(),r):o.wrap(i.mapper.toViewRange(t.range),r):o.unwrap(i.mapper.toViewRange(t.range),r)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(e,t,{writer:i,mapper:o})=>{const n=o.toViewElement(t.item),r=Array.from(n.getChildren()).find(e=>"a"===e.name);for(const e of this._definitions){const o=mo(e.attributes);if(e.callback(t.attributeNewValue)){for(const[e,t]of o)"class"===e?i.addClass(t,r):i.setAttribute(e,t,r);e.classes&&i.addClass(e.classes,r);for(const t in e.styles)i.setStyle(t,e.styles[t],r)}else{for(const[e,t]of o)"class"===e?i.removeClass(t,r):i.removeAttribute(e,r);e.classes&&i.removeClass(e.classes,r);for(const t in e.styles)i.removeStyle(t,r)}}})}}}var hp=function(e,t,i){var o=e.length;return i=void 0===i?o:i,!t&&i>=o?e:Bo(e,t,i)},up=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var gp=function(e){return up.test(e)};var mp=function(e){return e.split("")},fp="[\\ud800-\\udfff]",pp="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",bp="\\ud83c[\\udffb-\\udfff]",wp="[^\\ud800-\\udfff]",kp="(?:\\ud83c[\\udde6-\\uddff]){2}",_p="[\\ud800-\\udbff][\\udc00-\\udfff]",vp="(?:"+pp+"|"+bp+")"+"?",yp="[\\ufe0e\\ufe0f]?"+vp+("(?:\\u200d(?:"+[wp,kp,_p].join("|")+")[\\ufe0e\\ufe0f]?"+vp+")*"),xp="(?:"+[wp+pp+"?",pp,kp,_p,fp].join("|")+")",Cp=RegExp(bp+"(?="+bp+")|"+xp+yp,"g");var Ap=function(e){return e.match(Cp)||[]};var Tp=function(e){return gp(e)?Ap(e):mp(e)};var Ep=function(e){return function(t){t=Ro(t);var i=gp(t)?Tp(t):void 0,o=i?i[0]:t.charAt(0),n=i?hp(i,1).join(""):t.slice(1);return o[e]()+n}}("toUpperCase");const Pp=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Sp=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,Ip=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,Rp=/^((\w+:(\/{2,})?)|(\W))/i;function Vp(e,{writer:t}){const i=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,i),i}function Op(e){return function(e){return e.replace(Pp,"").match(Sp)}(e=String(e))?e:"#"}function zp(e,t){return!!e&&t.checkAttribute(e.name,"linkHref")}function Mp(e,t){const i=(o=e,Ip.test(o)?"mailto:":t);var o;const n=!!i&&!Rp.test(e);return e&&n?i+e:e}class Bp extends Ze{constructor(e){super(e),this.manualDecorators=new Zi,this.automaticDecorators=new dp}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||Os(t.getSelectedBlocks());zp(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const i=this.editor.model,o=i.document.selection,n=[],r=[];for(const e in t)t[e]?n.push(e):r.push(e);i.change(t=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=mg(s,"linkHref",o.getAttribute("linkHref"),i);t.setAttribute("linkHref",e,a),n.forEach(e=>{t.setAttribute(e,!0,a)}),r.forEach(e=>{t.removeAttribute(e,a)}),t.setSelection(t.createPositionAfter(a.end.nodeBefore))}else if(""!==e){const r=mo(o.getAttributes());r.set("linkHref",e),n.forEach(e=>{r.set(e,!0)});const{end:a}=i.insertContent(t.createText(e,r),s);t.setSelection(a)}["linkHref",...n,...r].forEach(e=>{t.removeSelectionAttribute(e)})}else{const s=i.schema.getValidRanges(o.getRanges(),"linkHref"),a=[];for(const e of o.getSelectedBlocks())i.schema.checkAttribute(e,"linkHref")&&a.push(t.createRangeOn(e));const l=a.slice();for(const e of s)this._isRangeToUpdate(e,a)&&l.push(e);for(const i of l)t.setAttribute("linkHref",e,i),n.forEach(e=>{t.setAttribute(e,!0,i)}),r.forEach(e=>{t.removeAttribute(e,i)})}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,o=i.getSelectedElement();return zp(o,t.schema)?o.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}}class Np extends Ze{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();zp(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,o=e.commands.get("link");t.change(e=>{const n=i.isCollapsed?[mg(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const t of n)if(e.removeAttribute("linkHref",t),o)for(const i of o.manualDecorators)e.removeAttribute(i.id,t)})}}class Fp{constructor({id:e,label:t,attributes:i,classes:o,styles:n,defaultValue:r}){this.id=e,this.set("value"),this.defaultValue=r,this.label=t,this.attributes=i,this.classes=o,this.styles=n}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}Ye(Fp,qe);i(96);const Dp=/^(https?:)?\/\//;class Lp extends Qe{static get pluginName(){return"LinkEditing"}static get requires(){return[ig,Yu,ef]}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Vp}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,t)=>Vp(Op(e),t)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new Bp(e)),e.commands.add("unlink",new Np(e));const t=function(e,t){const i={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach(e=>(e.label&&i[e.label]&&(e.label=i[e.label]),e)),t}(e.t,function(e){const t=[];if(e)for(const[i,o]of Object.entries(e)){const e=Object.assign({},o,{id:"link"+Ep(i)});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(e=>"automatic"===e.mode)),this._enableManualDecorators(t.filter(e=>"manual"===e.mode));e.plugins.get(ig).registerAttribute("linkHref"),pg(e,"linkHref","a","ck-link_selected"),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&i.add({id:"linkIsExternal",mode:"automatic",callback:e=>Dp.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),i.add(e),i.length&&t.conversion.for("downcast").add(i.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach(e=>{t.model.schema.extend("$text",{allowAttributes:e.id}),e=new Fp(e),i.add(e),t.conversion.for("downcast").attributeToElement({model:e.id,view:(t,{writer:i})=>{if(t){const t=i.createAttributeElement("a",e.attributes,{priority:5});e.classes&&i.addClass(e.classes,t);for(const o in e.styles)i.setStyle(o,e.styles[o],t);return i.setCustomProperty("link",!0,t),t}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...e._createPattern()},model:{key:e.id}})})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(e,"insertContent",()=>{const i=t.anchor.nodeBefore,o=t.anchor.nodeAfter;t.hasAttribute("linkHref")&&i&&i.hasAttribute("linkHref")&&(o&&o.hasAttribute("linkHref")||e.change(t=>{Hp(t,Wp(e.schema))}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.model;e.editing.view.addObserver(Eh);let i=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{i=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!i)return;i=!1;const e=t.document.selection;if(!e.isCollapsed)return;if(!e.hasAttribute("linkHref"))return;const o=e.getFirstPosition(),n=mg(o,"linkHref",e.getAttribute("linkHref"),t);(o.isTouching(n.start)||o.isTouching(n.end))&&t.change(e=>{Hp(e,Wp(t.schema))})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let i,o;this.listenTo(t.document,"delete",()=>{o=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const t=e.model.document.selection;t.isCollapsed||(o?o=!1:jp(e)&&function(e){const t=e.document.selection,i=t.getFirstPosition(),o=t.getLastPosition(),n=i.nodeAfter;if(!n)return!1;if(!n.is("$text"))return!1;if(!n.hasAttribute("linkHref"))return!1;const r=o.textNode||o.nodeBefore;if(n===r)return!0;return mg(i,"linkHref",n.getAttribute("linkHref"),e).containsRange(e.createRange(i,o),!0)}(e.model)&&(i=t.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(t,[n])=>{o=!1,jp(e)&&i&&(e.model.change(e=>{for(const[t,o]of i)e.setAttribute(t,o,n)}),i=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,i=t.document.selection,o=e.editing.view;let n=!1,r=!1;this.listenTo(o.document,"delete",(e,t)=>{r=t.domEvent.keyCode===On.backspace},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{n=!1;const e=i.getFirstPosition(),o=i.getAttribute("linkHref");if(!o)return;const r=mg(e,"linkHref",o,t);n=r.containsPosition(e)||r.end.isEqual(e)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{r&&(r=!1,n||e.model.enqueueChange(e=>{Hp(e,Wp(t.schema))}))},{priority:"low"})}}function Hp(e,t){e.removeSelectionAttribute("linkHref");for(const i of t)e.removeSelectionAttribute(i)}function jp(e){return e.plugins.get("Input").isInput(e.model.change(e=>e.batch))}function Wp(e){return e.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))}i(98);class qp extends Bc{constructor(e,t){super(e);const i=e.t;this.focusTracker=new zs,this.keystrokes=new Ms,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Rc.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Rc.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusables=new Mc,this._focusCycler=new hd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children}),Oc(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),zc({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new Hd(this.locale,jd);return t.label=e("Link URL"),t}_createButton(e,t,i,o){const n=new rd(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:i}}),o&&n.delegate("execute").to(this,o),n}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const o=new sd(this.locale);o.set({name:i.id,label:i.label,withText:!0}),o.bind("isOn").toMany([i,e],"value",(e,t)=>void 0===t&&void 0===e?i.defaultValue:e),o.on("execute",()=>{i.set("value",!o.isOn)}),t.add(o)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new Bc;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(e)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}i(100);class $p extends Bc{constructor(e){super(e);const t=e.t;this.focusTracker=new zs,this.keystrokes=new Ms,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(t("Edit link"),Rc.pencil,"edit"),this.set("href"),this._focusables=new Mc,this._focusCycler=new hd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const o=new rd(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.delegate("execute").to(this,i),o}_createPreviewButton(){const e=new rd(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",e=>e&&Op(e)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",e=>e||i("This link has no URL")),e.bind("isEnabled").to(this,"href",e=>!!e),e.template.tag="a",e.template.eventListeners={},e}}class Up extends Qe{static get requires(){return[eh]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(Th),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=e.plugins.get(eh),this._createToolbarLinkButton(),this._enableUserBalloonInteractions(),e.conversion.for("editingDowncast").markerToHighlight({model:"link-ui",view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:"link-ui",view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const e=this.editor,t=new $p(e.locale),i=e.commands.get("link"),o=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(o),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(e,t)=>{this._hideUI(),t()}),t.keystrokes.set("Ctrl+K",(e,t)=>{this._addFormView(),t()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),o=new qp(e.locale,t);return o.urlInputView.fieldView.bind("value").to(t,"value"),o.urlInputView.bind("isReadOnly").to(t,"isEnabled",e=>!e),o.saveButtonView.bind("isEnabled").to(t),this.listenTo(o,"submit",()=>{const{value:t}=o.urlInputView.fieldView.element,n=Mp(t,i);e.execute("link",n,o.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(o,"cancel",()=>{this._closeFormView()}),o.keystrokes.set("Esc",(e,t)=>{this._closeFormView(),t()}),o}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),i=e.t;e.keystrokes.set("Ctrl+K",(e,i)=>{i(),t.isEnabled&&this._showUI(!0)}),e.ui.componentFactory.add("link",e=>{const o=new rd(e);return o.isEnabled=!0,o.label=i("Link"),o.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',o.keystroke="Ctrl+K",o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(t,"isEnabled"),o.bind("isOn").to(t,"value",e=>!!e),this.listenTo(o,"execute",()=>this._showUI(!0)),o})}_enableUserBalloonInteractions(){const e=this.editor.editing.view.document;this.listenTo(e,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Vc({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=e.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),o=r();const n=()=>{const e=this._getSelectedLinkElement(),t=r();i&&!e||!i&&t!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=e,o=t};function r(){return t.selection.focus.getAncestors().reverse().find(e=>e.is("element"))}this.listenTo(e.ui,"update",n),this.listenTo(this._balloon,"change:visibleView",n)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let o=null;if(t.markers.has("link-ui")){const t=Array.from(this.editor.editing.mapper.markerNameToElements("link-ui")),i=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));o=e.domConverter.viewRangeToDom(i)}else o=()=>{const t=this._getSelectedLinkElement();return t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:o}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&um(i))return Kp(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),o=Kp(i.start),n=Kp(i.end);return o&&o==n&&e.createRangeIn(o).getTrimmed().isEqual(i)?o:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has("link-ui"))t.updateMarker("link-ui",{range:i});else if(i.start.isAtEnd){const o=i.start.getLastMatchingPosition(({item:t})=>!e.schema.isContent(t),{boundaries:i});t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:t.createRange(o,i.end)})}else t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has("link-ui")&&e.change(e=>{e.removeMarker("link-ui")})}}function Kp(e){return e.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})}const Gp=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class Jp extends Qe{static get requires(){return[Zu]}static get pluginName(){return"AutoLink"}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const e=this.editor,t=new tg(e.model,e=>{if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=Yp(e.substr(0,e.length-1));return t?{url:t}:void 0}),i=e.plugins.get("Input");t.on("matched:data",(t,o)=>{const{batch:n,range:r,url:s}=o;if(!i.isInput(n))return;const a=r.end.getShiftedBy(-1),l=a.getShiftedBy(-s.length),c=e.model.createRange(l,a);this._applyAutoLink(s,c)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const i=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(i)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const e=t.document.selection.getFirstPosition(),i=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(i)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:o}=eg(e,t),n=Yp(i);if(n){const e=t.createRange(o.end.getShiftedBy(-n.length),o.end);this._applyAutoLink(n,e)}}_applyAutoLink(e,t){const i=this.editor.model,o=this.editor.plugins.get("Delete");this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,i)&&i.enqueueChange(n=>{const r=this.editor.config.get("link.defaultProtocol"),s=Mp(e,r);n.setAttribute("linkHref",s,t),i.enqueueChange(()=>{o.requestUndoOnBackspace()})})}}function Yp(e){const t=Gp.exec(e);return t?t[2]:null}class Qp extends Ze{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document,o=Array.from(i.selection.getSelectedBlocks()).filter(e=>Zp(e,t.schema)),n=void 0!==e.forceValue?!e.forceValue:this.value;t.change(e=>{if(n){let t=o[o.length-1].nextSibling,i=Number.POSITIVE_INFINITY,n=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e<i&&(i=e);const o=e-i;n.push({element:t,listIndent:o}),t=t.nextSibling}n=n.reverse();for(const t of n)e.setAttribute("listIndent",t.listIndent,t.element)}if(!n){let e=Number.POSITIVE_INFINITY;for(const t of o)t.is("element","listItem")&&t.getAttribute("listIndent")<e&&(e=t.getAttribute("listIndent"));e=0===e?1:e,Xp(o,!0,e),Xp(o,!1,e)}for(const t of o.reverse())n&&"listItem"==t.name?e.rename(t,"paragraph"):n||"listItem"==t.name?n||"listItem"!=t.name||t.getAttribute("listType")==this.type||e.setAttribute("listType",this.type,t):(e.setAttributes({listType:this.type,listIndent:0},t),e.rename(t,"listItem"));this.fire("_executeCleanup",o)})}_getValue(){const e=Os(this.editor.model.document.selection.getSelectedBlocks());return!!e&&e.is("element","listItem")&&e.getAttribute("listType")==this.type}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Os(e.getSelectedBlocks());return!!i&&Zp(i,t)}}function Xp(e,t,i){const o=t?e[0]:e[e.length-1];if(o.is("element","listItem")){let n=o[t?"previousSibling":"nextSibling"],r=o.getAttribute("listIndent");for(;n&&n.is("element","listItem")&&n.getAttribute("listIndent")>=i;)r>n.getAttribute("listIndent")&&(r=n.getAttribute("listIndent")),n.getAttribute("listIndent")==r&&e[t?"unshift":"push"](n),n=n[t?"previousSibling":"nextSibling"]}}function Zp(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}class eb extends Ze{constructor(e,t){super(e),this._indentBy="forward"==t?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let i=Array.from(t.selection.getSelectedBlocks());e.change(e=>{const t=i[i.length-1];let o=t.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>t.getAttribute("listIndent");)i.push(o),o=o.nextSibling;this._indentBy<0&&(i=i.reverse());for(const t of i){const i=t.getAttribute("listIndent")+this._indentBy;i<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",i,t)}this.fire("_executeCleanup",i)})}_checkEnabled(){const e=Os(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),i=e.getAttribute("listType");let o=e.previousSibling;for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=t;){if(o.getAttribute("listIndent")==t)return o.getAttribute("listType")==i;o=o.previousSibling}return!1}return!0}}function tb(e,t){const i=t.mapper,o=t.writer,n="numbered"==e.getAttribute("listType")?"ol":"ul",r=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=cb,t}(o),s=o.createContainerElement(n,null);return o.insert(o.createPositionAt(s,0),r),i.bindElements(e,r),r}function ib(e,t,i,o){const n=t.parent,r=i.mapper,s=i.writer;let a=r.toViewPosition(o.createPositionBefore(e));const l=rb(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute("listIndent")}),c=e.previousSibling;if(l&&l.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=r.toViewElement(l);a=s.breakContainer(s.createPositionAfter(e))}else if(c&&"listItem"==c.name){a=r.toViewPosition(o.createPositionAt(c,"end"));const e=r.findMappedViewAncestor(a),t=ab(e);a=t?s.createPositionBefore(t):s.createPositionAt(e,"end")}else a=r.toViewPosition(o.createPositionBefore(e));if(a=nb(a),s.insert(a,n),c&&"listItem"==c.name){const e=r.toViewElement(c),i=s.createRange(s.createPositionAt(e,0),a).getWalker({ignoreElementEnd:!0});for(const e of i)if(e.item.is("element","li")){const o=s.breakContainer(s.createPositionBefore(e.item)),n=e.item.parent,r=s.createPositionAt(t,"end");ob(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(n),r),i.position=o}}else{const i=n.nextSibling;if(i&&(i.is("element","ul")||i.is("element","ol"))){let o=null;for(const t of i.getChildren()){const i=r.toModelElement(t);if(!(i&&i.getAttribute("listIndent")>e.getAttribute("listIndent")))break;o=t}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(t,"end")))}}ob(s,n,n.nextSibling),ob(s,n.previousSibling,n)}function ob(e,t,i){return!t||!i||"ul"!=t.name&&"ol"!=t.name||t.name!=i.name||t.getAttribute("class")!==i.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function nb(e){return e.getLastMatchingPosition(e=>e.item.is("uiElement"))}function rb(e,t){const i=!!t.sameIndent,o=!!t.smallerIndent,n=t.listIndent;let r=e;for(;r&&"listItem"==r.name;){const e=r.getAttribute("listIndent");if(i&&n==e||o&&n>e)return r;r="forward"===t.direction?r.nextSibling:r.previousSibling}return null}function sb(e,t,i,o){e.ui.componentFactory.add(t,n=>{const r=e.commands.get(t),s=new rd(n);return s.set({label:i,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",()=>{e.execute(t),e.editing.view.focus()}),s})}function ab(e){for(const t of e.getChildren())if("ul"==t.name||"ol"==t.name)return t;return null}function lb(e,t){const i=[],o=e.parent,n={ignoreElementEnd:!0,startPosition:e,shallow:!0,direction:t},r=o.getAttribute("listIndent"),s=[...new Zs(n)].filter(e=>e.item.is("element")).map(e=>e.item);for(const e of s){if(!e.is("element","listItem"))break;if(e.getAttribute("listIndent")<r)break;if(!(e.getAttribute("listIndent")>r)){if(e.getAttribute("listType")!==o.getAttribute("listType"))break;if(e.getAttribute("listStyle")!==o.getAttribute("listStyle"))break;"backward"===t?i.unshift(e):i.push(e)}}return i}function cb(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:rn.call(this)}function db(e){return(t,i,o)=>{const n=o.consumable;if(!n.test(i.item,"insert")||!n.test(i.item,"attribute:listType")||!n.test(i.item,"attribute:listIndent"))return;n.consume(i.item,"insert"),n.consume(i.item,"attribute:listType"),n.consume(i.item,"attribute:listIndent");const r=i.item;ib(r,tb(r,o),o,e)}}function hb(e,t,i){if(!i.consumable.consume(t.item,"attribute:listType"))return;const o=i.mapper.toViewElement(t.item),n=i.writer;n.breakContainer(n.createPositionBefore(o)),n.breakContainer(n.createPositionAfter(o));const r=o.parent,s="numbered"==t.attributeNewValue?"ol":"ul";n.rename(s,r)}function ub(e,t,i){const o=i.mapper.toViewElement(t.item).parent,n=i.writer;ob(n,o,o.nextSibling),ob(n,o.previousSibling,o);for(const e of t.item.getChildren())i.consumable.consume(e,"insert")}function gb(e,t,i){if("listItem"!=t.item.name){let e=i.mapper.toViewPosition(t.range.start);const o=i.writer,n=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=o.breakContainer(e),"li"==e.parent.name);){const t=e,i=o.createPositionAt(e.parent,"end");if(!t.isEqual(i)){const e=o.remove(o.createRange(t,i));n.push(e)}e=o.createPositionAfter(e.parent)}if(n.length>0){for(let t=0;t<n.length;t++){const i=e.nodeBefore;if(e=o.insert(e,n[t]).end,t>0){const t=ob(o,i,i.nextSibling);t&&t.parent==i&&e.offset--}}ob(o,e.nodeBefore,e.nodeAfter)}}}function mb(e,t,i){const o=i.mapper.toViewPosition(t.position),n=o.nodeBefore,r=o.nodeAfter;ob(i.writer,n,r)}function fb(e,t,i){if(i.consumable.consume(t.viewItem,{name:!0})){const e=i.writer,o=e.createElement("listItem"),n=function(e){let t=0,i=e.parent;for(;i;){if(i.is("element","li"))t++;else{const e=i.previousSibling;e&&e.is("element","li")&&t++}i=i.parent}return t}(t.viewItem);e.setAttribute("listIndent",n,o);const r=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";if(e.setAttribute("listType",r,o),!i.safeInsert(o,t.modelCursor))return;const s=function(e,t,i){const{writer:o,schema:n}=i;let r=o.createPositionAfter(e);for(const s of t)if("ul"==s.name||"ol"==s.name)r=i.convertItem(s,r).modelCursor;else{const t=i.convertItem(s,o.createPositionAt(e,"end")),a=t.modelRange.start.nodeAfter;a&&a.is("element")&&!n.checkChild(e,a.name)&&(e=t.modelCursor.parent.is("element","listItem")?t.modelCursor.parent:_b(t.modelCursor),r=o.createPositionAfter(e))}return r}(o,t.viewItem.getChildren(),i);t.modelRange=e.createRange(t.modelCursor,s),i.updateConversionResult(o,t)}}function pb(e,t,i){if(i.consumable.test(t.viewItem,{name:!0})){const e=Array.from(t.viewItem.getChildren());for(const t of e){!(t.is("element","li")||yb(t))&&t._remove()}}}function bb(e,t,i){if(i.consumable.test(t.viewItem,{name:!0})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let i=!1;for(const t of e)i&&!yb(t)&&t._remove(),yb(t)&&(i=!0)}}function wb(e){return(t,i)=>{if(i.isPhantom)return;const o=i.modelPosition.nodeBefore;if(o&&o.is("element","listItem")){const t=i.mapper.toViewElement(o),n=t.getAncestors().find(yb),r=e.createPositionAt(t,0).getWalker();for(const e of r){if("elementStart"==e.type&&e.item.is("element","li")){i.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==n){i.viewPosition=e.nextPosition;break}}}}}function kb(e,[t,i]){let o,n=t.is("documentFragment")?t.getChild(0):t;if(o=i?this.createSelection(i):this.document.selection,n&&n.is("element","listItem")){const e=o.getFirstPosition();let t=null;if(e.parent.is("element","listItem")?t=e.parent:e.nodeBefore&&e.nodeBefore.is("element","listItem")&&(t=e.nodeBefore),t){const e=t.getAttribute("listIndent");if(e>0)for(;n&&n.is("element","listItem");)n._setAttribute("listIndent",n.getAttribute("listIndent")+e),n=n.nextSibling}}}function _b(e){const t=new Zs({startPosition:e});let i;do{i=t.next()}while(!i.value.item.is("element","listItem"));return i.value.item}function vb(e,t,i,o,n,r){const s=rb(t.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e,foo:"b"}),a=n.mapper,l=n.writer,c=s?s.getAttribute("listIndent"):null;let d;if(s)if(c==e){const e=a.toViewElement(s).parent;d=l.createPositionAfter(e)}else{const e=r.createPositionAt(s,"end");d=a.toViewPosition(e)}else d=i;d=nb(d);for(const e of[...o.getChildren()])yb(e)&&(d=l.move(l.createRangeOn(e),d).end,ob(l,e,e.nextSibling),ob(l,e.previousSibling,e))}function yb(e){return e.is("element","ol")||e.is("element","ul")}class xb extends Qe{static get pluginName(){return"ListEditing"}static get requires(){return[jg,Zu]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,i=e.editing;var o;e.model.document.registerPostFixer(t=>function(e,t){const i=e.document.differ.getChanges(),o=new Map;let n=!1;for(const o of i)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const i=o.position.nodeAfter;i.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",i),n=!0),i.hasAttribute("listType")&&(t.removeAttribute("listType",i),n=!0),i.hasAttribute("listStyle")&&(t.removeAttribute("listStyle",i),n=!0);for(const t of Array.from(e.createRangeIn(i)).filter(e=>e.item.is("element","listItem")))r(t.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const e of o.values())s(e),a(e);return n;function r(e){const t=e.nodeBefore;if(t&&t.is("element","listItem")){let e=t;if(o.has(e))return;for(let t=e.previousSibling;t&&t.is("element","listItem");t=e.previousSibling)if(e=t,o.has(e))return;o.set(t,e)}else{const t=e.nodeAfter;t&&t.is("element","listItem")&&o.set(t,t)}}function s(e){let i=0,o=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(r>i){let s;null===o?(o=r-i,s=i):(o>r&&(o=r),s=r-o),t.setAttribute("listIndent",s,e),n=!0}else o=null,i=e.getAttribute("listIndent")+1;e=e.nextSibling}}function a(e){let i=[],o=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(i=i.slice(0,r+1)),0!=r)if(i[r]){const o=i[r];e.getAttribute("listType")!=o&&(t.setAttribute("listType",o,e),n=!0)}else i[r]=e.getAttribute("listType");o=e,e=e.nextSibling}}}(e.model,t)),i.mapper.registerViewToModelLength("li",Cb),t.mapper.registerViewToModelLength("li",Cb),i.mapper.on("modelToViewPosition",wb(i.view)),i.mapper.on("viewToModelPosition",(o=e.model,(e,t)=>{const i=t.viewPosition,n=i.parent,r=t.mapper;if("ul"==n.name||"ol"==n.name){if(i.isAtEnd){const e=r.toModelElement(i.nodeBefore),n=r.getModelLength(i.nodeBefore);t.modelPosition=o.createPositionBefore(e).getShiftedBy(n)}else{const e=r.toModelElement(i.nodeAfter);t.modelPosition=o.createPositionBefore(e)}e.stop()}else if("li"==n.name&&i.nodeBefore&&("ul"==i.nodeBefore.name||"ol"==i.nodeBefore.name)){const s=r.toModelElement(n);let a=1,l=i.nodeBefore;for(;l&&yb(l);)a+=r.getModelLength(l),l=l.previousSibling;t.modelPosition=o.createPositionBefore(s).getShiftedBy(a),e.stop()}})),t.mapper.on("modelToViewPosition",wb(i.view)),e.conversion.for("editingDowncast").add(t=>{t.on("insert",gb,{priority:"high"}),t.on("insert:listItem",db(e.model)),t.on("attribute:listType:listItem",hb,{priority:"high"}),t.on("attribute:listType:listItem",ub,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return(t,i,o)=>{if(!o.consumable.consume(i.item,"attribute:listIndent"))return;const n=o.mapper.toViewElement(i.item),r=o.writer;r.breakContainer(r.createPositionBefore(n)),r.breakContainer(r.createPositionAfter(n));const s=n.parent,a=s.previousSibling,l=r.createRangeOn(s);r.remove(l),a&&a.nextSibling&&ob(r,a,a.nextSibling),vb(i.attributeOldValue+1,i.range.start,l.start,n,o,e),ib(i.item,n,o,e);for(const e of i.item.getChildren())o.consumable.consume(e,"insert")}}(e.model)),t.on("remove:listItem",function(e){return(t,i,o)=>{const n=o.mapper.toViewPosition(i.position).getLastMatchingPosition(e=>!e.item.is("element","li")).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(n)),r.breakContainer(r.createPositionAfter(n));const s=n.parent,a=s.previousSibling,l=r.createRangeOn(s),c=r.remove(l);a&&a.nextSibling&&ob(r,a,a.nextSibling);vb(o.mapper.toModelElement(n).getAttribute("listIndent")+1,i.position,l.start,n,o,e);for(const e of r.createRangeIn(c).getItems())o.mapper.unbindViewElement(e);t.stop()}}(e.model)),t.on("remove",mb,{priority:"low"})}),e.conversion.for("dataDowncast").add(t=>{t.on("insert",gb,{priority:"high"}),t.on("insert:listItem",db(e.model))}),e.conversion.for("upcast").add(e=>{e.on("element:ul",pb,{priority:"high"}),e.on("element:ol",pb,{priority:"high"}),e.on("element:li",bb,{priority:"high"}),e.on("element:li",fb)}),e.model.on("insertContent",kb,{priority:"high"}),e.commands.add("numberedList",new Qp(e,"numbered")),e.commands.add("bulletedList",new Qp(e,"bulleted")),e.commands.add("indentList",new eb(e,"forward")),e.commands.add("outdentList",new eb(e,"backward"));const n=i.view.document;this.listenTo(n,"enter",(e,t)=>{const i=this.editor.model.document,o=i.selection.getLastPosition().parent;i.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop())},{context:"li"}),this.listenTo(n,"delete",(e,t)=>{if("backward"!==t.direction)return;const i=this.editor.model.document.selection;if(!i.isCollapsed)return;const o=i.getFirstPosition();if(!o.isAtStart)return;const n=o.parent;if("listItem"!==n.name)return;n.previousSibling&&"listItem"===n.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop())},{context:"li"});const r=e=>(t,i)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),i())};e.keystrokes.set("Tab",r("indentList")),e.keystrokes.set("Shift+Tab",r("outdentList"))}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),i&&i.registerChildCommand(e.get("outdentList"))}}function Cb(e){let t=1;for(const i of e.getChildren())if("ul"==i.name||"ol"==i.name)for(const e of i.getChildren())t+=Cb(e);return t}var Ab='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',Tb='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z"/></svg>';class Eb extends Qe{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;sb(this.editor,"numberedList",e("Numbered List"),Ab),sb(this.editor,"bulletedList",e("Bulleted List"),Tb)}}class Pb extends Ze{constructor(e,t){super(e),this._defaultType=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model;let i=[...t.document.selection.getSelectedBlocks()].filter(e=>e.is("element","listItem")).map(e=>{const i=t.change(t=>t.createPositionAt(e,0));return[...lb(i,"backward"),...lb(i,"forward")]}).flat();i=[...new Set(i)],i.length&&t.change(t=>{for(const o of i)t.setAttribute("listStyle",e.type||this._defaultType,o)})}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}}class Sb extends Qe{static get requires(){return[xb]}static get pluginName(){return"ListStyleEditing"}init(){const e=this.editor,t=e.model;t.schema.extend("listItem",{allowAttributes:["listStyle"]}),e.commands.add("listStyle",new Pb(e,"default")),this.listenTo(e.commands.get("indentList"),"_executeCleanup",function(e){return(t,i)=>{let o;const n=i[0],r=n.getAttribute("listIndent"),s=i.filter(e=>e.getAttribute("listIndent")===r);if(n.previousSibling.getAttribute("listIndent")+1===r)o="default";else{const e=rb(n.previousSibling,{sameIndent:!0,direction:"backward",listIndent:r});o=e.getAttribute("listStyle")}e.model.change(e=>{for(const t of s)e.setAttribute("listStyle",o,t)})}}(e)),this.listenTo(e.commands.get("outdentList"),"_executeCleanup",function(e){return(t,i)=>{if(!(i=i.reverse().filter(e=>e.is("element","listItem"))).length)return;const o=i[0].getAttribute("listIndent"),n=i[0].getAttribute("listType");let r=i[0].previousSibling;if(r.is("element","listItem"))for(;r.getAttribute("listIndent")!==o;)r=r.previousSibling;else r=null;r||(r=i[i.length-1].nextSibling),r&&r.is("element","listItem")&&r.getAttribute("listType")===n&&e.model.change(e=>{const t=i.filter(e=>e.getAttribute("listIndent")===o);for(const i of t)e.setAttribute("listStyle",r.getAttribute("listStyle"),i)})}}(e)),this.listenTo(e.commands.get("bulletedList"),"_executeCleanup",Vb(e)),this.listenTo(e.commands.get("numberedList"),"_executeCleanup",Vb(e)),t.document.registerPostFixer(function(e){return t=>{let i=!1;const o=Ob(e.model.document.differ.getChanges()).filter(e=>"todo"!==e.getAttribute("listType"));if(!o.length)return i;let n=o[o.length-1].nextSibling;if((!n||!n.is("element","listItem"))&&(n=o[o.length-1].previousSibling,n)){const e=o[0].getAttribute("listIndent");for(;n.is("element","listItem")&&n.getAttribute("listIndent")!==e&&(n=n.previousSibling,n););}for(const e of o)if(e.hasAttribute("listStyle")){const o=e.previousSibling;Rb(o,e)&&(t.setAttribute("listStyle",o.getAttribute("listStyle"),e),i=!0)}else Ib(n,e)?t.setAttribute("listStyle",n.getAttribute("listStyle"),e):t.setAttribute("listStyle","default",e),i=!0;return i}}(e)),e.conversion.for("upcast").add(e=>{e.on("element:li",(e,t,i)=>{const o=t.viewItem.parent;if(!o)return;const n=o.getStyle("list-style-type")||"default",r=t.modelRange.start.nodeAfter||t.modelRange.end.nodeBefore;i.writer.setAttribute("listStyle",n,r)},{priority:"low"})}),e.conversion.for("downcast").add(e=>{e.on("attribute:listStyle:listItem",(e,t,i)=>{const o=i.writer,n=t.item,r=rb(n.previousSibling,{sameIndent:!0,listIndent:n.getAttribute("listIndent"),direction:"backward"}),s=i.mapper.toViewElement(n);var a,l,c,d,h;a=n,(l=r)&&a.getAttribute("listType")===l.getAttribute("listType")&&a.getAttribute("listIndent")===l.getAttribute("listIndent")&&a.getAttribute("listStyle")===l.getAttribute("listStyle")||o.breakContainer(o.createPositionBefore(s)),c=o,d=t.attributeNewValue,h=s.parent,d&&"default"!==d?c.setStyle("list-style-type",d,h):c.removeStyle("list-style-type",h)},{priority:"low"})}),this._mergeListStyleAttributeWhileMergingLists()}afterInit(){const e=this.editor;e.commands.get("todoList")&&e.model.document.registerPostFixer(function(e){return t=>{const i=Ob(e.model.document.differ.getChanges()).filter(e=>"todo"===e.getAttribute("listType")&&e.hasAttribute("listStyle"));if(!i.length)return!1;for(const e of i)t.removeAttribute("listStyle",e);return!0}}(e))}_mergeListStyleAttributeWhileMergingLists(){const e=this.editor.model;let t;this.listenTo(e,"deleteContent",(e,[i])=>{const o=i.getFirstPosition(),n=i.getLastPosition();if(o.parent===n.parent)return;if(!o.parent.is("element","listItem"))return;const r=n.parent.nextSibling;if(!r||!r.is("element","listItem"))return;const s=rb(o.parent,{sameIndent:!0,listIndent:r.getAttribute("listIndent")});s&&s.getAttribute("listType")===r.getAttribute("listType")&&(t=s)},{priority:"high"}),this.listenTo(e,"deleteContent",()=>{t&&(e.change(e=>{const i=rb(t.nextSibling,{sameIndent:!0,listIndent:t.getAttribute("listIndent"),direction:"forward"}),o=[i,...lb(e.createPositionAt(i,0),"forward")];for(const i of o)e.setAttribute("listStyle",t.getAttribute("listStyle"),i)}),t=null)},{priority:"low"})}}function Ib(e,t){if(!e)return!1;const i=e.getAttribute("listStyle");return!!i&&("default"!==i&&e.getAttribute("listType")===t.getAttribute("listType"))}function Rb(e,t){if(!e||!e.is("element","listItem"))return!1;if(t.getAttribute("listType")!==e.getAttribute("listType"))return!1;const i=e.getAttribute("listIndent");if(i<1||i!==t.getAttribute("listIndent"))return!1;const o=e.getAttribute("listStyle");return!(!o||o===t.getAttribute("listStyle"))}function Vb(e){return(t,i)=>{i=i.filter(e=>e.is("element","listItem")),e.model.change(e=>{for(const t of i)e.removeAttribute("listStyle",t)})}}function Ob(e){const t=[];for(const i of e){const e=zb(i);e&&e.is("element","listItem")&&t.push(e)}return t}function zb(e){return"attribute"===e.type?e.range.start.nodeAfter:"insert"===e.type?e.position.nodeAfter:null}i(102);class Mb extends Qe{static get pluginName(){return"ListStyleUI"}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("bulletedList",Bb({editor:e,parentCommandName:"bulletedList",buttonLabel:t("Bulleted List"),buttonIcon:Tb,toolbarAriaLabel:t("Bulleted list styles toolbar"),styleDefinitions:[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6z"/></svg>'},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"/></svg>'},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M14 27v6H8v-6h6zm0-9v6H8v-6h6zm0-9v6H8V9h6z"/></svg>'}]})),e.ui.componentFactory.add("numberedList",Bb({editor:e,parentCommandName:"numberedList",buttonLabel:t("Numbered List"),buttonIcon:Ab,toolbarAriaLabel:t("Numbered list styles toolbar"),styleDefinitions:[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M10.29 15V8.531H9.286c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.343 0v-1.235h-1.235V15h1.235zM11.3 24v-1.147H8.848c.064-.111.148-.226.252-.343.104-.117.351-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.494-.824.104-.263.156-.539.156-.829 0-.51-.182-.936-.545-1.279-.363-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.153-.155.358-.233.616-.233.26 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.468.536-1.024 1.055-.692.641-1.155 1.156-1.389 1.544-.234.389-.375.8-.422 1.233H11.3zm2.333 0v-1.235h-1.235V24h1.235zM9.204 34.11c.615 0 1.129-.2 1.542-.598.413-.398.62-.88.62-1.446 0-.39-.11-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.619-.337.928-.788.928-1.353 0-.399-.151-.756-.453-1.073-.366-.386-.852-.58-1.459-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.668.55c-.16.232-.28.544-.358.933l1.138.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.215 0 .386.065.515.194s.193.302.193.518c0 .255-.087.46-.263.613-.176.154-.43.227-.765.218l-.136 1.006c.22-.061.409-.092.567-.092.24 0 .444.09.61.272.168.182.251.428.251.739 0 .328-.087.589-.261.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.307-.698l-1.196.145c.062.542.285.98.668 1.316.384.335.868.503 1.45.503zm4.43-.11v-1.235h-1.236V34h1.235z"/></svg>'},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M5.714 15.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm6.078.914V8.531H10.79c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.344 0v-1.235h-1.235V15h1.235zm-9.422 9.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm7.088.914v-1.147H10.35c.065-.111.149-.226.253-.343.104-.117.35-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.493-.824.104-.263.156-.539.156-.829 0-.51-.181-.936-.544-1.279-.364-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.152-.155.357-.233.615-.233.261 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.467.536-1.024 1.055-.691.641-1.154 1.156-1.388 1.544-.235.389-.375.8-.422 1.233h4.328zm2.334 0v-1.235h-1.235V24h1.235zM5.714 34.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm4.992 1.024c.616 0 1.13-.2 1.543-.598.413-.398.62-.88.62-1.446 0-.39-.111-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.618-.337.927-.788.927-1.353 0-.399-.15-.756-.452-1.073-.366-.386-.853-.58-1.46-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.667.55c-.16.232-.28.544-.359.933l1.139.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.214 0 .386.065.515.194s.193.302.193.518c0 .255-.088.46-.264.613-.175.154-.43.227-.764.218l-.136 1.006c.22-.061.408-.092.566-.092.24 0 .444.09.611.272.167.182.25.428.25.739 0 .328-.086.589-.26.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.308-.698l-1.195.145c.062.542.284.98.668 1.316.384.335.867.503 1.45.503zm4.43-.11v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the lowerroman list style"),tooltip:t("Lowerroman"),type:"lower-roman",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.88 8.7V7.558h-1.234V8.7h1.234zm0 5.3V9.333h-1.234V14h1.234zm2.5 0v-1.235h-1.234V14h1.235zm-4.75 4.7v-1.142H8.395V18.7H9.63zm0 5.3v-4.667H8.395V24H9.63zm2.5-5.3v-1.142h-1.234V18.7h1.235zm0 5.3v-4.667h-1.234V24h1.235zm2.501 0v-1.235h-1.235V24h1.235zM7.38 28.7v-1.142H6.145V28.7H7.38zm0 5.3v-4.667H6.145V34H7.38zm2.5-5.3v-1.142H8.646V28.7H9.88zm0 5.3v-4.667H8.646V34H9.88zm2.5-5.3v-1.142h-1.234V28.7h1.235zm0 5.3v-4.667h-1.234V34h1.235zm2.501 0v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the upperroman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.916 15V8.558h-1.301V15h1.3zm2.465 0v-1.235h-1.235V15h1.235zM9.665 25v-6.442h-1.3V25h1.3zm2.5 0v-6.442h-1.3V25h1.3zm2.466 0v-1.235h-1.235V25h1.235zm-7.216 9v-6.442h-1.3V34h1.3zm2.5 0v-6.442h-1.3V34h1.3zm2.501 0v-6.442h-1.3V34h1.3zm2.465 0v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the lowerlatin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M9.62 14.105c.272 0 .528-.05.768-.153s.466-.257.677-.462c.009.024.023.072.044.145.047.161.086.283.119.365h1.221a2.649 2.649 0 0 1-.222-.626c-.04-.195-.059-.498-.059-.908l.013-1.441c0-.536-.055-.905-.165-1.105-.11-.201-.3-.367-.569-.497-.27-.13-.68-.195-1.23-.195-.607 0-1.064.108-1.371.325-.308.217-.525.55-.65 1.002l1.12.202c.076-.217.176-.369.299-.455.123-.086.294-.13.514-.13.325 0 .546.05.663.152.118.101.176.27.176.508v.123c-.222.093-.622.194-1.2.303-.427.082-.755.178-.982.288-.227.11-.403.268-.53.474a1.327 1.327 0 0 0-.188.706c0 .398.138.728.415.988.277.261.656.391 1.136.391zm.368-.87a.675.675 0 0 1-.492-.189.606.606 0 0 1-.193-.448c0-.176.08-.32.241-.435.106-.07.33-.142.673-.215a7.19 7.19 0 0 0 .751-.19v.247c0 .296-.016.496-.048.602a.773.773 0 0 1-.295.409 1.07 1.07 0 0 1-.637.22zm4.645.765v-1.235h-1.235V14h1.235zM10.2 25.105c.542 0 1.003-.215 1.382-.646.38-.43.57-1.044.57-1.84 0-.771-.187-1.362-.559-1.774a1.82 1.82 0 0 0-1.41-.617c-.522 0-.973.216-1.354.65v-2.32H7.594V25h1.147v-.686a1.9 1.9 0 0 0 .67.592c.26.133.523.2.79.2zm-.299-.975c-.354 0-.638-.164-.852-.492-.153-.232-.229-.59-.229-1.073 0-.468.098-.818.295-1.048a.93.93 0 0 1 .738-.345c.302 0 .55.118.743.354.193.236.29.62.29 1.154 0 .5-.096.868-.288 1.1-.192.233-.424.35-.697.35zm4.478.87v-1.235h-1.234V25h1.234zm-4.017 9.105c.6 0 1.08-.142 1.437-.426.357-.284.599-.704.725-1.261l-1.213-.207c-.061.326-.167.555-.316.688a.832.832 0 0 1-.576.2.916.916 0 0 1-.75-.343c-.185-.228-.278-.62-.278-1.173 0-.498.091-.853.274-1.066.183-.212.429-.318.736-.318.232 0 .42.061.565.184.145.123.238.306.28.55l1.216-.22c-.146-.501-.387-.874-.722-1.119-.336-.244-.788-.366-1.356-.366-.695 0-1.245.214-1.653.643-.407.43-.61 1.03-.61 1.8 0 .762.202 1.358.608 1.788.406.431.95.646 1.633.646zM14.633 34v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the upperlatin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="m7.88 15 .532-1.463h2.575L11.549 15h1.415l-2.58-6.442H9.01L6.5 15h1.38zm2.69-2.549H8.811l.87-2.39.887 2.39zM14.88 15v-1.235h-1.234V15h1.234zM9.352 25c.83-.006 1.352-.02 1.569-.044.346-.038.636-.14.872-.305.236-.166.422-.387.558-.664.137-.277.205-.562.205-.855 0-.372-.106-.695-.317-.97-.21-.276-.512-.471-.905-.585a1.51 1.51 0 0 0 .661-.567 1.5 1.5 0 0 0 .244-.83c0-.28-.066-.53-.197-.754a1.654 1.654 0 0 0-.495-.539 1.676 1.676 0 0 0-.672-.266c-.25-.042-.63-.063-1.14-.063H7.158V25h2.193zm.142-3.88H8.46v-1.49h.747c.612 0 .983.007 1.112.022.217.026.38.102.49.226.11.125.165.287.165.486a.68.68 0 0 1-.192.503.86.86 0 0 1-.525.23 11.47 11.47 0 0 1-.944.023h.18zm.17 2.795H8.46v-1.723h1.05c.592 0 .977.03 1.154.092.177.062.313.16.406.295a.84.84 0 0 1 .14.492c0 .228-.06.41-.181.547a.806.806 0 0 1-.473.257c-.126.026-.423.04-.892.04zM14.88 25v-1.235h-1.234V25h1.234zm-5.018 9.11c.691 0 1.262-.17 1.711-.512.45-.341.772-.864.965-1.567l-1.261-.4c-.109.472-.287.818-.536 1.037-.25.22-.547.33-.892.33-.47 0-.85-.173-1.143-.519-.293-.345-.44-.925-.44-1.74 0-.767.15-1.322.447-1.665.297-.343.684-.514 1.162-.514.346 0 .64.096.881.29.242.193.4.457.477.79l1.288-.307c-.147-.516-.367-.911-.66-1.187-.492-.465-1.132-.698-1.92-.698-.902 0-1.63.296-2.184.89-.554.593-.83 1.426-.83 2.498 0 1.014.275 1.813.825 2.397.551.585 1.254.877 2.11.877zM14.88 34v-1.235h-1.234V34h1.234z"/></svg>'}]}))}}function Bb({editor:e,parentCommandName:t,buttonLabel:i,buttonIcon:o,toolbarAriaLabel:n,styleDefinitions:r}){const s=e.commands.get(t),a=e.commands.get("listStyle");return l=>{const c=Vd(l,pd),d=c.buttonView,h=function({editor:e,listStyleCommand:t,parentCommandName:i}){const o=e.locale,n=e.commands.get(i);return({label:r,type:s,icon:a,tooltip:l})=>{const c=new rd(o);return c.set({label:r,icon:a,tooltip:l}),t.on("change:value",()=>{c.isOn=t.value===s}),c.on("execute",()=>{n.value?t.value!==s?e.execute("listStyle",{type:s}):e.execute("listStyle",{type:t._defaultType}):e.model.change(()=>{e.execute(i),e.execute("listStyle",{type:s})}),e.editing.view.focus()}),c}}({editor:e,parentCommandName:t,listStyleCommand:a});return Od(c,r.map(h)),c.bind("isEnabled").to(s),c.toolbarView.ariaLabel=n,c.class="ck-list-styles-dropdown",d.on("execute",()=>{e.execute(t),e.editing.view.focus()}),d.set({label:i,icon:o,tooltip:!0,isToggleable:!0}),d.bind("isOn").to(s,"value",e=>!!e),c}}class Nb extends Ze{constructor(e){super(e),this._selectedElements=[],this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){this._selectedElements=this._getSelectedItems(),this.value=this._selectedElements.every(e=>!!e.getAttribute("todoListChecked")),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){const e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),o=i.start.parent,n=[];t.checkAttribute(o,"todoListChecked")&&n.push(o);for(const e of i.getItems())t.checkAttribute(e,"todoListChecked")&&!n.includes(e)&&n.push(e);return n}execute(e={}){this.editor.model.change(t=>{for(const i of this._selectedElements){(void 0===e.forceValue?!this.value:e.forceValue)?t.setAttribute("todoListChecked",!0,i):t.removeAttribute("todoListChecked",i)}})}}function Fb(e,t,i){const o=t.modelCursor,n=o.parent,r=t.viewItem;if("checkbox"!=r.getAttribute("type")||"listItem"!=n.name||!o.isAtStart)return;if(!i.consumable.consume(r,{name:!0}))return;const s=i.writer;s.setAttribute("listType","todo",n),t.viewItem.hasAttribute("checked")&&s.setAttribute("todoListChecked",!0,n),t.modelRange=s.createRange(o)}function Db(e){return(t,i)=>{const o=i.modelPosition,n=o.parent;if(!n.is("element","listItem")||"todo"!=n.getAttribute("listType"))return;const r=Hb(i.mapper.toViewElement(n),e);r&&(i.viewPosition=i.mapper.findPositionIn(r,o.offset))}}function Lb(e,t,i,o){return t.createUIElement("label",{class:"todo-list__label",contenteditable:!1},(function(t){const n=ys(document,"input",{type:"checkbox"});i&&n.setAttribute("checked","checked"),n.addEventListener("change",()=>o(e));const r=this.toDomElement(t);return r.appendChild(n),r}))}function Hb(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("containerElement","span")&&e.item.hasClass("todo-list__label__description"))return e.item}const jb=Bn("Ctrl+Enter");class Wb extends Qe{static get pluginName(){return"TodoListEditing"}static get requires(){return[xb]}init(){const e=this.editor,{editing:t,data:i,model:o}=e;o.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),o.schema.addAttributeCheck((e,t)=>{const i=e.last;if("todoListChecked"==t&&"listItem"==i.name&&"todo"!=i.getAttribute("listType"))return!1}),e.commands.add("todoList",new Qp(e,"todo"));const n=new Nb(e);var r,s;e.commands.add("checkTodoList",n),e.commands.add("todoListCheck",n),i.downcastDispatcher.on("insert:listItem",function(e){return(t,i,o)=>{const n=o.consumable;if(!n.test(i.item,"insert")||!n.test(i.item,"attribute:listType")||!n.test(i.item,"attribute:listIndent"))return;if("todo"!=i.item.getAttribute("listType"))return;const r=i.item;n.consume(r,"insert"),n.consume(r,"attribute:listType"),n.consume(r,"attribute:listIndent"),n.consume(r,"attribute:todoListChecked");const s=o.writer,a=tb(r,o);s.addClass("todo-list",a.parent);const l=s.createContainerElement("label",{class:"todo-list__label"}),c=s.createEmptyElement("input",{type:"checkbox",disabled:"disabled"}),d=s.createContainerElement("span",{class:"todo-list__label__description"});r.getAttribute("todoListChecked")&&s.setAttribute("checked","checked",c),s.insert(s.createPositionAt(a,0),l),s.insert(s.createPositionAt(l,0),c),s.insert(s.createPositionAfter(c),d),ib(r,a,o,e)}}(o),{priority:"high"}),i.upcastDispatcher.on("element:input",Fb,{priority:"high"}),t.downcastDispatcher.on("insert:listItem",function(e,t){return(i,o,n)=>{const r=n.consumable;if(!r.test(o.item,"insert")||!r.test(o.item,"attribute:listType")||!r.test(o.item,"attribute:listIndent"))return;if("todo"!=o.item.getAttribute("listType"))return;const s=o.item;r.consume(s,"insert"),r.consume(s,"attribute:listType"),r.consume(s,"attribute:listIndent"),r.consume(s,"attribute:todoListChecked");const a=n.writer,l=tb(s,n),c=!!s.getAttribute("todoListChecked"),d=Lb(s,a,c,t),h=a.createContainerElement("span",{class:"todo-list__label__description"});a.addClass("todo-list",l.parent),a.insert(a.createPositionAt(l,0),d),a.insert(a.createPositionAfter(d),h),ib(s,l,n,e)}}(o,e=>this._handleCheckmarkChange(e)),{priority:"high"}),t.downcastDispatcher.on("attribute:listType:listItem",(r=e=>this._handleCheckmarkChange(e),s=t.view,(e,t,i)=>{const o=i.mapper.toViewElement(t.item),n=i.writer,a=function(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("uiElement","label"))return e.item}(o,s);if("todo"==t.attributeNewValue){const e=!!t.item.getAttribute("todoListChecked"),i=Lb(t.item,n,e,r),s=n.createContainerElement("span",{class:"todo-list__label__description"}),a=n.createRangeIn(o),l=ab(o),c=nb(a.start),d=l?n.createPositionBefore(l):a.end,h=n.createRange(c,d);n.addClass("todo-list",o.parent),n.move(h,n.createPositionAt(s,0)),n.insert(n.createPositionAt(o,0),i),n.insert(n.createPositionAfter(i),s)}else if("todo"==t.attributeOldValue){const e=Hb(o,s);n.removeClass("todo-list",o.parent),n.remove(a),n.move(n.createRangeIn(e),n.createPositionBefore(e)),n.remove(e)}})),t.downcastDispatcher.on("attribute:todoListChecked:listItem",function(e){return(t,i,o)=>{if("todo"!=i.item.getAttribute("listType"))return;if(!o.consumable.consume(i.item,"attribute:todoListChecked"))return;const{mapper:n,writer:r}=o,s=!!i.item.getAttribute("todoListChecked"),a=n.toViewElement(i.item).getChild(0),l=Lb(i.item,r,s,e);r.insert(r.createPositionAfter(a),l),r.remove(a)}}(e=>this._handleCheckmarkChange(e))),t.mapper.on("modelToViewPosition",Db(t.view)),i.mapper.on("modelToViewPosition",Db(t.view)),this.listenTo(t.view.document,"arrowKey",function(e,t){return(i,o)=>{if("left"!=Fn(o.keyCode,t.contentLanguageDirection))return;const n=e.schema,r=e.document.selection;if(!r.isCollapsed)return;const s=r.getFirstPosition(),a=s.parent;if("listItem"===a.name&&"todo"==a.getAttribute("listType")&&s.isAtStart){const t=n.getNearestSelectionRange(e.createPositionBefore(a),"backward");t&&e.change(e=>e.setSelection(t)),o.preventDefault(),o.stopPropagation(),i.stop()}}}(o,e.locale),{context:"li"}),this.listenTo(t.view.document,"keydown",(t,i)=>{Mn(i)===jb&&(e.execute("checkTodoList"),t.stop())},{priority:"high"});const a=new Set;this.listenTo(o,"applyOperation",(e,t)=>{const i=t[0];if("rename"==i.type&&"listItem"==i.oldName){const e=i.position.nodeAfter;e.hasAttribute("todoListChecked")&&a.add(e)}else if("changeAttribute"==i.type&&"listType"==i.key&&"todo"===i.oldValue)for(const e of i.range.getItems())e.hasAttribute("todoListChecked")&&"todo"!==e.getAttribute("listType")&&a.add(e)}),o.document.registerPostFixer(e=>{let t=!1;for(const i of a)e.removeAttribute("todoListChecked",i),t=!0;return a.clear(),t})}_handleCheckmarkChange(e){const t=this.editor,i=t.model,o=Array.from(i.document.selection.getRanges());i.change(i=>{i.setSelection(e,"end"),t.execute("checkTodoList"),i.setSelection(o)})}}class qb extends Qe{static get pluginName(){return"TodoListUI"}init(){const e=this.editor.t;sb(this.editor,"todoList",e("To-do List"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m2.315 14.705 2.224-2.24a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.682.682 0 0 1-.112.089.647.647 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.717.722zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75zM2.329 5.745l2.21-2.226a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.685.685 0 0 1-.496.196.644.644 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>')}}i(104);function $b(e,t){if(!e.childCount)return;const i=new Ph(e.document),o=function(e,t){const i=t.createRangeIn(e),o=new fo({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),n=[];for(const e of i)if("elementStart"===e.type&&o.match(e.item)){const t=Gb(e.item);n.push({element:e.item,id:t.id,order:t.order,indent:t.indent})}return n}(e,i);if(!o.length)return;let n=null,r=1;o.forEach((e,s)=>{const a=function(e,t){if(!e)return!0;if(e.id!==t.id)return t.indent-e.indent!=1;const i=t.element.previousSibling;if(!i)return!0;return o=i,!(o.is("element","ol")||o.is("element","ul"));var o}(o[s-1],e),l=a?null:o[s-1],c=(h=e,(d=l)?h.indent-d.indent:h.indent-1);var d,h;if(a&&(n=null,r=1),!n||0!==c){const o=function(e,t){const i=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]{0,100});/gi,n=i.exec(t);let r="decimal",s="ol";if(n&&n[1]){const t=o.exec(n[1]);if(t&&t[1]&&(r=t[1].trim(),s="bullet"!==r&&"image"!==r?"ol":"ul"),"bullet"===r){const t=function(e){const t=function(e){if(e.getChild(0).is("$text"))return null;for(const t of e.getChildren()){if(!t.is("element","span"))continue;const e=t.getChild(0);return e.is("$text")?e:e.getChild(0)}}(e);if(!t)return null;const i=t._data;if("o"===i)return"circle";if("·"===i)return"disc";if("§"===i)return"square";return null}(e.element);t&&(r=t)}}return{type:s,style:Ub(r)}}(e,t);if(n){if(e.indent>r){const e=n.getChild(n.childCount-1),t=e.getChild(e.childCount-1);n=Kb(o,t,i),r+=1}else if(e.indent<r){const t=r-e.indent;n=function(e,t){const i=e.getAncestors({parentFirst:!0});let o=null,n=0;for(const e of i)if("ul"!==e.name&&"ol"!==e.name||n++,n===t){o=e;break}return o}(n,t),r=parseInt(e.indent)}}else n=Kb(o,e.element,i);e.indent<=r&&(n.is("element",o.type)||(n=i.rename(o.type,n)))}const u=function(e,t){return function(e,t){const i=new fo({name:"span",styles:{"mso-list":"Ignore"}}),o=t.createRangeIn(e);for(const e of o)"elementStart"===e.type&&i.match(e.item)&&t.remove(e.item)}(e,t),t.rename("li",e)}(e.element,i);i.appendChild(u,n)})}function Ub(e){switch(e){case"arabic-leading-zero":return"decimal-leading-zero";case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return e;default:return null}}function Kb(e,t,i){const o=t.parent,n=i.createElement(e.type),r=o.getChildIndex(t)+1;return i.insertChild(r,n,o),e.style&&i.setStyle("list-style-type",e.style,n),n}function Gb(e){const t={},i=e.getStyle("mso-list");if(i){const e=i.match(/(^|\s{1,100})l(\d+)/i),o=i.match(/\s{0,100}lfo(\d+)/i),n=i.match(/\s{0,100}level(\d+)/i);e&&o&&n&&(t.id=e[2],t.order=o[1],t.indent=n[1])}return t}const Jb=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class Yb{constructor(e){this.document=e}isActive(e){return Jb.test(e)}execute(e){const t=new Ph(this.document),{body:i}=e._parsedData;!function(e,t){for(const i of e.getChildren())if(i.is("element","b")&&"normal"===i.getStyle("font-weight")){const o=e.getChildIndex(i);t.remove(i),t.insertChild(o,i.getChildren(),e)}}(i,t),function(e,t){for(const i of t.createRangeIn(e)){const e=i.item;if(e.is("element","li")){const i=e.getChild(0);i&&i.is("element","p")&&t.unwrapElement(i)}}}(i,t),e.content=i}}function Qb(e,t){if(!e.childCount)return;const i=new Ph;!function(e,t,i){const o=i.createRangeIn(t),n=new fo({name:"img"}),r=[];for(const t of o)if(n.match(t.item)){const i=t.item,o=i.getAttribute("v:shapes")?i.getAttribute("v:shapes").split(" "):[];o.length&&o.every(t=>e.indexOf(t)>-1)?r.push(i):i.getAttribute("src")||r.push(i)}for(const e of r)i.remove(e)}(function(e,t){const i=t.createRangeIn(e),o=new fo({name:/v:(.+)/}),n=[];for(const e of i){if("elementStart"!=e.type)continue;const t=e.item,i=t.previousSibling&&t.previousSibling.name||null;o.match(t)&&t.getAttribute("o:gfxdata")&&"v:shapetype"!==i&&n.push(e.item.getAttribute("id"))}return n}(e,i),e,i),function(e,t){const i=t.createRangeIn(e),o=new fo({name:/v:(.+)/}),n=[];for(const e of i)"elementStart"==e.type&&o.match(e.item)&&n.push(e.item);for(const e of n)t.remove(e)}(e,i);const o=function(e,t){const i=t.createRangeIn(e),o=new fo({name:"img"}),n=[];for(const e of i)o.match(e.item)&&e.item.getAttribute("src").startsWith("file://")&&n.push(e.item);return n}(e,i);o.length&&function(e,t,i){if(e.length===t.length)for(let n=0;n<e.length;n++){const r=`data:${t[n].type};base64,${o=t[n].hex,btoa(o.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(""))}`;i.setAttribute("src",r,e[n])}var o}(o,function(e){if(!e)return[];const t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,i=new RegExp("(?:("+t.source+"))([\\da-fA-F\\s]+)\\}","g"),o=e.match(i),n=[];if(o)for(const e of o){let i=!1;e.includes("\\pngblip")?i="image/png":e.includes("\\jpegblip")&&(i="image/jpeg"),i&&n.push({hex:e.replace(t,"").replace(/[^\da-fA-F]/g,""),type:i})}return n}(t),i)}const Xb=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,Zb=/xmlns:o="urn:schemas-microsoft-com/i;class ew{constructor(e){this.document=e}isActive(e){return Xb.test(e)||Zb.test(e)}execute(e){const{body:t,stylesString:i}=e._parsedData;$b(t,i),Qb(t,e.dataTransfer.getData("text/rtf")),e.content=t}}function tw(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1===t.length?" ":Array(t.length+1).join("  ").substr(0,t.length))}function iw(e,t){const i=new DOMParser,o=function(e){return tw(tw(e)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>(&nbsp;|\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)</g,"><")}(function(e){const t=e.indexOf("</body>");if(t<0)return e;const i=e.indexOf("</html>",t+"</body>".length);return e.substring(0,t+"</body>".length)+(i>=0?e.substring(i):"")}(e=e.replace(/<!--\[if gte vml 1]>/g,""))),n=i.parseFromString(o,"text/html");!function(e){e.querySelectorAll("span[style*=spacerun]").forEach(e=>{const t=e.innerText.length||0;e.innerHTML=Array(t+1).join("  ").substr(0,t)})}(n);const r=n.body.innerHTML,s=function(e,t){const i=new xn(t),o=new Er(i,{blockFillerMode:"nbsp"}),n=e.createDocumentFragment(),r=e.body.childNodes;for(;r.length>0;)n.appendChild(r[0]);return o.domToView(n,{skipComments:!0})}(n,t),a=function(e){const t=[],i=[],o=Array.from(e.getElementsByTagName("style"));for(const e of o)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),i.push(e.innerHTML));return{styles:t,stylesString:i.join(" ")}}(n);return{body:s,bodyString:r,styles:a.styles,stylesString:a.stylesString}}function ow(e,t,i,o,n=1){t>n?o.setAttribute(e,t,i):o.removeAttribute(e,i)}function nw(e,t,i={}){const o=e.createElement("tableCell",i);return e.insertElement("paragraph",o),e.insert(o,t),o}function rw(e,t){const i=t.parent.parent,o=parseInt(i.getAttribute("headingColumns")||0),{column:n}=e.getCellLocation(t);return!!o&&n<o}function sw(){return e=>{e.on("element:table",(e,t,i)=>{const o=t.viewItem;if(!i.consumable.test(o,{name:!0}))return;const{rows:n,headingRows:r,headingColumns:s}=function(e){const t={headingRows:0,headingColumns:0},i=[],o=[];let n;for(const r of Array.from(e.getChildren()))if("tbody"===r.name||"thead"===r.name||"tfoot"===r.name){"thead"!==r.name||n||(n=r);const e=Array.from(r.getChildren()).filter(e=>e.is("element","tr"));for(const r of e)if("thead"===r.parent.name&&r.parent===n)t.headingRows++,i.push(r);else{o.push(r);const e=lw(r);e>t.headingColumns&&(t.headingColumns=e)}}return t.rows=[...i,...o],t}(o),a={};s&&(a.headingColumns=s),r&&(a.headingRows=r);const l=i.writer.createElement("table",a);if(i.safeInsert(l,t.modelCursor)){if(i.consumable.consume(o,{name:!0}),n.forEach(e=>i.convertItem(e,i.writer.createPositionAt(l,"end"))),i.convertChildren(o,i.writer.createPositionAt(l,"end")),l.isEmpty){const e=i.writer.createElement("tableRow");i.writer.insert(e,i.writer.createPositionAt(l,"end")),nw(i.writer,i.writer.createPositionAt(e,"end"))}i.updateConversionResult(l,t)}})}}function aw(e){return t=>{t.on("element:"+e,(e,t,i)=>{if(t.modelRange&&t.viewItem.isEmpty){const e=t.modelRange.start.nodeAfter,o=i.writer.createPositionAt(e,0);i.writer.insertElement("paragraph",o)}},{priority:"low"})}}function lw(e){let t=0,i=0;const o=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name);for(;i<o.length&&"th"===o[i].name;){const e=o[i];t+=parseInt(e.getAttribute("colspan")||1),i++}return t}class cw{constructor(e,t={}){this._table=e,this._startRow=void 0!==t.row?t.row:t.startRow||0,this._endRow=void 0!==t.row?t.row:t.endRow,this._startColumn=void 0!==t.column?t.column:t.startColumn||0,this._endColumn=void 0!==t.column?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const i=this._getSpanned();if(i)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(i.cell,i.row,i.column));else{const i=e.getChild(this._cellIndex);if(!i)return this._advanceToNextRow();const o=parseInt(i.getAttribute("colspan")||1),n=parseInt(i.getAttribute("rowspan")||1);(o>1||n>1)&&this._recordSpans(i,n,o),this._shouldSkipSlot()||(t=this._formatOutValue(i)),this._nextCellAtColumn=this._column+o}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(e,t=this._row,i=this._column){return{done:!1,value:new dw(this,e,t,i)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,i=this._column<this._startColumn,o=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||i||o}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,i){const o={cell:e,row:this._row,column:this._column};for(let e=this._row;e<this._row+t;e++)for(let t=this._column;t<this._column+i;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,o)}_markSpannedCell(e,t,i){this._spannedCells.has(e)||this._spannedCells.set(e,new Map);this._spannedCells.get(e).set(t,i)}}class dw{constructor(e,t,i,o){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=i,this.cellAnchorColumn=o,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||1)}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||1)}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function hw(e={}){return t=>t.on("insert:table",(t,i,o)=>{const n=i.item;if(!o.consumable.consume(n,"insert"))return;o.consumable.consume(n,"attribute:headingRows:table"),o.consumable.consume(n,"attribute:headingColumns:table");const r=e&&e.asWidget,s=o.writer.createContainerElement("figure",{class:"table"}),a=o.writer.createContainerElement("table");let l;var c,d;o.writer.insert(o.writer.createPositionAt(s,0),a),r&&(c=s,(d=o.writer).setCustomProperty("table",!0,c),l=gm(c,d,{hasSelectionHandle:!0}));const h=new cw(n),u={headingRows:n.getAttribute("headingRows")||0,headingColumns:n.getAttribute("headingColumns")||0},g=new Map;for(const t of h){const{row:i,cell:r}=t,s=n.getChild(i),l=g.get(i)||pw(a,s,i,u,o);g.set(i,l),o.consumable.consume(r,"insert");fw(t,u,o.writer.createPositionAt(l,"end"),o,e)}for(const e of n.getChildren()){const t=e.index;e.is("element","tableRow")&&!g.has(t)&&g.set(t,pw(a,e,t,u,o))}const m=o.mapper.toViewPosition(i.range.start);o.mapper.bindElements(n,r?l:s),o.writer.insert(m,r?l:s)})}function uw(e,t){const{writer:i}=t;if(e.parent.is("element","tableCell"))return gw(e)?i.createContainerElement("span",{class:"ck-table-bogus-paragraph"}):i.createContainerElement("p")}function gw(e){return 1===e.parent.childCount&&!_w(e)}function mw(e,t,i){const{cell:o}=e,n=bw(e,t),r=i.mapper.toViewElement(o);r&&r.name!==n&&function(e,t,i){const o=i.writer,n=i.mapper.toViewElement(e),r=wm(o.createEditableElement(t,n.getAttributes()),o);o.insert(o.createPositionAfter(n),r),o.move(o.createRangeIn(n),o.createPositionAt(r,0)),o.remove(o.createRangeOn(n)),i.mapper.unbindViewElement(n),i.mapper.bindElements(e,r)}(o,n,i)}function fw(e,t,i,o,n){const r=n&&n.asWidget,s=bw(e,t),a=r?wm(o.writer.createEditableElement(s),o.writer):o.writer.createContainerElement(s),l=e.cell,c=l.getChild(0),d=1===l.childCount&&"paragraph"===c.name;if(o.writer.insert(i,a),o.mapper.bindElements(l,a),!r&&d&&!_w(c)){const e=l.getChild(0);o.consumable.consume(e,"insert"),o.mapper.bindElements(e,a)}}function pw(e,t,i,o,n){n.consumable.consume(t,"insert");const r=t.isEmpty?n.writer.createEmptyElement("tr"):n.writer.createContainerElement("tr");n.mapper.bindElements(t,r);const s=o.headingRows,a=function(e,t,i){const o=ww(e,t);return o||function(e,t,i){const o=i.writer.createContainerElement(e),n=i.writer.createPositionAt(t,"tbody"==e?"end":0);return i.writer.insert(n,o),o}(e,t,i)}(function(e,t){return e<t.headingRows?"thead":"tbody"}(i,o),e,n),l=s>0&&i>=s?i-s:i,c=n.writer.createPositionAt(a,l);return n.writer.insert(c,r),r}function bw(e,t){const{row:i,column:o}=e,{headingColumns:n,headingRows:r}=t;if(r&&r>i)return"th";return n&&n>o?"th":"td"}function ww(e,t){for(const i of t.getChildren())if(i.name==e)return i}function kw(e,t,i){const o=ww(e,t);o&&0===o.childCount&&i.writer.remove(i.writer.createRangeOn(o))}function _w(e){return!![...e.getAttributeKeys()].length}class vw extends Ze{refresh(){const e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=function(e,t){const i=e.getFirstPosition().parent,o=i===i.root?i:i.parent;return t.checkChild(o,"table")}(t,i)}execute(e={}){const t=this.editor.model,i=t.document.selection,o=this.editor.plugins.get("TableUtils"),n=this.editor.config.get("table"),r=km(i,t),s=n.defaultHeadings.rows,a=n.defaultHeadings.columns;void 0===e.headingRows&&s&&(e.headingRows=s),void 0===e.headingColumns&&a&&(e.headingColumns=a),t.change(i=>{const n=o.createTable(i,e);t.insertContent(n,r),i.setSelection(i.createPositionAt(n.getNodeByPath([0,0,0]),0))})}}function yw(e){const t=[];for(const i of Pw(e.getRanges())){const e=i.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}function xw(e){const t=[];for(const i of e.getRanges()){const e=i.start.findAncestor("tableCell");e&&t.push(e)}return t}function Cw(e){const t=yw(e);return t.length?t:xw(e)}function Aw(e){return Sw(e.map(e=>e.parent.index))}function Tw(e){const t=e[0].findAncestor("table");return Sw([...new cw(t)].filter(t=>e.includes(t.cell)).map(e=>e.column))}function Ew(e,t){if(e.length<2||!function(e){const t=e[0].findAncestor("table"),i=Aw(e),o=parseInt(t.getAttribute("headingRows")||0);if(!Rw(i,o))return!1;const n=parseInt(t.getAttribute("headingColumns")||0);return Rw(Tw(e),n)}(e))return!1;const i=new Set,o=new Set;let n=0;for(const r of e){const{row:e,column:s}=t.getCellLocation(r),a=parseInt(r.getAttribute("rowspan")||1),l=parseInt(r.getAttribute("colspan")||1);i.add(e),o.add(s),a>1&&i.add(e+a-1),l>1&&o.add(s+l-1),n+=a*l}return function(e,t){const i=Array.from(e.values()),o=Array.from(t.values()),n=Math.max(...i),r=Math.min(...i),s=Math.max(...o),a=Math.min(...o);return(n-r+1)*(s-a+1)}(i,o)==n}function Pw(e){return Array.from(e).sort(Iw)}function Sw(e){const t=e.sort((e,t)=>e-t);return{first:t[0],last:t[t.length-1]}}function Iw(e,t){const i=e.start,o=t.start;return i.isBefore(o)?-1:1}function Rw({first:e,last:t},i){return e<i===t<i}class Vw extends Ze{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=!!Cw(this.editor.model.document.selection).length;this.isEnabled=e}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),o="above"===this.order,n=Cw(t),r=Aw(n),s=o?r.first:r.last,a=n[0].findAncestor("table");i.insertRows(a,{at:o?s:s+1,copyStructureFromAbove:!o})}}class Ow extends Ze{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=!!Cw(this.editor.model.document.selection).length;this.isEnabled=e}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),o="left"===this.order,n=Cw(t),r=Tw(n),s=o?r.first:r.last,a=n[0].findAncestor("table");i.insertColumns(a,{columns:1,at:o?s:s+1})}}class zw extends Ze{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=Cw(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=Cw(this.editor.model.document.selection)[0],t="horizontally"===this.direction,i=this.editor.plugins.get("TableUtils");t?i.splitCellHorizontally(e,2):i.splitCellVertically(e,2)}}function Mw(e,t,i){const{startRow:o,startColumn:n,endRow:r,endColumn:s}=t,a=i.createElement("table"),l=r-o+1;for(let e=0;e<l;e++)i.insertElement("tableRow",a,"end");const c=[...new cw(e,{startRow:o,endRow:r,startColumn:n,endColumn:s,includeAllSlots:!0})];for(const{row:e,column:t,cell:l,isAnchor:d,cellAnchorRow:h,cellAnchorColumn:u}of c){const c=e-o,g=a.getChild(c);if(d){const o=i.cloneElement(l);i.append(o,g),Lw(o,e,t,r,s,i)}else(h<o||u<n)&&nw(i,i.createPositionAt(g,"end"))}return function(e,t,i,o,n){const r=parseInt(t.getAttribute("headingRows")||0);if(r>0){ow("headingRows",r-i,e,n,0)}const s=parseInt(t.getAttribute("headingColumns")||0);if(s>0){ow("headingColumns",s-o,e,n,0)}}(a,e,o,n,i),a}function Bw(e,t,i=0){const o=[],n=new cw(e,{startRow:i,endRow:t-1});for(const e of n){const{row:i,cellHeight:n}=e,r=i+n-1;i<t&&t<=r&&o.push(e)}return o}function Nw(e,t,i){const o=e.parent,n=o.parent,r=o.index,s=t-r,a={},l=parseInt(e.getAttribute("rowspan"))-s;l>1&&(a.rowspan=l);const c=parseInt(e.getAttribute("colspan")||1);c>1&&(a.colspan=c);const d=r+s,h=[...new cw(n,{startRow:r,endRow:d,includeAllSlots:!0})];let u,g=null;for(const t of h){const{row:o,column:n,cell:r}=t;r===e&&void 0===u&&(u=n),void 0!==u&&u===n&&o===d&&(g=nw(i,t.getPositionBefore(),a))}return ow("rowspan",s,e,i),g}function Fw(e,t){const i=[],o=new cw(e);for(const e of o){const{column:o,cellWidth:n}=e,r=o+n-1;o<t&&t<=r&&i.push(e)}return i}function Dw(e,t,i,o){const n=i-t,r={},s=parseInt(e.getAttribute("colspan"))-n;s>1&&(r.colspan=s);const a=parseInt(e.getAttribute("rowspan")||1);a>1&&(r.rowspan=a);const l=nw(o,o.createPositionAfter(e),r);return ow("colspan",n,e,o),l}function Lw(e,t,i,o,n,r){const s=parseInt(e.getAttribute("colspan")||1),a=parseInt(e.getAttribute("rowspan")||1);if(i+s-1>n){ow("colspan",n-i+1,e,r,1)}if(t+a-1>o){ow("rowspan",o-t+1,e,r,1)}}function Hw(e,t){const i=t.getColumns(e),o=new Array(i).fill(0);for(const{column:t}of new cw(e))o[t]++;const n=o.reduce((e,t,i)=>t?e:[...e,i],[]);if(n.length>0){const i=n[n.length-1];return t.removeColumns(e,{at:i}),!0}return!1}function jw(e,t){const i=[],o=t.getRows(e);for(let t=0;t<o;t++){e.getChild(t).isEmpty&&i.push(t)}if(i.length>0){const o=i[i.length-1];return t.removeRows(e,{at:o}),!0}return!1}function Ww(e,t){Hw(e,t)||jw(e,t)}function qw(e,t){const i=Array.from(new cw(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(i.every(({cellHeight:e})=>1===e))return t.lastRow;const o=i[0].cellHeight-1;return t.lastRow+o}function $w(e,t){const i=Array.from(new cw(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(i.every(({cellWidth:e})=>1===e))return t.lastColumn;const o=i[0].cellWidth-1;return t.lastColumn+o}class Uw extends Ze{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=xw(e.document.selection)[0],i=this.value,o=this.direction;e.change(e=>{const n="right"==o||"down"==o,r=n?t:i,s=n?i:t,a=s.parent;!function(e,t,i){Kw(e)||(Kw(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end")));i.remove(e)}(s,r,e);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(t.getAttribute(l)||1),d=parseInt(i.getAttribute(l)||1);e.setAttribute(l,c+d,r),e.setSelection(e.createRangeIn(r));const h=this.editor.plugins.get("TableUtils");Ww(a.findAncestor("table"),h)})}_getMergeableCell(){const e=xw(this.editor.model.document.selection)[0];if(!e)return;const t=this.editor.plugins.get("TableUtils"),i=this.isHorizontal?function(e,t,i){const o=e.parent.parent,n="right"==t?e.nextSibling:e.previousSibling,r=(o.getAttribute("headingColumns")||0)>0;if(!n)return;const s="right"==t?e:n,a="right"==t?n:e,{column:l}=i.getCellLocation(s),{column:c}=i.getCellLocation(a),d=parseInt(s.getAttribute("colspan")||1),h=rw(i,s),u=rw(i,a);if(r&&h!=u)return;return l+d===c?n:void 0}(e,this.direction,t):function(e,t,i){const o=e.parent,n=o.parent,r=n.getChildIndex(o);if("down"==t&&r===i.getRows(n)-1||"up"==t&&0===r)return;const s=parseInt(e.getAttribute("rowspan")||1),a=n.getAttribute("headingRows")||0,l="down"==t&&r+s===a,c="up"==t&&r===a;if(a&&(l||c))return;const d=parseInt(e.getAttribute("rowspan")||1),h="down"==t?r+d:r,u=[...new cw(n,{endRow:h})],g=u.find(t=>t.cell===e).column,m=u.find(({row:e,cellHeight:i,column:o})=>o===g&&("down"==t?e===h:h===e+i));return m&&m.cell}(e,this.direction,t);if(!i)return;const o=this.isHorizontal?"rowspan":"colspan",n=parseInt(e.getAttribute(o)||1);return parseInt(i.getAttribute(o)||1)===n?i:void 0}}function Kw(e){return 1==e.childCount&&e.getChild(0).is("element","paragraph")&&e.getChild(0).isEmpty}class Gw extends Ze{refresh(){const e=Cw(this.editor.model.document.selection),t=e[0];if(t){const i=t.findAncestor("table"),o=this.editor.plugins.get("TableUtils").getRows(i)-1,n=Aw(e),r=0===n.first&&n.last===o;this.isEnabled=!r}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=Cw(e.document.selection),o=Aw(i),n=i[0],r=n.findAncestor("table"),s=t.getCellLocation(n).column;e.change(e=>{const i=o.last-o.first+1;t.removeRows(r,{at:o.first,rows:i});const n=function(e,t,i,o){const n=e.getChild(Math.min(t,o-1));let r=n.getChild(0),s=0;for(const e of n.getChildren()){if(s>i)return r;r=e,s+=parseInt(e.getAttribute("colspan")||1)}return r}(r,o.first,s,t.getRows(r));e.setSelection(e.createPositionAt(n,0))})}}class Jw extends Ze{refresh(){const e=Cw(this.editor.model.document.selection),t=e[0];if(t){const i=t.findAncestor("table"),o=this.editor.plugins.get("TableUtils").getColumns(i),{first:n,last:r}=Tw(e);this.isEnabled=r-n<o-1}else this.isEnabled=!1}execute(){const[e,t]=function(e){const t=Cw(e),i=t[0],o=t.pop(),n=[i,o];return i.isBefore(o)?n:n.reverse()}(this.editor.model.document.selection),i=e.parent.parent,o=[...new cw(i)],n={first:o.find(t=>t.cell===e).column,last:o.find(e=>e.cell===t).column},r=function(e,t,i,o){return parseInt(i.getAttribute("colspan")||1)>1?i:t.previousSibling||i.nextSibling?i.nextSibling||t.previousSibling:o.first?e.reverse().find(({column:e})=>e<o.first).cell:e.reverse().find(({column:e})=>e>o.last).cell}(o,e,t,n);this.editor.model.change(e=>{const t=n.last-n.first+1;this.editor.plugins.get("TableUtils").removeColumns(i,{at:n.first,columns:t}),e.setSelection(e.createPositionAt(r,0))})}}class Yw extends Ze{refresh(){const e=Cw(this.editor.model.document.selection),t=e.length>0;this.isEnabled=t,this.value=t&&e.every(e=>this._isInHeading(e,e.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.model,i=Cw(t.document.selection),o=i[0].findAncestor("table"),{first:n,last:r}=Aw(i),s=this.value?n:r+1,a=o.getAttribute("headingRows")||0;t.change(e=>{if(s){const t=Bw(o,s,s>a?a:0);for(const{cell:i}of t)Nw(i,s,e)}ow("headingRows",s,o,e,0)})}_isInHeading(e,t){const i=parseInt(t.getAttribute("headingRows")||0);return!!i&&e.parent.index<i}}class Qw extends Ze{refresh(){const e=Cw(this.editor.model.document.selection),t=this.editor.plugins.get("TableUtils"),i=e.length>0;this.isEnabled=i,this.value=i&&e.every(e=>rw(t,e))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.model,i=Cw(t.document.selection),o=i[0].findAncestor("table"),{first:n,last:r}=Tw(i),s=this.value?n:r+1;t.change(e=>{if(s){const t=Fw(o,s);for(const{cell:i,column:o}of t)Dw(i,o,s,e)}ow("headingColumns",s,o,e,0)})}}class Xw extends Qe{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,i=t.parent,o=i.getChildIndex(t),n=new cw(i,{row:o});for(const{cell:t,row:i,column:o}of n)if(t===e)return{row:i,column:o}}createTable(e,t){const i=e.createElement("table"),o=parseInt(t.rows)||2,n=parseInt(t.columns)||2;return Zw(e,i,0,o,n),t.headingRows&&ow("headingRows",Math.min(t.headingRows,o),i,e,0),t.headingColumns&&ow("headingColumns",Math.min(t.headingColumns,n),i,e,0),i}insertRows(e,t={}){const i=this.editor.model,o=t.at||0,n=t.rows||1,r=void 0!==t.copyStructureFromAbove,s=t.copyStructureFromAbove?o-1:o,a=this.getRows(e),c=this.getColumns(e);if(o>a)throw new l.a("tableutils-insertrows-insert-out-of-range",this,{options:t});i.change(t=>{const i=e.getAttribute("headingRows")||0;if(i>o&&ow("headingRows",i+n,e,t,0),!r&&(0===o||o===a))return void Zw(t,e,o,n,c);const l=r?Math.max(o,s):o,d=new cw(e,{endRow:l}),h=new Array(c).fill(1);for(const{row:e,column:i,cellHeight:a,cellWidth:l,cell:c}of d){const d=e+a-1,u=e<=s&&s<=d;e<o&&o<=d?(t.setAttribute("rowspan",a+n,c),h[i]=-l):r&&u&&(h[i]=l)}for(let i=0;i<n;i++){const i=t.createElement("tableRow");t.insert(i,e,o);for(let e=0;e<h.length;e++){const o=h[e],n=t.createPositionAt(i,"end");o>0&&nw(t,n,o>1?{colspan:o}:null),e+=Math.abs(o)-1}}})}insertColumns(e,t={}){const i=this.editor.model,o=t.at||0,n=t.columns||1;i.change(t=>{const i=e.getAttribute("headingColumns");o<i&&t.setAttribute("headingColumns",i+n,e);const r=this.getColumns(e);if(0===o||r===o){for(const i of e.getChildren())i.is("element","tableRow")&&ek(n,t,t.createPositionAt(i,o?"end":0));return}const s=new cw(e,{column:o,includeAllSlots:!0});for(const e of s){const{row:i,cell:r,cellAnchorColumn:a,cellAnchorRow:l,cellWidth:c,cellHeight:d}=e;if(a<o){t.setAttribute("colspan",c+n,r);const e=l+d-1;for(let t=i;t<=e;t++)s.skipRow(t)}else ek(n,t,e.getPositionBefore())}})}removeRows(e,t){const i=this.editor.model,o=t.rows||1,n=this.getRows(e),r=t.at,s=r+o-1;if(s>n-1)throw new l.a("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});i.change(t=>{const{cellsToMove:i,cellsToTrim:o}=function(e,t,i){const o=new Map,n=[];for(const{row:r,column:s,cellHeight:a,cell:l}of new cw(e,{endRow:i})){const e=r+a-1;if(r>=t&&r<=i&&e>i){const e=a-(i-r+1);o.set(s,{cell:l,rowspan:e})}if(r<t&&e>=t){let o;o=e>=i?i-t+1:e-t+1,n.push({cell:l,rowspan:a-o})}}return{cellsToMove:o,cellsToTrim:n}}(e,r,s);if(i.size){!function(e,t,i,o){const n=[...new cw(e,{includeAllSlots:!0,row:t})],r=e.getChild(t);let s;for(const{column:e,cell:t,isAnchor:a}of n)if(i.has(e)){const{cell:t,rowspan:n}=i.get(e),a=s?o.createPositionAfter(s):o.createPositionAt(r,0);o.move(o.createRangeOn(t),a),ow("rowspan",n,t,o),s=t}else a&&(s=t)}(e,s+1,i,t)}for(let i=s;i>=r;i--)t.remove(e.getChild(i));for(const{rowspan:e,cell:i}of o)ow("rowspan",e,i,t);!function(e,t,i,o){const n=e.getAttribute("headingRows")||0;if(t<n){ow("headingRows",i<n?n-(i-t+1):t,e,o,0)}}(e,r,s,t),Hw(e,this)||jw(e,this)})}removeColumns(e,t){const i=this.editor.model,o=t.at,n=t.columns||1,r=t.at+n-1;i.change(t=>{!function(e,t,i){const o=e.getAttribute("headingColumns")||0;if(o&&t.first<o){const n=Math.min(o-1,t.last)-t.first+1;i.setAttribute("headingColumns",o-n,e)}}(e,{first:o,last:r},t);for(let i=r;i>=o;i--)for(const{cell:o,column:n,cellWidth:r}of[...new cw(e)])n<=i&&r>1&&n+r>i?ow("colspan",r-1,o,t):n===i&&t.remove(o);jw(e,this)||Hw(e,this)})}splitCellVertically(e,t=2){const i=this.editor.model,o=e.parent.parent,n=parseInt(e.getAttribute("rowspan")||1),r=parseInt(e.getAttribute("colspan")||1);i.change(i=>{if(r>1){const{newCellsSpan:o,updatedSpan:s}=tk(r,t);ow("colspan",s,e,i);const a={};o>1&&(a.colspan=o),n>1&&(a.rowspan=n);ek(r>t?t-1:r-1,i,i.createPositionAfter(e),a)}if(r<t){const s=t-r,a=[...new cw(o)],{column:l}=a.find(({cell:t})=>t===e),c=a.filter(({cell:t,cellWidth:i,column:o})=>t!==e&&o===l||o<l&&o+i>l);for(const{cell:e,cellWidth:t}of c)i.setAttribute("colspan",t+s,e);const d={};n>1&&(d.rowspan=n),ek(s,i,i.createPositionAfter(e),d);const h=o.getAttribute("headingColumns")||0;h>l&&ow("headingColumns",h+s,o,i)}})}splitCellHorizontally(e,t=2){const i=this.editor.model,o=e.parent,n=o.parent,r=n.getChildIndex(o),s=parseInt(e.getAttribute("rowspan")||1),a=parseInt(e.getAttribute("colspan")||1);i.change(i=>{if(s>1){const o=[...new cw(n,{startRow:r,endRow:r+s-1,includeAllSlots:!0})],{newCellsSpan:l,updatedSpan:c}=tk(s,t);ow("rowspan",c,e,i);const{column:d}=o.find(({cell:t})=>t===e),h={};l>1&&(h.rowspan=l),a>1&&(h.colspan=a);for(const e of o){const{column:t,row:o}=e,n=t===d,s=(o+r+c)%l==0;o>=r+c&&n&&s&&ek(1,i,e.getPositionBefore(),h)}}if(s<t){const o=t-s,l=[...new cw(n,{startRow:0,endRow:r})];for(const{cell:t,cellHeight:n,row:s}of l)if(t!==e&&s+n>r){const e=n+o;i.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),Zw(i,n,r+1,o,1,c);const d=n.getAttribute("headingRows")||0;d>r&&ow("headingRows",d+o,n,i)}})}getColumns(e){return[...e.getChild(0).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||1),0)}getRows(e){return Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0)}}function Zw(e,t,i,o,n,r={}){for(let s=0;s<o;s++){const o=e.createElement("tableRow");e.insert(o,t,i),ek(n,e,e.createPositionAt(o,"end"),r)}}function ek(e,t,i,o={}){for(let n=0;n<e;n++)nw(t,i,o)}function tk(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const i=Math.floor(e/t);return{newCellsSpan:i,updatedSpan:e-i*t+i}}class ik extends Ze{refresh(){const e=yw(this.editor.model.document.selection);this.isEnabled=Ew(e,this.editor.plugins.get(Xw))}execute(){const e=this.editor.model,t=this.editor.plugins.get(Xw);e.change(i=>{const o=yw(e.document.selection),n=o.shift(),{mergeWidth:r,mergeHeight:s}=function(e,t,i){let o=0,n=0;for(const e of t){const{row:t,column:r}=i.getCellLocation(e);o=rk(e,r,o,"colspan"),n=rk(e,t,n,"rowspan")}const{row:r,column:s}=i.getCellLocation(e);return{mergeWidth:o-s,mergeHeight:n-r}}(n,o,t);ow("colspan",r,n,i),ow("rowspan",s,n,i);for(const e of o)ok(e,n,i);Ww(n.findAncestor("table"),t),i.setSelection(n,"in")})}}function ok(e,t,i){nk(e)||(nk(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end"))),i.remove(e)}function nk(e){return 1==e.childCount&&e.getChild(0).is("element","paragraph")&&e.getChild(0).isEmpty}function rk(e,t,i,o){const n=parseInt(e.getAttribute(o)||1);return Math.max(i,t+n)}class sk extends Ze{refresh(){const e=Cw(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=Cw(e.document.selection),i=Aw(t),o=t[0].findAncestor("table"),n=[];for(let t=i.first;t<=i.last;t++)for(const i of o.getChild(t).getChildren())n.push(e.createRangeOn(i));e.change(e=>{e.setSelection(n)})}}class ak extends Ze{refresh(){const e=Cw(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=Cw(e.document.selection),i=t[0],o=t.pop(),n=i.findAncestor("table"),r=this.editor.plugins.get("TableUtils"),s=r.getCellLocation(i),a=r.getCellLocation(o),l=Math.min(s.column,a.column),c=Math.max(s.column,a.column),d=[];for(const t of new cw(n,{startColumn:l,endColumn:c}))d.push(e.createRangeOn(t.cell));e.change(e=>{e.setSelection(d)})}}function lk(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.differ.getChanges();let o=!1;const n=new Set;for(const t of i){let i;"table"==t.name&&"insert"==t.type&&(i=t.position.nodeAfter),"tableRow"!=t.name&&"tableCell"!=t.name||(i=t.position.findAncestor("table")),hk(t)&&(i=t.range.start.findAncestor("table")),i&&!n.has(i)&&(o=ck(i,e)||o,o=dk(i,e)||o,n.add(i))}return o}(t,e))}function ck(e,t){let i=!1;const o=function(e){const t=parseInt(e.getAttribute("headingRows")||0),i=Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0),o=[];for(const{row:n,cell:r,cellHeight:s}of new cw(e)){if(s<2)continue;const e=n<t?t:i;if(n+s>e){const t=e-n;o.push({cell:r,rowspan:t})}}return o}(e);if(o.length){i=!0;for(const e of o)ow("rowspan",e.rowspan,e.cell,t,1)}return i}function dk(e,t){let i=!1;const o=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:i}of new cw(e,{includeAllSlots:!0}))t[i]++;return t}(e),n=[];for(const[t,i]of o.entries())!i&&e.getChild(t).is("element","tableRow")&&n.push(t);if(n.length){i=!0;for(const i of n.reverse())t.remove(e.getChild(i)),o.splice(i,1)}const r=o.filter((t,i)=>e.getChild(i).is("element","tableRow")),s=r[0];if(!r.every(e=>e===s)){const o=r.reduce((e,t)=>t>e?t:e,0);for(const[n,s]of r.entries()){const r=o-s;if(r){for(let i=0;i<r;i++)nw(t,t.createPositionAt(e.getChild(n),"end"));i=!0}}}return i}function hk(e){const t="attribute"===e.type,i=e.attributeKey;return t&&("headingRows"===i||"colspan"===i||"rowspan"===i)}function uk(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.differ.getChanges();let o=!1;for(const t of i)"insert"==t.type&&"table"==t.name&&(o=gk(t.position.nodeAfter,e)||o),"insert"==t.type&&"tableRow"==t.name&&(o=mk(t.position.nodeAfter,e)||o),"insert"==t.type&&"tableCell"==t.name&&(o=fk(t.position.nodeAfter,e)||o),pk(t)&&(o=fk(t.position.parent,e)||o);return o}(t,e))}function gk(e,t){let i=!1;for(const o of e.getChildren())o.is("element","tableRow")&&(i=mk(o,t)||i);return i}function mk(e,t){let i=!1;for(const o of e.getChildren())i=fk(o,t)||i;return i}function fk(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const i=Array.from(e.getChildren()).filter(e=>e.is("$text"));for(const e of i)t.wrap(t.createRangeOn(e),"paragraph");return!!i.length}function pk(e){return!(!e.position||!e.position.parent.is("element","tableCell"))&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function bk(e,t){e.document.registerPostFixer(()=>function(e,t){const i=new Set;for(const t of e.getChanges()){const e="attribute"==t.type?t.range.start.parent:t.position.parent;e.is("element","tableCell")&&i.add(e)}for(const o of i.values())for(const i of[...o.getChildren()].filter(e=>wk(e,t)))e.refreshItem(i);return!1}(e.document.differ,t))}function wk(e,t){if(!e.is("element","paragraph"))return!1;const i=t.toViewElement(e);return!!i&&gw(e)!==i.is("element","span")}function kk(e){e.document.registerPostFixer(()=>function(e){const t=e.document.differ,i=new Set;for(const e of t.getChanges())if("attribute"===e.type){const t=e.range.start.nodeAfter;t&&t.is("element","table")&&"headingRows"===e.attributeKey&&i.add(t)}else if("insert"===e.type||"remove"===e.type)if("tableRow"===e.name){const t=e.position.findAncestor("table"),o=t.getAttribute("headingRows")||0;e.position.offset<o&&i.add(t)}else if("tableCell"===e.name){const t=e.position.findAncestor("table"),o=t.getAttribute("headingColumns")||0;e.position.offset<o&&i.add(t)}if(i.size){for(const e of i.values())t.refreshItem(e);return!0}return!1}(e))}i(106);class _k extends Qe{static get pluginName(){return"TableEditing"}init(){const e=this.editor,t=e.model,i=t.schema,o=e.conversion;i.register("table",{allowWhere:"$block",allowAttributes:["headingRows","headingColumns"],isObject:!0,isBlock:!0}),i.register("tableRow",{allowIn:"table",isLimit:!0}),i.register("tableCell",{allowIn:"tableRow",allowChildren:"$block",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),o.for("upcast").add(e=>{e.on("element:figure",(e,t,i)=>{if(!i.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const o=function(e){for(const t of e.getChildren())if(t.is("element","table"))return t}(t.viewItem);if(!o||!i.consumable.test(o,{name:!0}))return;const n=Os(i.convertItem(o,t.modelCursor).modelRange.getItems());n&&(i.consumable.consume(t.viewItem,{name:!0,classes:"table"}),i.convertChildren(t.viewItem,i.writer.createPositionAt(n,"end")),i.updateConversionResult(n,t))})}),o.for("upcast").add(sw()),o.for("editingDowncast").add(hw({asWidget:!0})),o.for("dataDowncast").add(hw()),o.for("upcast").elementToElement({model:"tableRow",view:"tr"}),o.for("upcast").add(e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()},{priority:"high"})}),o.for("editingDowncast").add(e=>e.on("insert:tableRow",(e,t,i)=>{const o=t.item;if(!i.consumable.consume(o,"insert"))return;const n=o.parent,r=function(e){for(const t of e.getChildren())if("table"===t.name)return t}(i.mapper.toViewElement(n)),s=n.getChildIndex(o),a=new cw(n,{row:s}),l={headingRows:n.getAttribute("headingRows")||0,headingColumns:n.getAttribute("headingColumns")||0},c=new Map;for(const e of a){const t=c.get(s)||pw(r,o,s,l,i);c.set(s,t),i.consumable.consume(e.cell,"insert"),fw(e,l,i.writer.createPositionAt(t,"end"),i,{asWidget:!0})}})),o.for("editingDowncast").add(e=>e.on("remove:tableRow",(e,t,i)=>{e.stop();const o=i.writer,n=i.mapper,r=n.toViewPosition(t.position).getLastMatchingPosition(e=>!e.item.is("element","tr")).nodeAfter,s=r.parent.parent,a=o.createRangeOn(r),l=o.remove(a);for(const e of o.createRangeIn(l).getItems())n.unbindViewElement(e);kw("thead",s,i),kw("tbody",s,i)},{priority:"higher"})),o.for("upcast").elementToElement({model:"tableCell",view:"td"}),o.for("upcast").elementToElement({model:"tableCell",view:"th"}),o.for("upcast").add(aw("td")),o.for("upcast").add(aw("th")),o.for("editingDowncast").add(e=>e.on("insert:tableCell",(e,t,i)=>{const o=t.item;if(!i.consumable.consume(o,"insert"))return;const n=o.parent,r=n.parent,s=r.getChildIndex(n),a=new cw(r,{row:s}),l={headingRows:r.getAttribute("headingRows")||0,headingColumns:r.getAttribute("headingColumns")||0};for(const e of a)if(e.cell===o){const t=i.mapper.toViewElement(n);return void fw(e,l,i.writer.createPositionAt(t,n.getChildIndex(o)),i,{asWidget:!0})}})),o.for("editingDowncast").elementToElement({model:"paragraph",view:uw,converterPriority:"high"}),o.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),o.for("upcast").attributeToAttribute({model:{key:"colspan",value:vk("colspan")},view:"colspan"}),o.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),o.for("upcast").attributeToAttribute({model:{key:"rowspan",value:vk("rowspan")},view:"rowspan"}),o.for("editingDowncast").add(e=>e.on("attribute:headingColumns:table",(e,t,i)=>{const o=t.item;if(!i.consumable.consume(t.item,e.name))return;const n={headingRows:o.getAttribute("headingRows")||0,headingColumns:o.getAttribute("headingColumns")||0},r=t.attributeOldValue,s=t.attributeNewValue,a=(r>s?r:s)-1;for(const e of new cw(o,{endColumn:a}))mw(e,n,i)})),e.data.mapper.on("modelToViewPosition",(e,t)=>{const i=t.modelPosition.parent,o=t.modelPosition.nodeBefore;if(!i.is("element","tableCell"))return;if(!o||!o.is("element","paragraph"))return;const n=t.mapper.toViewElement(o),r=t.mapper.toViewElement(i);n===r&&(t.viewPosition=t.mapper.findPositionIn(r,o.maxOffset))}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new vw(e)),e.commands.add("insertTableRowAbove",new Vw(e,{order:"above"})),e.commands.add("insertTableRowBelow",new Vw(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new Ow(e,{order:"left"})),e.commands.add("insertTableColumnRight",new Ow(e,{order:"right"})),e.commands.add("removeTableRow",new Gw(e)),e.commands.add("removeTableColumn",new Jw(e)),e.commands.add("splitTableCellVertically",new zw(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new zw(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new ik(e)),e.commands.add("mergeTableCellRight",new Uw(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Uw(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Uw(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Uw(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new Qw(e)),e.commands.add("setTableRowHeader",new Yw(e)),e.commands.add("selectTableRow",new sk(e)),e.commands.add("selectTableColumn",new ak(e)),kk(t),lk(t),bk(t,e.editing.mapper),uk(t)}static get requires(){return[Xw]}}function vk(e){return t=>{const i=parseInt(t.getAttribute(e));return Number.isNaN(i)||i<=0?null:i}}i(108);class yk extends Bc{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(e,t)=>`${t} × ${e}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck-insert-table-dropdown__label"]},children:[{text:t.to("label")}]}],on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(e,t)=>{const{row:i,column:o}=t.target.dataset;this.set({rows:parseInt(i),columns:parseInt(o)})}),this.on("change:columns",()=>{this._highlightGridBoxes()}),this.on("change:rows",()=>{this._highlightGridBoxes()})}focus(){}focusLast(){}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((i,o)=>{const n=Math.floor(o/10)<e&&o%10<t;i.set("isOn",n)})}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const i=Math.floor(t/10),o=t%10;e.push(new xk(this.locale,i+1,o+1))}return this.createCollection(e)}}class xk extends Bc{constructor(e,t,i){super(e);const o=this.bindTemplate;this.set("isOn",!1),this.setTemplate({tag:"div",attributes:{class:["ck-insert-table-dropdown-grid-box",o.if("isOn","ck-on")],"data-row":t,"data-column":i}})}}class Ck extends Qe{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,i="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",i=>{const o=e.commands.get("insertTable"),n=Vd(i);let r;return n.bind("isEnabled").to(o),n.buttonView.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 6v3h4V6H3zm0 4v3h4v-3H3zm0 4v3h4v-3H3zm5 3h4v-3H8v3zm5 0h4v-3h-4v3zm4-4v-3h-4v3h4zm0-4V6h-4v3h4zm1.5 8a1.5 1.5 0 0 1-1.5 1.5H3A1.5 1.5 0 0 1 1.5 17V4c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13zM12 13v-3H8v3h4zm0-4V6H8v3h4z"/></svg>',label:t("Insert table"),tooltip:!0}),n.on("change:isOpen",()=>{r||(r=new yk(i),n.panelView.children.add(r),r.delegate("execute").to(n),n.buttonView.on("open",()=>{r.rows=0,r.columns=0}),n.on("execute",()=>{e.execute("insertTable",{rows:r.rows,columns:r.columns}),e.editing.view.focus()}))}),n}),e.ui.componentFactory.add("tableColumn",e=>{const o=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:i?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:i?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',o,e)}),e.ui.componentFactory.add("tableRow",e=>{const i=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',i,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{const o=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:i?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:i?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',o,e)})}_prepareDropdown(e,t,i,o){const n=this.editor,r=Vd(o),s=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0}),r.bind("isEnabled").toMany(s,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(r,"execute",e=>{n.execute(e.source.commandName),n.editing.view.focus()}),r}_prepareMergeSplitButtonDropdown(e,t,i,o){const n=this.editor,r=Vd(o,pd),s=n.commands.get("mergeTableCells"),a=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),r.bind("isEnabled").toMany([s,...a],"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(r.buttonView,"execute",()=>{n.execute("mergeTableCells"),n.editing.view.focus()}),this.listenTo(r,"execute",e=>{n.execute(e.source.commandName),n.editing.view.focus()}),r}_fillDropdownWithListOptions(e,t){const i=this.editor,o=[],n=new Zi;for(const e of t)Ak(e,i,o,n);return zd(e,n,i.ui.componentFactory),o}}function Ak(e,t,i,o){const n=e.model=new $d(e.model),{commandName:r,bindIsOn:s}=e.model;if("button"===e.type||"switchbutton"===e.type){const e=t.commands.get(r);i.push(e),n.set({commandName:r}),n.bind("isEnabled").to(e),s&&n.bind("isOn").to(e,"value")}n.set({withText:!0}),o.add(e)}i(110);class Tk extends Qe{static get pluginName(){return"TableSelection"}static get requires(){return[Xw]}init(){const e=this.editor.model;this.listenTo(e,"deleteContent",(e,t)=>this._handleDeleteContent(e,t),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=yw(this.editor.model.document.selection);return 0==e.length?null:e}getSelectionAsFragment(){const e=this.getSelectedTableCells();return e?this.editor.model.change(t=>{const i=t.createDocumentFragment(),o=this.editor.plugins.get("TableUtils"),{first:n,last:r}=Tw(e),{first:s,last:a}=Aw(e),l=e[0].findAncestor("table");let c=a,d=r;if(Ew(e,o)){const e={firstColumn:n,lastColumn:r,firstRow:s,lastRow:a};c=qw(l,e),d=$w(l,e)}const h=Mw(l,{startRow:s,startColumn:n,endRow:c,endColumn:d},t);return t.insert(h,i,0),i}):null}setCellSelection(e,t){const i=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(i.cells.map(t=>e.createRangeOn(t)),{backward:i.backward})})}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=Os(this.editor.model.document.selection.getRanges()).getContainedElement();return e&&e.is("element","tableCell")?e:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(e=>e.on("selection",(e,i,o)=>{const n=o.writer;!function(e){for(const i of t)e.removeClass("ck-editor__editable_selected",i);t.clear()}(n);const r=this.getSelectedTableCells();if(!r)return;for(const e of r){const i=o.mapper.toViewElement(e);n.addClass("ck-editor__editable_selected",i),t.add(i)}const s=o.mapper.toViewElement(r[r.length-1]);n.setSelection(s,0)},{priority:"lowest"}))}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change(i=>{const o=i.createPositionAt(t[0],0),n=e.model.schema.getNearestSelectionRange(o);i.setSelection(n)})}})}_handleDeleteContent(e,t){const[i,o]=t,n=this.editor.model,r=!o||"backward"==o.direction,s=yw(i);s.length&&(e.stop(),n.change(e=>{const t=s[r?s.length-1:0];n.change(e=>{for(const t of s)n.deleteContent(e.createSelection(t,"in"))});const o=n.schema.getNearestSelectionRange(e.createPositionAt(t,0));i.is("documentSelection")?e.setSelection(o):i.setTo(o)}))}_getCellsToSelect(e,t){const i=this.editor.plugins.get("TableUtils"),o=i.getCellLocation(e),n=i.getCellLocation(t),r=Math.min(o.row,n.row),s=Math.max(o.row,n.row),a=Math.min(o.column,n.column),l=Math.max(o.column,n.column),c=new Array(s-r+1).fill(null).map(()=>[]),d={startRow:r,endRow:s,startColumn:a,endColumn:l};for(const{row:t,cell:i}of new cw(e.findAncestor("table"),d))c[t-r].push(i);const h=n.row<o.row,u=n.column<o.column;return h&&c.reverse(),u&&c.forEach(e=>e.reverse()),{cells:c.flat(),backward:h||u}}}class Ek extends Qe{static get pluginName(){return"TableClipboard"}static get requires(){return[Tk,Xw]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",(e,t)=>this._onCopyCut(e,t)),this.listenTo(t,"cut",(e,t)=>this._onCopyCut(e,t)),this.listenTo(e.model,"insertContent",(e,t)=>this._onInsertContent(e,...t),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const i=this.editor.plugins.get(Tk);if(!i.getSelectedTableCells())return;if("cut"==e.name&&this.editor.isReadOnly)return;t.preventDefault(),e.stop();const o=this.editor.data,n=this.editor.editing.view.document,r=o.toView(i.getSelectionAsFragment());n.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:r,method:e.name})}_onInsertContent(e,t,i){if(i&&!i.is("documentSelection"))return;const o=this.editor.model,n=this.editor.plugins.get(Xw);let r=function(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(1==e.childCount&&e.getChild(0).is("element","table"))return e.getChild(0);const i=t.createRangeIn(e);for(const e of i.getItems())if(e.is("element","table")){const o=t.createRange(i.start,t.createPositionBefore(e));if(t.hasContent(o,{ignoreWhitespaces:!0}))return null;const n=t.createRange(t.createPositionAfter(e),i.end);return t.hasContent(n,{ignoreWhitespaces:!0})?null:e}return null}(t,o);if(!r)return;const s=Cw(o.document.selection);s.length?(e.stop(),o.change(e=>{const t={width:n.getColumns(r),height:n.getRows(r)},i=function(e,t,i,o){const n=e[0].findAncestor("table"),r=Tw(e),s=Aw(e),a={firstColumn:r.first,lastColumn:r.last,firstRow:s.first,lastRow:s.last},l=1===e.length;l&&(a.lastRow+=t.height-1,a.lastColumn+=t.width-1,function(e,t,i,o){const n=o.getColumns(e),r=o.getRows(e);i>n&&o.insertColumns(e,{at:n,columns:i-n});t>r&&o.insertRows(e,{at:r,rows:t-r})}(n,a.lastRow+1,a.lastColumn+1,o));l||!Ew(e,o)?function(e,t,i){const{firstRow:o,lastRow:n,firstColumn:r,lastColumn:s}=t,a={first:o,last:n},l={first:r,last:s};Sk(e,r,a,i),Sk(e,s+1,a,i),Pk(e,o,l,i),Pk(e,n+1,l,i,o)}(n,a,i):(a.lastRow=qw(n,a),a.lastColumn=$w(n,a));return a}(s,t,e,n),o=i.lastRow-i.firstRow+1,a=i.lastColumn-i.firstColumn+1,l={startRow:0,startColumn:0,endRow:Math.min(o,t.height)-1,endColumn:Math.min(a,t.width)-1};r=Mw(r,l,e);const c=s[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(r,t,c,i,e);if(this.editor.plugins.get("TableSelection").isEnabled){const t=Pw(d.map(t=>e.createRangeOn(t)));e.setSelection(t)}else e.setSelection(d[0],0)})):Ww(r,n)}_replaceSelectedCellsWithPasted(e,t,i,o,n){const{width:r,height:s}=t,a=function(e,t,i){const o=new Array(i).fill(null).map(()=>new Array(t).fill(null));for(const{column:t,row:i,cell:n}of new cw(e))o[i][t]=n;return o}(e,r,s),l=[...new cw(i,{startRow:o.firstRow,endRow:o.lastRow,startColumn:o.firstColumn,endColumn:o.lastColumn,includeAllSlots:!0})],c=[];let d;for(const e of l){const{row:t,column:i}=e;i===o.firstColumn&&(d=e.getPositionBefore());const l=t-o.firstRow,h=i-o.firstColumn,u=a[l%s][h%r],g=u?n.cloneElement(u):null,m=this._replaceTableSlotCell(e,g,d,n);m&&(Lw(m,t,i,o.lastRow,o.lastColumn,n),c.push(m),d=n.createPositionAfter(m))}const h=parseInt(i.getAttribute("headingRows")||0),u=parseInt(i.getAttribute("headingColumns")||0),g=o.firstRow<h&&h<=o.lastRow,m=o.firstColumn<u&&u<=o.lastColumn;if(g){const e=Pk(i,h,{first:o.firstColumn,last:o.lastColumn},n,o.firstRow);c.push(...e)}if(m){const e=Sk(i,u,{first:o.firstRow,last:o.lastRow},n);c.push(...e)}return c}_replaceTableSlotCell(e,t,i,o){const{cell:n,isAnchor:r}=e;return r&&o.remove(n),t?(o.insert(t,i),t):null}}function Pk(e,t,i,o,n=0){if(t<1)return;return Bw(e,t,n).filter(({column:e,cellWidth:t})=>Ik(e,t,i)).map(({cell:e})=>Nw(e,t,o))}function Sk(e,t,i,o){if(t<1)return;return Fw(e,t).filter(({row:e,cellHeight:t})=>Ik(e,t,i)).map(({cell:e,column:i})=>Dw(e,i,t,o))}function Ik(e,t,i){const o=e+t-1,{first:n,last:r}=i;return e>=n&&e<=r||e<n&&o>=n}class Rk extends Qe{static get pluginName(){return"TableKeyboard"}static get requires(){return[Tk]}init(){const e=this.editor.editing.view.document;this.editor.keystrokes.set("Tab",(...e)=>this._handleTabOnSelectedTable(...e),{priority:"low"}),this.editor.keystrokes.set("Tab",this._getTabHandler(!0),{priority:"low"}),this.editor.keystrokes.set("Shift+Tab",this._getTabHandler(!1),{priority:"low"}),this.listenTo(e,"arrowKey",(...e)=>this._onArrowKey(...e),{context:"table"})}_handleTabOnSelectedTable(e,t){const i=this.editor,o=i.model.document.selection.getSelectedElement();o&&o.is("element","table")&&(t(),i.model.change(e=>{e.setSelection(e.createRangeIn(o.getChild(0).getChild(0)))}))}_getTabHandler(e){const t=this.editor;return(i,o)=>{let n=xw(t.model.document.selection)[0];if(n||(n=this.editor.plugins.get("TableSelection").getFocusCell()),!n)return;o();const r=n.parent,s=r.parent,a=s.getChildIndex(r),l=r.getChildIndex(n),c=0===l;if(!e&&c&&0===a)return void t.model.change(e=>{e.setSelection(e.createRangeOn(s))});const d=this.editor.plugins.get("TableUtils"),h=l===r.childCount-1,u=a===d.getRows(s)-1;if(e&&u&&h&&(t.execute("insertTableRowBelow"),a===d.getRows(s)-1))return void t.model.change(e=>{e.setSelection(e.createRangeOn(s))});let g;if(e&&h){const e=s.getChild(a+1);g=e.getChild(0)}else if(!e&&c){const e=s.getChild(a-1);g=e.getChild(e.childCount-1)}else g=r.getChild(l+(e?1:-1));t.model.change(e=>{e.setSelection(e.createRangeIn(g))})}}_onArrowKey(e,t){const i=this.editor,o=Fn(t.keyCode,i.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const i=this.editor.model,o=i.document.selection,n=["right","down"].includes(e),r=yw(o);if(r.length){let i;return i=t?this.editor.plugins.get("TableSelection").getFocusCell():n?r[r.length-1]:r[0],this._navigateFromCellInDirection(i,e,t),!0}const s=o.focus.findAncestor("tableCell");if(!s)return!1;if(!o.isCollapsed)if(t){if(o.isBackward==n&&!o.containsEntireContent(s))return!1}else{const e=o.getSelectedElement();if(!e||!i.schema.isObject(e))return!1}return!!this._isSelectionAtCellEdge(o,s,n)&&(this._navigateFromCellInDirection(s,e,t),!0)}_isSelectionAtCellEdge(e,t,i){const o=this.editor.model,n=this.editor.model.schema,r=i?e.getLastPosition():e.getFirstPosition();if(!n.getLimitElement(r).is("element","tableCell")){return o.createPositionAt(t,i?"end":0).isTouching(r)}const s=o.createSelection(r);return o.modifySelection(s,{direction:i?"forward":"backward"}),r.isEqual(s.focus)}_navigateFromCellInDirection(e,t,i=!1){const o=this.editor.model,n=e.findAncestor("table"),r=[...new cw(n,{includeAllSlots:!0})],{row:s,column:a}=r[r.length-1],l=r.find(({cell:t})=>t==e);let{row:c,column:d}=l;switch(t){case"left":d--;break;case"up":c--;break;case"right":d+=l.cellWidth;break;case"down":c+=l.cellHeight}if(c<0||c>s||d<0&&c<=0||d>a&&c>=s)return void o.change(e=>{e.setSelection(e.createRangeOn(n))});d<0?(d=i?0:a,c--):d>a&&(d=i?a:0,c++);const h=r.find(e=>e.row==c&&e.column==d).cell,u=["right","down"].includes(t),g=this.editor.plugins.get("TableSelection");if(i&&g.isEnabled){const t=g.getAnchorCell()||e;g.setCellSelection(t,h)}else{const e=o.createPositionAt(h,u?0:"end");o.change(t=>{t.setSelection(e)})}}}class Vk extends ts{constructor(e){super(e),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class Ok extends Qe{static get pluginName(){return"TableMouse"}static get requires(){return[Tk]}init(){this.editor.editing.view.addObserver(Vk),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor;let t=!1;const i=e.plugins.get(Tk);this.listenTo(e.editing.view.document,"mousedown",(o,n)=>{if(!this.isEnabled||!i.isEnabled)return;if(!n.domEvent.shiftKey)return;const r=i.getAnchorCell()||xw(e.model.document.selection)[0];if(!r)return;const s=this._getModelTableCellFromDomEvent(n);s&&zk(r,s)&&(t=!0,i.setCellSelection(r,s),n.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{t=!1}),this.listenTo(e.editing.view.document,"selectionChange",e=>{t&&e.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,i,o=!1,n=!1;const r=e.plugins.get(Tk);this.listenTo(e.editing.view.document,"mousedown",(e,i)=>{this.isEnabled&&r.isEnabled&&(i.domEvent.shiftKey||i.domEvent.ctrlKey||i.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(i)))}),this.listenTo(e.editing.view.document,"mousemove",(e,s)=>{if(!s.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(s);a&&zk(t,a)&&(i=a,o||i==t||(o=!0)),o&&(n=!0,r.setCellSelection(t,i),s.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{o=!1,n=!1,t=null,i=null}),this.listenTo(e.editing.view.document,"selectionChange",e=>{n&&e.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,i=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(i).parent.findAncestor("tableCell",{includeSelf:!0})}}function zk(e,t){return e.parent.parent==t.parent.parent}i(112);function Mk(e){const t=e.getSelectedElement();return t&&Nk(t)?t:null}function Bk(e){let t=e.getFirstPosition().parent;for(;t;){if(t.is("element")&&Nk(t))return t;t=t.parent}return null}function Nk(e){return!!e.getCustomProperty("table")&&um(e)}function Fk(e,t){const{viewElement:i,defaultValue:o,modelAttribute:n,styleName:r,reduceBoxSides:s=!1}=t;e.for("upcast").attributeToAttribute({view:{name:i,styles:{[r]:/[\s\S]+/}},model:{key:n,value:e=>{const t=e.getNormalizedStyle(r),i=s?jk(t):t;if(o!==i)return i}}})}function Dk(e,t,i){e.for("upcast").add(e=>e.on("element:"+t,(e,t,o)=>{if(!t.modelRange)return;const n=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter(e=>t.viewItem.hasStyle(e));if(!n.length)return;const r={styles:n};if(!o.consumable.test(t.viewItem,r))return;const s=[...t.modelRange.getItems({shallow:!0})].pop();o.consumable.consume(t.viewItem,r);const a={style:t.viewItem.getNormalizedStyle("border-style"),color:t.viewItem.getNormalizedStyle("border-color"),width:t.viewItem.getNormalizedStyle("border-width")},l={style:jk(a.style),color:jk(a.color),width:jk(a.width)};l.style!==i.style&&o.writer.setAttribute("borderStyle",l.style,s),l.color!==i.color&&o.writer.setAttribute("borderColor",l.color,s),l.width!==i.width&&o.writer.setAttribute("borderWidth",l.width,s)}))}function Lk(e,{modelElement:t,modelAttribute:i,styleName:o}){e.for("downcast").attributeToAttribute({model:{name:t,key:i},view:e=>({key:"style",value:{[o]:e}})})}function Hk(e,{modelAttribute:t,styleName:i}){e.for("downcast").add(e=>e.on(`attribute:${t}:table`,(e,t,o)=>{const{item:n,attributeNewValue:r}=t,{mapper:s,writer:a}=o;if(!o.consumable.consume(t.item,e.name))return;const l=[...s.toViewElement(n).getChildren()].find(e=>e.is("element","table"));r?a.setStyle(i,r,l):a.removeStyle(i,l)}))}function jk(e){if(!e)return;return["top","right","bottom","left"].map(t=>e[t]).reduce((e,t)=>e==t?e:null)||e}class Wk extends Ze{constructor(e,t,i){super(e),this.attributeName=t,this._defaultValue=i}refresh(){const e=this.editor.model.document.selection.getFirstPosition().findAncestor("table");this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,i=t.document.selection,{value:o,batch:n}=e,r=i.getFirstPosition().findAncestor("table"),s=this._getValueToSet(o);t.enqueueChange(n||"default",e=>{s?e.setAttribute(this.attributeName,s,r):e.removeAttribute(this.attributeName,r)})}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class qk extends Wk{constructor(e,t){super(e,"backgroundColor",t)}}function $k(e){if(!e||!w(e))return e;const{top:t,right:i,bottom:o,left:n}=e;return t==i&&i==o&&o==n?t:void 0}function Uk(e,t){const i=parseFloat(e);return Number.isNaN(i)||String(i)!==String(e)?e:`${i}${t}`}function Kk(e,t={}){const i=Object.assign({borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:""},e);return t.includeAlignmentProperty&&!i.alignment&&(i.alignment="center"),t.includePaddingProperty&&!i.padding&&(i.padding=""),t.includeVerticalAlignmentProperty&&!i.verticalAlignment&&(i.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!i.horizontalAlignment&&(i.horizontalAlignment=t.isRightToLeftContent?"right":"left"),i}class Gk extends Wk{constructor(e,t){super(e,"borderColor",t)}_getValue(e){if(!e)return;const t=$k(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Jk extends Wk{constructor(e,t){super(e,"borderStyle",t)}_getValue(e){if(!e)return;const t=$k(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Yk extends Wk{constructor(e,t){super(e,"borderWidth",t)}_getValue(e){if(!e)return;const t=$k(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){if((e=Uk(e,"px"))!==this._defaultValue)return e}}class Qk extends Wk{constructor(e,t){super(e,"width",t)}_getValueToSet(e){if((e=Uk(e,"px"))!==this._defaultValue)return e}}class Xk extends Wk{constructor(e,t){super(e,"height",t)}_getValueToSet(e){return(e=Uk(e,"px"))===this._defaultValue?null:e}}class Zk extends Wk{constructor(e,t){super(e,"alignment",t)}}const e_=/^(left|center|right)$/,t_=/^(left|none|right)$/;class i_ extends Qe{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[_k]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const o=Kk(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});e.data.addStyleProcessorRules(iu),function(e,t,i){e.extend("table",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),Dk(t,"table",i),Hk(t,{modelAttribute:"borderColor",styleName:"border-color"}),Hk(t,{modelAttribute:"borderStyle",styleName:"border-style"}),Hk(t,{modelAttribute:"borderWidth",styleName:"border-width"})}(t,i,{color:o.borderColor,style:o.borderStyle,width:o.borderWidth}),e.commands.add("tableBorderColor",new Gk(e,o.borderColor)),e.commands.add("tableBorderStyle",new Jk(e,o.borderStyle)),e.commands.add("tableBorderWidth",new Yk(e,o.borderWidth)),function(e,t,i){e.extend("table",{allowAttributes:["alignment"]}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"alignment"},view:e=>({key:"style",value:{float:"center"===e?"none":e}}),converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:t_}},model:{key:"alignment",value:e=>{let t=e.getStyle("float");return"none"===t&&(t="center"),t===i?null:t}}}).attributeToAttribute({view:{attributes:{align:e_}},model:{name:"table",key:"alignment",value:e=>{const t=e.getAttribute("align");return t===i?null:t}}})}(t,i,o.alignment),e.commands.add("tableAlignment",new Zk(e,o.alignment)),o_(t,i,{modelAttribute:"width",styleName:"width",defaultValue:o.width}),e.commands.add("tableWidth",new Qk(e,o.width)),o_(t,i,{modelAttribute:"height",styleName:"height",defaultValue:o.height}),e.commands.add("tableHeight",new Xk(e,o.height)),e.data.addStyleProcessorRules(eu),function(e,t,i){const{modelAttribute:o}=i;e.extend("table",{allowAttributes:[o]}),Fk(t,{viewElement:"table",...i}),Hk(t,i)}(t,i,{modelAttribute:"backgroundColor",styleName:"background-color",defaultValue:o.backgroundColor}),e.commands.add("tableBackgroundColor",new qk(e,o.backgroundColor))}}function o_(e,t,i){const{modelAttribute:o}=i;e.extend("table",{allowAttributes:[o]}),Fk(t,{viewElement:/^(table|figure)$/,...i}),Lk(t,{modelElement:"table",...i})}i(114);class n_ extends Bc{constructor(e,t){super(e);const i=this.bindTemplate;this.set("value",""),this.set("id"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.set("ariaDescribedById"),this.options=t,this._dropdownView=this._createDropdownView(),this._inputView=this._createInputTextView(),this._stillTyping=!1,this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color",i.if("hasError","ck-error")],id:i.to("id"),"aria-invalid":i.if("hasError",!0),"aria-describedby":i.to("ariaDescribedById")},children:[this._dropdownView,this._inputView]}),this.on("change:value",(e,t,i)=>this._setInputValue(i))}focus(){this._inputView.focus()}_createDropdownView(){const e=this.locale,t=e.t,i=this.bindTemplate,o=this._createColorGrid(e),n=Vd(e),r=new Bc,s=this._createRemoveColorButton();return r.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:i.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",i.if("value","ck-hidden",e=>""!=e)]}}]}),n.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),n.buttonView.children.add(r),n.buttonView.tooltip=t("Color picker"),n.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",n.panelView.children.add(s),n.panelView.children.add(o),n.bind("isEnabled").to(this,"isReadOnly",e=>!e),n}_createInputTextView(){const e=this.locale,t=new Ld(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",()=>{const e=t.element.value,i=this.options.colorDefinitions.find(t=>e===t.label);this._stillTyping=!0,this.value=i&&i.color||e}),t.on("blur",()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate("input").to(this),t}_createRemoveColorButton(){const e=this.locale,t=e.t,i=new rd(e),o=this.options.defaultColorValue||"",n=t(o?"Restore default":"Remove color");return i.class="ck-input-color__remove-color",i.withText=!0,i.icon=Rc.eraser,i.label=n,i.on("execute",()=>{this.value=o,this._dropdownView.isOpen=!1,this.fire("input")}),i}_createColorGrid(e){const t=new gd(e,{colorDefinitions:this.options.colorDefinitions,columns:this.options.columns});return t.on("execute",(e,t)=>{this.value=t.value,this._dropdownView.isOpen=!1,this.fire("input")}),t.bind("selectedColor").to(this,"value"),t}_setInputValue(e){if(!this._stillTyping){const t=r_(e),i=this.options.colorDefinitions.find(e=>t===r_(e.color));this._inputView.value=i?i.label:e||""}}}function r_(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const s_=e=>""===e;function a_(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function l_(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function c_(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function d_(e){return e=e.trim(),s_(e)||Mh(e)}function h_(e){return e=e.trim(),s_(e)||b_(e)||Dh(e)||Hh(e)}function u_(e){return e=e.trim(),s_(e)||b_(e)||Dh(e)}function g_(e,t){const i=new Zi,o=a_(e.t);for(const n in o){const r={type:"button",model:new $d({_borderStyleValue:n,label:o[n],withText:!0})};"none"===n?r.model.bind("isOn").to(e,"borderStyle",e=>"none"===t?!e:e===n):r.model.bind("isOn").to(e,"borderStyle",e=>e===n),i.add(r)}return i}function m_(e){const{view:t,icons:i,toolbar:o,labels:n,propertyName:r,nameToValue:s,defaultValue:a}=e;for(const e in n){const l=new rd(t.locale);l.set({label:n[e],icon:i[e],tooltip:n[e]});const c=s?s(e):e;l.bind("isOn").to(t,r,e=>{let t=e;return""===e&&a&&(t=a),c===t}),l.on("execute",()=>{t[r]=c}),o.items.add(l)}}const f_=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function p_(e){return(t,i,o)=>{const n=new n_(t.locale,{colorDefinitions:(r=e.colorConfig,r.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns,defaultColorValue:e.defaultColorValue});var r;return n.set({id:i,ariaDescribedById:o}),n.bind("isReadOnly").to(t,"isEnabled",e=>!e),n.bind("hasError").to(t,"errorText",e=>!!e),n.on("input",()=>{t.errorText=null}),t.bind("isEmpty","isFocused").to(n),n}}function b_(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}i(116);class w_ extends Bc{constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach(e=>this.children.add(e)),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",i.to("class")],role:i.to("_role"),"aria-labelledby":i.to("_ariaLabelledBy")},children:this.children})}}i(15),i(16),i(120);const k_={left:Rc.objectLeft,center:Rc.objectCenter,right:Rc.objectRight};class __ extends Bc{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:o,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:h}=this._createDimensionFields(),{alignmentToolbar:u,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new zs,this.keystrokes=new Ms,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=o,this.borderColorInput=n,this.backgroundInput=a,this.widthInput=l,this.heightInput=d,this.alignmentToolbar=u;const{saveButtonView:m,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=m,this.cancelButtonView=f,this._focusables=new Mc,this._focusCycler=new hd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Dd(e,{label:this.t("Table properties")})),this.children.add(new w_(e,{labelView:r,children:[r,i,n,o],class:"ck-table-form__border-row"})),this.children.add(new w_(e,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new w_(e,{children:[new w_(e,{labelView:h,children:[h,l,c,d],class:"ck-table-form__dimensions-row"}),new w_(e,{labelView:g,children:[g,u],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new w_(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),zc({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=p_({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color}),o=this.locale,n=this.t,r=new Bd(o);r.text=n("Border");const s=a_(this.t),a=new Hd(o,Wd);a.set({label:n("Style"),class:"ck-table-form__border-style"}),a.fieldView.buttonView.set({isOn:!1,withText:!0,tooltip:n("Style")}),a.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>s[e||"none"]),a.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),a.bind("isEmpty").to(this,"borderStyle",e=>!e),zd(a.fieldView,g_(this,t.style));const l=new Hd(o,jd);l.set({label:n("Width"),class:"ck-table-form__border-width"}),l.fieldView.bind("value").to(this,"borderWidth"),l.bind("isEnabled").to(this,"borderStyle",v_),l.fieldView.on("input",()=>{this.borderWidth=l.fieldView.element.value});const c=new Hd(o,i);return c.set({label:n("Color"),class:"ck-table-form__border-color"}),c.fieldView.bind("value").to(this,"borderColor"),c.bind("isEnabled").to(this,"borderStyle",v_),c.fieldView.on("input",()=>{this.borderColor=c.fieldView.value}),this.on("change:borderStyle",(e,i,o,n)=>{v_(o)||(this.borderColor="",this.borderWidth=""),v_(n)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:a,borderColorInput:c,borderWidthInput:l}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Bd(e);i.text=t("Background");const o=p_({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor}),n=new Hd(e,o);return n.set({label:t("Color"),class:"ck-table-properties-form__background"}),n.fieldView.bind("value").to(this,"backgroundColor"),n.fieldView.on("input",()=>{this.backgroundColor=n.fieldView.value}),{backgroundRowLabel:i,backgroundInput:n}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Bd(e);i.text=t("Dimensions");const o=new Hd(e,jd);o.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),o.fieldView.bind("value").to(this,"width"),o.fieldView.on("input",()=>{this.width=o.fieldView.element.value});const n=new Bc(e);n.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new Hd(e,jd);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:i,widthInput:o,operatorLabel:n,heightInput:r}}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Bd(e);i.text=t("Alignment");const o=new Ad(e);return o.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),m_({view:this,icons:k_,toolbar:o,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:i,alignmentToolbar:o}}_createActionButtons(){const e=this.locale,t=this.t,i=new rd(e),o=new rd(e),n=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return i.set({label:t("Save"),icon:Rc.check,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(n,"errorText",(...e)=>e.every(e=>!e)),o.set({label:t("Cancel"),icon:Rc.cancel,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:o}}get _alignmentLabels(){const e=this.locale,t=this.t,i=t("Align table to the left"),o=t("Center table"),n=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:n,center:o,left:i}:{left:i,center:o,right:n}}}function v_(e){return"none"!==e}const y_=Gd.defaultPositions,x_=[y_.northArrowSouth,y_.northArrowSouthWest,y_.northArrowSouthEast,y_.southArrowNorth,y_.southArrowNorthWest,y_.southArrowNorthEast,y_.viewportStickyNorth];function C_(e,t){const i=e.plugins.get("ContextualBalloon");if(Bk(e.editing.view.document.selection)){let o;o="cell"===t?T_(e):A_(e),i.updatePosition(o)}}function A_(e){const t=e.model.document.selection.getFirstPosition().findAncestor("table"),i=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.viewToDom(i),positions:x_}}function T_(e){const t=e.editing.mapper,i=e.editing.view.domConverter,o=e.model.document.selection;if(o.rangeCount>1)return{target:()=>function(e,t){const i=t.editing.mapper,o=t.editing.view.domConverter,n=Array.from(e).map(e=>{const t=E_(e.start),n=i.toViewElement(t);return new Ts(o.viewToDom(n))});return Ts.getBoundingRect(n)}(o.getRanges(),e),positions:x_};const n=E_(o.getFirstPosition()),r=t.toViewElement(n);return{target:i.viewToDom(r),positions:x_}}function E_(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}const P_={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class S_ extends Qe{static get requires(){return[eh]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:f_,backgroundColors:f_})}init(){const e=this.editor,t=e.t;this._defaultTableProperties=Kk(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(eh),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableProperties",i=>{const o=new rd(i);o.set({label:t("Table properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(o,"execute",()=>this._showView());const n=Object.values(P_).map(t=>e.commands.get(t));return o.bind("isEnabled").toMany(n,"isEnabled",(...e)=>e.some(e=>e)),o})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableProperties"),i=ld(t.borderColors),o=ad(e.locale,i),n=ld(t.backgroundColors),r=ad(e.locale,n),s=new __(e.locale,{borderColors:o,backgroundColors:r,defaultTableProperties:this._defaultTableProperties}),a=e.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),Vc({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const l=l_(a),c=c_(a);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle",this._defaultTableProperties.borderStyle)),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableBorderColor",errorText:l,validator:d_,defaultValue:this._defaultTableProperties.borderColor})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableBorderWidth",errorText:c,validator:u_,defaultValue:this._defaultTableProperties.borderWidth})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableBackgroundColor",errorText:l,validator:d_,defaultValue:this._defaultTableProperties.backgroundColor})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableWidth",errorText:c,validator:h_,defaultValue:this._defaultTableProperties.width})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableHeight",errorText:c,validator:h_,defaultValue:this._defaultTableProperties.height})),s.on("change:alignment",this._getPropertyChangeCallback("tableAlignment",this._defaultTableProperties.alignment)),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(P_).map(([t,i])=>{const o=this._defaultTableProperties[t]||"";return[t,e.get(i).value||o]}).forEach(([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i)})}_showView(){const e=this.editor;this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:A_(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;Bk(e.editing.view.document.selection)?this._isViewVisible&&C_(e,"table"):this._hideView()}get _isViewVisible(){return this._balloon.visibleView===this.view}get _isViewInBalloon(){return this._balloon.hasView(this.view)}_getPropertyChangeCallback(e,t){return(i,o,n,r)=>{(r||t!==n)&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:o,errorText:n,defaultValue:r}=e,s=fs(()=>{i.errorText=n},500);return(e,n,a,l)=>{s.cancel(),(l||r!==a)&&(o(a)?(this.editor.execute(t,{value:a,batch:this._undoStepBatch}),i.errorText=null):s())}}}i(122);const I_={left:Rc.alignLeft,center:Rc.alignCenter,right:Rc.alignRight,justify:Rc.alignJustify,top:Rc.alignTop,middle:Rc.alignMiddle,bottom:Rc.alignBottom};class R_ extends Bc{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:o,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:h}=this._createDimensionFields(),{horizontalAlignmentToolbar:u,verticalAlignmentToolbar:g,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new zs,this.keystrokes=new Ms,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=o,this.borderColorInput=n,this.backgroundInput=a,this.paddingInput=this._createPaddingField(),this.widthInput=l,this.heightInput=d,this.horizontalAlignmentToolbar=u,this.verticalAlignmentToolbar=g;const{saveButtonView:f,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=f,this.cancelButtonView=p,this._focusables=new Mc,this._focusCycler=new hd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Dd(e,{label:this.t("Cell properties")})),this.children.add(new w_(e,{labelView:r,children:[r,i,n,o],class:"ck-table-form__border-row"})),this.children.add(new w_(e,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new w_(e,{children:[new w_(e,{labelView:h,children:[h,l,c,d],class:"ck-table-form__dimensions-row"}),new w_(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new w_(e,{labelView:m,children:[m,u,g],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new w_(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),zc({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=p_({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color}),o=this.locale,n=this.t,r=new Bd(o);r.text=n("Border");const s=a_(n),a=new Hd(o,Wd);a.set({label:n("Style"),class:"ck-table-form__border-style"}),a.fieldView.buttonView.set({isOn:!1,withText:!0,tooltip:n("Style")}),a.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>s[e||"none"]),a.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),a.bind("isEmpty").to(this,"borderStyle",e=>!e),zd(a.fieldView,g_(this,t.style));const l=new Hd(o,jd);l.set({label:n("Width"),class:"ck-table-form__border-width"}),l.fieldView.bind("value").to(this,"borderWidth"),l.bind("isEnabled").to(this,"borderStyle",V_),l.fieldView.on("input",()=>{this.borderWidth=l.fieldView.element.value});const c=new Hd(o,i);return c.set({label:n("Color"),class:"ck-table-form__border-color"}),c.fieldView.bind("value").to(this,"borderColor"),c.bind("isEnabled").to(this,"borderStyle",V_),c.fieldView.on("input",()=>{this.borderColor=c.fieldView.value}),this.on("change:borderStyle",(e,i,o,n)=>{V_(o)||(this.borderColor="",this.borderWidth=""),V_(n)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:a,borderColorInput:c,borderWidthInput:l}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Bd(e);i.text=t("Background");const o=p_({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor}),n=new Hd(e,o);return n.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),n.fieldView.bind("value").to(this,"backgroundColor"),n.fieldView.on("input",()=>{this.backgroundColor=n.fieldView.value}),{backgroundRowLabel:i,backgroundInput:n}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Bd(e);i.text=t("Dimensions");const o=new Hd(e,jd);o.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),o.fieldView.bind("value").to(this,"width"),o.fieldView.on("input",()=>{this.width=o.fieldView.element.value});const n=new Bc(e);n.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new Hd(e,jd);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:i,widthInput:o,operatorLabel:n,heightInput:r}}_createPaddingField(){const e=this.locale,t=this.t,i=new Hd(e,jd);return i.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),i.fieldView.bind("value").to(this,"padding"),i.fieldView.on("input",()=>{this.padding=i.fieldView.element.value}),i}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Bd(e);i.text=t("Table cell text alignment");const o=new Ad(e),n="rtl"===this.locale.contentLanguageDirection;o.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),m_({view:this,icons:I_,toolbar:o,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(n){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new Ad(e);return r.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),m_({view:this,icons:I_,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:o,verticalAlignmentToolbar:r,alignmentLabel:i}}_createActionButtons(){const e=this.locale,t=this.t,i=new rd(e),o=new rd(e),n=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return i.set({label:t("Save"),icon:Rc.check,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(n,"errorText",(...e)=>e.every(e=>!e)),o.set({label:t("Cancel"),icon:Rc.cancel,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:o}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,i=t("Align cell text to the left"),o=t("Align cell text to the center"),n=t("Align cell text to the right"),r=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:n,center:o,left:i,justify:r}:{left:i,center:o,right:n,justify:r}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function V_(e){return"none"!==e}const O_={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",width:"tableCellWidth",height:"tableCellHeight",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class z_ extends Qe{static get requires(){return[eh]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:f_,backgroundColors:f_})}init(){const e=this.editor,t=e.t;this._defaultTableCellProperties=Kk(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(eh),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableCellProperties",i=>{const o=new rd(i);o.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(o,"execute",()=>this._showView());const n=Object.values(O_).map(t=>e.commands.get(t));return o.bind("isEnabled").toMany(n,"isEnabled",(...e)=>e.some(e=>e)),o})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.editing.view.document,i=e.config.get("table.tableCellProperties"),o=ld(i.borderColors),n=ad(e.locale,o),r=ld(i.backgroundColors),s=ad(e.locale,r),a=new R_(e.locale,{borderColors:n,backgroundColors:s,defaultTableCellProperties:this._defaultTableCellProperties}),l=e.t;a.render(),this.listenTo(a,"submit",()=>{this._hideView()}),this.listenTo(a,"cancel",()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()}),a.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),this.listenTo(e.ui,"update",()=>{Bk(t.selection)?this._isViewVisible&&C_(e,"cell"):this._hideView()}),Vc({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=l_(l),d=c_(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle",this._defaultTableCellProperties.borderStyle)),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:c,validator:d_,defaultValue:this._defaultTableCellProperties.borderColor})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:u_,defaultValue:this._defaultTableCellProperties.borderWidth})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:h_,defaultValue:this._defaultTableCellProperties.padding})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:h_,defaultValue:this._defaultTableCellProperties.width})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:h_,defaultValue:this._defaultTableCellProperties.height})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:c,validator:d_,defaultValue:this._defaultTableCellProperties.backgroundColor})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment",this._defaultTableCellProperties.horizontalAlignment)),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment",this._defaultTableCellProperties.verticalAlignment)),a}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(O_).map(([t,i])=>{const o=this._defaultTableCellProperties[t]||"";return[t,e.get(i).value||o]}).forEach(([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i)})}_showView(){const e=this.editor;this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:T_(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){if(!this._isViewInBalloon)return;const e=this.editor;this.stopListening(e.ui,"update"),this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}get _isViewVisible(){return this._balloon.visibleView===this.view}get _isViewInBalloon(){return this._balloon.hasView(this.view)}_getPropertyChangeCallback(e,t){return(i,o,n,r)=>{(r||t!==n)&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:o,errorText:n,defaultValue:r}=e,s=fs(()=>{i.errorText=n},500);return(e,n,a,l)=>{s.cancel(),(l||r!==a)&&(o(a)?(this.editor.execute(t,{value:a,batch:this._undoStepBatch}),i.errorText=null):s())}}}class M_ extends Ze{constructor(e,t,i){super(e),this.attributeName=t,this._defaultValue=i}refresh(){const e=Cw(this.editor.model.document.selection);this.isEnabled=!!e.length,this.value=this._getSingleValue(e)}execute(e={}){const{value:t,batch:i}=e,o=this.editor.model,n=Cw(o.document.selection),r=this._getValueToSet(t);o.enqueueChange(i||"default",e=>{r?n.forEach(t=>e.setAttribute(this.attributeName,r,t)):n.forEach(t=>e.removeAttribute(this.attributeName,t))})}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}}class B_ extends M_{constructor(e,t){super(e,"padding",t)}_getAttribute(e){if(!e)return;const t=$k(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){if((e=Uk(e,"px"))!==this._defaultValue)return e}}class N_ extends M_{constructor(e,t){super(e,"width",t)}_getValueToSet(e){if((e=Uk(e,"px"))!==this._defaultValue)return e}}class F_ extends M_{constructor(e,t){super(e,"height",t)}_getValueToSet(e){return(e=Uk(e,"px"))===this._defaultValue?null:e}}class D_ extends M_{constructor(e,t){super(e,"backgroundColor",t)}}class L_ extends M_{constructor(e,t){super(e,"verticalAlignment",t)}}class H_ extends M_{constructor(e,t){super(e,"horizontalAlignment",t)}}class j_ extends M_{constructor(e,t){super(e,"borderStyle",t)}_getAttribute(e){if(!e)return;const t=$k(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class W_ extends M_{constructor(e,t){super(e,"borderColor",t)}_getAttribute(e){if(!e)return;const t=$k(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class q_ extends M_{constructor(e,t){super(e,"borderWidth",t)}_getAttribute(e){if(!e)return;const t=$k(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){if((e=Uk(e,"px"))!==this._defaultValue)return e}}const $_=/^(top|middle|bottom)$/,U_=/^(left|center|right|justify)$/;class K_ extends Qe{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[_k]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const o=Kk(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection});e.data.addStyleProcessorRules(iu),function(e,t,i){e.extend("tableCell",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),Dk(t,"td",i),Dk(t,"th",i),Lk(t,{modelElement:"tableCell",modelAttribute:"borderStyle",styleName:"border-style"}),Lk(t,{modelElement:"tableCell",modelAttribute:"borderColor",styleName:"border-color"}),Lk(t,{modelElement:"tableCell",modelAttribute:"borderWidth",styleName:"border-width"})}(t,i,{color:o.borderColor,style:o.borderStyle,width:o.borderWidth}),e.commands.add("tableCellBorderStyle",new j_(e,o.borderStyle)),e.commands.add("tableCellBorderColor",new W_(e,o.borderColor)),e.commands.add("tableCellBorderWidth",new q_(e,o.borderWidth)),function(e,t,i){e.extend("tableCell",{allowAttributes:["horizontalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"horizontalAlignment"},view:e=>({key:"style",value:{"text-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":U_}},model:{key:"horizontalAlignment",value:e=>{const t=e.getStyle("text-align");return t===i?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:U_}},model:{key:"horizontalAlignment",value:e=>{const t=e.getAttribute("align");return t===i?null:t}}})}(t,i,o.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new H_(e,o.horizontalAlignment)),G_(t,i,{modelAttribute:"width",styleName:"width",defaultValue:o.width}),e.commands.add("tableCellWidth",new N_(e,o.width)),G_(t,i,{modelAttribute:"height",styleName:"height",defaultValue:o.height}),e.commands.add("tableCellHeight",new F_(e,o.height)),e.data.addStyleProcessorRules(mu),G_(t,i,{modelAttribute:"padding",styleName:"padding",reduceBoxSides:!0,defaultValue:o.padding}),e.commands.add("tableCellPadding",new B_(e,o.padding)),e.data.addStyleProcessorRules(eu),G_(t,i,{modelAttribute:"backgroundColor",styleName:"background-color",defaultValue:o.backgroundColor}),e.commands.add("tableCellBackgroundColor",new D_(e,o.backgroundColor)),function(e,t,i){e.extend("tableCell",{allowAttributes:["verticalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"verticalAlignment"},view:e=>({key:"style",value:{"vertical-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":$_}},model:{key:"verticalAlignment",value:e=>{const t=e.getStyle("vertical-align");return t===i?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:$_}},model:{key:"verticalAlignment",value:e=>{const t=e.getAttribute("valign");return t===i?null:t}}})}(t,i,o.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new L_(e,o.verticalAlignment))}}function G_(e,t,i){const{modelAttribute:o}=i;e.extend("tableCell",{allowAttributes:[o]}),Fk(t,{viewElement:/^(td|th)$/,...i}),Lk(t,{modelElement:"tableCell",...i})}function J_(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.differ.getChanges();let o=!1;for(const t of i){if("insert"!=t.type)continue;if(t.position.parent.is("element","table")||"table"==t.name){const i="table"==t.name?t.position.nodeAfter:t.position.parent,n=Array.from(i.getChildren()).filter(e=>e.is("element","caption")),r=n.shift();if(!r)continue;for(const t of n)e.move(e.createRangeIn(t),r,"end"),e.remove(t);r.nextSibling&&(e.move(e.createRangeOn(r),i,"end"),o=!0),o=!!n.length||o}}return o}(t,e))}function Y_(e){return!!e&&e.is("element","table")}function Q_(e){for(const t of e.getChildren())if(t.is("element","caption"))return t;return null}function X_(e){const t=e.parent;return"figcaption"==e.name&&t&&"figure"==t.name&&t.hasClass("table")||"caption"==e.name&&t&&"table"==t.name?{name:!0}:null}function Z_(e){const t=e.getSelectedElement();return t&&t.is("element","table")?t:e.getFirstPosition().findAncestor("table")}class ev extends Ze{refresh(){const e=Z_(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?this.value=!!Q_(e):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change(e=>{this.value?this._hideTableCaption(e):this._showTableCaption(e,t)})}_showTableCaption(e,t){const i=Z_(this.editor.model.document.selection),o=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(i)||e.createElement("caption");e.append(o,i),t&&e.setSelection(o,"in")}_hideTableCaption(e){const t=Z_(this.editor.model.document.selection),i=this.editor.plugins.get("TableCaptionEditing"),o=Q_(t);i._saveCaption(t,o),e.setSelection(e.createRangeIn(t.getChild(0).getChild(0))),e.remove(o)}}class tv extends Qe{static get pluginName(){return"TableCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema,i=e.editing.view,o=e.t;t.isRegistered("caption")?t.extend("caption",{allowIn:"table"}):t.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new ev(this.editor)),e.conversion.for("upcast").elementToElement({view:X_,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>Y_(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if(!Y_(e.parent))return null;const n=t.createEditableElement("figcaption");return t.setCustomProperty("tableCaption",!0,n),dh({view:i,element:n,text:o("Enter table caption"),keepOnFocus:!0}),wm(n,t)}}),J_(e.model)}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Xs.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class iv extends Qe{static get pluginName(){return"TableCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.t;e.ui.componentFactory.add("toggleTableCaption",o=>{const n=e.commands.get("toggleTableCaption"),r=new rd(o);return r.set({icon:Rc.caption,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(n,"value","isEnabled"),r.bind("label").to(n,"value",e=>i(e?"Toggle caption off":"Toggle caption on")),this.listenTo(r,"execute",()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),n.value){const i=function(e){const t=Z_(e);return t?Q_(t):null}(e.model.document.selection),o=e.editing.mapper.toViewElement(i);if(!o)return;t.scrollToTheSelection(),t.change(e=>{e.addClass("table__caption_highlighted",o)})}}),r})}}i(124);const ov={heading1:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 9v10h-2v-8h-2V9h4zM4 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V11H4v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H3a1 1 0 0 1 1 1v4.5z"/></svg>',heading2:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm16.076 8.343V18.5h-6.252c.067-.626.27-1.22.61-1.78.338-.561 1.006-1.305 2.005-2.232.804-.749 1.297-1.257 1.479-1.523.245-.368.368-.732.368-1.092 0-.398-.107-.703-.32-.917-.214-.214-.51-.32-.886-.32-.372 0-.669.111-.889.336-.22.224-.347.596-.38 1.117l-1.778-.178c.106-.982.438-1.686.997-2.114.558-.427 1.257-.64 2.095-.64.918 0 1.64.247 2.164.742.525.495.787 1.11.787 1.847 0 .419-.075.818-.225 1.197-.15.378-.388.775-.714 1.19-.216.275-.605.67-1.168 1.187-.563.516-.92.859-1.07 1.028a3.11 3.11 0 0 0-.365.495h3.542z"/></svg>',heading3:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm9.989 7.53 1.726-.209c.055.44.203.777.445 1.01.24.232.533.349.876.349.368 0 .678-.14.93-.42.251-.279.377-.655.377-1.13 0-.448-.12-.803-.362-1.066a1.153 1.153 0 0 0-.882-.393c-.228 0-.501.044-.819.133l.197-1.453c.482.012.85-.092 1.105-.315.253-.222.38-.517.38-.885 0-.313-.093-.563-.279-.75-.186-.185-.434-.278-.743-.278a1.07 1.07 0 0 0-.78.317c-.216.212-.347.52-.394.927l-1.644-.28c.114-.562.287-1.012.517-1.348.231-.337.553-.601.965-.794a3.24 3.24 0 0 1 1.387-.289c.876 0 1.579.28 2.108.838.436.457.653.973.653 1.549 0 .817-.446 1.468-1.339 1.955.533.114.96.37 1.28.768.319.398.478.878.478 1.441 0 .817-.298 1.513-.895 2.088-.596.576-1.339.864-2.228.864-.842 0-1.54-.243-2.094-.727-.555-.485-.876-1.118-.965-1.901z"/></svg>',heading4:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm13.55 10v-1.873h-3.81v-1.561l4.037-5.91h1.498v5.904h1.156v1.567h-1.156V18.5H17.05zm0-3.44v-3.18l-2.14 3.18h2.14z"/></svg>',heading5:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm9.578 7.607 1.777-.184c.05.402.201.72.45.955a1.223 1.223 0 0 0 1.81-.101c.258-.303.387-.759.387-1.368 0-.572-.128-1-.384-1.286-.256-.285-.59-.428-1-.428-.512 0-.971.226-1.377.679l-1.448-.21.915-4.843h4.716v1.67H15.56l-.28 1.58a2.697 2.697 0 0 1 1.219-.298 2.68 2.68 0 0 1 2.012.863c.55.576.825 1.323.825 2.241a3.36 3.36 0 0 1-.666 2.05c-.605.821-1.445 1.232-2.52 1.232-.86 0-1.56-.23-2.101-.692-.542-.461-.866-1.081-.971-1.86z"/></svg>',heading6:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm15.595 2.973-1.726.19c-.043-.355-.153-.617-.33-.787-.178-.169-.409-.253-.692-.253-.377 0-.695.169-.956.507-.26.339-.424 1.043-.492 2.114.445-.525.997-.787 1.657-.787.745 0 1.383.284 1.914.85.531.568.797 1.3.797 2.197 0 .952-.28 1.716-.838 2.291-.559.576-1.276.864-2.152.864-.94 0-1.712-.365-2.317-1.095-.605-.73-.908-1.927-.908-3.59 0-1.705.316-2.935.946-3.688.63-.753 1.45-1.13 2.457-1.13.706 0 1.291.198 1.755.594.463.395.758.97.885 1.723zm-4.043 3.891c0 .58.133 1.028.4 1.343.266.315.57.473.914.473.33 0 .605-.13.825-.388.22-.258.33-.68.33-1.27 0-.604-.118-1.047-.355-1.329a1.115 1.115 0 0 0-.89-.422c-.342 0-.632.134-.869.403s-.355.666-.355 1.19z"/></svg>'};class nv extends Ze{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,o=e.value;t.change(e=>{if(i.isCollapsed)o?e.setSelectionAttribute(this.attributeKey,o):e.removeSelectionAttribute(this.attributeKey);else{const n=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const t of n)o?e.setAttribute(this.attributeKey,o,t):e.removeAttribute(this.attributeKey,t)}})}}class rv extends Zi{constructor(e){super(e),this.set("isEmpty",!0),this.on("change",()=>{this.set("isEmpty",0===this.length)})}add(e,t){this.find(t=>t.color===e.color)||super.add(e,t)}hasColor(e){return!!this.find(t=>t.color===e)}}Ye(rv,qe);i(126);class sv extends Bc{constructor(e,{colors:t,columns:i,removeButtonLabel:o,documentColorsLabel:n,documentColorsCount:r}){super(e),this.items=this.createCollection(),this.colorDefinitions=t,this.focusTracker=new zs,this.keystrokes=new Ms,this.set("selectedColor"),this.removeButtonLabel=o,this.columns=i,this.documentColors=new rv,this.documentColorsCount=r,this._focusCycler=new hd({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this._documentColorsLabel=n,this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table"]},children:this.items}),this.items.add(this._removeColorButton())}updateDocumentColors(e,t){const i=e.document,o=this.documentColorsCount;this.documentColors.clear();for(const n of i.getRootNames()){const r=i.getRoot(n),s=e.createRangeIn(r);for(const e of s.getItems())if(e.is("$textProxy")&&e.hasAttribute(t)&&(this._addColorToDocumentColors(e.getAttribute(t)),this.documentColors.length>=o))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,i=this.selectedColor;t.selectedColor=i,e&&(e.selectedColor=i)}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}appendGrids(){if(!this.staticColorsGrid&&(this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount)){const e=Nc.bind(this.documentColors,this.documentColors),t=new Bd(this.locale);t.text=this._documentColorsLabel,t.extendTemplate({attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]}}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_removeColorButton(){const e=new rd;return e.set({withText:!0,icon:Rc.eraser,tooltip:!0,label:this.removeButtonLabel}),e.class="ck-color-table__remove-color",e.on("execute",()=>{this.fire("execute",{value:null})}),e}_createStaticColorsGrid(){const e=new gd(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.delegate("execute").to(this),e}_createDocumentColorsGrid(){const e=Nc.bind(this.documentColors,this.documentColors),t=new gd(this.locale,{columns:this.columns});return t.delegate("execute").to(this),t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using(e=>{const t=new dd;return t.set({color:e.color,hasBorder:e.options&&e.options.hasBorder}),e.label&&t.set({label:e.label,tooltip:!0}),t.on("execute",()=>{this.fire("execute",{value:e.color})}),t}),this.documentColors.on("change:isEmpty",(e,i,o)=>{o&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find(t=>t.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}function av(e,t){const i={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)i.model.values.push(e.model),i.view[e.model]=e.view,e.upcastAlso&&(i.upcastAlso[e.model]=e.upcastAlso);return i}function lv(e){return t=>t.getStyle(e).replace(/\s/g,"")}function cv(e){return(t,{writer:i})=>i.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class dv extends nv{constructor(e){super(e,"fontFamily")}}function hv(e){return e.map(uv).filter(e=>!!e)}function uv(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),i=t[0],o=t.map(gv).join(", ");return{title:i,model:o,view:{name:"span",styles:{"font-family":o},priority:7}}}(e):void 0}function gv(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class mv extends Qe{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define("fontFamily",{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"fontFamily"}),e.model.schema.setAttributeProperties("fontFamily",{isFormatting:!0,copyOnEnter:!0});const t=av("fontFamily",hv(e.config.get("fontFamily.options")).filter(e=>e.model));e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(t),e.commands.add("fontFamily",new dv(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:"fontFamily",view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:"fontFamily",value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:"fontFamily",value:e=>e.getAttribute("face")}})}}class fv extends Qe{static get pluginName(){return"FontFamilyUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),o=e.commands.get("fontFamily");e.ui.componentFactory.add("fontFamily",n=>{const r=Vd(n);return zd(r,function(e,t){const i=new Zi;for(const o of e){const e={type:"button",model:new $d({commandName:"fontFamily",commandParam:o.model,label:o.title,withText:!0})};e.model.bind("isOn").to(t,"value",e=>e===o.model||!(!e||!o.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===o.model.toLowerCase()),o.view&&o.view.styles&&e.model.set("labelStyle","font-family: "+o.view.styles["font-family"]),i.add(e)}return i}(i,o)),r.buttonView.set({label:t("Font Family"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>',tooltip:!0}),r.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),r.bind("isEnabled").to(o),this.listenTo(r,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),r})}_getLocalizedOptions(){const e=this.editor,t=e.t;return hv(e.config.get("fontFamily").options).map(e=>("Default"===e.title&&(e.title=t("Default")),e))}}class pv extends Qe{static get requires(){return[mv,fv]}static get pluginName(){return"FontFamily"}}class bv extends nv{constructor(e){super(e,"fontSize")}}function wv(e){return e.map(e=>function(e){if(t=e,"object"==typeof t&&t.title&&t.model&&t.view)return _v(e);var t;const i=function(e){return kv[e]||kv[e.model]}(e);if(i)return _v(i);if("default"===e)return{model:void 0,title:"Default"};if(function(e){let t;if("object"==typeof e){if(!e.model)throw new l.a("font-size-invalid-definition",null,e);t=parseFloat(e.model)}else t=parseFloat(e);return isNaN(t)}(e))return;return function(e){"number"!=typeof e&&"string"!=typeof e||(e={title:String(e),model:parseFloat(e)+"px"});return e.view={name:"span",styles:{"font-size":e.model}},_v(e)}(e)}(e)).filter(e=>!!e)}const kv={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function _v(e){return e.view.priority||(e.view.priority=7),e}const vv=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class yv extends Qe{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define("fontSize",{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"fontSize"}),e.model.schema.setAttributeProperties("fontSize",{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),i=av("fontSize",wv(this.editor.config.get("fontSize.options")).filter(e=>e.model));t?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add("fontSize",new bv(e))}_prepareAnyValueConverters(e){const t=this.editor,i=e.model.values.filter(e=>!Dh(String(e))&&!Hh(String(e)));if(i.length)throw new l.a("font-size-invalid-use-of-named-presets",null,{presets:i});t.conversion.for("downcast").attributeToElement({model:"fontSize",view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:"fontSize",value:e=>e.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:"fontSize",value:e=>{const t=e.getAttribute("size"),i="-"===t[0]||"+"===t[0];let o=parseInt(t,10);i&&(o=3+o);const n=vv.length-1,r=Math.min(Math.max(o,0),n);return vv[r]}}})}}i(128);class xv extends Qe{static get pluginName(){return"FontSizeUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),o=e.commands.get("fontSize");e.ui.componentFactory.add("fontSize",n=>{const r=Vd(n);return zd(r,function(e,t){const i=new Zi;for(const o of e){const e={type:"button",model:new $d({commandName:"fontSize",commandParam:o.model,label:o.title,class:"ck-fontsize-option",withText:!0})};o.view&&o.view.styles&&e.model.set("labelStyle","font-size:"+o.view.styles["font-size"]),o.view&&o.view.classes&&e.model.set("class",`${e.model.class} ${o.view.classes}`),e.model.bind("isOn").to(t,"value",e=>e===o.model),i.add(e)}return i}(i,o)),r.buttonView.set({label:t("Font Size"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>',tooltip:!0}),r.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),r.bind("isEnabled").to(o),this.listenTo(r,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),r})}_getLocalizedOptions(){const e=this.editor,t=e.t,i={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return wv(e.config.get("fontSize").options).map(e=>{const t=i[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e})}}class Cv extends Qe{static get requires(){return[yv,xv]}static get pluginName(){return"FontSize"}}class Av extends nv{constructor(e){super(e,"fontColor")}}class Tv extends Qe{static get pluginName(){return"FontColorEditing"}constructor(e){super(e),e.config.define("fontColor",{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:"fontColor",value:lv("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:"fontColor",value:e=>e.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:"fontColor",view:cv("color")}),e.commands.add("fontColor",new Av(e)),e.model.schema.extend("$text",{allowAttributes:"fontColor"}),e.model.schema.setAttributeProperties("fontColor",{isFormatting:!0,copyOnEnter:!0})}}class Ev extends Qe{constructor(e,{commandName:t,icon:i,componentName:o,dropdownLabel:n}){super(e),this.commandName=t,this.componentName=o,this.icon=i,this.dropdownLabel=n,this.columns=e.config.get(this.componentName+".columns"),this.colorTableView=void 0}init(){const e=this.editor,t=e.locale,i=t.t,o=e.commands.get(this.commandName),n=ad(t,ld(e.config.get(this.componentName).colors)),r=e.config.get(this.componentName+".documentColors");e.ui.componentFactory.add(this.componentName,t=>{const s=Vd(t);return this.colorTableView=function({dropdownView:e,colors:t,columns:i,removeButtonLabel:o,documentColorsLabel:n,documentColorsCount:r}){const s=e.locale,a=new sv(s,{colors:t,columns:i,removeButtonLabel:o,documentColorsLabel:n,documentColorsCount:r});return e.colorTableView=a,e.panelView.children.add(a),a.delegate("execute").to(e,"execute"),a}({dropdownView:s,colors:n.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),documentColorsLabel:0!==r?i("Document colors"):void 0,documentColorsCount:void 0===r?this.columns:r}),this.colorTableView.bind("selectedColor").to(o,"value"),s.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),s.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),s.bind("isEnabled").to(o),s.on("execute",(t,i)=>{e.execute(this.commandName,i),e.editing.view.focus()}),s.on("change:isOpen",(t,i,o)=>{s.colorTableView.appendGrids(),o&&(0!==r&&this.colorTableView.updateDocumentColors(e.model,this.componentName),this.colorTableView.updateSelectedColors())}),s})}}class Pv extends Ev{constructor(e){super(e,{commandName:"fontColor",componentName:"fontColor",icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>',dropdownLabel:(0,e.locale.t)("Font Color")})}static get pluginName(){return"FontColorUI"}}class Sv extends Qe{static get requires(){return[Tv,Pv]}static get pluginName(){return"FontColor"}}class Iv extends nv{constructor(e){super(e,"fontBackgroundColor")}}class Rv extends Qe{static get pluginName(){return"FontBackgroundColorEditing"}constructor(e){super(e),e.config.define("fontBackgroundColor",{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(eu),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:"fontBackgroundColor",value:lv("background-color")}}),e.conversion.for("downcast").attributeToElement({model:"fontBackgroundColor",view:cv("background-color")}),e.commands.add("fontBackgroundColor",new Iv(e)),e.model.schema.extend("$text",{allowAttributes:"fontBackgroundColor"}),e.model.schema.setAttributeProperties("fontBackgroundColor",{isFormatting:!0,copyOnEnter:!0})}}class Vv extends Ev{constructor(e){super(e,{commandName:"fontBackgroundColor",componentName:"fontBackgroundColor",icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>',dropdownLabel:(0,e.locale.t)("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class Ov extends Qe{static get requires(){return[Rv,Vv]}static get pluginName(){return"FontBackgroundColor"}}function zv(e){const t=e.t,i=e.config.get("codeBlock.languages");for(const e of i)"Plain text"===e.label&&(e.label=t("Plain text")),void 0===e.class&&(e.class="language-"+e.language);return i}function Mv(e,t,i){const o={};for(const n of e)"class"===t?o[n[t].split(" ").shift()]=n[i]:o[n[t]]=n[i];return o}function Bv(e){return e.data.match(/^(\s*)/)[0]}function Nv(e){const t=e.document.selection,i=[];if(t.isCollapsed)i.push(t.anchor);else{const o=t.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:t}of o)if(t.is("$textProxy")&&t.parent.is("element","codeBlock")){const o=Bv(t.textNode),{parent:n,startOffset:r}=t.textNode,s=e.createPositionAt(n,r+o.length);i.push(s)}}return i}function Fv(e){const t=Os(e.getSelectedBlocks());return t&&t.is("element","codeBlock")}class Dv extends Ze{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,i=t.model,o=i.document.selection,n=zv(t)[0],r=Array.from(o.getSelectedBlocks()),s=void 0===e.forceValue?!this.value:e.forceValue,a=function(e,t,i){if(e.language)return e.language;if(e.usePreviousLanguageChoice&&t)return t;return i}(e,this._lastLanguage,n.language);i.change(e=>{s?this._applyCodeBlock(e,r,a):this._removeCodeBlock(e,r)})}_getValue(){const e=Os(this.editor.model.document.selection.getSelectedBlocks());return!!!(!e||!e.is("element","codeBlock"))&&e.getAttribute("language")}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Os(e.getSelectedBlocks());return!!i&&Lv(t,i)}_applyCodeBlock(e,t,i){this._lastLanguage=i;const o=this.editor.model.schema,n=t.filter(e=>Lv(o,e));for(const t of n)e.rename(t,"codeBlock"),e.setAttribute("language",i,t),o.removeDisallowedAttributes([t],e),Array.from(t.getChildren()).filter(e=>!o.checkChild(t,e)).forEach(t=>e.remove(t));n.reverse().forEach((t,i)=>{const o=n[i+1];t.previousSibling===o&&(e.appendElement("softBreak",o),e.merge(e.createPositionBefore(t)))})}_removeCodeBlock(e,t){const i=t.filter(e=>e.is("element","codeBlock"));for(const t of i){const i=e.createRangeOn(t);for(const t of Array.from(i.getItems()).reverse())if(t.is("element","softBreak")&&t.parent.is("element","codeBlock")){const{position:i}=e.split(e.createPositionBefore(t));e.rename(i.nodeAfter,"paragraph"),e.removeAttribute("language",i.nodeAfter),e.remove(t)}e.rename(t,"paragraph"),e.removeAttribute("language",t)}}}function Lv(e,t){return!t.is("rootElement")&&!e.isLimit(t)&&e.checkChild(t.parent,"codeBlock")}class Hv extends Ze{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change(t=>{const i=Nv(e);for(const e of i)t.insertText(this._indentSequence,e)})}_checkEnabled(){return!!this._indentSequence&&Fv(this.editor.model.document.selection)}}class jv extends Ze{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change(t=>{const i=Nv(e);for(const e of i){const i=Wv(this.editor.model,e,this._indentSequence);i&&t.remove(i)}})}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return!!Fv(e.document.selection)&&Nv(e).some(t=>Wv(e,t,this._indentSequence))}}function Wv(e,t,i){const o=function(e){let t=e.parent.getChild(e.index);t&&!t.is("element","softBreak")||(t=e.nodeBefore);if(!t||t.is("element","softBreak"))return null;return t}(t);if(!o)return null;const n=Bv(o),r=n.lastIndexOf(i);if(r+i.length!==n.length)return null;if(-1===r)return null;const{parent:s,startOffset:a}=o;return e.createRange(e.createPositionAt(s,a+r),e.createPositionAt(s,a+r+i.length))}function qv(e,t,i=!1){const o=Mv(t,"language","class"),n=Mv(t,"language","label");return(t,r,s)=>{const{writer:a,mapper:l,consumable:c}=s;if(!c.consume(r.item,"insert"))return;const d=r.item.getAttribute("language"),h=l.toViewPosition(e.createPositionBefore(r.item)),u={};i&&(u["data-language"]=n[d],u.spellcheck="false");const g=a.createContainerElement("pre",u),m=a.createContainerElement("code",{class:o[d]||null});a.insert(a.createPositionAt(g,0),m),a.insert(h,g),l.bindElements(r.item,m)}}class $v extends Qe{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[Ug]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"\t"})}init(){const e=this.editor,t=e.model.schema,i=e.model,o=(e.editing.view,zv(e));e.commands.add("codeBlock",new Dv(e)),e.commands.add("indentCodeBlock",new Hv(e)),e.commands.add("outdentCodeBlock",new jv(e));const n=e=>(t,i)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),i())};e.keystrokes.set("Tab",n("indentCodeBlock")),e.keystrokes.set("Shift+Tab",n("outdentCodeBlock")),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",isBlock:!0,allowAttributes:["language"]}),t.addAttributeCheck(e=>{if(e.endsWith("codeBlock $text"))return!1}),e.model.schema.addChildCheck((e,t)=>{if(e.endsWith("codeBlock")&&t.isObject)return!1}),e.editing.downcastDispatcher.on("insert:codeBlock",qv(i,o,!0)),e.data.downcastDispatcher.on("insert:codeBlock",qv(i,o)),e.data.downcastDispatcher.on("insert:softBreak",function(e){return(t,i,o)=>{if("codeBlock"!==i.item.parent.name)return;const{writer:n,mapper:r,consumable:s}=o;if(!s.consume(i.item,"insert"))return;const a=r.toViewPosition(e.createPositionBefore(i.item));n.insert(a,n.createText("\n"))}}(i),{priority:"high"}),e.data.upcastDispatcher.on("element:code",function(e,t){const i=Mv(t,"class","language"),o=t[0].language;return(e,t,n)=>{const r=t.viewItem,s=r.parent;if(!s||!s.is("element","pre"))return;if(t.modelCursor.findAncestor("codeBlock"))return;const{consumable:a,writer:l}=n;if(!a.test(r,{name:!0}))return;const c=l.createElement("codeBlock"),d=[...r.getClassNames()];d.length||d.push("");for(const e of d){const t=i[e];if(t){l.setAttribute("language",t,c);break}}c.hasAttribute("language")||l.setAttribute("language",o,c),n.convertChildren(r,c),n.safeInsert(c,t.modelCursor)&&(a.consume(r,{name:!0}),n.updateConversionResult(c,t))}}(0,o)),e.data.upcastDispatcher.on("text",(e,t,{consumable:i,writer:o})=>{let n=t.modelCursor;if(!i.test(t.viewItem))return;if(!n.findAncestor("codeBlock"))return;i.consume(t.viewItem);const r=t.viewItem.data.split("\n").map(e=>o.createText(e)),s=r[r.length-1];for(const e of r)if(o.insert(e,n),n=n.getShiftedBy(e.offsetSize),e!==s){const e=o.createElement("softBreak");o.insert(e,n),n=o.createPositionAfter(e)}t.modelRange=o.createRange(t.modelCursor,n),t.modelCursor=n}),this.listenTo(e.editing.view.document,"clipboardInput",(t,o)=>{let n=i.createRange(i.document.selection.anchor);if(o.targetRanges&&(n=e.editing.mapper.toModelRange(o.targetRanges[0])),!n.start.parent.is("element","codeBlock"))return;const r=o.dataTransfer.getData("text/plain"),s=new Ph(e.editing.view.document);o.content=function(e,t){const i=e.createDocumentFragment(),o=t.split("\n"),n=o.reduce((t,i,n)=>(t.push(i),n<o.length-1&&t.push(e.createElement("br")),t),[]);return e.appendChild(n,i),i}(s,r)}),this.listenTo(i,"getSelectedContent",(e,[o])=>{const n=o.anchor;!o.isCollapsed&&n.parent.is("element","codeBlock")&&n.hasSameParentAs(o.focus)&&i.change(i=>{const r=e.return;if(r.childCount>1||o.containsEntireContent(n.parent)){const t=i.createElement("codeBlock",n.parent.getAttributes());i.append(r,t);const o=i.createDocumentFragment();i.append(t,o),e.return=o}else{const e=r.getChild(0);t.checkAttribute(e,"code")&&i.setAttribute("code",!0,e)}})})}afterInit(){const e=this.editor,t=e.commands,i=t.get("indent"),o=t.get("outdent");i&&i.registerChildCommand(t.get("indentCodeBlock")),o&&o.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",(t,i)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(e,t){const i=e.model.document,o=e.editing.view,n=i.selection.getLastPosition(),r=n.nodeAfter;if(t||!i.selection.isCollapsed||!n.isAtStart)return!1;if(!r||!r.is("element","softBreak"))return!1;return e.model.change(t=>{e.execute("enter");const o=i.selection.anchor.parent.previousSibling;t.rename(o,"paragraph"),t.setSelection(o,"in"),e.model.schema.removeDisallowedAttributes([o],t),t.remove(r)}),o.scrollToTheSelection(),!0}(e,i.isSoft)||function(e,t){const i=e.model,o=i.document,n=e.editing.view,r=o.selection.getLastPosition(),s=r.nodeBefore;let a;if(t||!o.selection.isCollapsed||!r.isAtEnd||!s)return!1;if(s.is("element","softBreak"))a=i.createRangeOn(s);else{if(!s.is("$text")||s.data.match(/\S/)||!s.previousSibling||!s.previousSibling.is("element","softBreak"))return!1;a=i.createRange(i.createPositionBefore(s.previousSibling),i.createPositionAfter(s))}return e.model.change(t=>{t.remove(a),e.execute("enter");const i=o.selection.anchor.parent;t.rename(i,"paragraph"),e.model.schema.removeDisallowedAttributes([i],t)}),n.scrollToTheSelection(),!0}(e,i.isSoft)||function(e){const t=e.model.document,i=t.selection.getLastPosition(),o=i.nodeBefore||i.textNode;let n;o&&o.is("$text")&&(n=Bv(o));e.model.change(i=>{e.execute("shiftEnter"),n&&i.insertText(n,t.selection.anchor)})}(e),i.preventDefault(),t.stop())},{context:"pre"})}}i(130);class Uv extends Qe{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,i=e.ui.componentFactory,o=zv(e);i.add("codeBlock",i=>{const n=e.commands.get("codeBlock"),r=Vd(i,pd),s=r.buttonView;return s.set({label:t("Insert code block"),tooltip:!0,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',isToggleable:!0}),s.bind("isOn").to(n,"value",e=>!!e),s.on("execute",()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()}),r.on("execute",t=>{e.execute("codeBlock",{language:t.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()}),r.class="ck-code-block-dropdown",r.bind("isEnabled").to(n),zd(r,this._getLanguageListItemDefinitions(o)),r})}_getLanguageListItemDefinitions(e){const t=this.editor.commands.get("codeBlock"),i=new Zi;for(const o of e){const e={type:"button",model:new $d({_codeBlockLanguage:o.language,label:o.label,withText:!0})};e.model.bind("isOn").to(t,"value",t=>t===e.model._codeBlockLanguage),i.add(e)}return i}}class Kv extends Ze{refresh(){const e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention")}execute(e){const t=this.editor.model,i=t.document.selection,o="string"==typeof e.mention?{id:e.mention}:e.mention,n=o.id,r=e.range||i.getFirstRange(),s=e.text||n,a=Jv({_text:s,id:n},o);if(1!=e.marker.length)throw new l.a("mentioncommand-incorrect-marker",this);if(n.charAt(0)!=e.marker)throw new l.a("mentioncommand-incorrect-id",this);t.change(e=>{const o=mo(i.getAttributes()),n=new Map(o.entries());n.set("mention",a),t.insertContent(e.createText(s,n),r),t.insertContent(e.createText(" ",o),r.start.getShiftedBy(s.length))})}}class Gv extends Qe{static get pluginName(){return"MentionEditing"}init(){const e=this.editor,t=e.model,i=t.document;t.schema.extend("$text",{allowAttributes:"mention"}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",key:"data-mention",classes:"mention"},model:{key:"mention",value:e=>Yv(e)}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:Xv}),e.conversion.for("downcast").add(Qv),i.registerPostFixer(e=>function(e,t,i){const o=t.differ.getChanges();let n=!1;for(const t of o){const o=t.position;if("$text"==t.name){const t=o.textNode&&o.textNode.nextSibling;n=ey(o.textNode,e)||n,n=ey(t,e)||n,n=ey(o.nodeBefore,e)||n,n=ey(o.nodeAfter,e)||n}if("$text"!=t.name&&"insert"==t.type){const t=o.nodeAfter;for(const i of e.createRangeIn(t).getItems())n=ey(i,e)||n}if("insert"==t.type&&i.isInline(t.name)){const t=o.nodeAfter&&o.nodeAfter.nextSibling;n=ey(o.nodeBefore,e)||n,n=ey(t,e)||n}}return n}(e,i,t.schema)),i.registerPostFixer(e=>function(e,t){const i=t.differ.getChanges();let o=!1;for(const t of i)if("attribute"===t.type&&"mention"!=t.attributeKey){const i=t.range.start.nodeBefore,n=t.range.end.nodeAfter;for(const r of[i,n])Zv(r)&&r.getAttribute(t.attributeKey)!=t.attributeNewValue&&(e.setAttribute(t.attributeKey,t.attributeNewValue,r),o=!0)}return o}(e,i)),i.registerPostFixer(e=>function(e,t){const i=t.selection,o=i.focus;if(i.isCollapsed&&i.hasAttribute("mention")&&function(e){const t=e.isAtStart;return e.nodeBefore&&e.nodeBefore.is("$text")||t}(o))return e.removeSelectionAttribute("mention"),!0}(e,i)),e.commands.add("mention",new Kv(e))}}function Jv(e,t){return Object.assign({uid:s()},e,t||{})}function Yv(e,t){const i=e.getAttribute("data-mention"),o=e.getChild(0);if(!o)return;return Jv({id:i,_text:o.data},t)}function Qv(e){e.on("attribute:mention",(e,t,i)=>{const o=t.attributeNewValue;if(!t.item.is("$textProxy")||!o)return;const n=t.range.start;(n.textNode||n.nodeAfter).data!=o._text&&i.consumable.consume(t.item,e.name)},{priority:"highest"})}function Xv(e,{writer:t}){if(!e)return;const i={class:"mention","data-mention":e.id},o={id:e.uid,priority:20};return t.createAttributeElement("span",i,o)}function Zv(e){if(!e||!e.is("$text")&&!e.is("$textProxy")||!e.hasAttribute("mention"))return!1;return e.data!=e.getAttribute("mention")._text}function ey(e,t){return!!Zv(e)&&(t.removeAttribute("mention",e),!0)}i(132);class ty extends Sd{constructor(e){super(e),this.extendTemplate({attributes:{class:["ck-mentions"],tabindex:"-1"}})}selectFirst(){this.select(0)}selectNext(){const e=this.selected,t=this.items.getIndex(e);this.select(t+1)}selectPrevious(){const e=this.selected,t=this.items.getIndex(e);this.select(t-1)}select(e){let t=0;e>0&&e<this.items.length?t=e:e<0&&(t=this.items.length-1);const i=this.items.get(t);this.selected!==i&&(this.selected&&this.selected.removeHighlight(),i.highlight(),this.selected=i,this._isItemVisibleInScrolledArea(i)||(this.element.scrollTop=i.element.offsetTop))}executeSelected(){this.selected.fire("execute")}_isItemVisibleInScrolledArea(e){return new Ts(this.element).contains(new Ts(e.element))}}class iy extends Bc{constructor(e,t){super(e),this.template=!1,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",!1),this.on("change:isOn",(e,t,i)=>{i?(this.domElement.classList.add("ck-on"),this.domElement.classList.remove("ck-off")):(this.domElement.classList.add("ck-off"),this.domElement.classList.remove("ck-on"))}),this.listenTo(this.domElement,"click",()=>{this.fire("execute")})}render(){super.render(),this.element=this.domElement}}class oy extends Id{highlight(){this.children.first.isOn=!0}removeHighlight(){this.children.first.isOn=!1}}const ny=[On.arrowup,On.arrowdown,On.esc],ry=[On.enter,On.tab];class sy extends Qe{static get pluginName(){return"MentionUI"}static get requires(){return[eh]}constructor(e){super(e),this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=fs(this._requestFeed,100),e.config.define("mention",{feeds:[]})}init(){const e=this.editor,t=e.config.get("mention.commitKeys")||ry,i=ny.concat(t);this._balloon=e.plugins.get(eh),e.editing.view.document.on("keydown",(e,o)=>{if(n=o.keyCode,i.includes(n)&&this._isUIVisible){if(o.keyCode==On.space)return void this._hideUIAndRemoveMarker();o.preventDefault(),e.stop(),o.keyCode==On.arrowdown&&this._mentionsView.selectNext(),o.keyCode==On.arrowup&&this._mentionsView.selectPrevious(),t.includes(o.keyCode)&&this._mentionsView.executeSelected(),o.keyCode==On.esc&&this._hideUIAndRemoveMarker()}var n},{priority:"highest"}),Vc({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const o=e.config.get("mention.feeds");for(const e of o){const t=e.feed,i=e.marker;if(!dy(i))throw new l.a("mentionconfig-incorrect-marker",null,{marker:i});const o=e.minimumCharacters||0,n="function"==typeof t?t.bind(this.editor):cy(t),r={watcher:this._setupTextWatcherForFeed(i,o),marker:i,feedCallback:n,itemRenderer:e.itemRenderer};this._mentionsConfigurations.set(i,r)}this.on("requestFeed:response",(e,t)=>this._handleFeedResponse(t)),this.on("requestFeed:error",()=>this._hideUIAndRemoveMarker())}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){const e=this.editor.locale,t=new ty(e);return this._items=new Zi,t.items.bindTo(this._items).using(i=>{const{item:o,marker:n}=i,r=new oy(e),s=this._renderItem(o,n);return s.delegate("execute").to(r),r.children.add(s),r.item=o,r.marker=n,r.on("execute",()=>{t.fire("execute",{item:o,marker:n})}),r}),t.on("execute",(e,t)=>{const i=this.editor,o=i.model,n=t.item,r=t.marker,s=i.model.markers.get("mention"),a=o.createPositionAt(o.document.selection.focus),l=o.createPositionAt(s.getStart()),c=o.createRange(l,a);this._hideUIAndRemoveMarker(),i.execute("mention",{mention:n,text:n.text,marker:r,range:c}),i.editing.view.focus()}),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:i}=this._mentionsConfigurations.get(e),o=i(t);o instanceof Promise?o.then(i=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:i,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:i,marker:e,feedText:t})}).catch(t=>{this.fire("requestFeed:error",{error:t}),Object(l.b)("mention-feed-callback-error",{marker:e})}):this.fire("requestFeed:response",{feed:o,marker:e,feedText:t})}_setupTextWatcherForFeed(e,t){const i=this.editor,o=new tg(i.model,function(e,t){const i=ly(e,t);return e=>i.test(e)}(e,t));o.on("matched:data",(t,o)=>{const n=i.model.document.selection.focus;if(function(e){const t=e.textNode&&e.textNode.hasAttribute("mention"),i=e.nodeBefore;return t||i&&i.is("$text")&&i.hasAttribute("mention")}(n))return void this._hideUIAndRemoveMarker();const r=function(e,t){const i=ly(e,0);return t.match(i)[2]}(e,o.text),s=e.length+r.length,a=n.getShiftedBy(-s),l=n.getShiftedBy(-r.length),c=i.model.createRange(a,l);if(hy(i)){const e=i.model.markers.get("mention");i.model.change(t=>{t.updateMarker(e,{range:c})})}else i.model.change(e=>{e.addMarker("mention",{range:c,usingOperation:!1,affectsData:!1})});this._requestFeedDebounced(e,r)}),o.on("unmatched",()=>{this._hideUIAndRemoveMarker()});const n=i.commands.get("mention");return o.bind("isEnabled").to(n),o}_handleFeedResponse(e){const{feed:t,marker:i}=e;if(!hy(this.editor))return;this._items.clear();for(const e of t){const t="object"!=typeof e?{id:e,text:e}:e;this._items.add({item:t,marker:i})}const o=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(o):this._hideUIAndRemoveMarker()}_showOrUpdateUI(e){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(e,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(e,this._mentionsView.position),singleViewMode:!0}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),hy(this.editor)&&this.editor.model.change(e=>e.removeMarker("mention")),this._mentionsView.position=void 0}_renderItem(e,t){const i=this.editor;let o,n=e.id;const r=this._getItemRenderer(t);if(r){const t=r(e);"string"!=typeof t?o=new iy(i.locale,t):n=t}if(!o){const e=new rd(i.locale);e.label=n,e.withText=!0,o=e}return o}_getBalloonPanelPositionData(e,t){const i=this.editor,o=i.editing,n=o.view.domConverter,r=o.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=i.model.document.selection.getFirstRange());const o=r.toViewRange(t);return Ts.getDomRangeRects(n.viewRangeToDom(o)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:ay(t)}}}function ay(e){const t={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se",config:{withArrow:!1}}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(t,e)?[t[e]]:[t.caret_se,t.caret_sw,t.caret_ne,t.caret_nw]}function ly(e,t){const i=0==t?"*":`{${t},}`,o=In.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";return new RegExp(`(?:^|[= ${o}])([${e}])([^\\s=]${i})$`,"u")}function cy(e){return t=>e.filter(e=>("string"==typeof e?e:String(e.id)).toLowerCase().includes(t.toLowerCase())).slice(0,10)}function dy(e){return e&&1==e.length}function hy(e){return e.model.markers.has("mention")}i(134);class uy extends Qe{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new tt(e)),e.commands.add("outdent",new tt(e))}}var gy='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',my='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>';class fy extends Qe{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,o="ltr"==t.uiLanguageDirection?gy:my,n="ltr"==t.uiLanguageDirection?my:gy;this._defineButton("indent",i("Increase indent"),o),this._defineButton("outdent",i("Decrease indent"),n)}_defineButton(e,t,i){const o=this.editor;o.ui.componentFactory.add(e,n=>{const r=o.commands.get(e),s=new rd(n);return s.set({label:t,icon:i,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",()=>{o.execute(e),o.editing.view.focus()}),s})}}class py extends Ze{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const e=this.editor.model,t=Os(e.document.selection.getSelectedBlocks());t&&e.schema.checkAttribute(t,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(t.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const e=this.editor.model,t=function(e){const t=e.document.selection,i=e.schema;return Array.from(t.getSelectedBlocks()).filter(e=>i.checkAttribute(e,"blockIndent"))}(e);e.change(e=>{for(const i of t){const t=i.getAttribute("blockIndent"),o=this._indentBehavior.getNextIndent(t);o?e.setAttribute("blockIndent",o,i):e.removeAttribute("blockIndent",i)}})}}class by{constructor(e){this.isForward="forward"===e.direction,this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||0);return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||0);if(!(!e||e.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const i=t+(this.isForward?this.offset:-this.offset);return i>0?i+this.unit:void 0}}class wy{constructor(e){this.isForward="forward"===e.direction,this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e),i=this.isForward?1:-1;return this.classes[t+i]}}const ky=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class _y extends Ze{execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!vy(e.schema,i))do{if(i=i.parent,!i)return}while(!vy(e.schema,i));e.change(e=>{e.setSelection(i,"in")})}}function vy(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const yy=Bn("Ctrl+A");class xy extends Qe{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new _y(e)),this.listenTo(t,"keydown",(t,i)=>{Mn(i)===yy&&(e.execute("selectAll"),i.preventDefault())})}}class Cy extends Qe{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const i=e.commands.get("selectAll"),o=new rd(t),n=t.t;return o.set({label:n("Select all"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>',keystroke:"Ctrl+A",tooltip:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),o})}}class Ay extends Qe{static get requires(){return[xy,Cy]}static get pluginName(){return"SelectAll"}}class Ty extends Ze{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=function(e,t,i){const o=function(e,t){const i=km(e,t).start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(e,i);return t.checkChild(o,"horizontalLine")}(i,t,e)}execute(){const e=this.editor.model;e.change(t=>{const i=t.createElement("horizontalLine");e.insertContent(i);let o=i.nextSibling;!(o&&e.schema.checkChild(o,"$text"))&&e.schema.checkChild(i.parent,"paragraph")&&(o=t.createElement("paragraph"),e.insertContent(o,t.createPositionAfter(i))),o&&t.setSelection(o,0)})}}i(136);class Ey extends Qe{static get pluginName(){return"HorizontalLineEditing"}init(){const e=this.editor,t=e.model.schema,i=e.t,o=e.conversion;t.register("horizontalLine",{isObject:!0,allowWhere:"$block"}),o.for("dataDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>t.createEmptyElement("hr")}),o.for("editingDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>{const o=i("Horizontal line"),n=t.createContainerElement("div"),r=t.createEmptyElement("hr");return t.addClass("ck-horizontal-line",n),t.setCustomProperty("hr",!0,n),t.insert(t.createPositionAt(n,0),r),function(e,t,i){return t.setCustomProperty("horizontalLine",!0,e),gm(e,t,{label:i})}(n,t,o)}}),o.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new Ty(e))}}class Py extends Qe{static get pluginName(){return"HorizontalLineUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("horizontalLine",i=>{const o=e.commands.get("horizontalLine"),n=new rd(i);return n.set({label:t("Horizontal line"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 9h16v2H2z"/></svg>',tooltip:!0}),n.bind("isEnabled").to(o,"isEnabled"),this.listenTo(n,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),n})}}class Sy extends Ze{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(e.data,"set",(e,t)=>{t[1]={...t[1]};const i=t[1];i.batchType||(i.batchType="transparent")},{priority:"high"}),this.listenTo(e.data,"set",(e,t)=>{"transparent"===t[1].batchType&&this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}addBatch(e){const t=this.editor.model.document.selection,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,i){const o=this.editor.model,n=o.document,r=[],s=e.map(e=>e.getTransformedByOperations(i)),a=s.flat();for(const e of s){const t=e.filter(e=>e.root!=n.graveyard).filter(e=>!Ry(e,a));t.length&&(Iy(t),r.push(t[0]))}r.length&&o.change(e=>{e.setSelection(r,{backward:t})})}_undo(e,t){const i=this.editor.model,o=i.document;this._createdBatches.add(t);const n=e.operations.slice().filter(e=>e.isDocumentOperation);n.reverse();for(const e of n){const n=e.baseVersion+1,r=Array.from(o.history.getOperations(n)),s=kh([e.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const n of s)t.addOperation(n),i.applyOperation(n),o.history.setOperationAsUndone(e,n)}}}function Iy(e){e.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let t=1;t<e.length;t++){const i=e[t-1].getJoined(e[t],!0);i&&(t--,e.splice(t,2,i))}}function Ry(e,t){return t.some(t=>t!==e&&t.containsRange(e,!0))}class Vy extends Sy{execute(e=null){const t=e?this._stack.findIndex(t=>t.batch==e):this._stack.length-1,i=this._stack.splice(t,1)[0],o=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(o,()=>{this._undo(i.batch,o);const e=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,e),this.fire("revert",i.batch,o)}),this.refresh()}}class Oy extends Sy{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(t,()=>{const i=e.batch.operations[e.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(i);this._restoreSelection(e.selection.ranges,e.selection.isBackward,o),this._undo(e.batch,t)}),this.refresh()}}class zy extends Qe{static get pluginName(){return"UndoEditing"}constructor(e){super(e),this._batchRegistry=new WeakSet}init(){const e=this.editor;this._undoCommand=new Vy(e),this._redoCommand=new Oy(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(e,t)=>{const i=t[0];if(!i.isDocumentOperation)return;const o=i.batch,n=this._redoCommand._createdBatches.has(o),r=this._undoCommand._createdBatches.has(o);this._batchRegistry.has(o)||"transparent"==o.type&&!n&&!r||(n?this._undoCommand.addBatch(o):r||(this._undoCommand.addBatch(o),this._redoCommand.clearStack()),this._batchRegistry.add(o))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(e,t,i)=>{this._redoCommand.addBatch(i)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}var My='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',By='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>';class Ny extends Qe{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,o="ltr"==t.uiLanguageDirection?My:By,n="ltr"==t.uiLanguageDirection?By:My;this._addButton("undo",i("Undo"),"CTRL+Z",o),this._addButton("redo",i("Redo"),"CTRL+Y",n)}_addButton(e,t,i,o){const n=this.editor;n.ui.componentFactory.add(e,r=>{const s=n.commands.get(e),a=new rd(r);return a.set({label:t,icon:o,keystroke:i,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",()=>{n.execute(e),n.editing.view.focus()}),a})}}class Fy extends Qe{static get requires(){return[zy,Ny]}static get pluginName(){return"Undo"}}class Dy extends Qe{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("removeFormat",i=>{const o=e.commands.get("removeFormat"),n=new rd(i);return n.set({label:t("Remove Format"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.69 14.915c.053.052.173.083.36.093a.366.366 0 0 1 .345.485l-.003.01a.738.738 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.681.681 0 0 1 .644-.458c.197-.012.325-.043.386-.093a.28.28 0 0 0 .072-.11L9.592 4.5H6.269c-.359-.017-.609.013-.75.09-.142.078-.289.265-.442.563-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486c.001-.284-.054-.464-.167-.54-.112-.076-.367-.106-.766-.091h-3.28l-2.68 10.257c-.006.074.007.127.038.158zM3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1zm11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414-1.414 1.414z"/></svg>',tooltip:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("removeFormat"),e.editing.view.focus()}),n})}}class Ly extends Ze{refresh(){const e=this.editor.model;this.isEnabled=!!Os(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change(i=>{for(const o of this._getFormattingItems(e.document.selection,t))if(o.is("selection"))for(const e of this._getFormattingAttributes(o,t))i.removeSelectionAttribute(e);else{const e=i.createRangeOn(o);for(const n of this._getFormattingAttributes(o,t))i.removeAttribute(n,e)}})}*_getFormattingItems(e,t){const i=e=>!!Os(this._getFormattingAttributes(e,t));for(const o of e.getRanges())for(const e of o.getItems())!t.isBlock(e)&&i(e)&&(yield e);for(const t of e.getSelectedBlocks())i(t)&&(yield t);i(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[i]of e.getAttributes()){const e=t.getAttributeProperties(i);e&&e.isFormatting&&(yield i)}}}class Hy extends Qe{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new Ly(e))}}class jy extends Ze{execute(e){const{model:t}=this.editor,{document:i}=t,{selection:o}=i,{mention:n}=e,r=e.range||o.getFirstRange();if(n.id.startsWith("#")||n.id.startsWith("~"))t.change(e=>{t.insertContent(e.createText(n.id,{}),r)});else if("create-note"===n.action){const e=this.editor.editing.view.getDomRoot();glob.getComponentByEl(e).createNoteForReferenceLink(n.noteTitle).then(e=>{this.insertReference(r,e)})}else this.insertReference(r,e.mention.notePath)}insertReference(e,t){const{model:i}=this.editor;i.change(o=>{i.insertContent(o.createText("",{}),e),this.editor.execute("referenceLink",{notePath:t})})}}class Wy{constructor(e){this.loader=e}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest().then(()=>{this._initListeners(t,i,e),this._sendRequest(e)})}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){return glob.getHeaders().then(e=>{const t=this.xhr=new XMLHttpRequest,{noteId:i}=glob.getActiveTabNote(),o="api/images?noteId="+i;t.open("POST",o,!0),t.responseType="json";for(const i in e)t.setRequestHeader(i,e[i])})}async _initListeners(e,t){const i=this.xhr,o=this.loader,n=`Cannot upload file: ${(await o.file).name}.`;i.addEventListener("error",()=>t(n)),i.addEventListener("abort",()=>t()),i.addEventListener("load",()=>{const o=i.response;if(!o||!o.uploaded)return t(o&&o.error&&o.error.message?o.error.message:n);e({default:o.url})}),i.upload&&i.upload.addEventListener("progress",e=>{e.lengthComputable&&(o.uploadTotal=e.total,o.uploaded=e.loaded)})}async _sendRequest(){const e=new FormData;e.append("upload",await this.loader.file),this.xhr.send(e)}}class qy extends Qe{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("includeNote",i=>{const o=e.commands.get("insertIncludeNote"),n=new rd(i);return n.set({label:t("Include note"),icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19,3H5C3.897,3,3,3.897,3,5v14c0,1.103,0.897,2,2,2h8c0.131,0,0.26-0.026,0.381-0.076s0.232-0.123,0.326-0.217l7-7 c0.086-0.086,0.147-0.187,0.196-0.293c0.014-0.03,0.022-0.061,0.033-0.093c0.028-0.084,0.046-0.17,0.051-0.259 C20.989,13.041,21,13.021,21,13V5C21,3.897,20.103,3,19,3z M5,5h14v7h-6c-0.553,0-1,0.448-1,1v6H5V5z M14,17.586V14h3.586 L14,17.586z"/></svg>',tooltip:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>e.execute("insertIncludeNote")),n})}}class $y extends Qe{static get requires(){return[Im]}init(){this._defineSchema(),this._defineConverters(),this.editor.commands.add("insertIncludeNote",new Uy(this.editor))}_defineSchema(){this.editor.model.schema.register("includeNote",{isObject:!0,allowAttributes:["noteId","boxSize"],allowWhere:"$block"})}_defineConverters(){const e=this.editor,t=e.conversion;t.for("upcast").elementToElement({model:(e,{writer:t})=>t.createElement("includeNote",{noteId:e.getAttribute("data-note-id"),boxSize:e.getAttribute("data-box-size")}),view:{name:"section",classes:"include-note"}}),t.for("dataDowncast").elementToElement({model:"includeNote",view:(e,{writer:t})=>t.createContainerElement("section",{class:"include-note","data-note-id":e.getAttribute("noteId"),"data-box-size":e.getAttribute("boxSize")})}),t.for("editingDowncast").elementToElement({model:"includeNote",view:(t,{writer:i})=>{const o=t.getAttribute("noteId"),n=t.getAttribute("boxSize"),r=i.createContainerElement("section",{class:"include-note box-size-"+n,"data-note-id":o,"data-box-size":n}),s=i.createUIElement("div",{class:"include-note-wrapper"},(function(t){const i=this.toDomElement(t),n=e.editing.view.getDomRoot();return glob.getComponentByEl(n).loadIncludedNote(o,$(i)),function(e,t){function i(e){e.stopPropagation(),t.editing.view._renderer.isFocused=!1}e.addEventListener("mousedown",i,{capture:!0}),e.addEventListener("focus",i,{capture:!0}),e.addEventListener("keydown",i,{capture:!0})}(i,e),i}));return i.insert(i.createPositionAt(r,0),s),gm(r,i,{label:"include note widget"})}})}}class Uy extends Ze{execute(){const e=this.editor.editing.view.getDomRoot();glob.getComponentByEl(e).triggerCommand("addIncludeNoteToText")}refresh(){const e=this.editor.model,t=e.document.selection,i=e.schema.findAllowedParent(t.getFirstPosition(),"includeNote");this.isEnabled=null!==i}}class Ky extends Ze{execute({notePath:e}){if(!e||!e.trim())return;const t=this.editor,i=e.split("/").pop();glob.treeCache.getNote(i,!0).then(()=>{t.model.change(i=>{const o=i.createElement("reference",{notePath:e});t.model.insertContent(o),i.setSelection(o,"after")})})}refresh(){const e=this.editor.model,t=e.document.selection;this.isEnabled=e.schema.checkChild(t.focus.parent,"reference")}}class Gy extends Qe{static get requires(){return[Im]}init(){this._defineSchema(),this._defineConverters(),this.editor.commands.add("referenceLink",new Ky(this.editor)),this.editor.editing.mapper.on("viewToModelPosition",_m(this.editor.model,e=>e.hasClass("reference-link")))}_defineSchema(){this.editor.model.schema.register("reference",{allowWhere:"$text",isInline:!0,isObject:!0,allowAttributes:["notePath"]})}_defineConverters(){const e=this.editor,t=e.conversion;t.for("upcast").elementToElement({view:{name:"a",classes:["reference-link"]},model:(e,{writer:t})=>{let i=e.getAttribute("data-note-path");return i||(i=e.getAttribute("href")),t.createElement("reference",{notePath:i})}}),t.for("editingDowncast").elementToElement({model:"reference",view:(t,{writer:i})=>{let o=t.getAttribute("notePath");o||(o=t.getAttribute("href"));const n=i.createContainerElement("a",{href:"javascript:",class:"reference-link","data-note-path":o}),r=i.createUIElement("span",{},(function(t){const i=this.toDomElement(t),n=o.split("/").pop(),r=e.editing.view.getDomRoot();return glob.getComponentByEl(r).loadReferenceLinkTitle(n,$(i)),i}));return i.insert(i.createPositionAt(n,0),r),gm(n,i)}}),t.for("dataDowncast").elementToElement({model:"reference",view:(e,{writer:t})=>{let i=e.getAttribute("notePath");i||(i=e.getAttribute("href"));const o=t.createContainerElement("a",{href:"#"+i,class:"reference-link","data-note-path":i}),n=i.split("/").pop(),r=glob.treeCache.getNoteFromCache(n);if(r){const e=t.createText(r.title);t.insert(t.createPositionAt(o,0),e)}return o}})}}function Jy(e){return e.match(/^(\\\[.*?\\\]|\\\(.*?\\\))$/)}function Yy(e){const t=(e=e.trim()).includes("\\(")&&e.includes("\\)"),i=e.includes("\\[")&&e.includes("\\]");return(t||i)&&(e=e.substring(2,e.length-2).trim()),{equation:e,display:i}}async function Qy(e,t,i="katex",o,n=!1,r=!1,s,a=[]){if("mathjax"===i&&"undefined"!=typeof MathJax)(l=MathJax.version)&&"string"==typeof l&&3===l.split(".").length&&"3"===l.split(".")[0]?Zy(t,r,s,a,i=>{!function(e,t,i,o){let n=void 0;void 0!==MathJax.tex2chtmlPromise?n=MathJax.tex2chtmlPromise:void 0!==MathJax.tex2svgPromise&&(n=MathJax.tex2svgPromise);void 0!==n&&n(e,{display:i}).then(e=>{t.firstChild&&t.removeChild(t.firstChild),t.appendChild(e),o()})}(e,i,n,()=>{r&&(ex(t,i),i.style.visibility="visible")})}):Zy(t,r,s,a,i=>{vr.window.setTimeout(()=>{!function(e,t,i){t.innerHTML=i?"\\["+e+"\\]":"\\("+e+"\\)";MathJax.Hub.Queue(["Typeset",MathJax.Hub,t])}(e,i,n),r&&MathJax.Hub.Queue(()=>{ex(t,i),i.style.visibility="visible"})})});else if("katex"===i&&"undefined"!=typeof katex)Zy(t,r,s,a,i=>{katex.render(e,i,{throwOnError:!1,displayMode:n}),r&&(ex(t,i),i.style.visibility="visible")});else if("function"==typeof i)i(e,t,n);else if(void 0!==o)try{vr.window.CKEDITOR_MATH_LAZY_LOAD||(vr.window.CKEDITOR_MATH_LAZY_LOAD=o()),t.innerHTML=e,await vr.window.CKEDITOR_MATH_LAZY_LOAD,Qy(e,t,i,void 0,n,r,s,a)}catch(i){t.innerHTML=e,console.error("math-tex-typesetting-lazy-load-failed: Lazy load failed: "+i)}else t.innerHTML=e,console.warn(`math-tex-typesetting-missing: Missing the mathematical typesetting engine (${i}) for tex.`);var l}function Xy(e){const t=e.editing.view,i=Gd.defaultPositions,o=t.document.selection.getSelectedElement();if(o)return{target:t.domConverter.viewToDom(o),positions:[i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast]};{const e=t.document;return{target:t.domConverter.viewRangeToDom(e.selection.getFirstRange()),positions:[i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast]}}}function Zy(e,t,i,o,n){t?function(e,t,i,o){const n=function(e,t,i){let o=vr.document.getElementById(t);if(!o){o=vr.document.createElement("div"),o.setAttribute("id",t),o.classList.add(...i),o.style.visibility="hidden",vr.document.body.appendChild(o);let n=!1;const r=()=>{n||(vr.window.requestAnimationFrame(()=>{tx(e,o),n=!1}),n=!0)};vr.window.addEventListener("resize",r),vr.window.addEventListener("scroll",r)}return o}(e,t,i);o(n)}(e,i,o,e=>{n(e)}):n(e)}function ex(e,t){tx(e,t);const i=t.getBoundingClientRect();e.style.width=i.width+"px",e.style.height=i.height+"px"}function tx(e,t){const i=e.getBoundingClientRect(),o=vr.window.scrollX+i.left,n=vr.window.scrollY+i.top;t.style.position="absolute",t.style.left=o+"px",t.style.top=n+"px",t.style.zIndex="var(--ck-z-modal)",t.style.pointerEvents="none"}i(138);class ix extends Bc{constructor(e,t){super(e);const i="ck-input-"+s(),o="ck-status-"+s();this.set("label"),this.set("value"),this.set("isReadOnly",!1),this.set("errorText",null),this.set("infoText",null),this.labelView=this._createLabelView(i),this.inputView=this._createInputView(t,i,o),this.statusView=this._createStatusView(o),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,t)=>e||t);const n=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-input",n.if("isReadOnly","ck-disabled")]},children:[this.labelView,this.inputView,this.statusView]})}_createLabelView(e){const t=new Bd(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createInputView(e,t,i){const o=new e(this.locale,i);return o.id=t,o.ariaDescribedById=i,o.bind("value").to(this),o.bind("isReadOnly").to(this),o.bind("hasError").to(this,"errorText",e=>!!e),o.on("input",()=>{this.errorText=null}),o}_createStatusView(e){const t=new Bc(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-input__status",i.if("errorText","ck-labeled-input__status_error"),i.if("_statusText","ck-hidden",e=>!e)],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}select(){this.inputView.select()}focus(){this.inputView.focus()}}class ox extends Bc{constructor(e,t,i,o,n){super(i),this.engine=e,this.lazyLoad=t,this.previewUid=o,this.previewClassName=n,this.set("value",""),this.set("display",!1),this.on("change",()=>{this.isRendered&&this.updateMath()}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-math-preview"]}})}updateMath(){Qy(this.value,this.element,this.engine,this.lazyLoad,this.display,!0,this.previewUid,this.previewClassName)}render(){super.render(),this.updateMath()}}i(140);class nx extends Bc{constructor(e,t,i,o,n,r,s){super(e);const a=e.t;this._createKeyAndFocusTrackers(),this.saveButtonView=this._createButton(a("Save"),Pc,"ck-button-save",null),this.saveButtonView.type="submit",this.mathInputView=this._createMathInput(),this.displayButtonView=this._createDisplayButton(),this.cancelButtonView=this._createButton(a("Cancel"),Ec,"ck-button-cancel","cancel"),this.previewEnabled=o;let l=[];this.previewEnabled?(this.previewLabel=new Bd(e),this.previewLabel.text=a("Equation preview"),this.mathView=new ox(t,i,e,n,r),this.mathView.bind("display").to(this.displayButtonView,"isOn"),l=[this.mathInputView,this.displayButtonView,this.previewLabel,this.mathView]):l=[this.mathInputView,this.displayButtonView],this.setTemplate({tag:"form",attributes:{class:["ck","ck-math-form",...s],tabindex:"-1",spellcheck:"false"},children:[{tag:"div",attributes:{class:["ck-math-view"]},children:l},this.saveButtonView,this.cancelButtonView]})}render(){super.render(),zc({view:this});[this.mathInputView,this.displayButtonView,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}get equation(){return this.mathInputView.inputView.element.value}set equation(e){this.mathInputView.inputView.element.value=e,this.previewEnabled&&(this.mathView.value=e)}_createKeyAndFocusTrackers(){this.focusTracker=new zs,this.keystrokes=new Ms,this._focusables=new Mc,this._focusCycler=new hd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}})}_createMathInput(){const e=this.locale.t,t=new ix(this.locale,Ld),i=t.inputView;t.infoText=e("Insert equation in TeX format.");const o=()=>{if(null!=i.element){let e=i.element.value.trim();if(Jy(e)){const t=Yy(e);i.element.value=t.equation,e=t.equation,this.displayButtonView.isOn=t.display}this.previewEnabled&&(this.mathView.value=e),this.saveButtonView.isEnabled=!!e}};return i.on("render",o),i.on("input",o),t}_createButton(e,t,i,o){const n=new rd(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:i}}),o&&n.delegate("execute").to(this,o),n}_createDisplayButton(){const e=this.locale.t,t=new sd(this.locale);return t.set({label:e("Display mode"),withText:!0}),t.extendTemplate({attributes:{class:"ck-button-display-toggle"}}),t.on("execute",()=>{t.isOn=!t.isOn,this.previewEnabled&&(this.mathView.display=t.isOn)}),t}}class rx extends Ze{execute(e,t,i,o){const n=this.editor.model,r=n.document.selection.getSelectedElement();n.change(s=>{let a;if(r&&(r.is("element","mathtex-inline")||r.is("element","mathtex-display"))){const n=r.getAttribute("type"),l=o?i:n||i;a=s.createElement(t?"mathtex-display":"mathtex-inline",{equation:e,type:l,display:t})}else a=s.createElement(t?"mathtex-display":"mathtex-inline",{equation:e,type:i,display:t});n.insertContent(a)})}refresh(){const e=this.editor.model.document.selection,t=e.getSelectedElement();this.isEnabled=null===t||t.is("element","mathtex-inline")||t.is("element","mathtex-display");const i=function(e){const t=e.getSelectedElement();return t&&(t.is("element","mathtex-inline")||t.is("element","mathtex-display"))?t:null}(e);this.value=i?i.getAttribute("equation"):null,this.display=i?i.getAttribute("display"):null}}class sx extends Qe{static get requires(){return[Im]}static get pluginName(){return"MathEditing"}init(){const e=this.editor;e.commands.add("math",new rx(e)),this._defineSchema(),this._defineConverters(),e.editing.mapper.on("viewToModelPosition",_m(e.model,e=>e.hasClass("math"))),e.config.define("math",{engine:"mathjax",outputType:"script",forceOutputType:!1,enablePreview:!0,previewClassName:[],popupClassName:[]})}_defineSchema(){const e=this.editor.model.schema;e.register("mathtex-inline",{allowWhere:"$text",isInline:!0,isObject:!0,allowAttributes:["equation","type","display"]}),e.register("mathtex-display",{allowWhere:"$block",isInline:!1,isObject:!0,allowAttributes:["equation","type","display"]})}_defineConverters(){const e=this.editor.conversion,t=this.editor.config.get("math");function i(e,i){const o=e.getAttribute("equation"),n=e.getAttribute("display"),r="user-select: none; "+(n?"":"display: inline-block;"),s="ck-math-tex "+(n?"ck-math-tex-display":"ck-math-tex-inline"),a=i.createContainerElement(n?"div":"span",{style:r,class:s}),l=i.createUIElement("div",null,(function(e){const i=this.toDomElement(e);return Qy(o,i,t.engine,t.lazyLoad,n,!1),i}));return i.insert(i.createPositionAt(a,0),l),a}function o(e,{writer:t}){const i=e.getAttribute("equation"),o=e.getAttribute("type"),n=e.getAttribute("display");if("span"===o){const e=t.createContainerElement("span",{class:"math-tex"});return n?t.insert(t.createPositionAt(e,0),t.createText("\\["+i+"\\]")):t.insert(t.createPositionAt(e,0),t.createText("\\("+i+"\\)")),e}{const e=t.createContainerElement("script",{type:n?"math/tex; mode=display":"math/tex"});return t.insert(t.createPositionAt(e,0),t.createText(i)),e}}e.for("upcast").elementToElement({view:{name:"script",attributes:{type:"math/tex"}},model:(e,{writer:i})=>{const o=e.getChild(0).data.trim();return i.createElement("mathtex-inline",{equation:o,type:t.forceOutputType?t.outputType:"script",display:!1})}}).elementToElement({view:{name:"script",attributes:{type:"math/tex; mode=display"}},model:(e,{writer:i})=>{const o=e.getChild(0).data.trim();return i.createElement("mathtex-display",{equation:o,type:t.forceOutputType?t.outputType:"script",display:!0})}}).elementToElement({view:{name:"span",classes:["math-tex"]},model:(e,{writer:i})=>{const o=e.getChild(0).data.trim(),n=Object.assign(Yy(o),{type:t.forceOutputType?t.outputType:"span"});return i.createElement(n.display?"mathtex-display":"mathtex-inline",n)}}).elementToElement({view:{name:"span",classes:["ql-formula"]},model:(e,{writer:i})=>{const o=e.getAttribute("data-value").trim();return i.createElement("mathtex-inline",{equation:o,type:t.forceOutputType?t.outputType:"script",display:!1})}}),e.for("editingDowncast").elementToElement({model:"mathtex-inline",view:(e,{writer:t})=>gm(i(e,t),t,"span")}).elementToElement({model:"mathtex-display",view:(e,{writer:t})=>gm(i(e,t),t,"div")}),e.for("dataDowncast").elementToElement({model:"mathtex-inline",view:o}).elementToElement({model:"mathtex-display",view:o})}}class ax extends Qe{static get requires(){return[eh,sx]}static get pluginName(){return"MathUI"}init(){const e=this.editor;e.editing.view.addObserver(Th),this._previewUid="math-preview-"+s(),this.formView=this._createFormView(),this._balloon=e.plugins.get(eh),this._createToolbarMathButton(),this._enableUserBalloonInteractions()}destroy(){super.destroy(),this.formView.destroy();const e=vr.document.getElementById(this._previewUid);e&&e.parentNode.removeChild(e)}_showUI(){this.editor.commands.get("math").isEnabled&&(this._addFormView(),this._balloon.showStack("main"))}_createFormView(){const e=this.editor,t=e.commands.get("math"),i=e.config.get("math"),o=new nx(e.locale,i.engine,i.lazyLoad,i.enablePreview,this._previewUid,i.previewClassName,i.popupClassName);return o.mathInputView.bind("value").to(t,"value"),o.displayButtonView.bind("isOn").to(t,"display"),o.mathInputView.bind("isReadOnly").to(t,"isEnabled",e=>!e),o.saveButtonView.bind("isEnabled").to(t),o.displayButtonView.bind("isEnabled").to(t),this.listenTo(o,"submit",()=>{e.execute("math",o.equation,o.displayButtonView.isOn,i.outputType,i.forceOutputType),this._closeFormView()}),this.listenTo(o,"cancel",()=>{this._closeFormView()}),o.keystrokes.set("esc",(e,t)=>{this._closeFormView(),t()}),o}_addFormView(){if(this._isFormInPanel)return;const e=this.editor,t=e.commands.get("math");this._balloon.add({view:this.formView,position:Xy(e)}),this._balloon.visibleView===this.formView&&this.formView.mathInputView.select();vr.document.getElementById(this._previewUid)&&this.formView.previewEnabled&&this.formView.mathView.updateMath(),this.formView.equation=t.value||"",this.formView.displayButtonView.isOn=t.display||!1}_hideUI(){if(!this._isFormInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView()}_closeFormView(){void 0!==this.editor.commands.get("math").value?this._removeFormView():this._hideUI()}_removeFormView(){if(this._isFormInPanel){this.formView.saveButtonView.focus(),this._balloon.remove(this.formView);const e=vr.document.getElementById(this._previewUid);e&&(e.style.visibility="hidden"),this.editor.editing.view.focus()}}_createToolbarMathButton(){const e=this.editor,t=e.commands.get("math"),i=e.t;e.keystrokes.set("Ctrl+M",(e,i)=>{i(),t.isEnabled&&this._showUI()}),this.editor.ui.componentFactory.add("math",e=>{const o=new rd(e);return o.isEnabled=!0,o.label=i("Insert math"),o.icon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.44 10.78" height="40.74" width="58.35"><path d="M8.15 0c-.06 0-.1.02-.11.03a.12.12 0 0 0-.02.01 6.81 6.81 0 0 0-2.32 4.9v.9a6.82 6.82 0 0 0 2.32 4.9.12.12 0 0 0 .02 0c.02.02.06.04.11.04.07 0 .12-.03.16-.07a.22.22 0 0 0 0-.32.12.12 0 0 0-.02-.02A4.4 4.4 0 0 1 7 8.44a7.62 7.62 0 0 1-.5-2.6v-.9c0-.82.19-1.76.5-2.6A4.4 4.4 0 0 1 8.3.42.12.12 0 0 0 8.3.39a.22.22 0 0 0 .08-.16.22.22 0 0 0-.07-.16.22.22 0 0 0-.16-.07zm4.83 0a.22.22 0 0 0-.16.07.22.22 0 0 0-.07.16c0 .08.05.13.08.16a.12.12 0 0 0 .01.02c.52.39.98 1.1 1.3 1.94.3.83.49 1.77.49 2.6v.88c0 .83-.18 1.78-.5 2.6a4.4 4.4 0 0 1-1.29 1.95.22.22 0 0 0-.01.33c.03.04.08.07.15.07.05 0 .09-.02.12-.03a.12.12 0 0 0 .02-.01 6.82 6.82 0 0 0 2.32-4.9v-.9a6.81 6.81 0 0 0-2.32-4.9.12.12 0 0 0-.02 0c-.03-.02-.06-.04-.12-.04zm-8.5.46c-.4 0-1.13.23-1.46 1.32-.06.2-.11.45-.33 1.58h-.64c-.1 0-.19-.01-.28.03a.25.25 0 0 0-.12.12.38.38 0 0 0-.03.17c0 .04 0 .1.04.14.03.04.07.07.11.08.09.03.16.02.26.02h.56l-.77 4.04c-.1.51-.19 1-.32 1.36-.06.18-.14.32-.22.4-.08.1-.16.13-.26.13-.03 0-.1 0-.2-.03.11-.05.2-.13.26-.2a.7.7 0 0 0 .13-.4.48.48 0 0 0-.16-.38.53.53 0 0 0-.35-.12c-.34 0-.7.3-.7.76 0 .27.14.5.34.64s.44.2.68.2c.33 0 .61-.17.83-.4.21-.21.37-.48.47-.69.18-.35.32-.84.43-1.25a14.17 14.17 0 0 0 .18-.8l.61-3.26h.81c.1 0 .2.01.3-.03.04-.03.09-.07.11-.13.02-.05.03-.1.03-.17 0-.05-.01-.1-.05-.14a.23.23 0 0 0-.11-.07c-.08-.03-.16-.02-.25-.02h-.73l.2-1.07a26.3 26.3 0 0 1 .24-1.07c.08-.17.22-.3.39-.3l.21.05a.7.7 0 0 0-.25.2.7.7 0 0 0-.13.4c0 .15.06.28.16.37.1.08.22.12.35.12.34 0 .7-.3.7-.76 0-.28-.15-.5-.35-.64-.2-.14-.45-.2-.7-.2zm5.4 2.78c-.6 0-1.06.37-1.36.76-.16.2-.27.4-.35.57-.07.18-.12.3-.12.42 0 .1.08.18.14.2.06.03.1.02.1.02.06 0 .12 0 .18-.04.05-.05.07-.1.08-.17v.02c.35-1.09 1-1.3 1.3-1.3.09 0 .2.01.29.09.09.07.17.2.17.5 0 .27-.18 1-.57 2.48a1.8 1.8 0 0 1-.37.75.7.7 0 0 1-.52.26c-.04 0-.13 0-.22-.03a.68.68 0 0 0 .3-.56.47.47 0 0 0-.18-.39.55.55 0 0 0-.32-.1c-.4 0-.7.33-.7.74 0 .28.16.5.38.63.21.13.48.18.73.18.39 0 .69-.2.89-.41.09-.1.15-.19.2-.27.2.36.59.68 1.16.68.6 0 1.05-.37 1.35-.76.15-.2.27-.4.34-.57.08-.18.12-.3.12-.42a.24.24 0 0 0-.11-.2c-.06-.03-.12-.02-.13-.02a.26.26 0 0 0-.18.06c-.05.05-.06.1-.07.14-.34 1.1-1.02 1.3-1.3 1.3-.17 0-.27-.06-.35-.17a.72.72 0 0 1-.11-.4c0-.22.06-.45.18-.91l.36-1.45c.03-.14.1-.44.25-.7.15-.25.36-.46.68-.46.03 0 .12 0 .22.03a.7.7 0 0 0-.32.56c0 .11.04.23.13.33.08.1.22.16.4.16.14 0 .3-.06.44-.18a.73.73 0 0 0 .24-.55c0-.32-.2-.54-.42-.66a1.52 1.52 0 0 0-.68-.16c-.34 0-.62.16-.82.34a1.8 1.8 0 0 0-.3.35 1.32 1.32 0 0 0-.5-.54 1.37 1.37 0 0 0-.63-.15z" style="line-height:1.25;-inkscape-font-specification:\'Latin Modern Math\'" font-weight="400" font-size="10.58" font-family="Latin Modern Math" letter-spacing="-1.06" word-spacing="0"/></svg>\n',o.keystroke="Ctrl+M",o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(t,"isEnabled"),this.listenTo(o,"execute",()=>this._showUI()),o})}_enableUserBalloonInteractions(){const e=this.editor,t=this.editor.editing.view.document;this.listenTo(t,"click",()=>{const t=e.commands.get("math");t.value&&t.isEnabled&&this._showUI()}),e.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Vc({emitter:this.formView,activator:()=>this._isFormInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}get _isUIVisible(){return this._balloon.visibleView==this.formView}get _isFormInPanel(){return this._balloon.hasView(this.formView)}}class lx extends Qe{static get requires(){return[lf,Fy]}static get pluginName(){return"AutoMath"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document;this.listenTo(e.plugins.get(lf),"inputTransformation",()=>{const e=t.selection.getFirstRange(),i=tc.fromPosition(e.start);i.stickiness="toPrevious";const o=tc.fromPosition(e.end);o.stickiness="toNext",t.once("change:data",()=>{this._mathBetweenPositions(i,o),i.detach(),o.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(vr.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_mathBetweenPositions(e,t){const i=this.editor,o=this.editor.config.get("math"),n=new wa(e,t),r=n.getWalker({ignoreElementEnd:!0});let s="";for(const e of r)e.item.is("$textProxy")&&(s+=e.item.data);if(s=s.trim(),!Jy(s)||2!==function(e){return e.match(/(\\\[|\\\]|\\\(|\\\))/g).length}(s))return;i.commands.get("math").isEnabled&&(this._positionToInsert=tc.fromPosition(e),this._timeoutId=vr.window.setTimeout(()=>{i.model.change(e=>{let t;this._timeoutId=null,e.remove(n),"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert),i.model.change(e=>{const n=Object.assign(Yy(s),{type:o.outputType}),r=e.createElement(n.display?"mathtex-display":"mathtex-inline",n);i.model.insertContent(r,t),e.setSelection(r,"on")}),this._positionToInsert.detach(),this._positionToInsert=null})},100))}}class cx extends Qe{static get requires(){return[sx,ax,lx,Im]}static get pluginName(){return"Math"}}class dx extends bu{}dx.builtinPlugins=[lf,jg,Ay,Ug,class extends Qe{static get requires(){return[Yu,Zu]}static get pluginName(){return"Typing"}},Fy,class extends Qe{static get requires(){return[Mu]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(Mu).createUploadAdapter=t=>new Lu(t,e,this.editor.t))}},_g,class extends Qe{static get requires(){return[xg,Cg]}static get pluginName(){return"Bold"}},class extends Qe{static get requires(){return[Ag,Tg]}static get pluginName(){return"Italic"}},class extends Qe{static get requires(){return[Rg,Vg]}static get pluginName(){return"Underline"}},class extends Qe{static get requires(){return[Og,zg]}static get pluginName(){return"Strikethrough"}},class extends Qe{static get requires(){return[Bg,Ng]}static get pluginName(){return"Code"}},class extends Qe{static get requires(){return[Eg,Pg]}static get pluginName(){return"Superscript"}},class extends Qe{static get requires(){return[Sg,Ig]}static get pluginName(){return"Subscript"}},class extends Qe{static get requires(){return[Qg,Xg]}static get pluginName(){return"BlockQuote"}},class extends Qe{static get requires(){return[rm,am]}static get pluginName(){return"Heading"}},class extends Qe{static get requires(){return[pf,wf]}static get pluginName(){return"Image"}},class extends Qe{static get requires(){return[yf,Cf]}static get pluginName(){return"ImageCaption"}},class extends Qe{static get requires(){return[Df,Lf]}static get pluginName(){return"ImageStyle"}},class extends Qe{static get requires(){return[Vm,qm]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(Vm),o=e.plugins.get("ImageUtils");var n;i.register("image",{ariaLabel:t("Image toolbar"),items:(n=e.config.get("image.toolbar")||[],n.map(e=>w(e)?e.name:e)),getRelatedElement:e=>o.getClosestSelectedImageWidget(e)})}},class extends Qe{static get pluginName(){return"ImageUpload"}static get requires(){return[tp,Kf,Gf]}},class extends Qe{static get requires(){return[np,cp,sp]}static get pluginName(){return"ImageResize"}},class extends Qe{static get requires(){return[Lp,Up,Jp]}static get pluginName(){return"Link"}},Jp,class extends Qe{static get requires(){return[xb,Eb]}static get pluginName(){return"List"}},class extends Qe{static get requires(){return[Sb,Mb]}static get pluginName(){return"ListStyle"}},class extends Qe{static get requires(){return[Wb,qb]}static get pluginName(){return"TodoList"}},im,class extends Qe{static get pluginName(){return"PasteFromOffice"}static get requires(){return[ef]}init(){const e=this.editor,t=e.editing.view.document,i=[];i.push(new ew(t)),i.push(new Yb(t)),e.plugins.get("ClipboardPipeline").on("inputTransformation",(e,o)=>{if(o._isTransformedWithPasteFromOffice)return;const n=o.dataTransfer.getData("text/html"),r=i.find(e=>e.isActive(n));r&&(o._parsedData=iw(n,t.stylesProcessor),r.execute(o),o._isTransformedWithPasteFromOffice=!0)},{priority:"high"})}},class extends Qe{static get requires(){return[_k,Ck,Tk,Ok,Rk,Ek,Im]}static get pluginName(){return"Table"}},class extends Qe{static get requires(){return[Vm]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(Vm),o=e.config.get("table.contentToolbar"),n=e.config.get("table.tableToolbar");o&&i.register("tableContent",{ariaLabel:t("Table toolbar"),items:o,getRelatedElement:Bk}),n&&i.register("table",{ariaLabel:t("Table toolbar"),items:n,getRelatedElement:Mk})}},class extends Qe{static get pluginName(){return"TableProperties"}static get requires(){return[i_,S_]}},class extends Qe{static get pluginName(){return"TableCellProperties"}static get requires(){return[K_,z_]}},Tk,class extends Qe{static get pluginName(){return"TableCaption"}static get requires(){return[tv,iv]}},class extends Qe{static get pluginName(){return"Indent"}static get requires(){return[uy,fy]}},class extends Qe{constructor(e){super(e),e.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const e=this.editor,t=e.config.get("indentBlock"),i=!t.classes||!t.classes.length,o=Object.assign({direction:"forward"},t),n=Object.assign({direction:"backward"},t);i?(e.data.addStyleProcessorRules(gu),this._setupConversionUsingOffset(e.conversion),e.commands.add("indentBlock",new py(e,new by(o))),e.commands.add("outdentBlock",new py(e,new by(n)))):(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new py(e,new wy(o))),e.commands.add("outdentBlock",new py(e,new wy(n))))}afterInit(){const e=this.editor,t=e.model.schema,i=e.commands.get("indent"),o=e.commands.get("outdent"),n=e.config.get("heading.options");(n&&n.map(e=>e.model)||ky).forEach(e=>{t.isRegistered(e)&&t.extend(e,{allowAttributes:"blockIndent"})}),t.setAttributeProperties("blockIndent",{isFormatting:!0}),i.registerChildCommand(e.commands.get("indentBlock")),o.registerChildCommand(e.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const e=this.editor.conversion,t="rtl"===this.editor.locale.contentLanguageDirection?"margin-right":"margin-left";e.for("upcast").attributeToAttribute({view:{styles:{[t]:/[\s\S]+/}},model:{key:"blockIndent",value:e=>e.getStyle(t)}}),e.for("downcast").attributeToAttribute({model:"blockIndent",view:e=>({key:"style",value:{[t]:e}})})}_setupConversionUsingClasses(e){const t={model:{key:"blockIndent",values:[]},view:{}};for(const i of e)t.model.values.push(i),t.view[i]={key:"class",value:[i]};this.editor.conversion.attributeToAttribute(t)}},class extends Qe{static get pluginName(){return"BlockToolbar"}constructor(e){super(e),this._blockToolbarConfig=Cd(this.editor.config.get("blockToolbar")),this.toolbarView=this._createToolbarView(),this.panelView=this._createPanelView(),this.buttonView=this._createButtonView(),this._resizeObserver=null,Vc({emitter:this.panelView,contextElements:[this.panelView.element,this.buttonView.element],activator:()=>this.panelView.isVisible,callback:()=>this._hidePanel()})}init(){const e=this.editor;this.listenTo(e.model.document.selection,"change:range",(e,t)=>{t.directChange&&this._hidePanel()}),this.listenTo(e.ui,"update",()=>this._updateButton()),this.listenTo(e,"change:isReadOnly",()=>this._updateButton(),{priority:"low"}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>this._updateButton()),this.listenTo(this.buttonView,"change:isVisible",(e,t,i)=>{i?this.buttonView.listenTo(window,"resize",()=>this._updateButton()):(this.buttonView.stopListening(window,"resize"),this._hidePanel())})}afterInit(){const e=this.editor.ui.componentFactory,t=this._blockToolbarConfig;this.toolbarView.fillFromConfig(t,e);for(const e of this.toolbarView.items)e.on("execute",()=>this._hidePanel(!0),{priority:"high"});t.shouldNotGroupWhenFull||this.listenTo(this.editor,"ready",()=>{const e=this.editor.ui.view.editable.element;this._resizeObserver=new Ss(e,()=>{this.toolbarView.maxWidth=this._getToolbarMaxWidth()})})}destroy(){super.destroy(),this.panelView.destroy(),this.buttonView.destroy(),this.toolbarView.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_createToolbarView(){const e=!this._blockToolbarConfig.shouldNotGroupWhenFull,t=new Ad(this.editor.locale,{shouldGroupWhenFull:e,isFloating:!0});return t.focusTracker.on("change:isFocused",(e,t,i)=>{i||this._hidePanel()}),t}_createPanelView(){const e=this.editor,t=new Gd(e.locale);return t.content.add(this.toolbarView),t.class="ck-toolbar-container",e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this.toolbarView.keystrokes.set("Esc",(e,t)=>{this._hidePanel(!0),t()}),t}_createButtonView(){const e=this.editor,t=e.t,i=new ah(e.locale);return i.set({label:t("Edit block"),icon:Sc,withText:!1}),i.bind("isOn").to(this.panelView,"isVisible"),i.bind("tooltip").to(this.panelView,"isVisible",e=>!e),this.listenTo(i,"execute",()=>{this.panelView.isVisible?this._hidePanel(!0):this._showPanel()}),e.ui.view.body.add(i),e.ui.focusTracker.add(i.element),i}_updateButton(){const e=this.editor,t=e.model,i=e.editing.view;if(!e.ui.focusTracker.isFocused)return void this._hideButton();if(e.isReadOnly)return void this._hideButton();const o=Array.from(t.document.selection.getSelectedBlocks())[0];if(!o||Array.from(this.toolbarView.items).every(e=>!e.isEnabled))return void this._hideButton();const n=i.domConverter.mapViewToDom(e.editing.mapper.toViewElement(o));this.buttonView.isVisible=!0,this._attachButtonToElement(n),this.panelView.isVisible&&this._showPanel()}_hideButton(){this.buttonView.isVisible=!1}_showPanel(){const e=this.panelView.isVisible;this.panelView.show(),this.toolbarView.maxWidth=this._getToolbarMaxWidth(),this.panelView.pin({target:this.buttonView.element,limiter:this.editor.ui.getEditableElement()}),e||this.toolbarView.items.get(0).focus()}_hidePanel(e){this.panelView.isVisible=!1,e&&this.editor.editing.view.focus()}_attachButtonToElement(e){const t=window.getComputedStyle(e),i=new Ts(this.editor.ui.getEditableElement()),o=parseInt(t.paddingTop,10),n=parseInt(t.lineHeight,10)||1.2*parseInt(t.fontSize,10),r=wd({element:this.buttonView.element,target:e,positions:[(e,t)=>{let r;return r="ltr"===this.editor.locale.uiLanguageDirection?i.left-t.width:i.right,{top:e.top+o+(n-t.height)/2,left:r}}]});this.buttonView.top=r.top,this.buttonView.left=r.left}_getToolbarMaxWidth(){const e=this.editor.ui.view.editable.element,t=new Ts(e),i=new Ts(this.buttonView.element),o="rtl"===this.editor.locale.uiLanguageDirection?i.left-t.right+i.width:t.left-i.left;return lh(t.width+o)}},class extends Qe{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("paragraph",i=>{const o=new rd(i),n=e.commands.get("paragraph");return o.label=t("Paragraph"),o.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(n),o.bind("isOn").to(n,"value"),o.on("execute",()=>{e.execute("paragraph")}),o})}},class extends Qe{init(){sm(this.editor).filter(e=>"paragraph"!==e.model).map(e=>this._createButton(e))}_createButton(e){const t=this.editor;t.ui.componentFactory.add(e.model,i=>{const o=new rd(i),n=t.commands.get("heading");return o.label=e.title,o.icon=e.icon||ov[e.model],o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(n),o.bind("isOn").to(n,"value",t=>t==e.model),o.on("execute",()=>{t.execute("heading",{value:e.model}),t.editing.view.focus()}),o})}},class extends Qe{static get requires(){return[Mu]}static get pluginName(){return"UploadimagePlugin"}init(){this.editor.plugins.get("FileRepository").createUploadAdapter=e=>new Wy(e)}},class extends Qe{init(){const e=this.editor;e.ui.componentFactory.add("internalLink",t=>{const i=new rd(t);return i.set({label:"Internal Trilium link (CTRL-L)",icon:'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n version="1.1"\n x="0px"\n y="0px"\n viewBox="0 0 67.008179 71.908997"\n enable-background="new 0 0 100 100"\n xml:space="preserve"\n id="svg4"\n sodipodi:docname="trilium.svg"\n width="67.008179"\n height="71.908997"\n inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata\n id="metadata10"><rdf:RDF><cc:Work\n rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n id="defs8" /><sodipodi:namedview\n pagecolor="#ffffff"\n bordercolor="#666666"\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="1857"\n inkscape:window-height="1053"\n id="namedview6"\n showgrid="false"\n fit-margin-top="0"\n fit-margin-left="0"\n fit-margin-right="0"\n fit-margin-bottom="0"\n inkscape:zoom="2.36"\n inkscape:cx="33.504176"\n inkscape:cy="35.954"\n inkscape:window-x="63"\n inkscape:window-y="27"\n inkscape:window-maximized="1"\n inkscape:current-layer="svg4" /><path\n d="m 47.470176,30.998 c 0.008,-0.009 0.021,-0.021 0.027,-0.029 0.938,-1.156 -0.823,-13.453 -5.063,-20.125 -1.389,-2.186 -2.239,-3.423 -3.219,-4.719 -3.907,-5.166 -6,-6.125 -6,-6.125 0,0 -13.979,10.735 -13.562,30.27 -1.754,0.065 -11.2179997,7.528 -14.8259997,14.388 -1.206,2.291 -1.856,3.645 -2.493,5.141 -2.53899996,5.957 -2.32999996,8.25 -2.32999996,8.25 0,0 16.27099966,6.79 33.01399966,-3.294 0.007,0.021 0.013,0.046 0.02,0.063 0.537,1.389 12.08,5.979 19.976,5.621 2.587,-0.116 4.084,-0.238 5.696,-0.444 6.424,-0.818 8.298,-2.157 8.298,-2.157 0,0 -2.36,-17.487 -19.538,-26.84 z m -13.179,20.3 c 1.059,-1.183 4.648,-5.853 0.995,-11.315 -0.253,-0.377 -0.496,-0.236 -0.496,-0.236 0,0 0.063,10.822 -5.162,12.359 -5.225,1.537 -13.886,4.4 -20.4269997,0.455 -0.697,-0.42 1.2269997,-13 12.8469997,-19.377 0.546,1.599 2.836,6.854 9.292,6.409 0.453,-0.031 0.453,-0.313 0.453,-0.313 0,0 -9.422,-5.328 -8.156,-10.625 1.266,-5.297 3.089,-14.236 9.766,-17.948 0.714,-0.397 10.746,7.593 10.417,20.94 -1.606,-0.319 -7.377,-1.004 -10.226,4.864 -0.198,0.409 0.046,0.549 0.046,0.549 0,0 9.31,-5.521 13.275,-1.789 3.965,3.733 10.813,9.763 10.71,17.4 -0.01,0.817 -11.924,5.542 -23.334,-1.373 z M 19.117176,21.1 c 0,0 -0.991,3.241 -0.603,7.524 L 5.1211763,21.1 c 10e-4,0 6.2209997,-4.214 13.9959997,0 z M 4.6971763,21.985 18.041176,29.597 c -3.872,1.872 -6.142,4.388 -6.142,4.388 -7.6149997,-4.499 -7.2019997,-12 -7.2019997,-12 z M 55.791176,35.019 c 0,0 -2.321,-2.471 -6.23,-4.263 l 13.187,-7.881 c -10e-4,0 0.564,7.493 -6.957,12.144 z m 6.4,-12.951 -13.237,7.794 c 0.3,-4.291 -0.754,-7.511 -0.754,-7.511 7.687,-4.371 13.991,-0.283 13.991,-0.283 z m -36.611,37.665 c 0,0 3.309,-0.737 6.845,-3.185 l 0.056,15.361 c 0,10e-4 -6.733,-3.333 -6.901,-12.176 z m 7.88,12.11 0.044,-15.362 c 3.539,2.445 6.846,3.181 6.846,3.181 -0.16,8.844 -6.89,12.181 -6.89,12.181 z"\n id="path2"\n inkscape:connector-curvature="0" /></svg>',tooltip:!0}),i.bind("isEnabled").to(e,"isReadOnly",e=>!e),i.on("execute",()=>{const t=e.editing.view.getDomRoot();glob.getComponentByEl(t).triggerCommand("addLinkToText")}),i})}},class extends Qe{init(){this.editor.ui.componentFactory.add("markdownImport",e=>{const t=new rd(e);return t.set({label:"Markdown import from clipboard",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="208" height="128" viewBox="0 0 208 128"><rect width="198" height="118" x="5" y="5" ry="10" stroke="#000" stroke-width="10" fill="none"/><path d="M30 98V30h20l20 25 20-25h20v68H90V59L70 84 50 59v39zm125 0l-30-33h20V30h20v35h20z"/></svg>',tooltip:!0}),t.on("execute",()=>{glob.importMarkdownInline()}),t})}},class extends Qe{init(){this.htmlDataProcessor=new dl,this.editor.ui.componentFactory.add("cutToNote",e=>{const t=new rd(e);return t.set({label:"Cut & paste selection to sub-note",icon:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">\n<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>\n<g><g><path d="M853.9,754.9c-26-45.4-66.5-76.2-109.1-87.8c-33.7-9.2-68.7-6.4-98.9,10.7l-90-157.3C611.6,409.5,736.5,160.5,759,121.2C788,70.4,736,10,736,10L500,422.8L264,10c0,0-52,60.4-22.9,111.2c22.5,39.3,147.5,288.3,203.1,399.3l-89.9,157.3c-30.2-17.1-65.3-19.9-98.9-10.7c-42.7,11.6-83.1,42.3-109.1,87.8c-46.8,81.7-28.9,179.7,39.7,219c30.4,17.5,65.7,20.3,99.6,11.1c42.6-11.6,83.1-42.4,109.1-87.7c11.4-20,18.9-41,22.8-61.8v0c0-0.2,0-0.3,0.2-0.5c0.2-1.7,0.5-3.5,0.7-5.4c19.3-129.5,55.8-195.7,81.6-227.8c25.9,32.1,62.4,98.3,81.7,227.8c0.2,1.9,0.5,3.6,0.7,5.4c0.1,0.2,0.1,0.3,0.2,0.5v0c3.9,20.8,11.4,41.8,22.7,61.8c26,45.3,66.5,76.1,109.2,87.7c34,9.2,69.2,6.4,99.7-11.1C882.8,934.5,900.6,836.5,853.9,754.9z M327.9,858.9c-14.8,25.8-38.1,45.2-62.5,51.8c-10.8,3-26.7,4.7-41.3-3.6c-31.1-17.8-36.2-70.1-11.1-114c15-26,37.8-45,62.5-51.8c10.7-2.9,26.7-4.7,41.3,3.6C347.9,762.7,353,814.9,327.9,858.9z M775.9,907.1c-14.6,8.4-30.4,6.6-41.3,3.6c-24.4-6.6-47.7-26-62.5-51.8c-25.1-44-20-96.2,11.1-114c14.7-8.3,30.6-6.5,41.3-3.6C749.3,748,772.1,767,787,793C812.1,837,807.1,889.3,775.9,907.1z"/><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></g>\n</svg>',tooltip:!0}),t.on("execute",()=>{const e=this.editor.editing.view.getDomRoot();glob.getComponentByEl(e).triggerCommand("cutIntoNote")}),t}),window.cutToNote={getSelectedHtml:()=>this.getSelectedHtml(),removeSelection:()=>this.removeSelection()}}getSelectedHtml(){const e=this.editor.model,t=e.document,i=this.editor.data.toView(e.getSelectedContent(t.selection));return this.htmlDataProcessor.toData(i)}async removeSelection(){const e=this.editor.model;e.deleteContent(e.document.selection);const t=this.editor.editing.view.getDomRoot(),i=glob.getComponentByEl(t);await i.triggerCommand("saveNoteDetailNow")}},class extends Qe{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}constructor(e){super(e),e.config.define("typing",{transformations:{include:cg}})}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTransformationWatchers()}_enableTransformationWatchers(){const e=this.editor,t=e.model,i=e.plugins.get("Input"),o=e.plugins.get("Delete"),n=function(e){const t=e.extra||[],i=e.remove||[],o=e=>!i.includes(e);return function(e){const t=new Set;for(const i of e)if(lg[i])for(const e of lg[i])t.add(e);else t.add(i);return Array.from(t)}(e.include.concat(t).filter(o)).filter(o).map(e=>ag[e]||e).map(e=>({from:dg(e.from),to:hg(e.to)}))}(e.config.get("typing.transformations")),r=new tg(e.model,e=>{for(const t of n){if(t.from.test(e))return{normalizedTransformation:t}}});r.on("matched:data",(e,n)=>{if(!i.isInput(n.batch))return;const{from:r,to:s}=n.normalizedTransformation,a=r.exec(n.text),l=s(a.slice(1)),c=n.range;let d=a.index;t.enqueueChange(e=>{for(let i=1;i<a.length;i++){const o=a[i],n=l[i-1];if(null==n){d+=o.length;continue}const r=c.start.getShiftedBy(d),s=t.createRange(r,r.getShiftedBy(o.length)),h=ug(r);t.insertContent(e.createText(n,h),s),d+=n.length}t.enqueueChange(()=>{o.requestUndoOnBackspace()})})}),r.bind("isEnabled").to(this)}},class extends Qe{static get requires(){return[pv,Cv,Sv,Ov]}static get pluginName(){return"Font"}},Sv,Ov,class extends Qe{static get requires(){return[$v,Uv]}static get pluginName(){return"CodeBlock"}},Ay,class extends Qe{static get requires(){return[Ey,Py,Im]}static get pluginName(){return"HorizontalLine"}},class extends Qe{static get requires(){return[Hy,Dy]}static get pluginName(){return"RemoveFormat"}},class extends Qe{static get requires(){return[Ou,ku]}static get pluginName(){return"FindAndReplace"}init(){const e=this.editor.plugins.get("FindAndReplaceUI"),t=this.editor.plugins.get("FindAndReplaceEditing"),i=t.state;e.on("findNext",(e,t)=>{t?(i.searchText=t.searchText,this.editor.execute("find",t.searchText,t)):this.editor.execute("findNext")}),e.on("findPrevious",(e,t)=>{t&&i.searchText!==t.searchText?this.editor.execute("find",t.searchText):this.editor.execute("findPrevious")}),e.on("replace",(e,t)=>{i.searchText!==t.searchText&&this.editor.execute("find",t.searchText);const o=i.highlightedResult;o&&this.editor.execute("replace",t.replaceText,o)}),e.on("replaceAll",(e,t)=>{i.searchText!==t.searchText&&this.editor.execute("find",t.searchText),this.editor.execute("replaceAll",t.replaceText,i.results)}),e.on("searchReseted",()=>{i.clear(this.editor.model),t.stop()})}},class extends Qe{toMentionAttribute(e,t){return Yv(e,t)}static get pluginName(){return"Mention"}static get requires(){return[Gv,sy]}},class extends Qe{afterInit(){const e=this.editor;e.commands.add("mention",new jy(e))}},class extends Qe{static get requires(){return[$y,qy]}},class extends Qe{static get requires(){return[Gy]}},function(e){function t(){let t=e.model.document.selection.getFirstPosition();for(;t;){if("tableCell"===t.name)return!0;t=t.parent}return!1}e.keystrokes.set("Tab",(i,o)=>{const n=e.commands.get("indentBlock");n.isEnabled&&!t()&&(n.execute(),o())}),e.keystrokes.set("Shift+Tab",(i,o)=>{const n=e.commands.get("outdentBlock");n.isEnabled&&!t()&&(n.execute(),o())})},function(e){e.model.schema.setAttributeProperties("linkHref",{isFormatting:!0})},cx,class extends Qe{static get requires(){return[cx,_g]}afterInit(){const e=this.editor,t=e.commands.get("math");if(t){const i=function(e,t){return()=>{if(!t.isEnabled)return!1;t.display=!0,e.plugins.get("MathUI")._showUI()}}(e,t);bg(e,this,/^\\\[$/,i),bg(e,this,/^\$\$$/,i)}}static get pluginName(){return"AutoformatMath"}}],dx.defaultConfig={toolbar:{items:["fontSize","bold","italic","underline","strikethrough","superscript","subscript","fontColor","fontBackgroundColor","code","link","removeFormat","internallink","cuttonote"]},image:{styles:["alignLeft","alignCenter","alignRight","full","side"],resizeOptions:[{name:"imageResize:original",value:null,icon:"original"},{name:"imageResize:25",value:"25",icon:"small"},{name:"imageResize:50",value:"50",icon:"medium"}],toolbar:["imageStyle:inline","imageStyle:alignLeft","imageStyle:alignCenter","imageStyle:alignRight","|","imageResize:25","imageResize:50","imageResize:original","|","toggleImageCaption"]},heading:{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading2",view:"h2",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h3",title:"Heading 3",class:"ck-heading_heading3"},{model:"heading4",view:"h4",title:"Heading 4",class:"ck-heading_heading4"},{model:"heading5",view:"h5",title:"Heading 5",class:"ck-heading_heading5"},{model:"heading6",view:"h6",title:"Heading 6",class:"ck-heading_heading6"}]},blockToolbar:["heading","|","bulletedList","numberedList","todoList","|","blockQuote","codeBlock","insertTable","includeNote","math","|","outdent","indent","horizontalLine","|","imageUpload","markdownImport","findAndReplace"],table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","tableProperties","tableCellProperties","toggleTableCaption"]},link:{defaultProtocol:"https://"},language:"en"}}]).default}));
//# sourceMappingURL=libraries/ckeditor/ckeditor.js.map